Use the POST method with the Configuration API to create LogDNA views as well as View-specific Alerts. To get started, you need to specify a name (required) and one of the following parameters: query, apps, levels, hosts, or tags. You can define an alert with a notification channel; we currently support configuring alert notifications to be sent via email, webhook, or PagerDuty.

The successful API response includes the created View's viewid.

Complete Example with Alerts

curl https://api.logdna.com/v1/config/view \
  -H 'content-type: application/json' \
  -H 'servicekey: YOUR_SERVICE_KEY' \
  -d '{
  "name": "My View With Alerts",
  "query": "response:500",
  "hosts": ["host1", "host2"],
  "apps": ["apps1", "apps2"],
  "levels": ["error"],
  "tags": ["prod"],
  "category": ["My Service"],
  "channels": [
    {
      "integration": "email",
      "emails": ["[email protected]"],
      "triggerlimit": 15,
      "triggerinterval": "5m",
      "immediate": true,
      "terminal": true,
      "operator": "presence",
      "timezone": "America/Los_Angeles"
    {
      "integration": "webhook",
      "url": "YOUR_WEBHOOK_URL_HERE",
      "triggerlimit": 25,
      "triggerinterval": "30",
      "operator": "presence",
      "immediate": true,
      "terminal": true,
      "method": "post",
      "headers": {
        "X-MY-HEADER": "My Header Value"
      },
      "bodyTemplate": {
        "my_log_lines": "{{ lines }}"
      }
    },
    {
      "integration": "pagerduty",
      "key": "YOUR_PD_KEY_HERE",
      "triggerlimit": 150,
      "triggerinterval": "15m",
      "operator": "absence",
      "immediate": false,
      "terminal": true
    }
  ]
}'
Language
Authentication
Header
Click Try It! to start a request and see the response here!