Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Creates new Logsene app under referenced account.

API call
HTTP Method
Attributes
Description
https://apps.sematext.com/logsene-reports/api/v2/app/addPOST

apiKey (of account under which app will be created)

name (of app which will be created)

discountCode (optional parameter, send only if you have a valid code)

Creates new Logsene application under account defined by apiKey, with name name (such name should be unique among other Logsene apps under this account)

Example of API call:

Code Block
curl -X POST -k -H "Content-Type: application/json" "https://apps.sematext.com/logsene-reports/api/v2/app/add" -d '
{
  "apiKey":"a9092d95-d062-4499-ad0b-a1b43fadb9b5",
  "name":"new-logsene-app-1"
}'

...

Code Block
{
  "success" : false,
  "message" : "User identified with API key a9092d95-d062-4499-ad0b-a1b43fadb9b4 doesn't exist"
}

List Apps

API callHTTP MethodAttributesDescription
https://apps.sematext.com/users-web/api/v2/app/listPOST

apiKey (of account whose apps are fetched)

Fetches all apps which can be accessed by account represented with apiKey. All app roles will be included (OWNER, ADMIN, USER). Apps available through sharing of other accounts will not be returned.

Example of API call:

Code Block
curl -X POST -k -H "Content-Type: application/json" "https://apps.sematext.com/users-web/api/v2/app/list" -d '
{
  "apiKey":"a9092d95-d06-4499-ad0b-a1b43fadb9b5"
}'

...

Fetches all alerts of specific type (threshold, anomaly) for a particular Logsene app.

API call
HTTP Method
Attributes
Description
https://apps.sematext.com/logsene-reports/api/v2/alert/threshold/listPOST

apiKey (of owner of app represented with "token")

appToken (of app whose alerts are fetched)

Fetches all threshold based alerts for app defined with appToken
https://apps.sematext.com/logsene-reports/api/v2/alert/anomaly/listPOSTapiKey (of owner of app represented with "token")

appToken (of app whose alerts are fetched)

Fetches all anomaly alerts for app defined with appToken

Examples of API calls:

Code Block
curl -X POST -k -H "Content-Type: application/json" "https://apps.sematext.com/logsene-reports/api/v2/alert/threshold/list" -d '
{
  "apiKey":"a9092d95-d062-4499-ad0b-a1b43fadb9b5",
  "appToken":"12c91563-ba95-4a73-aa5a-08fe04b94631"
}'
 
curl -X POST -k -H "Content-Type: application/json" "https://apps.sematext.com/logsene-reports/api/v2/alert/anomaly/list" -d '
{
  "apiKey":"a9092d95-d062-4499-ad0b-a1b43fadb9b5",
  "appToken":"12c91563-ba95-4a73-aa5a-08fe04b94631"
}'

...

Threshold and Anomaly Alerts are created for a specific query.

Create Threshold Alert
API call
HTTP Method
Attributes
Description
https://apps.sematext.com/logsene-reports/api/v2/alert/threshold/addPOST

apiKey (of owner of app represented with "token")

appToken (of app for which alert is created)

+ attributes specific to threshold alert

Creates new threshold based query alert for Logsene app defined with appToken

Example of API call:

Code Block
curl -X POST -k -H "Content-Type: application/json" "https://apps.sematext.com/logsene-reports/api/v2/alert/threshold/add" -d '
{
  "apiKey":"a9092d95-d062-4499-ad0b-a1b43fadb9b5",
  "appToken":"12c91563-ba95-4a73-aa5a-08fe04b94631",
  "alertRule":{
    "name":"Apache alert",
    "query":"apache",
    "enabled":true,
    "estimateValue":500,
    "estimateOperation":"MORE",
    "analyzingTime":5,
    "backToNormalNeeded":false,
    "ignoreRegularEventsEnabled":false,
    "muteTimePeriodInMinutes":30,
    "minDelayBetweenNotificationsInMinutes":1,
    "maxNotificationsInMutePeriod":3,
    "muteIsGlobal":false,
    "sendToEmail":"email-to-send-alerts-to@your-company.com",
    "ruleType": "AFValuesRule"
   }
}'

Example of a success response (with HTTP code 200):

Code Block
{
  "success" : true,
  "message" : "Alert rule created",
  "data" : {
    "alertRule" : {
      "sendToEmail" : "email-to-send-alerts-to@your-company.com",
      "muteTimePeriodInMinutes" : "30",
      "minDelayBetweenNotificationsInMinutes" : "1",
      "maxNotificationsInMutePeriod" : 3,
      "ignoreRegularEventsEnabled" : false,
      "muteIsGlobal" : false,
      "analyzingTime" : "05",
      "systemId" : 2199,
      "enabled" : true,
      "name" : "Apache Alert",
      "query" : "apache",
      "estimateOperation" : "MORE",
      "estimateValue" : 500.0,
      "backToNormalNeeded" : false
    }
  }
}
Create Anomaly Alert
API call
HTTP Method
Attributes
Description
https://apps.sematext.com/logsene-reports/api/v2/alert/anomaly/addPOST

