Export

Description

The export operation exports organization logs based on either query or search parameters. Using the query filter parameters, you can aggregate and filter through logs for your deployment. Using the search parameters, you can search for specific log records. Once completed, a .zip file of the exported logs is uploaded to the uploads directory, which can be downloaded from the URL provided with the success response. If necessary, the export operation can be invoked multiple times to acquire additional logs.

Request parameters

The table below describes the parameters applicable to both query and search requests. For the query and search parameters, see the Query parameters and Search parameters sections below.

ParameterDetails

num

(Required)

The maximum number of results returned by this operation. The default number of results per page is 1,000. The limit for number of results returned is 10,000 logs.

Example
Use dark colors for code blocksCopy
1
num=1000

stackTraces

(Required)

A binary that specifies whether stack traces of exceptions will be included with the returned logs. The default is false.

Values: true | false

f

The response format. The default response format is html.

Values: html | json | pjson

Query parameters

ParameterDetails

logLevel

(Required)

The base log level for the logs being queried. Only logs at the same level or at a level with higher severity will be returned. The default level is the log level currently set for the organization.

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

startTime

(Optional)

The most recent time used to query logs, formatted as either a time stamp (yyyy-mm-ddThh:mm:ss ) or milliseconds from epoch. The default is the current time.

Example
Use dark colors for code blocksCopy
1
2
3
4
5
//Timestamp
startTime=2020-08-01T15:17:20

//Milliseconds
startTime=1597072460000

endTime

(Optional)

The oldest time used to query logs, formatted as either a time stamp (yyyy-mm-ddThh:mm:ss ) or milliseconds from epoch. The default is kept blank.

Example
Use dark colors for code blocksCopy
1
2
3
4
5
//Timestamp
endTime=2020-08-01T15:14:20

//Milliseconds
endTime=1597072520000

logCode

(Optional)

The log codes assigned to the logs. When specified, the query will return logs associated with those codes.

Example
Use dark colors for code blocksCopy
1
logCode=202010,1251

users

(Optional)

The username of a user in the organization to further filter log results.

Example
Use dark colors for code blocksCopy
1
users=user1

requestIDs

(Optional)

An ID assigned to a specific server event.

Example
Use dark colors for code blocksCopy
1
requestIDs=a1fc28db-4575-4a09-84df-7b313c239e5b,22d8113a-e229-4e48-8fe4-008a5037fcba

serviceTypes

(Optional)

The service type of a service in the organization to further filter query results.

Example
Use dark colors for code blocksCopy
1
serviceTypes=MapServer

source

(Optional)

The source of the logged events.

Examples
Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
//Sharing API as source
source=Sharing

//Service in folder as source
source=Folder/CommercialDamageAssessment.FeatureServer

//Enterprise Admin as source
source=Enterprise Admin

//REST Catalog as source
source=Rest Catalog

//SOAP Catalog as source
source=Soap Catalog

Search parameters

ParameterDetails

searchQuery

(Optional)

The search terms used to query your organization's logs. This parameter supports keywords (for example, completed) and phrases (for example, completed successfully). For accepted query types and examples, see the Supported queries section below.

Example
Use dark colors for code blocksCopy
1
searchQuery=(“Updated Kubernetes Secret” AND logCode:1312) AND NOT logLevel:VERBOSE OR elapsed:[1.45195 TO 2.43]

sortBy

(Required)

Specifies the way in which search results are sorted. Sorting by bestMatch returns the results that best match the searchQuery values. Sorting by time sorts the search results by the time information recorded in the log's time stamp, the order of which is determined by the sortOrder parameter. The default value is bestMatch.

Values: bestMatch | time

sortOrder

(Required)

The sort order for the results, either descending or ascending, in relation to the sortBy value. The default is desc. This parameter is ignored if sortBy is set to bestMatch.

Values: desc | asc

Supported queries

The sections below outline the supported query ties for searchQuery. The export operation supports the following query types:

Full-text query

Full-text queries return all logs that match any of the search terms.

In this example, log records that contain, in some capacity, the words completed or successfully are returned:

Example
Use dark colors for code blocksCopy
1
searchQuery=completed successfully

Exact match query

Exact match queries search for a phrase, contained within doubt quotes, that allows exact matches of the search terms to be returned.

In this example, an exact match query is used to find log records that exactly match the success response for creating an organization:

Example
Use dark colors for code blocksCopy
1
searchQuery="The process to create a new organization has completed successfully."

Field-based query

Field-based queries allow searchQuery values to be searched against a single log field using the field name, followed by a colon (:), and the search term. If no field indicator is used, all default fields are searched. The default log fields for searchQuery are as follows:

  • msg
  • source
  • className
  • username
  • stackTraces
  • serviceTypes
  • logLevel
  • logCode

In this example, a field-based query is used to search for a log record that has ArcSOCGISServiceClient as the className value:

Example
Use dark colors for code blocksCopy
1
searchQuery=className: ArcSOCGISServiceClient

Boolean queries

Using Boolean operators in searchQuery allows you to combine terms through logic operators. ArcGIS Enterprise Administrator API supports AND, OR, and NOT as Boolean operators. Operators must be in all caps.

AND

The AND operator performs matching when both terms exist in either the given or default fields. This is equivalent to an intersection using sets.

In this example, the AND operator is used to search for a log record that contains the phrase "Updated Kubernetes Secret" and the username administrator:

Example
Use dark colors for code blocksCopy
1
searchQuery="Updated Kubernetes Secret" AND username:administrator

