WebAPI Reference Guide > Available API Methods > Server and Cluster Management Methods > The logsReadLines Method

The logsReadLines Method

Read a certain number of log lines from the end of the file log. If serverId is passed, then the request will be performed against that cluster member, otherwise it is performed locally.

Version: 1.3

Required Permissions: Read-Only

HTTP method: GET

Supported by Editions: Zend Server

Request Parameters:  

Parameter

 Type

Required

Description

logName

String

Yes

One of the following values:

codetracing, datacache, deployment, dserver, jobqueue, jqd, monitor, monitor_node, monitor_ui, pagecache, php, sc, scd, statistics, utils, zdd, zem, zsd, php

serverId

Integer

No

If passed, the log contents will be fetched from that cluster member, otherwise performed locally.

linesToRead

Integer

No

How many lines to read. defaults to a certain system-wide configurable setting. Limited by another such setting.

filter

String

No

Apply a certain case-insensitive string filter to the log lines.

Expected Response Code: 200 OK.

Response Format: The response contains some metadata fields, and the log lines content

Possible Action Specific Error Codes:

HTTP Code

Error Code

Description

400

invalidParameter

Could be as of non-recognized logName, non-existent serverId etc.

404

logFileNotReadable

Log file was not found / missing read permissions

500

internalServerError

Operation against remote server failed.

Example

Usage Example

Request (headers removed for the purpose of clarity)

GET /ZendServerManager/Api/logsReadLines?logname=zdd&filter=error

Response (not all headers are shown)

HTTP/1.0 200 OK

<?xml version="1.0" encoding="UTF-8"?>

<zendServerAPIResponse xmlns="http://www.zend.com/server/api/1.3">

<requestData>

<apiKeyName><![CDATA[Admin]]></apiKeyName>

<method>logsReadLines</method>

</requestData>

<responseData>

<logFileMetaData>

<lineNumber>896</lineNumber>

<fileSize>152124</fileSize>

<lastModified>2012-07-30T07:44:27+00:00</lastModified>

</logFileMetaData>

<logFileLines><![CDATA[[19-Jun-2012 06:14:34 UTC] PHP Fatal error: Call to undefined method stdClass::saveXML() in /home/tmak/zs_auto/scraplandia/scrap.php on line 15

[22-Jul-2012 10:05:01 UTC] PHP Fatal error: Uncaught exception &#039;Exception&#039; with message &#039;DateTime::__construct(): Failed to parse time string (1342951501) at position 8 (0): Unexpected character&#039; in /home/tmak/zs_auto/scraplandia/scrap.php:15

]]>

</logFileLines>

</responseData>

</zendServerAPIResponse>

 

 

Related Links

Related Links:

Available API Methods

 

 

 

© 1999-2013 Zend Technologies, Ltd. All rights reserved.