Coralogix provides an activation/deactivation rules API for its Rules engine. This allows you to control your rules and trigger their activation remotely based on triggers such as alerts and usage warnings.
This guide will help you use our Rules CRUD-API to create, read, update or delete rules and rule groups using an API.
In order to send an external request, the request headers should contain the following:
Content-Type: application/JSON
Cache-Control: no-cache
Authorization: Bearer {an auto-generated API key, which can be found under Settings –> Account –> ‘API access’ and generate a new API key}
Groups API
Search:
| Request type | URL | Body |
|
|
|
|
Create | POST | URL: api.coralogix.com/api/v1/external/group | "name" (string) - the name for the rules group (Mandatory) |
Read | GET | URL: api.coralogix.com/api/v1/external/group/GROUPID |
|
Update | PUT | URL: api.coralogix.com/api/v1/external/group/GROUPID | "name" (string) - the updated name for the rules group |
Delete | DELETE | URL: api.coralogix.com/api/v1/external/group/GROUPID |
|
Showing 1 to 4 of 4 entries
Rules API
Search:
| Request type | URL | Body |
|
|
|
|
Create | POST | URL: api.coralogix.com/api/v1/external/rule/GROUPID | "Type" [string] (block, extract, parse, jsonextract, replace, timestampextract, removefields)
|
Read | GET | URL: api.coralogix.com/api/v1/external/rule/RULEID/group/GROUPID |
|
Update | PUT | URL: api.coralogix.com/api/v1/external/rule/RULEID/group/GROUPID | "Name" [string] - The updated name for the rule
|
Delete | DELETE | URL: api.coralogix.com/api/v1/external/rule/RULEID/group/GROUPID |
|
Showing 1 to 4 of 4 entries
Exporting multiple Rules and Groups
Search:
| Request type | URL | Headers |
|
|
|
|
Get all Rules | GET | URL: api.coralogix.com/api/v1/external/rules | Content-Type: application/json |
Transfer rules | POST | URL: api.coralogix.com/api/v1/external/rules/export | Content-Type: application/json |
Showing 1 to 2 of 2 entries
In order to get the groupId so you could use it with the different requests’ URLs, enter your account settings –> Rules. Click on any group and the browser URL will show the groupId. The ruleId on the other hand can only be retrieved when executing a GET request to get a certain rule/group or when getting all the rules of the account.
To learn more about log parsing in Coralogix, read the tutorial.
Read our Regular Expressions 101 guide if you need some pointers on RegEx.