apiKey (of owner of app represented with "token")

appToken (of app for which alert is created)

+ attributes specific to anomaly alert

Creates new anomaly query alert for Logsene app defined with appToken

Example of API call:

Code Block
curl -X POST -k -H "Content-Type: application/json" "https://apps.sematext.com/logsene-reports/api/v2/alert/anomaly/add" -d '
{
  "apiKey":"a9092d95-d062-4499-ad0b-a1b43fadb9b5",
  "appToken":"12c91563-ba95-4a73-aa5a-08fe04b94631",
  "alertRule":{
    "name":"Anomaly apache alert",
    "query":"apache",
    "enabled":"true",
    "backToNormalNeeded":false,
    "ignoreRegularEventsEnabled":true,
    "muteTimePeriodInMinutes":"30",
    "analyzingTime" : "05",
    "minDelayBetweenNotificationsInMinutes":"1",
    "maxNotificationsInMutePeriod":"3",
    "muteIsGlobal":false,
    "sendToEmail":"email-to-send-alerts-to@your-company.com",
    "ruleType": "AFAnomalyValuesRule"
   }
}'

Example of a success response (with HTTP code 200):

...

Code Block
{
 "success" : false,
 "message" : "Missing mandatory param alertRule.query"
}

Delete Alert

API callHTTP MethodAttributesDescription
https://apps.sematext.com/logsene-reports/api/v2/alert/delete/{alertId}DELETE

apiKey (of owner of app represented with "token")

appToken (of app to which alert belongs)

 

Deletes a single alert rule

Note: {alertId} value in URL should be replaced with real id of alert rule which should be deleted - alertId of each alert is returned as a key in list alerts API call response.

...

Code Block
{
  "success" : true,
  "message" : "Alert with alertId 141 deleted",
  "data" : {
    "alertId" : "141"
  }
}

Enable/Disable Alert

API callHTTP MethodAttributesDescription
https://apps.sematext.com/logsene-reports/api/v2/alert/enable/{alertId}POST

apiKey (of owner of app whose alert is enabled)

appToken (of app to which alert belongs)
Enables alert
https://apps.sematext.com/logsene-reports/api/v2/alert/disable/{alertId}POST

apiKey (of owner of app whose alert is enabled)

appToken (of app to which alert belongs)
Disables alert

Note: {alertId} value in URL should be replaced with real id of alert rule which should be deleted - alertId of each alert is returned as a key in list alerts API call response.

...

List Alert Notifications (Coming soon!)

API callHTTP MethodAttributesDescription
https://apps.sematext.com/logsene-reports/api/v2/alert/notification/listPOST

apiKey (of owner of apps whose alert notifications want to list)

appToken (of app to list alert notifications for; it is optional - if omitted, alerts for all active apps will be returned)

start (time of interval to return alert notifications for; optional; can be expressed as timestamp in milliseconds or UTC date in format yyyy-MM-dd HH:mm:ss)

end (time of interval to return alert notifications for; optional; can be expressed as timestamp in milliseconds or UTC date in format yyyy-MM-dd HH:mm:ss)

interval (to return alert notifications for,expressed in milliseconds; optional; Can use suffixes s, m, h, d to express interval in seconds, minutes, hours, days - e.g. "1d" is equal to "86400000" )

List alerts for provided user, app and defined time interval.

Examples of API calls:

Code Block
# alert notifications for last 24h for all apps owned by user with provided key
curl -X POST -k -H "Content-Type: application/json" "https://apps.sematext.com/logsene-reports/api/v2/alert/notification/list" -d '{
  "apiKey":"a9092d95-d062-4499-ad0b-a1b43fadb9b5"
}'
 
# alert notifications for last 24h for app with provided token
curl -X POST -k -H "Content-Type: application/json" "https://apps.sematext.com/logsene-reports/api/v2/alert/notification/list" -d '{
  "apiKey":"a9092d95-d062-4499-ad0b-a1b43fadb9b5",
  "appToken":"12c91563-ba95-4a73-aa5a-08fe04b94631"
}'
 
# alert notifications for one hour interval specified with start and end
curl -X POST -k -H "Content-Type: application/json" "https://apps.sematext.com/logsene-reports/api/v2/alert/notification/list" -d '{
  "apiKey":"a9092d95-d062-4499-ad0b-a1b43fadb9b5",
  "start":"2015-07-28 12:36:14",
  "end":"2015-07-28 13:36:14",
}'
 
# alert notifications for last hour
curl -X POST -k -H "Content-Type: application/json" "https://apps.sematext.com/logsene-reports/api/v2/alert/notification/list" -d '{
  "apiKey":"a9092d95-d062-4499-ad0b-a1b43fadb9b5",
  "interval":"1h",
}'
 
# alert notifications created after timestamp provided in start
curl -X POST -k -H "Content-Type: application/json" "https://apps.sematext.com/logsene-reports/api/v2/alert/notification/list" -d '{
  "apiKey":"a9092d95-d062-4499-ad0b-a1b43fadb9b5",
  "start":"1438086975139"
}'

...

Regardless on how input is defined, output will contain list of alert notifications matching criteria and start and end dates of returned interval. Following tables explains rules how star, end and interval are combined.

"start""end""interval"Rule
NoNoNo

[current - 24h, current]

NoNoYes[current - interval, current]
NoYesNo[end - 24h, end]
NoYesYes[end - interval, end]
YesNoNo[start, current]
YesNoYes[start, start + interval]
YesYesNo[start, end]
YesYesYes[start, end]

 

Subscriptions API

Subscriptions API provides API calls for fetching of existing subscriptions and for triggering emailing of reports.

...

For particular Logsene application, this API call will return a list of all existing subscriptions.

API call
HTTP Method
Attributes
Description

https://apps.sematext.com/logsene-reports/api/v2/subscription/list


POST

apiKey (of owner of app represented with "token")

appToken (token of app whose metrics info is being fetched)

Fetches subscriptions for Logsene app defined with appToken.

 

Example of API call:

Code Block
curl -X POST -k -H "Content-Type: application/json" "https://apps.sematext.com/logsene-reports/api/v2/subscription/list -d '
{
  "apiKey":"a9092d95-d062-4499-ad0b-a1b43fadb9b5",
  "appToken":"01f1d605-8ab4-4a08-bf7e-ef2749e90de5"
}'

...

Triggers instant emailing of a report defined by some subscription.

 
API callHTTP MethodAttributesDescription

https://apps.sematext.com/logsene-reports/api/v2/subscription/send/{subscriptionId}


POST

apiKey (of owner of app represented with "token")

appToken (token of app whose metrics info is being fetched)

Triggers instant sending of report

Example of API call:

Code Block
curl -X POST -k -H "Content-Type: application/json" "https://apps.sematext.com/logsene-reports/api/v2/subscription/send/36" -d '
{
  "apiKey":"a9092d95-d062-4499-ad0b-a1b43fadb9b5",
  "appToken":"262f66e5-0951-488b-9c92-379ba71a4299"
}'

...

Fetches saved queries for a particular Logsene app.

API call
HTTP Method
Attributes
Description
https://apps.sematext.com/logsene-reports/api/v2/query/listPOST

apiKey (of owner of app represented with "token")

appToken (of app whose saved queries are fetched)

Fetches all saved queries for app defined with appToken

Examples of API calls:

Code Block
curl -X POST -k -H "Content-Type: application/json" "https://apps.sematext.com/logsene-reports/api/v2/query/list" -d '
{
  "apiKey":"a9092d95-d062-4499-ad0b-a1b43fadb9b5",
  "appToken":"12c91563-ba95-4a73-aa5a-08fe04b94631"
}'

...

If response succeeded, HTTP code will be 200 and response content will be a map where keys are query IDs (which can be used as parameter in delete saved query API call) and values are query objects.

Create Saved Query

API call
HTTP Method
Attributes
Description
https://apps.sematext.com/logsene-reports/api/v2/query/addPOST

apiKey (of owner of app represented with "token")

appToken (of app for which saved query is created)

queryName (display name, does not have to be unique)

queryString (saved query string)

Creates new saved query with provided name and query string for Logsene app defined with appToken

Example of API call:

Code Block
curl -X POST -k -H "Content-Type: application/json" "https://apps.sematext.com/logsene-reports/api/v2/query/add" -d '
{
  "apiKey":"a9092d95-d062-4499-ad0b-a1b43fadb9b5",
  "appToken":"12c91563-ba95-4a73-aa5a-08fe04b94631",
  "query":{
    "queryName" : "Hot",
    "queryString" : "tag:(hot)"
  }
}'

...

Code Block
{
  "success" : true,
  "message" : "Query created",
  "data" : {
    "query":{
      "id" : 50,
      "queryName" : "Hot",
      "queryString" : "tag:(hot)"
    }
  }
}

Delete Saved Query

API callHTTP MethodAttributesDescription
https://apps.sematext.com/logsene-reports/api/v2/query/delete/{queryId}DELETE

apiKey (of owner of app represented with "token")

appToken (of app to which saved query belongs to)

 

Deletes a single saved query

Note: {queryId} value in URL should be replaced with real id of saved query which should be deleted - queryId of each saved query is returned as a key in list saved queries API call response.

...