Messages: query

Description

Retrieves message records for the specified filters.

Request

Method Path Content-Type Header
POST /api/v1/messages/query application/json

Parameters

None.

Fields

An array of query objects containing the following filtering fields:

Message Filter Fields

Name Type Description
type string Message type.
source string Message source.
tags object Object with name=value fields.
Matches records that contain tags specified in the request object.
The matching records can include additional tags, not listed in the object.
severity string Severity name.
Matches records with the specified severity.
severities array An array of severity codes or names.
Matches records with one of the specified severities.
Array elements can be specified as a string or as a number.
minSeverity string Minimum code or name severity filter.
Can be specified as a string or as a number.
expression string Include messages that match a filter expression consisting of tags, message and severity fields and operators. Example: message LIKE 'Starting*'.
Supported wildcards: * and ?.
  • severity, minSeverity, and severities values are case-insensitive.

Expression

The expression can include tags, message and severity fields.

String literals must be enclosed in single or double quotes.

Examples:

message IN ('Completed job', 'Starting job')
severity != 'FATAL'
message NOT LIKE 'Access*' && tags.ip = '192.0.2.1'

Entity Filter Fields

Date Filter Fields

Result Filter Fields

Name Type Description
limit integer Maximum number of records to be returned. Default: 1000.
Limit is not applied if the parameter value <= 0.

Response

An array of matching message objects containing the following fields:

Fields

Field Type Description
entity string Entity name.
type string Message type.
source string Message source.
severity string Message severity name.
tags object Object containing name=value fields, for example tags: {"path": "/", "name": "sda"}.
message string Message text.
date string ISO 8601 date of message record creation.

Errors

None.

Example

Request

URI

POST /api/v1/messages/query

Payload

[
  {
    "entity": "nurswgvml007",
    "type": "logger",
    "limit": 5,
    "endDate": "now",
    "interval": {
      "count": 30,
      "unit": "MINUTE"
    }
  }
]

curl

curl https://atsd_hostname:8443/api/v1/messages/query \
  --insecure --include --user {username}:{password} \
  --header "Content-Type: application/json" \
  --data @file.json

Response

Payload

[
  {
    "entity": "nurswgvml007",
    "type": "logger",
    "source": "com.axibase.tsd.service.entity.findentitybyexpressionserviceimpl",
    "severity": "NORMAL",
    "tags": {
      "level": "INFO",
      "thread": "applicationScheduler-5",
      "command": "com.axibase.tsd.Server"
    },
    "message": "Expression entity group 'scollector-linux' updated",
    "date": "2016-05-25T17:05:00Z"
  },
  {
    "entity": "nurswgvml007",
    "type": "logger",
    "source": "com.axibase.tsd.web.csv.csvcontroller",
    "severity": "NORMAL",
    "tags": {
      "level": "INFO",
      "thread": "qtp490763067-195",
      "command": "com.axibase.tsd.Server"
    },
    "message": "Start processing csv, config: nginx-status",
    "date": "2016-05-25T17:04:01Z"
  }
]

Java Example

Python Example

Additional Examples