Table of Contents | ||||
---|---|---|---|---|
|
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 |
| Name of the application being called |
| One of |
| Name of the program being called |
| Start and stop times, given as seconds since the start of the Epoch. |
Example
HTTP Method |
|
---|---|
Description | Return the logs for all the events from the flow WordCountTracker of the WordCount application in the namespace default, beginning |
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 |
| Name of the application being called |
| One of |
| Name of the program being called |
| Run id of the program run |
| Start and stop times, given as seconds since the start of the Epoch. |
Example
HTTP Method |
|
---|---|
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 |
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 |
---|---|
| One of |
| 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 |
|
---|---|
Description | Return the logs for the AppFabric service beginning |
Formatting and Filtering
Formatting
...
Code Block |
---|
'{ "io.cdap.cdap":"ERROR", "ROOT":"TRACE" }' |
Parameter | Description |
---|---|
| One of |
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 |
---|---|
| One of |
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 |
| Name of the application |
| Version of the application |
| One of |
| Name of the program |
| 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 |
| Name of the application |
| Version of the application |
| One of |
| Name of the program |
| UUID of the program run |
JSON Parameters
Parameter | Description |
---|---|
| Name of the logger. |
| Log level ( For example, if you pass the JSON input: |
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 |
| Name of the application |
| Version of the application |
| One of |
| Name of the program |
| 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 |
| Name of the application |
| Version of the application |
| One of |
| Name of the program |
| UUID of the program run |
JSON Parameters
Parameter | Description |
---|---|
| Name of the logger. |
loglevel | Log level ( For example, if you pass the JSON input: |