Hitachi

Job Management Partner 1 Version 10 Job Management Partner 1/Automatic Operation GUI, Command, and API Reference


9.6.13 Acquisition of task logs

Function

Acquires the logs for the specified task.

Execution permissions

Admin role, Develop role, Modify role, Submit role

API version

v1

Request format

GET http://host:port/Automation/version/objects/TaskLogs

This API acquires the logs for the task that has the specified taskID, among all tasks for which the user who executed the API has permissions. By specifying query parameters, you can filter the tasks for which you want to acquire the list.

This API acquires the logs for the task that has the specified taskID, in the size specified for readSize or smaller, starting from the point specified for the offset. If reverse is specified, the API acquires the logs in the size specified for readSize to the opposite direction from the offset. Specify query parameters in the format below.

Note that logs are acquired line by line. If the log size reaches the specified size, the line being acquired will be discarded.

?query-parameter=value[&query-parameter=value...] 
Table 9‒49: List of query parameters that can be specified for API Acquisition of task logs

Query parameter

Filter condition

taskID

Equal to the specified value

readSize

Equal to the specified value

offset

Equal to the specified value

reverse

Equal to the specified value

For details about other query parameters that can be specified, see 9.2.9 Query parameter.

Example

The following example specifies 16731 for serviceID and 512 for taskID as query parameters.

?serviceID=16731&taskID=512

Status code

The following table describes the various status codes that can be returned as the response to a request.

Status code

Message

Description

200

Created

Processing has been successfully completed.

400

Bad Request

The argument is invalid.

401

Unauthorized

The user does not have login permission.

404

Not found

The permission is invalid, or the resource does not exist.

412

Precondition failed

The server is not running.

500

Server-side error

A server processing error occurred.

Response schema

The following shows the structure of the response body for a request.

{
  "data" : [ {"member-of-the-resources-for-task-log-functionality(Tasklogs)" : value ... }, ... ],
  "count" : number-of-data-items-that-match-the-conditions-specified-by-query-parameters(0-to-n)
}

Usage example

In the following example, the API acquires a list of logs for the task whose taskID is 2052 (logs read from 0 bytes, up to 5,000,000 bytes).

Request header:

GET /Automation/v1/objects/TaskLogs?taskID=2052&offset=0&readSize=5000000 HTTP/1.1
Host:10.196.184.238:22015
Accept:application/json
Accept-Language: ja
Authorization: Basic c3lzdGVtOm1hbmFnZXI=
User-Agent: useragent1

Response header:

HTTP/1.1 200 OK
Date: Mon, 14 Jul 2014 12:42:47 GMT
Server: Cosminexus HTTP Server
Access-Control-Expose-Headers: WWW-Authenticate
WWW-Authenticate: HSSO a6daa83f23a873c39c7a65069728796ce882153_V0300
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: GET, POST, DELETE, PUT, HEAD, OPTIONS
Access-Control-Allow-Credentials: true
Cache-Control: no-cache
Transfer-Encoding: chunked
Content-Type: application/json

Response body

