Getting an audit log

Ops Center Analyzer Detail View REST API Reference Guide

Version
11.0.x
Audience
anonymous
Part Number
MK-99ANA004-11

You can request audit logs based on a specific search criteria. The audit log contains the following information: date, request ID, dataset, user, user agent, HTTP method, client IP, action, request length, response code, and service time.

Request line

POST baseURL/dbapi.do?action=getAuditLogs&dataset=<Datasetname>

Request body

{
  "tw":"",
  "requestId":"",
  "user":"",
  "clientIp":"",
  "responseCode":"",
  "serviceTime":[
    , 
  ]
}

Request example

POST /dbapi.do?action=getAuditLogs&dataset=defaultDs HTTP /1.1 Authorization: Basic ZnJlZDpmcmVk
{
  "user":"admin",
  "responseCode":"200",
  "serviceTime":[
    10, 20
  ]
}

Request parameters

Parameter Type Description
action String getAuditLogs

Specify the API function to be invoked.

dataset String Dataset name. From 2 to 32 alphanumeric, underscore (_), and hyphen (-) characters are allowed.
tw String (Optional) JSON list of string where the first element represents the audit start time and the second element represents end time for audit.

Date format: yyyyMMdd_HHmmss

Time zone: UTC

By default the last 24 hours are considered for audit.

requestId String Request ID of the requested audit log.

Default: *

user String

User name of the requested audit log .If you want audit logs for the specific username, then do not use the regular expression special characters in the user name.

Default: *
clientIp String Client IP address of the requested audit log.

Default: *

responseCode String HTTP response code of the requested audit log.

Default: *

serviceTime Integer

(Optional) Service time range of the requested audit log.

List of service time where elements in the list represent the minimum and maximum service time.

Default: 0 (Java integer maximum value)

Response body

[
  {
    "date":"",
    "requestId":"",
    "dataset":"",
    "user":"",
    "userAgent":"",
    "HTTPMethod":"",
    "clientIP":"",
    "action":"",
    "requestLength":"",
    "responseCode":,
    "serviceTime":
  }
]

Response example

[
  {
    "date":"20150615_092909",
    "requestId":"363041533_8",
    "dataset":"defaultDs",
    "user":"admin",
    "userAgent":"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.124 Safari/537.36",
    "HTTPMethod":"POST",
    "clientIP":"192.168.1.157",
    "action":"createResourceDef",
    "requestLength":"375",
    "responseCode":200,
    "serviceTime":14
  },
  {
    "date":"20150615_100850",
    "requestId":"924518978_17",
    "dataset":"defaultDs",
    "user":"admin",
    "userAgent":"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.124 Safari/537.36",
    "HTTPMethod":"POST",
    "clientIP":"192.168.1.157",
    "action":"getAuditLogs",
    "requestLength":"12",
    "responseCode":200,
    "serviceTime":11
  },
  {
    "date":"20150615_124609",
    "requestId":"213068087_52",
    "dataset":"defaultDs",
    "user":"admin",
    "userAgent":"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.124 Safari/537.36",
    "HTTPMethod":"POST",
    "clientIP":"192.168.1.157",
    "action":"createResourceDef",
    "requestLength":"375",
    "responseCode":200,
    "serviceTime":10
  }
]

Response parameters

Parameter

Type

Description

date String

Time stamp of the request.

Format: yyyyMMdd_HHmmss

Time zone: UTC

requestId String Request ID.
dataset String Dataset name.
user String User name that requested the request.
userAgent String User agent name from which the request is received.
HTTPMethod String HTTP method used for the request.
clientIP String Client IP address from where this API request is received.
action String Action used for this API request.
requestLength String Request length.
responseCode Integer HTTP response code.
serviceTime Integer Total time required to execute the request.

Status codes

Status code

Message

Description

200 OK Request was successful, and the response body contains the requested log details.
206 PARTIAL CONTENT Request is in progress, and the incremental content is available in the response body.
400 BAD REQUEST Request URL or request body validation failed. Check the response body for details.
500 SERVER ERROR API operation request failed. Check the response body for details.

Response codes

The following table lists the common API response codes that might be generated through the standard API. If an error response is not listed, examine the HTTP status codes to determine the best method for addressing the issue.

Response code Message Condition
82010002 Invalid JSON Request. Specified JSON input is invalid.
8201000C Parameter {query, startTime, endTime} not supportedParameter {query, startTime, endTime} are not supported. Invalid parameters.
8201000F Invalid value specified for the parameter {tw}. Specified value for the parameter tw is not of a JSON list of string.
8201000F Invalid value specified for the parameter {tw}. The parameter [tw] must have only two elements. Specified JSON list for the parameter tw does not contain 2 elements.
8201000F Invalid value specified for parameter {tw}. The parameter [tw] must contain start and end time in yyyyMMdd_HHmmss format. Specified JSON list for the parameter tw does not contain start time or end time in valid format .
8201000F Invalid value specified for parameter {tw}. The endTime must be after the startTime. Specified endTime is before the specified startTime.
8201000F Invalid value specified for the parameter {requestId}. Specified value for the parameter requestId is not of type string.
8201000F Invalid value specified for the parameter {dataset}. Specified value for the parameter dataset is not of type String.
8201000F Invalid value specified for the parameter {user}. Specified value for the parameter user is not of type string.
8201000F Invalid value specified for the parameter {clientIP}. Specified value for the parameter clientIP is not of type string.
8201000F Invalid value specified for the parameter {action}. Specified value for the parameter action is not of type string.
8201000F Invalid value specified for the parameter {responseCode}. Specified value for the parameter responseCode is not of type string.
8201000F Invalid value specified for the parameter {serviceTime}. Specified value for the parameter serviceTime is not JSON list of integer.
8201000F Invalid value specified for the parameter {serviceTime}. The parameter [serviceTime] must have two element. Specified JSON list for the parameter serviceTime does not contain two elements.
8201000F Invalid value specified for parameter {serviceTime}. The maximum serviceTime must be greater than minimum. Specified minimum service time is greater than maximum service time.
8201000C Parameter {userAgent} is not supported. Unsupported parameter specified.
820000E2 Application encountered an internal error. API server encountered an unknown error.