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.
The expression can include fields: type, source, tags, tags.{name}, message,severity.
Example: message LIKE 'Starting*'.
Supported wildcards: * and ?.
  • severity, minSeverity, and severities fields are case insensitive.

Expression

The expression can include type, source, tags, tags.{name}, 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

  • [Required]
  • Date conditions are applied to the date field.
  • Refer to date filter.

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
date string Message record creation date in ISO format.
type string Message type.
source string Message source.
entity string Entity name.
severity string Message severity code.
tags object Object containing name=value fields, for example tags: {"path": "/", "name": "sda"}.
message string Message text.

Errors

None.

Example

Request

URI

POST /api/v1/messages/query

Payload

[{
  "entity": "nurswgvml007",
  "type": "logger",
  "limit": 10,
  "endDate": "now",
  "interval": { "count": 1, "unit": "HOUR" }
}]

curl

curl https://atsd_hostname:8443/api/v1/messages/query \
  -k --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