Skip to content

Instantly share code, notes, and snippets.

@suzuki-shunsuke
Created December 3, 2019 00:30
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save suzuki-shunsuke/39e31d46f195863d3298a8146df3ff8b to your computer and use it in GitHub Desktop.
Save suzuki-shunsuke/39e31d46f195863d3298a8146df3ff8b to your computer and use it in GitHub Desktop.
Graylog Event Definition and Event Notification API (Graylog v3.1.2) https://github.com/suzuki-shunsuke/go-graylog/issues/170
curl -u admin:admin -H 'Content-Type: application/json' -H 'Accept: application/json' -H 'X-Requested-By: api' -X POST 'http://127.0.0.1:9000/api/events/definitions?pretty=true' -d '
{
"title": "new-event-definition",
"description": "",
"priority": 2,
"alert": true,
"config": {
"type": "aggregation-v1",
"query": "test",
"streams": [
"000000000000000000000001"
],
"group_by": [],
"series": [],
"conditions": {
"expression": null
},
"search_within_ms": 60000,
"execute_every_ms": 60000
},
"field_spec": {
"test": {
"data_type": "string",
"providers": [
{
"type": "template-v1",
"template": "test",
"require_values": false
}
]
}
},
"key_spec": [],
"notification_settings": {
"grace_period_ms": 0,
"backlog_size": 0
},
"notifications": [
{
"notification_id": "5de5a365a1de18000cdfdf49",
"notification_parameters": null
}
],
"storage": [
{
"type": "persist-to-streams-v1",
"streams": [
"000000000000000000000002"
]
}
]
}
'
curl -u admin:admin -H 'Content-Type: application/json' -H 'Accept: application/json' -H 'X-Requested-By: api' -X POST 'http://127.0.0.1:9000/api/events/notifications?pretty=true' -d '
{
"title": "new-notification-2",
"description": "",
"config": {
"type": "http-notification-v1",
"url": "http://example.com"
}
}
'
curl -u admin:admin -H 'Content-Type: application/json' -H 'Accept: application/json' -H 'X-Requested-By: api' -X PUT 'http://127.0.0.1:9000/api/events/definitions/5de5aac1a1de18000cdfe2b3?pretty=true' -d '
{
"id": "5de5aac1a1de18000cdfe2b3",
"title": "new-event-definition",
"description": "",
"priority": 2,
"alert": true,
"config": {
"type": "aggregation-v1",
"query": "test",
"streams": [
"000000000000000000000001"
],
"group_by": [],
"series": [],
"conditions": {
"expression": null
},
"search_within_ms": 60000,
"execute_every_ms": 60000
},
"field_spec": {
"test": {
"data_type": "string",
"providers": [
{
"type": "template-v1",
"template": "test",
"require_values": false
}
]
}
},
"key_spec": [],
"notification_settings": {
"grace_period_ms": 0,
"backlog_size": 0
},
"notifications": [
{
"notification_id": "5de5a365a1de18000cdfdf49",
"notification_parameters": null
}
],
"storage": [
{
"type": "persist-to-streams-v1",
"streams": [
"000000000000000000000002"
]
}
]
}
'
curl -u admin:admin -H 'Content-Type: application/json' -H 'Accept: application/json' -H 'X-Requested-By: api' -X PUT 'http://127.0.0.1:9000/api/events/notifications/5de5a365a1de18000cdfdf49?pretty=true' -d '
{
"id" : "5de5a365a1de18000cdfdf49",
"title": "new-notification-2",
"description": "updated",
"config": {
"type": "http-notification-v1",
"url": "http://example.com"
}
}
'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment