Logs/notifications REST interface
Get all logs
Retrieve the latest log entries for all managed nodes.
Definition
| GET /api/logs?originator=ORIGINATOR&after_date=AFTER_DATE_AND_TIME&tags=LISTOFTAGS
|
Example requests
| curl -X GET "http://127.0.0.1:8080/api/logs"
curl -X GET "http://127.0.0.1:8080/api/logs?originator=alarm"
curl -X GET "http://127.0.0.1:8080/api/logs?after_date=2015-11-25T13:58:38.345Z"
curl -X GET "http://127.0.0.1:8080/api/logs?tags=dev,critical"
|
Example response
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26 | {
"logs": [
{
"date": "1406817800759",
"severity": "warning",
"originator": "System monitor",
"nodeId": "298548c9-f5f8-464d-9a2c-07d494c3ecd4",
"nodeName": "wombat@127.0.0.1",
"message": "Long schedule time <0.19954.0>[{timeout,307},\n {in,{folsom_ets,notify,1}},\n {out,{wo_metrics_graphite_ch,send_to_carbon,1}}]",
"type": "logEvent"
},
{
"date": "1406817800452",
"severity": "warning",
"originator": "System monitor",
"nodeId": "298548c9-f5f8-464d-9a2c-07d494c3ecd4",
"nodeName": "wombat@127.0.0.1",
"message": "Long schedule time <0.19954.0>[{timeout,158},{in,{folsom_metrics,notify,1}},{out,{folsom_ets,notify,1}}]",
"type": "logEvent"
},
{...},
{...},
{...}
],
"cursor" : "HnOk2fFJCPRM24T3tr0up2Kg/WuDbAAAAAFqaAJoA2IAAAfeYQphH2EY"
}
|
Arguments
Argument |
Description |
originator |
Optional. Filter the logs by this field's value. |
originator[] |
Optional. Multiple originators can be supplied through this parameter. |
not_originator[] |
Optional. The supplied originators will not beincluded in the returned logs. |
after_date |
Optional. Logs created before this date will be returned. |
tags |
Optional. A comma separated list of tags that overrides the tags set for the user. |
limit |
Optional. A positive integer specifying the maximum number of logs returned. The maximum is 100. |
Returns
An array of the 20 or the limit amount of most recent log entries for all managed nodes, starting with
the newest log entry. Each entry has the following properties: date,
severity, originator, nodeId, nodeName, message, props and
type. A cursor is provided that can be used to enumerate further log entries
(unless it's null
which indicates there are no more results). Possible properties
when the full log message is bigger than 1000 bytes:
- hasNext: there's enough data in the log message to show on next page
- hasPrev: there's enough data in the log message to show on previous page
- start: the index of the first byte currently shown. Use the Get part of
a log message call to get the rest of the message.
- cursor: contains the cursor of this message.
Get 20 logs from a cursor position
Retrieve older log entries for all managed nodes.
Definition
| GET /api/logs/previous/all?c=CURSOR&originator=ORIGINATOR&after_date=AFTER_DATE_AND_TIME&tags=dev,critical
|
Example response
See "Get all logs", above.
Arguments
Argument |
Description |
cursor |
Required. The cursor returned in the previous call. |
originator |
Optional. Filter the logs by this field's value. |
originator[] |
Optional. Multiple originators can be supplied through this parameter. |
not_originator[] |
Optional. The supplied originators will not beincluded in the returned logs. |
after_date |
Optional. Logs created before this date will be returned. |
tags |
Optional. A comma separated list of tags that overrides the tags set for the user. |
limit |
Optional. A positive integer specifying the maximum number of logs returned. The maximum is 100. |
Returns
An array of 20 or the limit amount of log entries, starting from the specified cursor position, for all
managed nodes. The most recent entries appear first. See "Get all logs", above,
for more details.
Get logs for a node
Retrieve the latest log entries for a specified node.
Definition
| GET /api/logs/node/NODE_ID?originator=ORIGINATOR&after_date=AFTER_DATE_AND_TIME&tags=dev,critical
|
Example request
| curl -X GET "http://127.0.0.1:8080/api/logs/node/3fa56f92-3195-401b-93a8-7bc43e54d66f
|
Example response
See "Get all logs", above.
Arguments
Argument |
Description |
node ID |
Required. The node's identifier. |
originator |
Optional. Filter the logs by this field's value. |
originator[] |
Optional. Multiple originators can be supplied through this parameter. |
not_originator[] |
Optional. The supplied originators will not beincluded in the returned logs. |
after_date |
Optional. Logs created before this date will be returned. |
tags |
Optional. A comma separated list of tags that overrides the tags set for the user. |
limit |
Optional. A positive integer specifying the maximum number of logs returned. The maximum is 100. |
Returns
Log entries for the specified node and a cursor. See "Get all logs", above, for
more details.
Get 20 logs from a cursor position for a node
Retrieve older log entries for a specified node.
Definition
| GET /api/logs/previous/node/NODE_ID?c=CURSOR&originator=ORIGINATOR&after_date=AFTER_DATE_AND_TIME&tags=dev,critical
|
Example response
See "Get all logs", above.
Arguments
Argument |
Description |
node ID |
Required. The node's identifier. |
cursor |
Required. The cursor returned in the previous call. |
originator |
Optional. Filter the logs by this field's value. |
originator[] |
Optional. Multiple originators can be supplied through this parameter. |
not_originator[] |
Optional. The supplied originators will not beincluded in the returned logs. |
after_date |
Optional. Logs created before this date will be returned. |
tags |
Optional. A comma separated list of tags that overrides the tags set for the user. |
limit |
Optional. A positive integer specifying the maximum number of logs returned. The maximum is 100. |
Returns
An array of 20 or the limit amount of log entries, starting from the specified cursor position, for the
specified node. The most recent entries appear first. See "Get all logs",
above, for more details.
Get logs for a node family
Retrieve the latest log entries for all the managed nodes in a specified
node family.
Definition
| GET /api/logs/node-family/NODE_FAMILY_ID?originator=ORIGINATOR&after_date=AFTER_DATE_AND_TIME&tags=dev,critical
|
Example request
| curl -X GET "http://127.0.0.1:8080/api/logs/node-family/93be4f01-dae6-49b0-9608-4552f841a720"
|
Example response
See "Get all logs", above.
Arguments
Argument |
Description |
node family ID |
Required. The node family's identifier. |
originator |
Optional. Filter the logs by this field's value. |
originator[] |
Optional. Multiple originators can be supplied through this parameter. |
not_originator[] |
Optional. The supplied originators will not be included in the returned logs. |
after_date |
Optional. Logs created before this date will be returned. |
tags |
Optional. A comma separated list of tags that overrides the tags set for the user. |
limit |
Optional. A positive integer specifying the maximum number of logs returned. The maximum is 100. |
Returns
An array of 20 or the limit amount of log entries, starting from the specified cursor position, for the
nodes in the specified node family. The most recent entries appear first.
See "Get all logs", above, for more details.
Get 20 logs from a cursor position for a node family
Retrieve older log entries for all the managed nodes in a specified node family.
Definition
| GET /api/logs/previous/node-family/NODE_FAMILY_ID?c=CURSOR&originator=ORIGINATOR&after_date=AFTER_DATE_AND_TIME&tags=dev,critical
|
Example response
See "Get all logs", above.
Arguments
Argument |
Description |
node family ID |
Required. The node family's identifier. |
cursor |
Required. The cursor returned in the previous call. |
originator |
Optional. Filter the logs by this field's value. |
originator[] |
Optional. Multiple originators can be supplied through this parameter. |
not_originator[] |
Optional. The supplied originators will not be included in the returned logs. |
after_date |
Optional. Logs created before this date will be returned. |
tags |
Optional. A comma separated list of tags that overrides the tags set for the user. |
limit |
Optional. A positive integer specifying the maximum number of logs returned. The maximum is 100. |
Returns
An array of 20 or the limit amount of log entries, starting from the specified cursor position, for the
nodes in the specified node family. The most recent entries appear first.
See "Get all logs", above, for more details.
Search in logs
Retrieve log entries for which all the given criteria hold.
The criteria can be defined as a logical conjunction using some filters defined
as follows.
q=TEXT
: The log message contains the TEXT
string.
originator=ORIGINATOR
: The originator of the log is ORIGINATOR
.
node=NODEID
: The log was collected from node NODEID
.
node-family=NODEFAMILYID
: the log was collected from a node belonging to
node family NODEFAMILYID
.
negate
: The log message does not contain the 'TEXT' string specified via the 'q' parameter.
after_date=AFTER_DATE_AND_TIME
: The logs that were created after AFTER_DATE_AND_TIME
will be returned.
tags=LISTOFTAGS
: The log entry is tagged with at least one of the given tags.
Definition
| GET /api/logs/search?q=TEXT&cs&originator=ORIGINATOR&node=NODEID&node-family=NODEFAMILYID&negate&after_date=AFTER_DATE_AND_TIME&tags=dev,critical
|
Example requests
- Retrieves all the log entries that contain the
error
string in their log message.
| curl -X GET "http://127.0.0.1:8080/api/logs/search?q=error"
|
| curl -X GET "http://127.0.0.1:8080/api/logs/search?q=terminated&originator=lager&node=cfeae528-d45c-4a9e-8a41-aefa39d0cdef"
|
| curl -X GET "http://127.0.0.1:8080/api/logs/search?q=loaded&node-family=c86645ba-684c-4ca8-a722-cdd51e3ba273"
|
- Retrieves all the log entries that does not contain the 'error' string in their log message.
| curl -X GET "http://127.0.0.1:8080/api/logs/search?q=error&negate"
|
Example response
See "Get all logs", above.
Arguments
Argument |
Description |
q |
Required. The string to search for. |
cs |
Optional. Do a case sensitive search. |
originator |
Optional. Filter the logs by this field's value. |
originator[] |
Optional. Multiple originators can be supplied through this parameter. |
not_originator[] |
Optional. The supplied originators will not be included in the returned logs. |
node |
Optional. The identifier of a node. Only those logs are considered that were collected from this node. |
node-family |
Optional. The identifier of a node family. Only those logs are considered that were collected from this node family. |
negate |
Optional. The log message does not contain the TEXT string specified via the q parameter. |
after_date |
Optional. Logs created before this date will be returned. |
tags |
Optional. A comma separated list of tags that overrides the tags set for the user. |
limit |
Optional. A positive integer specifying the maximum number of logs returned. The maximum is 100. |
Returns
An array of the 20 or the limit amount of most recent log entries for which all the given criteria hold.
See "Get all logs", above, for more details.
Get 20 logs from a cursor position for the search query
Retrieve older log entries for which all the given criteria hold.
The criteria can be defined as a logical conjunction using some filters defined
as follows.
q=TEXT
: The log message contains the TEXT
string.
originator=ORIGINATOR
: The originator of the log is ORIGINATOR
.
node=NODEID
: The log was collected from node NODEID
.
node-family=NODEFAMILYID
: the log was collected from a node belonging to
node family NODEFAMILYID
.
negate
: The log message does not contain the TEXT
string specified via the
q
parameter.
after_date=AFTER_DATE_AND_TIME
: The logs that were created after AFTER_DATE_AND_TIME
will be returned.
tags=LISTOFTAGS
: The log entry is tagged with at least one of the given tags.
Definition
| GET /api/logs/previous/search?q=TEXT&c=CURSOR&cs&originator=ORIGINATOR&node=NODEID&node-family=NODEFAMILYID&negate&after_date=AFTER_DATE_AND_TIME&tags=dev,critical
|
Example response
See "Get all logs", above.
Arguments
Argument |
Description |
cursor |
Required. The cursor returned in the previous call. |
q |
Required. The string to search for. |
cs |
Optional. Do a case sensitive search. |
originator |
Optional. Filter the logs by this field's value. |
originator[] |
Optional. Multiple originators can be supplied through this parameter. |
not_originator[] |
Optional. The supplied originators will not be included in the returned logs. |
node |
Optional. The identifier of a node. Only those logs are considered that were collected from this node. |
node-family |
Optional. The identifier of a node family. Only those logs are considered that were collected from this node family. |
negate |
Optional. The log message does not contain the TEXT string specified via the q parameter. |
after_date |
Optional. Logs created before this date will be returned. |
tags |
Optional. A comma separated list of tags that overrides the tags set for the user. |
limit |
Optional. A positive integer specifying the maximum number of logs returned. The maximum is 100. |
Returns
An array of 20 or the specified amount of log entries, starting from the specified cursor position, for
which all the given criteria hold. See "Get all logs", above, for more details.
Get all log originators
Retrieve the list of log originators for all nodes.
Definition
Example request
| curl -X GET "http://127.0.0.1:8080/api/logs/originator"
|
Example response
| {
"originators" : [
"Module checker",
"Shell",
"System monitor",
"lager"
]
}
|
Arguments
None.
Returns
An array that contains each originator that can be used for filtering
logs.
Get log originators for a node
Retrieve the list of log originators for a given node.
Definition
| GET /api/logs/originator/node/NODE_ID
|
Example request
| curl -X GET "http://127.0.0.1:8080/api/logs/originator/node/3fa56f92-3195-401b-93a8-7bc43e54d66f"
|
Example response
See "Get all log originators", above.
Arguments
Argument |
Description |
node ID |
Required. The node's identifier. |
Returns
See "Get all log originators", above.
Get log originators for a node family
Retrieve the list of log originators for a given node family.
Definition
| GET /api/logs/originator/node-family/NODE_FAMILY_ID
|
Example request
| curl -X GET "http://127.0.0.1:8080/api/logs/originator/node-family/93be4f01-dae6-49b0-9608-4552f841a720"
|
Example response
See "Get all log originators", above.
Arguments
Argument |
Description |
node family ID |
Required. The node family's identifier |
Returns
See "Get all log originators", above.
Get log levels for a node
Retrieve the current log levels for a specified node.
Definition
| GET /api/logs/level/NODE_ID
|
Example request
| curl -X GET "http://127.0.0.1:8080/api/logs/level/3fa56f92-3195-401b-93a8-7bc43e54d66f"
|
Example response
1
2
3
4
5
6
7
8
9
10
11
12 | {
"logLevels": [
{
"handler": "wo_logs_lager_agent",
"logLevel": "warning"
},
{
"handler": "wo_logs_elogger_agent",
"logLevel": "warning"
}
]
}
|
Arguments
Argument |
Description |
node ID |
Required. The node's identifier. |
Returns
An array that contains each handler and its current log level for the
specified node.
Set log level for current node
Update the log level for the specified handler on a node.
Definition
| POST /api/logs/level/NODE_ID
|
Data
| {
"handler": "HANDLER",
"level": "SEVERITY"
}
|
Example request
| curl -X POST "http://127.0.0.1:8080/api/logs/level/3fa56f92-3195-401b-93a8-7bc43e54d66f" \
-H "Content-Type: application/json" \
-d "{\"handler\":\"wo_logs_lager_agent\", \"level\":\"info\"}"
|
Example response
Arguments
Argument |
Description |
node ID |
Required. The node's identifier. |
handler |
Required. The handler for which to update the log level. |
level |
Optional. The new log level (info, warning, or error). |
Returns
An empty object. If successful, the HTTP response is 200 OK.
Get part of a log message
If a log message is too big (more than 1000000 bytes), WombatOAM might run out
of memory crash when encoding it to JSON. The web browsers have trouble
displaying this much data too. To avoid these problems, the server only returns
big log messages page by page, when a page contains around 1000 bytes data (might
be 1-3 bytes more to avoid splitting multibyte UTF-8 encoded characters). This
function is used to get these pages. To go through the pages in forward direction,
set the FROM
value to the start
property and set DIRECTION
to next
. Set
DIRECTION
to prev
and you can go backwards within the pages. If DIRECTION
is set to first
or last
, then the first or last page is returned, regardless
of the FROM
value. The hasNext
and the hasPrev
properties in the result
show if there are any more pages in either direction.
Get first/last/next/previous page (1000 bytes) of a single log message.
Definition
| GET /api/logs/previous/part?c=CURSOR&from=FROM&direction=DIRECTION
|
Example requests
| curl -X GET "http://127.0.0.1:8080/api/logs/previous/part?c=r3jpgnb8hSoMyL9RNkPhTRrsEeaDbAAAAAFqaAJoA2IAAAXXYgADIHZiAA0YHWEU&from=0&direction=next
|
Example response
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 | {
"logs": [
{
"date":"1494850906467",
"severity":"error",
"originator":"error_logger",
"nodeId":"3fcaf6a5-a222-40e0-a708-ef19c4eeb90b",
"nodeName":"test_app@127.0.0.1",
"message":"187, 94188, 94189, 94190, 94191, 94192, 94193, \n 94194, 94195, 94196, 94197, 94",
"props":
{
"cursor":"r3jpgnb8hSoMyL9RNkPhTRrsEeaDbAAAAAFqaAJoA2IAAAXXYgADIHZiAA0YHWEU",
"hasNext":true,
"start":1001,
"hasPrev":true
},
"type":"logEvent",
"displayName":"test_app@127.0.0.1"
}
],
"cursor":null
}
|
Arguments
Argument |
Description |
cursor |
Required. The cursor returned from the previous call. This specifies the log message. |
from |
Required. The index of the byte from where the previous log message part is returned. |
direction |
Required. The direction of the next page. Can be first , prev , next or last . |