ComputerLog API

  1. last year

    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:

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

    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 /ComputerLog/GetOnDemandLogs, pick a sensible limit, filter the results, and if they do not contain the log entries I am looking for, increase the limit 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.

  2. clonedeploy

    30 Oct 2017 Administrator Answer

    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.

  3. clonedeploy

    17 Nov 2017 Administrator

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

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

 

or Sign Up to reply!