You are viewing the Apigee Management API reference documentation. For the main product docs, and to search all docs, go to https://docs.apigee.com. For cross-site search, click Search all in the search results.

Get Cached Logs

Resource Summary

Security

Content Type

application/json, text/xml

Category

Cached Logs,

getCachedLogsforNodejs

GET

Get Cached Logs

Retrieve the most recent log records for the specified API.

Supported categories include:

organizations/docs/environments/test/apis/hello-world-nodejs/cachedlogs/categories/nodejs

or

organizations/docs/environments/test/apis/hello-world-nodejs/cachedlogs/categories/hostedtarget-runtime

or

organizations/docs/environments/test/apis/hello-world-nodejs/cachedlogs/categories/hostedtarget-build

The exact number of log records retrieved may change depending on system configuration, but it will typically be 500 for each message processor or 1000 in most configurations. Hosted Targets logs are retained for 7 days or 50 Gb per month, whichever comes first. 

The response format is as follows: [TIMESTAMP CATEGORY SERVER] Record...

  • TIMESTAMP is the time at which the log record was generated.
  • CATEGORY denotes the log category (nodejs, hostedtarget-build, or hostedtarget-runtime) and whether it went to stdout or stderr.
  • SERVER:
    • For Node.js logs: Uniquely identifies the server within Apigee Edge where the log was generated. For example: [2014-10-09T00:58:17.619Z nodejs/stdout svr.701] Hello, World! 
    • For Hosted Targets, SERVER  is always reported as svr.0

Example Hosted Targets runtime log output

[2018-01-19T18:09:06.733Z hostedtarget-runtime/stdout svr.0] Node HTTP server is listening 
[2018-01-19T18:09:18.118Z hostedtarget-runtime/stdout svr.0] GET / 
[2018-01-19T18:09:21.286Z hostedtarget-runtime/stdout svr.0] The time is  2018-01-19T18:06:18.182Z

Example Hosted Targets build log output

[2018-01-19T18:03:53.000Z hostedtarget-build/stdout svr.0] BUILD
[2018-01-19T18:03:53.000Z hostedtarget-build/stdout svr.0] Starting Step #0
[2018-01-19T18:03:53.000Z hostedtarget-build/stdout svr.0] Step #0: Pulling image: gcr.io/turbo-validators/nodevalidation:0.0.1
[2018-01-19T18:03:53.000Z hostedtarget-build/stdout svr.0] Step #0: 0.0.1: Pulling from turbo-validators/nodevalidation

Resource URL

https://api.enterprise.apigee.com/v1 /o/{org_name}/e/{env_name}/apis/{api_name}/cachedlogs/categories/{category_name}

Query Parameters

Name Values Description
tz

Enter a standard time zone abbreviation to express the TIMESTAMP value in that time zone.

For example, enter "EST" or "PST". By default, the timestamp value is expressed in UTC/GMT time.

getState

Set to true to have the last line of the log output use the following format: [state XXXX,] where "XXXX" is an opaque value that represents the current position in the log.

For example: [state 4-Li2Msq8PDg8sn9mlxcHEfYBBafBbEB].

state

If this query parameter is set to the "state" of a previous log request with "getState=true" in it, then this API call will return only log records that were created since that point.

Note that each API call to cachedlogs/categories/nodejs may return a different state value.

A script that wishes to "tail -f" the logs must add "getState=true" to each API call and then pass the new state every time.

For example: .../cachedlogs/categories/nodejs?getState=true&state=4-Li2Msq8PDg8sn9mlxcHEfYBBafBbEB.

Request Body

org_name Mention the organization name true

env_name Mention the environment name true

api_name Mention the API name true

category_name Mention the category name true

HTTP Basic

OAuth 2.0

API Key

Reset

Make a request and see the response.

Make a request and see the response.

Make a request and see the response.

Working...

Help or comments?

  • If something's not working: Ask the Apigee Community or see Apigee Support.
  • If something's wrong with the docs: Click the "Send Feedback" button.
    (Incorrect? Unclear? Broken link? Typo?)