{
  "data" : [ {
    "instanceID" : 2052,
    "text" : "**** Windows Server 2008 R2 6.1
TZ=America/Los_Angeles
2014/07/14 04:57:31.730\r\n     
yyyy/mm/dd hh:mm:ss.sss                      pid      tid      message-id            message(LANG=ja)\r\n
8947 2014/07/14 04:57:31.746     Automation       27A4F43E 12252248 KNAE08001-I           Started executing plug-in (task name:Execute remote command_20140714045708, task ID:2052, step ID:/remoteHostCommandExe, execution ID:@A102).\r\n
9101 2014/07/14 04:57:31.824     Automation       27A4F43E 12252248 KNAE08129-I           The general command plug-in started (command:a).\r\n
9103 2014/07/14 04:57:31.824     Automation       27A4F43E 12252248 KNAE08070-I           The setting to elevate to root privileges for SSH connections is now enabled.\r\n
9140 2014/07/14 04:57:34.433     Automation       27A4F43E 12252248 KNAE08131-E      ER   The general command plug-in failed (command:a, plug-in return code:77).\r\n
9148 2014/07/14 04:57:34.449     Automation       27A4F43E 12252248 KNAE08002-I           Plug-in execution completed (task name:Execute remote command_20140714045708, task ID:2052, step ID:/remoteHostCommandExe, execution ID:@A102, plug-in return code:77).\r\n
9152 2014/07/14 04:57:34.449     Automation       27A4F43E 12252248 KNAE08004-I           schema_version=1.1\r\n9154 2014/07/14 04:57:34.449     Automation       27A4F43E 12252248 KNAE08004-I           vendor=com.hitachi.software.dna\r\n
9156 2014/07/14 04:57:34.449     Automation       27A4F43E 12252248 KNAE08004-I           name=ExecuteCommandPlugin\r\n9158 2014/07/14 04:57:34.449     Automation       27A4F43E 12252248 KNAE08004-I           version=01.10.00\r\n
9160 2014/07/14 04:57:34.449     Automation       27A4F43E 12252248 KNAE08004-I           plugin_type=javaClass\r\n9162 2014/07/14 04:57:34.449     Automation       27A4F43E 12252248 KNAE08004-I           vendor_display_name=Hitachi, Ltd.\r\n
9164 2014/07/14 04:57:34.449     Automation       27A4F43E 12252248 KNAE08004-I           display_name=General Command Plug-in\r\n
9166 2014/07/14 04:57:34.449     Automation       27A4F43E 12252248 KNAE08004-I           short_description=This plug-in executes a command line on the destination host.\r\n
9168 2014/07/14 04:57:34.449     Automation       27A4F43E 12252248 KNAE08004-I           tags=Basic,Hitachi\r\n9170 2014/07/14 04:57:34.449     Automation       27A4F43E 12252248 KNAE08004-I           enable_SSH_charset_detection=true\r\n
9172 2014/07/14 04:57:34.449     Automation       27A4F43E 12252248 KNAE08004-I           property=com.hitachi.software.dna.sys.mail.bcc, value=\r\n
9174 2014/07/14 04:57:34.449     Automation       27A4F43E 12252248 KNAE08004-I           property=com.hitachi.software.dna.sys.mail.cc, value=\r\n
9177 2014/07/14 04:57:34.449     Automation       27A4F43E 12252248 KNAE08004-I           property=com.hitachi.software.dna.sys.mail.from, value=********\r\n
9179 2014/07/14 04:57:34.449     Automation       27A4F43E 12252248 KNAE08004-I           property=com.hitachi.software.dna.sys.mail.notify, value=false\r\n
9182 2014/07/14 04:57:34.449     Automation       27A4F43E 12252248 KNAE08004-I           property=com.hitachi.software.dna.sys.mail.smtp.password, value=********\r\n
9184 2014/07/14 04:57:34.449     Automation       27A4F43E 12252248 KNAE08004-I           property=com.hitachi.software.dna.sys.mail.smtp.port, value=25\r\n
9186 2014/07/14 04:57:34.449     Automation       27A4F43E 12252248 KNAE08004-I           property=com.hitachi.software.dna.sys.mail.smtp.server, value=\r\n
9188 2014/07/14 04:57:34.449     Automation       27A4F43E 12252248 KNAE08004-I           property=com.hitachi.software.dna.sys.mail.smtp.userid, value=\r\n
9190 2014/07/14 04:57:34.449     Automation       27A4F43E 12252248 KNAE08004-I           property=com.hitachi.software.dna.sys.mail.to, value=\r\n
9192 2014/07/14 04:57:34.449     Automation       27A4F43E 12252248 KNAE08004-I           property=com.hitachi.software.dna.sys.task.log.level, value=10\r\n
9194 2014/07/14 04:57:34.449     Automation       27A4F43E 12252248 KNAE08004-I           property=common.remoteCommand, value=a\r\n
9196 2014/07/14 04:57:34.449     Automation       27A4F43E 12252248 KNAE08004-I           property=common.remoteCommandParameter, value=a\r\n
9198 2014/07/14 04:57:34.449     Automation       27A4F43E 12252248 KNAE08004-I           property=common.stdoutProperty, value=\r\n
9200 2014/07/14 04:57:34.449     Automation       27A4F43E 12252248 KNAE08004-I           property=common.targetHost, value=a\r\n
9202 2014/07/14 04:57:34.449     Automation       27A4F43E 12252248 KNAE08004-I           property=foreach.max_value, value=3\r\n
9204 2014/07/14 04:57:34.449     Automation       27A4F43E 12252248 KNAE08004-I           property=mail.plugin.retry.interval, value=10\r\n
9206 2014/07/14 04:57:34.449     Automation       27A4F43E 12252248 KNAE08004-I           property=mail.plugin.retry.times, value=3\r\n
9208 2014/07/14 04:57:34.449     Automation       27A4F43E 12252248 KNAE08004-I           property=plugin.private.builtin.baseUrl, value=http://WIN-JLTV0PQLK2A:22015/Automation/\r\n
9210 2014/07/14 04:57:34.449     Automation       27A4F43E 12252248 KNAE08004-I           property=reserved.service.category, value=OS_Operations/Basic\r\n
9212 2014/07/14 04:57:34.449     Automation       27A4F43E 12252248 KNAE08004-I           property=reserved.service.name, value=Execute remote command\r\n
9214 2014/07/14 04:57:34.449     Automation       27A4F43E 12252248 KNAE08004-I           property=reserved.service.resourceGroupName, value=Default Service Group\r\n
9216 2014/07/14 04:57:34.449     Automation       27A4F43E 12252248 KNAE08004-I           property=reserved.step.path, value=/remoteHostCommandExe\r\n
9218 2014/07/14 04:57:34.449     Automation       27A4F43E 12252248 KNAE08004-I           property=reserved.step.prevReturnCode, value=0\r\n
9220 2014/07/14 04:57:34.449     Automation       27A4F43E 12252248 KNAE08004-I           property=reserved.task.description, value=\r\n
9222 2014/07/14 04:57:34.449     Automation       27A4F43E 12252248 KNAE08004-I           property=reserved.task.dir, value=C:\\Program Files\\HiCommand\\Automation\\data\\task\\2052\r\n
9224 2014/07/14 04:57:34.449     Automation       27A4F43E 12252248 KNAE08004-I           property=reserved.task.id, value=2052\r\n
9226 2014/07/14 04:57:34.449     Automation       27A4F43E 12252248 KNAE08004-I           property=reserved.task.name, value=Execute remote command_20140714045708\r\n
9228 2014/07/14 04:57:34.449     Automation       27A4F43E 12252248 KNAE08004-I           property=reserved.task.submitter, value=System\r\n
9230 2014/07/14 04:57:34.449     Automation       27A4F43E 12252248 KNAE08004-I           property=reserved.task.url, value=http://WIN-JLTV0PQLK2A:22015/Automation/launcher/TaskDetails?task_id=2052\r\n
9232 2014/07/14 04:57:34.449     Automation       27A4F43E 12252248 KNAE08004-I           property=account, value=\r\n
9234 2014/07/14 04:57:34.449     Automation       27A4F43E 12252248 KNAE08004-I           property=commandLine, value=a\r\n
9236 2014/07/14 04:57:34.449     Automation       27A4F43E 12252248 KNAE08004-I           property=commandLineParameter, value=a\r\n
9238 2014/07/14 04:57:34.449     Automation       27A4F43E 12252248 KNAE08004-I           property=credentialType, value=destination\r\n
9240 2014/07/14 04:57:34.449     Automation       27A4F43E 12252248 KNAE08004-I           property=destinationHost, value=a\r\n
9243 2014/07/14 04:57:34.457     Automation       27A4F43E 12252248 KNAE08004-I           property=password, value=********\r\n
9245 2014/07/14 04:57:34.457     Automation       27A4F43E 12252248 KNAE08004-I           property=stdoutPattern1, value=((?s).*)\r\n
9247 2014/07/14 04:57:34.457     Automation       27A4F43E 12252248 KNAE08004-I           property=stdoutPattern2, value=\r\n
9249 2014/07/14 04:57:34.457     Automation       27A4F43E 12252248 KNAE08004-I           property=stdoutPattern3, value=\r\n
9252 2014/07/14 04:57:34.457     Automation       27A4F43E 12252248 KNAE08004-I           property=suPassword, value=********\r\n
9254 2014/07/14 04:57:34.457     Automation       27A4F43E 12252248 KNAE08009-I           No standard output exists.\r\n
9258 2014/07/14 04:57:34.699     Automation       27A4F43E 12252248 KNAE08014-E      ER   Cannot resolve the specified host name (error details: a  [errno=11004, syscall=getaddrinfo]).
The specified host name could not be resolved. Check your network and DNS configuration, and then re-execute the service.\r\n
9260 2014/07/14 04:57:34.699     Automation       27A4F43E 12252248 KNAE08016-E      ER   An error occurred while executing the plug-in (task name:Execute remote command_20140714045708, task ID:2052, step ID:/remoteHostCommandExe, execution ID:@A102,
plug-in return code:77).\r\n
Possible causes are as follows:\r\n(1) An error occurred during plug-in execution.\r\n(2) An operation to forcibly stop the task was performed.\r\n
(3) An operation to stop this product was performed.\r\n
See the messages that were output to the task log or to the common message log (Server[n].log) before and after the error occurred, and then take the necessary actions. If there is no evidence of an operation to forcibly stop the task or to stop the product, and if no error message was output before or after the error, collect the log information by using the Data Collection Tool, and then contact the system administrator.\r\n
**** Windows Server 2008 R2 6.1                                                    TZ=America/Los_Angeles           2014/07/14 04:58:17.793\r\n
yyyy/mm/dd hh:mm:ss.sss                      pid      tid      message-id            message(LANG=ja)\r\n
9913 2014/07/14 04:58:17.793     Automation       27A4F43E 1A87FBF6 KNAE08904-I           The task was retried from the step after the failed step. (user ID = System)\r\n",
    "totalSize" : 9477,
    "readSize" : 9477,
    "lineCount" : 66,
    "offset" : 0,
    "reverse" : false
  } ],
  "count" : 1
}