Logs API
Logs API is only available for our Enterprise plan offerings.
Log files also can be downloaded using Opsgenie's Command Line tool Lamp. For more information, please click here.
List Log Files
This endpoint allows you to list the log files available for download. Maximum 1000 files are returned in response. To fetch all the log files, get the marker in response and use it in the next request until the data field in response is empty.
If you are using the EU instance of Opsgenie, the URL should be changed to https://api.eu.opsgenie.com for requests to be successful.
Field | Mandatory | Description | Limit |
---|---|---|---|
marker | true | The marker, which should be in the date format as: YYYY-MM-DD-HH-mm-ss, i.e. 2018-10-26-15-30-00 . It can include milliseconds, optionally, i.e. 2018-10-26-15-30-00_123 | |
limit | false | 1-1000 |
Sample Request
curl -X GET 'https://api.opsgenie.com/v2/logs/list/2018-10-24-07-30-00_123'
-H 'Authorization: GenieKey ob2oxzs-saa4-nba2-a551q-nalpf565c889'
-H 'Content-Type: application/json'
Response
{
"data": [{
"filename": "2018-10-24-07-52-17_123.json",
"date": 1540367662000,
"size": 10823
}, {
"filename": "2018-10-24-07-53-20_234.json",
"date": 1540367723000,
"size": 1637
}, {
"filename": "2018-10-24-08-41-34_345.json",
"date": 1540370623000,
"size": 1121
}],
"took": 0.281,
"marker": "2018-10-24-08-41-34_345",
"requestId": "144360f8-fcf7-4905-8e5f-60526c5074be"
}
Generate Log File Download Link
From the List Log Files API request result, generate a link that is valid for 5 minutes to download the given log file, which is a text file with JSON Lines format.
Field | Mandatory | Description |
---|---|---|
filename | true | Filename of the requested log file. |
Sample Request
curl -X GET 'https://api.opsgenie.com/v2/logs/download/2018-10-24-07-52-17_123.json'
-H 'Authorization: GenieKey ob2oxzs-saa4-nba2-a551q-nalpf565c889'
-H 'Content-Type: application/json'
Response
https://og-customer-logs-prod-oregon.s3.us-west-2.amazonaws.com/downloadable/fdc42d65-abae-497d-96a5-cc2cae592048/2018-10-24-07-52-17_123.json?X-Amz-Security-Token=somelongtoken&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20181026T143417Z&X-Amz-SignedHeaders=host&X-Amz-Expires=299&X-Amz-Credential=cred&X-Amz-Signature=somesignature
Updated over 3 years ago