Skip to main content

Logging

Every node keeps logs: its application log, and a log for each pipeline run, network and network instance. Use this service to follow a log live or to download a complete log file, from any node.

Open log stream​

Stream the log messages of one log on a node. The requested number of past entries is sent first, then new entries as they are written. Fails with an invalid argument error when the node is invalid or no log is chosen, and ends with an error when the log cannot be read or the node loses its connection.

The body names the log to stream, for example {"appLogStreamRequest": {}} or {"pipelineRunLogStreamRequest": {"pipelineRunId": "..."}}.

POST/v1/streams/nodes/{node_id}/logs

Server-sent events. A : ready comment is sent when the stream is ready, then each message is a data: line holding the response below. A failure after that is an error event.

Path parameters
  • node_idstring

    ID of the node whose log to stream.

Request body
  • optionsOptions

    Stream options. When unset, only new entries are sent.

  • appLogStreamRequestOpenAppLogStreamRequestone of request

    Stream the node's application log.

  • pipelineRunLogStreamRequestOpenPipelineRunLogStreamRequestone of request

    Stream the log of a pipeline run.

  • networkLogStreamRequestOpenNetworkLogStreamRequestone of request

    Stream the log of a network.

  • networkInstanceLogStreamRequestOpenNetworkInstanceLogStreamRequestone of request

    Stream the log of a network instance.

Example
import { NanopingClient } from "@nanoping/api";

const client = new NanopingClient({ baseUrl: "http://127.0.0.1:10565" });

for await (const response of client.logging.openLogStream({
nodeId: "3f2b1c9e-8d4a-4f6b-9c2e-1a7d5e8b0c4f",
options: {
lines: "0"
},
appLogStreamRequest: {}
})) {
}
Response messages
  • messagesMessage[]

    The log entries.

Download log file​

Download one complete log file from a node as a series of chunks. Join the chunks in order to get the file. The stream ends when the whole file has been sent, or after an error chunk when the file could not be read.

The log file is returned as plain text. The query string names the log, for example pipelineRunLogFileRequest.pipelineRunId=..., and the app log is returned when it names none.

GET/v1/nodes/{node_id}/log-file

Returns the file as the response body.

Path parameters
  • node_idstring

    ID of the node that holds the log file.

Query parameters
  • app_log_file_requestDownloadAppLogFileRequestone of request

    Download the node's application log.

  • pipeline_run_log_file_requestDownloadPipelineRunLogFileRequestone of request

    Download the log of a pipeline run.

  • network_log_file_requestDownloadNetworkLogFileRequestone of request

    Download the log of a network.

  • network_instance_log_file_requestDownloadNetworkInstanceLogFileRequestone of request

    Download the log of a network instance.

Example
import { NanopingClient } from "@nanoping/api";

const client = new NanopingClient({ baseUrl: "http://127.0.0.1:10565" });

const logFile = await client.logging.downloadLogFile({
nodeId: "3f2b1c9e-8d4a-4f6b-9c2e-1a7d5e8b0c4f",
appLogFileRequest: {}
});