How can opsgenie-lamp output be used for automation?
Asked by Matthew Greenwald:

Hi,

The opsgenie-lamp cli tool has output which is very hard to use for automation. For example the output below would require a lot of parsing to become usable:

```
% lamp getIncidentList --query "status: open" --output-format yaml --pretty
INFO[2022-02-20T10:58:10.306159-05:00] Client is configured with ApiUrl: api.opsgenie.com, LogLevel: info, RetryMaxCount: 4
2022/02/20 10:58:10 INFO : Incident List : {
"requestId": "dcbeb75a-1759-4642-8cbb-76180052aae6",
"took": 0.02,
"RateLimitState": "OK",
"RateLimitReason": "",
"RateLimitPeriod": "",
"RetryCount": 0,
"data": [
{
"id": "f0fbe12d-5e29-44ee-8649-16400705cdee",
"serviceId": "",
"tinyId": "1",
"message": "TEST Incident",
"status": "open",
"tags": [],
"createdAt": "2022-02-20T15:23:22.419Z",
"updatedAt": "2022-02-20T15:33:41.939Z",
"priority": "P5",
"ownerTeam": "",
"responders": [
{
"type": "team",
"id": "c0200188-6812-411b-9834-bccf4b739c43"
},
{
"type": "user",
"id": "85bacf31-e22b-4c02-a92a-9ca2804e1ee8"
}
],
"extraProperties": {}
}
],
"paging": {
"next": "",
"prev": "",
"first": "https://api.opsgenie.com/v1/incidents?limit=20\u0026sort=createdAt\u0026offset=0\u0026order=desc\u0026query=status%3A+open",
"last": "https://api.opsgenie.com/v1/incidents?limit=20\u0026sort=createdAt\u0026offset=0\u0026order=desc\u0026query=status%3A+open"
}
}
```

What I would expect to happen, especially with output set to JSON is that there would only be a JSON printed so that I could pipe to a tool like jq and then use the data to drive a script. Instead the JSON is wrapped with informational logging with no configurable way to suppress the log output.  

There is an open GitHub issue to this effect: <https://github.com/opsgenie/opsgenie-lamp/issues/47>

And there is a Draft Pull Request to change this as well: <https://github.com/opsgenie/opsgenie-lamp/pull/45>


Answers:
author: Darryl Lee
body: Hi [@Matthew Greenwald](/t5/user/viewprofilepage/user-id/4768047) ,

This is Darryl. I am here to help.

Understand that this inquiry is about the output data of the opsgenie-lamp command tool.

Unfortunately, as you said, it is output to the stderr instead of stdout, and the content is in a log format.

I have just raised a feature request, OPSGENIE-152, and we will keep you posted as all the request tickets don't have public accessibility.

Please note that our Product team reviews all FR together and they prioritize those with higher demand to be implemented first and any FR will take months until is ready since it needs to go through Design, Development, Testing, and rolling out to Production.

Thank you for your valuable feedback in helping us improve Opsgenie.

Kind regards,   
Darryl Lee  
Support Engineer, Atlassian

comments: author: Matthew Greenwald
body: Thanks Darryl, I hope OPSGENIE-152 gets implemented.


author: Darryl Lee
body: Hi [@Matthew Greenwald](/t5/user/viewprofilepage/user-id/4768047),

Here is the link to the feature request, [OPSGENIE-152](https://jira.atlassian.com/browse/OPSGENIE-152), please vote for it and start watching it to stay tuned.

Thank you.

Kind regards,   
Darryl Lee  
Support Engineer, Atlassian


author: Dustin Schultz
body: In the configuration file, put

```
lamp.log.level=error
```

and then it won't print out the default INFO statement and you can pipe it to jq.

comments: author: Darryl Lee
body: Hi [@Dustin Schultz](/t5/user/viewprofilepage/user-id/4528547),

Great point.

In the default settings, the LAMP is expecting the log level to be WARN.

To further dive into this issue you described, please contact Opsgenie Support via [this link](https://support.atlassian.com/opsgenie/) and attach the lamp.conf also the executed result for our team to kick off the investigation.

We appreciate your cooperation.

Best regards,   
Darryl Lee  
Support Engineer, Atlassian


Tags: automation

bash

output

shell