Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Table of Contents
minLevel1
maxLevel4

Use the CDAP Logging Microservices to download the logs of applications and the system, with the option of formatting and filtering the logs that are downloaded, and setting the log levels of programs at runtime when under Distributed CDAP mode.

...

Code Block
GET /v3/namespaces/<namespace-id>/apps/<app-id>/<program-type>/<program-id>/logs?start=<ts>&stop=<ts>

Parameter

Description

namespace-id

Namespace ID

app-id

Name of the application being called

program-type

One of mapreduceservicessparkworkers, or workflows

program-id

Name of the program being called

ts

Start and stop times, given as seconds since the start of the Epoch.

Example

HTTP Method

GET /v3/namespaces/default/apps/WordCount/spark/WordCountTracker/logs?start=1382576400&stop=1382576700

Description

Return the logs for all the events from the flow WordCountTracker of the WordCount application in the namespace default, beginning Thu, 24 Oct 2013 01:00:00 GMT and ending Thu, 24 Oct 2013 01:05:00 GMT (five minutes later)

Downloading Application Logs for a Run

...

Code Block
GET /v3/namespaces/<namespace-id>/apps/<app-id>/<program-type>/<program-id>/runs/<run-id>/logs?start=<ts>&stop=<ts>

Parameter

Description

namespace-id

Namespace ID

app-id

Name of the application being called

program-type

One of mapreduceservicessparkworkers, or workflows

program-id

Name of the program being called

run-id

Run id of the program run

ts

Start and stop times, given as seconds since the start of the Epoch.

Example

HTTP Method

GET /v3/namespaces/default/apps/WordCount/spark/WordCountTracker/runs/c826e692-ef8c-11e4-953d-d6686e126da6/logs?start=1382576400&stop=1382576700

Description

Return the logs for all the events from the flow WordCountTracker of the WordCount application in the namespace default for run c826e692-ef8c-11e4-953d-d6686e126da6, beginning Thu, 24 Oct 2013 01:00:00 GMT and ending Thu, 24 Oct 2013 01:05:00 GMT (five minutes later)

Downloading System Logs

Logs emitted by a system service running in CDAP can be downloaded with the Logging HTTP API. To do that, send an HTTP GET request:

Code Block
GET /v3/system/services/<service-id>/logs?start=<ts>&stop=<ts>

where:

Parameter

Description

service-id

One of appfabricdataset.executorexplore.servicemetricsmetrics.processortransaction

ts

Start and stop times, given as seconds since the start of the Epoch.

Note that the start and stop times are not optional.

Example

HTTP Method

GET /v3/system/services/appfabric/logs?start=1428541200&stop=1428541500

Description

Return the logs for the AppFabric service beginning Thu, 09 Apr 2015 01:00:00 GMT and ending Thu, 09 Apr 2015 01:05:00 GMT (five minutes later)

Formatting and Filtering

Formatting

...

Code Block
'{ "io.cdap.cdap":"ERROR", "ROOT":"TRACE" }'

Parameter

Description

service-id

One of appfabricdataset.executorexplore.servicelog.savermessaging.servicemetricsmetrics.processortransaction

Note that changing the log levels of the appfabric service will also change the log levels of the dataset.service as they run on the same node.

...

If the body is not provided or is empty, it will reset the log levels of all logger names.

Parameter

Description

service-id

One of appfabricdataset.executorexplore.servicelog.savermessaging.service,``metrics``, metrics.processortransaction

Note that resetting the log levels of the appfabric service will also rest the log levels of the dataset.service as they run on the same node.

...

Code Block
'{ "io.cdap.cdap":"ERROR", "ROOT":"TRACE" }'

Parameter

Description

namespace-id

Namespace ID

app-id

Name of the application

version-id

Version of the application

program-type

One of services or workers

program-id

Name of the program

run-id

UUID of the program run

For example:

Code Block
PUT /v3/namespaces/default/apps/SportResults/services/UploadService/run-id/cdec1791-c2c0-11e6-ac6b-42010a800022/loglevels \ -d '{ "io.cdap.cdap":"ERROR", "ROOT":"TRACE" }'

...

Code Block
PUT /v3/namespaces/<namespace-id>/apps/<app-id>/versions/<app-version>/<program-type>/<program-id>/runs/<run-id>/loglevels

Path Parameters

Parameter

Description

namespace-id

Namespace ID

app-id

Name of the application

app-version

Version of the application

program-type

One of services or workers

program-id

Name of the program

run-id

UUID of the program run

JSON Parameters

Parameter

Description

loggername

Name of the logger.

loglevels

Log level (FATAL, ERROR, WARN, INFO, DEBUG, TRACE)

For example, if you pass the JSON input:
{
“appLogger”: “DEBUG”
}
”appLogger” is the loggername, and “DEBUG” is the log level.

Resetting Program Log Levels

...

If the body is not provided or is empty, it will reset the log levels of all logger names.

Parameter

Description

namespace-id

Namespace ID

app-id

Name of the application

version-id

Version of the application

program-type

One of services or workers

program-id

Name of the program

run-id

UUID of the program run

For example:

Code Block
POST /v3/namespaces/default/apps/SportResults/services/UploadService/run-id/cdec1791-c2c0-11e6-ac6b-42010a800022/resetloglevels \ -d '[ "io.cdap.cdap", "ROOT" ]'

...

Code Block
POST /v3/namespaces/<namespace-id>/apps/<app-id>/versions/<app-version>/<program-type>/<program-id>/runs/<run-id>/resetloglevels

Path Parameters

Parameter

Description

namespace-id

Namespace ID

app-id

Name of the application

app-version

Version of the application

program-type

One of services or workers

program-id

Name of the program

run-id

UUID of the program run

JSON Parameters

Parameter

Description

loggername

Name of the logger.

loglevel

Log level (FATAL, ERROR, WARN, INFO, DEBUG, TRACE)

For example, if you pass the JSON input:
{
“appLogger”: “DEBUG”
}
”appLogger” is the loggername, and “DEBUG” is the log level.