Actions107
- Node Actions
- Network Actions
- Container Actions
- Container List
- Container Create
- Container Inspect
- Container Top
- Container Logs
- Container Changes
- Container Export
- Container Stats
- Container Resize
- Container Start
- Container Stop
- Container Restart
- Container Kill
- Container Update
- Container Rename
- Container Pause
- Container Unpause
- Container Attach
- Container Attach Websocket
- Container Wait
- Container Delete
- Container Archive Info
- Container Archive
- Put Container Archive
- Container Prune
- Image Actions
- Volume Actions
- Swarm Actions
- Secret Actions
- System Actions
- Exec Actions
- Service Actions
- Task Actions
- Config Actions
- Plugin Actions
- Distribution Actions
- Session Actions
Overview
This node interacts with Docker through the Portainer API, specifically focusing on retrieving logs for a given Docker task. It is useful in scenarios where you need to monitor or debug containerized tasks managed by Portainer. For example, you can fetch the standard output or error logs of a specific task, follow live log updates, or filter logs based on timestamps.
Practical examples:
- Fetching the last 100 lines of logs from a specific Docker task to diagnose an issue.
- Continuously streaming logs (
followoption) to monitor a task's real-time output. - Retrieving detailed logs including context and extra details for deeper debugging.
Properties
| Name | Meaning |
|---|---|
| EndpointID Name or ID | The Portainer endpoint identifier used to access Docker. You can select from a list of available endpoints or specify an ID directly using an expression. |
| Id | The unique identifier of the Docker task whose logs you want to retrieve. |
| Additional Fields | Optional parameters to customize the log retrieval: • Details: Show task context and extra details in logs. • Follow: Keep connection open to stream logs continuously. • Stdout: Return logs from standard output. • Stderr: Return logs from standard error. • Since: Only return logs since this UNIX timestamp. • Timestamps: Add timestamps to each log line. • Tail: Number of log lines to return from the end, or all for all lines. |
Output
The node outputs JSON data containing the logs retrieved from the specified Docker task. The structure typically includes the log lines as strings, optionally enriched with timestamps or additional details depending on the input options.
If the follow option is enabled, the node keeps the connection open and streams new log entries as they become available.
No binary data output is indicated for this operation.
Dependencies
- Requires access to a Portainer instance with its API enabled.
- Needs an API key or token credential configured in n8n to authenticate requests to the Portainer API.
- The node depends on the Portainer API endpoint
/api/endpoints/{endpointId}/dockerto fetch task logs. - The node uses a method to dynamically load available endpoints from Portainer for user convenience.
Troubleshooting
Common issues:
- Invalid or missing
endpointIdoridwill cause the request to fail. - Insufficient permissions or invalid API credentials may result in authentication errors.
- Network connectivity problems to the Portainer server will prevent log retrieval.
- Using incompatible or outdated Portainer API versions might cause unexpected errors.
- Invalid or missing
Error messages and resolutions:
- "Unauthorized" or "Authentication failed": Verify that the API key/token is correct and has sufficient permissions.
- "Endpoint not found": Ensure the
endpointIdcorresponds to a valid Portainer endpoint. - "Task ID not found": Confirm the task ID exists and is correct.
- Timeouts or connection errors: Check network connectivity and Portainer server status.