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.

FieldMandatoryDescriptionLimit
markertrueThe marker, which should be in the date format as: YYYY-MM-DD-HH-mm-ss, i.e. *2018-10-26-15-30-00
limitfalse1-1000

Sample Request

curl -X GET 'https://api.opsgenie.com/v2/logs/list/2018-10-24-07-30-00'
    -H 'Authorization: GenieKey ob2oxzs-saa4-nba2-a551q-nalpf565c889'
    -H 'Content-Type: application/json'

Response

{
  "data": [{
    "filename": "2018-10-24-07-52-17.json",
    "date": 1540367662000,
    "size": 10823
  }, {
    "filename": "2018-10-24-07-53-20.json",
    "date": 1540367723000,
    "size": 1637
  }, {
    "filename": "2018-10-24-08-41-34.json",
    "date": 1540370623000,
    "size": 1121
  }],
  "took": 0.281,
  "marker": "2018-10-24-08-41-34",
  "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.

FieldMandatoryDescription
filenametrueFilename of the requested log file.

Sample Request

curl -X GET 'https://api.opsgenie.com/v2/logs/download/2018-10-24-07-52-17.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-26-16-09-30.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