Tail/head an LSF log file (GET)

Description

URL

scheme://domain:port/platform/ws/lsflogs/{logfilename}?head =%d

scheme://domain:port/platform/ws/lsflogs/{logfilename}?head=%d &days=%d

scheme://domain:port/platform/ws/ lsflogs/{logfilename}?tail =%d

scheme://domain:port/platform/ws/lsflogs/{logfilename}?tail=%d &days=%d

Description

Head and tail can only be used when LSF log files are located on a shared filesystem accessible to all hosts in the cluster with one network path, and the Platform Web Services host has access to these files.

When head is used, by default, gets the first 30 lines of the specified log file for the past day.

When tail is used, by default, gets the last 30 lines of the specified log file for the past day.

HTTP Method

GET

Parameters

Name Description
 

tail=%d

Required to tail a log file.

Returns the last specified number of lines for the log file.

Specify a number from 30 to 200.

 

head=%d

Required to head a log file.

Returns the first specified number of lines for the log file.

Specify a number from 30 to 200.

 

days=%d

Optional.

Number of days for which to head or tail a file, counted from the current date and time.

Returns only the lines in the log file that fall within the specified time period.

The default value is 1 day. Specify a number from 1 to 14.

Request

Request-Method

GET

Request-URI


/platform/ws/lsflogs/{logfilename}?head=%d
/platform/ws/lsflogs/{logfilename}?head=%d&days=%d
/platform/ws/lsflogs/{logfilename}?tail=%d
/platform/ws/lsflogs/{logfilename}?tail=%d&days=%d

Request-Header

Name Value

Accept

application/xml or application/json

Message-body

empty

Response

Response-Code

  • 200 Successful: Successfully retrieved the LSF log records.
  • 403 Forbidden: Access restricted by role-based access control permissions.
  • 404 Not Found: The specified LSF log file was not found.
    If the Platform Web Services host cannot access the log files, the error "404: Not Found" is returned.
    Tip: If using this API for a graphical user interface, disable the head/tail action on the web page after receiving 404: Not Found.
  • 400 Bad request: Client specified parameters are not valid.
  • 500 Internal Server Error: Exception occurred

Response-Header

Name Value

Content-Type

application/xml or application/json

Message-body

Success Message

If successful, returns lines from the LSF log.

For additional information, refer to the schema files ./schemas/lsflog/lsflog.xsd and ./schemas/lsflog/lsflogrecords.xsd.


<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<lsflog>
    <logFileName>%s</logFileName>
    <dateModified>%s</dateModified>
    <fileSize>%s</fileSize>
    <lsfLogRecords total="%s" 
        xmlns:atom="http://www.w3.org/2005/Atom">
        <atom:link href="self" rel="%s?tail=%s&days=%s"/>
        <logRecordContent 
            xmlns:xsi="http://www.w3.org/2001/
XMLSchema-instance" 
            xmlns:xs="http://www.w3.org/2001/XMLSchema"
 xsi:type="xs:string">%s
        </logRecordContent>
        <logRecordContent 
            xmlns:xsi="http://www.w3.org/2001/
XMLSchema-instance" 
            xmlns:xs="http://www.w3.org/2001/XMLSchema" 
xsi:type="xs:string">%s
        </logRecordContent>
         ...   
    </lsfLogRecords>
</lsflog>
Failure Message

If not successful, returns an error message.

For additional information, refer to the schema file ./schemas/error/error.xsd.

<error>
  <message>
     %s
  </message>
</error>

Related APIs

  • Get a list of log files for a host/platform/ws/lsflogs?hostname=%s