ComputerLog API



  • In the API we hacked together for C/D 1.2.1, by quiring the underlying database, we had a way (although not a pretty one) to get a log entry for a deployment job:

    [quote]
    Before we started a deploy job [i]J[/i] for a ComputerId [i]C[/i], we found out the [b]largest LogId[/b] [i]L[/i]. Then the deploy job associated with [i]J[/i] is the [b]smallest LogId[/b] that is still larger than [i]L[/i] where ComputerId is [i]C[/i].
    [/quote]

    AFAIK, this surprisingly non-trivial task became even harder with the new API introduced by C/D 1.3.0:
    I can't find a good way getting the logs for a given computer. The best I can do is GET the [code]/ComputerLog/GetOnDemandLogs[/code], pick a sensible [code]limit[/code], filter the results, and if they do not contain the log entries I am looking for, increase the [code]limit[/code] and repeat.

    Is there a better way for getting the log of a given deploy task?



  • There is currently no association between tasks and logs. I guess there probably should be. I would think that this web method would work for you though.
    /Computer/GetComputerLogs/{id}

    The on demand logs are only for computers that aren't registered. Even if a task is on demand and the computer is registered the log will still be in what I mentioned above.



  • Not sure if this helps you, but I've added GetLastLog to the computer api in 1.3.2



  • This can somewhat can simplify my code, for now I put a [i]TODO[/i] comment to use the new API, for when we do the upgrade. Thanks.