OR

The OR operator links two terms and returns a match if either term exists in the log records. This is equivalent to a union using sets.

In this example, the OR operator is used to search for a log record that contains the phrase "GP Server" or has the logCode 1312:

Example

Example
Use dark colors for code blocksCopy
1
searchQuery="GP Server" OR logCode:1312

NOT

The NOT operator excludes items that contain the term after NOT. This is equivalent to a differencing using sets.

In this example, the NOT operator is used to search for a log record that contains the phrase "Updated Kubernetes Secret" that belongs to any logLevel other than VERBOSE:

Example
Use dark colors for code blocksCopy
1
searchQuery="Updated Kubernetes Secret" AND NOT logLevel:VERBOSE

Range queries

Using range queries allows searchQuery to match single or multiple field values between lower and upper boundaries, exclusively for numerical fields (for example, logCodes and timestamps).

Range queries can be inclusive or exclusive of the upper and lower bounds. Range requests that are inclusive of their bounds use brackets: [ ]. Exclusive range requests use braces: { }.

Example
Use dark colors for code blocksCopy
1
searchQuery=elapsed: [1.4195 TO 2.43]

Grouping queries

Grouping allows queries by grouping subqueries within parenthesis to combine clauses and any of the other query types.

In this example, grouping is used in combination with exact match, Boolean, field-based, and range queries to find all log records with the phrase "Updated Kubernetes Secret" and a logCode of 1312 that either belong to a logLevel other than VERBOSE or have elapsed between 1.45195 to 2.43:

Example
Use dark colors for code blocksCopy
1
searchQuery=(“Updated Kubernetes Secret” AND logCode:1312) AND NOT logLevel:VERBOSE OR elapsed:[1.45195 TO 2.43]

Example usage

The following is a sample POST request for the export operation that demonstrates using query filter parameters (logLevel, startTime, endTime, users, and source):

Use dark colors for code blocksCopy
1
2
3
4
5
6
POST /context/admin/logs/export HTTP/1.1
Host: organization.domain.com
Content-Type: application/x-www-form-urlencoded
Content-Length: []

logLevel=DEBUG&startTime=2020-08-09T22:45:06&endTime=2020-08-09T22:45:00&logCode=&users=jSmith&requestIDs=&serviceTypes=&source=Enterprise Admin&searchQuery=&sortBy=bestMatch&sortOrder=desc&num=1000&stackTraces=false&f=html&token=7O7EKYp0WhTLZLku7vilWPky53qD8mz-vweu9YyLMAPqlno0-85wDdjBe8w_rsl2jmlAph2Fp6-BQ4boFqidGIT4cR0vWpj2kgEmICN2gukc0M2PLP2rjBKwUhef__TtAvWDIbHzaPMGtL1HjRaim4rG-7jjjjzxMprn0eRsI_tbbOT6JmPF4Y4PqLHIQbp8ZcOFl_bSVBFqU2MtNIo4BPCaRZqDxcTxy9C0EJhljkoWnA-GCbV_E8kPcPqeGf1M

The following is a sample POST request for the export operation that demonstrates using search parameters (searchQuery, sortBy, and sortOrder):

Use dark colors for code blocksCopy
1
2
3
4
5
6
POST /context/admin/logs/export HTTP/1.1
Host: organization.domain.com
Content-Type: application/x-www-form-urlencoded
Content-Length: []

logLevel=DEBUG&startTime=&endTime=&logCode=&users=&requestIDs=&serviceTypes=&source=&searchQuery="Completed Successfully"&sortBy=bestMatch&sortOrder=desc&num=1000&stackTraces=false&f=html&token=7O7EKYp0WhTLZLku7vilWPky53qD8mz-vweu9YyLMAPqlno0-85wDdjBe8w_rsl2jmlAph2Fp6-BQ4boFqidGIT4cR0vWpj2kgEmICN2gukc0M2PLP2rjBKwUhef__TtAvWDIbHzaPMGtL1HjRaim4rG-7jjjjzxMprn0eRsI_tbbOT6JmPF4Y4PqLHIQbp8ZcOFl_bSVBFqU2MtNIo4BPCaRZqDxcTxy9C0EJhljkoWnA-GCbV_E8kPcPqeGf1M

JSON Response examples

The following response is returned when the job request is submitted. The value returned for jobsUrl can be used to access the job resource to poll a job's status after it has been submitted.

Use dark colors for code blocksCopy
1
2
3
4
5
{
  "jobsUrl": "https://organization.domain.com/context/admin/jobs/j1fad73a1-ea33-45e8-b2f4-a665aaeeed69",
  "jobid": "j1fad73a1-ea33-45e8-b2f4-a665aaeeed69",
  "status": "SUBMITTED"
}

Once status returns as COMPLETED, the job resource returns the following response. The value returned for result can be used to access the uploaded .zip file and download the exported logs.

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
{
  "result": {"URL": "https://organization.domain.com/context/admin/uploads/9d3f618c-e23f-4fed-8856-2a277a908e0d"},
  "updatedtime": 1654240807010,
  "jobid": "j423b3cfd-3ce6-4ee7-84b5-aed574ec57c9",
  "resource": {"name":"Logs"}
  "requestID": "6e767d21-1421-4fef-b8d1-d2148e9a71e6",
  "name": "exportLogs",
  "endtime": 1654240807012,
  "starttime": 1654240803053,
  "operationURI": "/arcgis/admin/logs/export",
  "status": "COMPLETED",
  "username": "Administrator"
}

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