- URL:
- https://<root>/logs/export
- Methods:
POST
- Required Capability:
- Access allowed with either the "Manage Licenses", "Links to organization-specific group", "Delete", "Security and infrastructure", or "Servers" privileges, or the Publisher role
- Version Introduced:
- 11.0
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.
Parameter | Details |
---|---|
(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
|
(Required) | A binary that specifies whether stack traces of exceptions will be included with the returned logs. The default is Values: |
| The response format. The default response format is Values: |
Query parameters
Parameter | Details |
---|---|
(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: |
(Optional) | The most recent time used to query logs, formatted as either a time stamp ( Example
|
(Optional) | The oldest time used to query logs, formatted as either a time stamp ( Example
|
(Optional) | The log codes assigned to the logs. When specified, the query will return logs associated with those codes. Example
|
(Optional) | The username of a user in the organization to further filter log results. Example
|
(Optional) | An ID assigned to a specific server event. Example
|
(Optional) | The service type of a service in the organization to further filter query results. Example
|
(Optional) | The source of the logged events. Examples
|
Search parameters
Parameter | Details |
---|---|
(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
|
(Required) | Specifies the way in which search results are sorted. Sorting by Values: |
(Required) | The sort order for the results, either descending or ascending, in relation to the Values: |
Supported queries
The sections below outline the supported query ties for search
. The export
operation supports the following query types:
- Full-text search
- Exact match search
- Field-based search
- Boolean queries
- Range queries
- Grouping queries
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:
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:
searchQuery="The process to create a new organization has completed successfully."
Field-based query
Field-based queries allow search
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 search
are as follows:
msg
source
class
Name username
stack
Traces service
Types log
Level log
Code
In this example, a field-based query is used to search for a log record that has Arc
as the class
value:
searchQuery=className: ArcSOCGISServiceClient
Boolean queries
Using Boolean operators in search
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 "
and the username
administrator:
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 "
or has the log
1312:
Example
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 "
that belongs to any log
other than VERBOSE
:
searchQuery="Updated Kubernetes Secret" AND NOT logLevel:VERBOSE
Range queries
Using range queries allows search
to match single or multiple field values between lower and upper boundaries, exclusively for numerical fields (for example, log
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: { }.
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 "
and a log
of 1312 that either belong to a log
other than VERBOSE
or have elapsed between 1.45195 to 2.43:
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 (log
, start
, end
, users
, and source
):
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 (search
, sort
, and sort
):
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 jobs
can be used to access the job
resource to poll a job's status after it has been submitted.
{
"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.
{
"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"
}