ArcGIS REST API

Query Logs

  • URL:https://server:port/arcgis/admin/logs/query(POST only)
  • Required Capability:Publisher or Administrator
  • Version Introduced:10.1

Description

The query operation on the logs resource provides a way to aggregate, filter, and page through logs across the entire ArcGIS Server site.

The Filter parameter provides flexibility and specificity to your queries with six optional properties. The HTML page provides two options for the filter: an HTML-based set of input boxes and drop-down boxes, and a JSON code block. Radio buttons allow you to switch between these two options, and any changes you make to the HTML set when switched on will automatically populate in the JSON code block.

Tip:

When you're learning how to make server log queries, you can use the HTML filter set to choose your options; then you can copy the JSON code block to use in future programmatic log requests.

At 10.7, the optional filter properties include the new Request ID property, which is assigned to all requests received by the server.

HTML Request parameters

ParameterDetails
Start Time

The most recent time to query. Time can be specified in milliseconds since UNIX epoch, or as an ArcGIS Server time stamp. If left blank, the query will include logs up to the present time.

End Time

The oldest time to include in the result set. You can use this to limit the query to the last few minutes or hours as needed. If left blank, the query will include all logs recorded since logging began.

Level

The minimum log level for which to query. The options are [SEVERE, WARNING, INFO, FINE, VERBOSE, DEBUG]. It returns only records with a log level at or more severe than this level. The default level is WARNING.

Filter

Filtering is allowed by any combination of the following properties, presented either as an input text field or a drop-down field. Leave input fields blank to omit filtering by that property.

  • Log CodesLog codes assigned to server logs.
  • Process IDs—Machine process IDs.
  • Request IDs—Request IDs assigned to specific server requests. This is available starting at 10.7.
  • Component—The server component delivering the log message. The options are [ALL, ADMIN, REST, SERVER, SOAP, DATA STORE].
  • Service—Choose from the services in your server site, or choose All to view logs from all services.
  • Machines—Choose one of the machines in your server site, or choose All to view logs from all machines.

Messages Per Page

The maximum number of log records to be returned by this query. The limit is 10,000 records. The default value is 1,000.

Format

The response format. The value options are HTML (the default), XML, and JSON.

JSON Request parameters

ParameterDetails
startTime

The most recent time to query. If the hasMore member of the response object is true, pass the endTime member as the startTime parameter for the next request to get the next set of records. Time can be specified in milliseconds since UNIX epoch or as an ArcGIS Server time stamp.

{ "startTime": "2011-08-01T15:17:20,123", ... }

{ "startTime": 1312237040123, ... }

Default: now

endTime

The oldest time to include in the result set. You can use this to limit the query to the last few minutes or hours as needed.

Note:

If sinceLastStart is true, the default is all logs since the server was started. Time can be specified in milliseconds since UNIX epoch or as an ArcGIS Server time stamp.

{ "endTime": "2011-08-01T15:17:20,123", ... }

{ "endTime": 1312237040123, ... }

Default: Beginning of all logging.

sinceLastStart

Can be TRUE or FALSE. When TRUE, only records written since the server most recently started or restarted are returned.

Default: FALSE

level

Can be one of [SEVERE, WARNING, INFO, FINE, VERBOSE, DEBUG]. Only records with a log level at or more severe than this level are returned.

Default: WARNING

filter

Filtering is allowed by any combination of the following properties, each given as a comma-separated list:

  • codesLog codes assigned to server logs. To see logs from all codes, specify [].
  • processIds—Machine process IDs. To see logs from all process IDs, specify [].
  • requestIds—Request IDs assigned to specific server requests. This is available starting at 10.7.
  • component—One or more server components delivering the log message: ADMIN, REST, SERVER, SOAP, or DATA STORE. You can also specify * to query logs from all components.
  • services—One or more services in your server site. You can also specify * to query logs from all services.
  • machines—One or more machines in your server site. You can also specify * to query logs from all machines.
The filter accepts a semicolon-delimited list of filter definitions. If any definition is omitted, it defaults to all.

Examples of the filter parameter:

Specific service logs on a specific machine:

{"services": ["System/PublishingTools.GPServer"], "machines": ["site2vm0.domain.com"]}

Only server logs on a specific machine:

{"server": "*", "machines": ["site2vm0.domain.com"]}

All services on all machines and only REST logs:

"services": "*", "server": ["Rest"]

pageSize

The maximum number of log records to be returned by this query. The limit is 10000 records.

Default: 1000

f

The response format: [html|json|pjson|xml].

Default: html

Request format

{
      "startTime" : [timeInMillis],
      "endTime" : [timeInMillis],
      "level":  [SEVERE|WARNING|INFO|FINE|VERBOSE|DEBUG],
      "filter": [see filter above],
      "pageSize": [records per page],
      "f": "JSON"
      }

Example GET Request

https://server.domain.com:port/arcgis/admin/logs/query?
startTime=
&endTime=
&sinceLastStart=false
&filter={"server": "*", "requestIds": "*", "services": "*", "machines":"*"}
&level=WARNING
&pageSize=100
&f=JSON
&token=cn28481VNW....

Response format

{
    "hasMore": true,
    "startTime": 1310165288,
    "endTime": 1310125087,
    "logMessages": [
        {
            "type": "INFO",
            "message": "Service has been successfully created in the server context.",
            "time": 1311101673947,
            "source": "Server",
            "machine": "SITE2VM0.DOMAIN.COM",
            "user": "",
            "code": 8271,
            "elapsed": "",
            "process": "4392",
            "thread": "1",
            "methodName": "",
												"requestID": "a1fc28db-4575-4a09-84df-7b313c239e5b"
        },
        {
     						 "type": "WARNING",
            "message": "Unable to process request. Service ByRef2/MapServer not found ",
            "time": 1540338505127,
            "source": "Rest",
            "machine": "SITE2VM0.DOMAIN.COM",
            "user": "",
            "code": 9003,
            "elapsed": "",
            "process": "9816",
            "thread": "1",
            "methodName": "",
            "requestID": "22d8113a-e229-4e48-8fe4-008a5037fcba"
    },
        ...
    ],