Skip to content

Query - Logs

URL:
https://<root>/logs/query
Methods:
GET
Version Introduced:
10.1

Access requirements

Required privileges

The Sever Administrator API requires privilege-based access. An administrator must be assigned a specific user privilege, or role, to access any given endpoint. Listed below are the user privileges or roles an administrator can be assigned that provides access to this endpoint. If multiple privileges are listed, only one needs to be assigned to gain access.



Note that administrators assigned a custom role must also have the administrative View all content privilege assigned to them to access the API directory as an administrator. Additonally, any custom roles that include a webhook-related privilege must also include the general Publish server-based layers content privilege.

Tokens

This API requires token-based authentication. A token is automatically generated for administrators who sign in to the Server Administrator API directory's HTML interface. Tokens generated in this way are stored for the entirety of the session.

Those accessing the API directory outside of the HTML interface will need to acquire a session token from the generateToken operation in the Portal Directory API. For security reasons, all POST requests made to the Server Administrator API must include a token in the request body.


Learn how to generate a token

Description

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

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.

Example
Use dark colors for code blocksCopy
1
startTime=1566379810000

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.

Example
Use dark colors for code blocksCopy
1
endTime=1566423010000

level

Only records with a log level at or more severe than this level are returned. The default value is WARNING.

Values: SEVERE | WARNING | INFO | FINE | VERBOSE | DEBUG

filterType

(Required)

Specifies that the filter filter format is JSON. If this operation is being performed within the ArcGIS Server Admin Directory UI, this parameter will automatically be added to the request when executed.

Example
Use dark colors for code blocksCopy
1
filterType=json

filter

(Required)

Filtering provides flexibility and specificity by combining any of the filter properties, each given as a comma-separated list.

Example
Use dark colors for code blocksCopy
1
2
filter={
"codes": [8271, 9003], "processIds": [4392, 9816], "requestIds": ["a1fc28db-4575-4a09-84df-7b313c239e5b", "22d8113a-e229-4e48-8fe4-008a5037fcba"], "services": ["Pro_mapimage.MapServer"], "machines": ["machine.example.com"]}

pageSize

The maximum number of log records to be returned by this query. The default messages per page is 1000. The limit is 10000 records.

Example
Use dark colors for code blocksCopy
1
pageSize=1000

f

The response format. The default value is html.

Values: html | json | pjson | xml

Filter properties

PropertyDescription

codes

(Optional)

Specifies the log codes assigned to server logs. To query all codes, set the value to []. At ArcGIS Enterprise 12.0, this list can also include codes to be omitted from the results (ex: -9003).

Example
Use dark colors for code blocksCopy
1
2
3
4
5
//web example
8271, 9003

//scripting example
"codes": [-9003]

processIds

(Optional)

Specifies the machine process IDs to query. To query logs from all process IDs, set the value to [].

Example
Use dark colors for code blocksCopy
1
2
3
4
5
//web example
4392, 9816

//scripting example
"processIds": [4392, 9816]

requestIds

(Optional)

Specifies an ID assigned to a specific server request.

Example
Use dark colors for code blocksCopy
1
2
3
4
5
//web example
a1fc28db-4575-4a09-84df-7b313c239e5b, 22d8113a-e229-4e48-8fe4-008a5037fcba

//scripting example
"requestIds": ["a1fc28db-4575-4a09-84df-7b313c239e5b", "22d8113a-e229-4e48-8fe4-008a5037fcba"]

component

(Optional)

Specifies the server components delivering the log message. To query logs from all components, set the value to *.

Values: ADMIN | REST | SERVER | SOAP | DATA STORE

services

(Optional)

Specifies whether to query all, none, or a specific service in your site. To query logs from all services, set the value to *.

Example
Use dark colors for code blocksCopy
1
2
3
4
5
//web example
Pro_mapimage.MapServer

//scripting example
"services": ["Pro_mapimage.MapServer"]

machines

(Optional)

Specifies whether to query all or a specific machine in your server sit. To query logs from all machines, set the value to *.

Example
Use dark colors for code blocksCopy
1
2
3
4
5
//web example
machine.example.com

//scripting example
"machines": ["machine.example.com"]

Example usage

The following is a sample GET request for the query operation.

Use dark colors for code blocksCopy
1
https://organization.example.com/<context>/admin/logs/query?startTime=1310165288&endTime=1310125087&level=INFO&filterType=json&filter={"codes": [8271, 9003], "processIds": [4392, 9816], "requestIds": ["a1fc28db-4575-4a09-84df-7b313c239e5b", "22d8113a-e229-4e48-8fe4-008a5037fcba"], "services": ["Pro_mapimage.MapServer"], "machines": ["machine.example.com"]}&pageSize=1000&f=pjson

JSON Response example

Use dark colors for code blocksCopy
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
27
28
29
30
31
32
33
34
35
{
  "hasMore": true,
  "startTime": 1310165288,
  "endTime": 1310125087,
  "logMessages": [
    {
      "type": "INFO",
      "message": "Service has been successfully created in the server context.",
      "time": 1311101673947,
      "source": "Server",
      "machine": "MACHINE.EXAMPLE.COM",
      "user": "",
      "code": 8271,
      "elapsed": "",
      "process": "4392",
      "thread": "1",
      "methodName": "",
      "requestID": "a1fc28db-4575-4a09-84df-7b313c239e5b"
    },
    {
     	"type": "INFO",
      "message": "Unable to process request. Service ByRef2/MapServer not found ",
      "time": 1540338505127,
      "source": "Rest",
      "machine": "MACHINE.EXAMPLE.COM",
      "user": "",
      "code": 9003,
      "elapsed": "",
      "process": "9816",
      "thread": "1",
      "methodName": "",
      "requestID": "22d8113a-e229-4e48-8fe4-008a5037fcba"
    }
  ]
}

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.