Actions86
- Config Actions
- Container Actions
- Edge Group Actions
- Edge Stack Actions
- Environment Actions
- Image Actions
- Network Actions
- Node Actions
- Registry Actions
- Secret Actions
- Service Actions
- Setting Actions
- Stack Actions
- System Actions
- Team Actions
- Template Actions
- User Actions
- Volume Actions
- Webhook Actions
Container → Get Logs
AI-generatedOverview
This node operation retrieves logs from a specified Docker container managed via Portainer. It allows users to fetch stdout and stderr logs, control the number of log lines returned, and optionally include timestamps. This is useful for monitoring container output, debugging issues, or auditing container activity.
Use Case Examples
- Fetch the last 100 lines of logs from a container to diagnose an error.
- Retrieve all logs including both stdout and stderr with timestamps for auditing purposes.
Properties
| Name | Meaning |
|---|---|
| Environment ID | The ID of the environment/endpoint in Portainer where the container is running. |
| Container ID | The unique identifier of the container from which to retrieve logs. |
| Include Stdout | Whether to include standard output (stdout) logs in the response. |
| Include Stderr | Whether to include standard error (stderr) logs in the response. |
| Tail Lines | Number of lines from the end of the logs to retrieve, or 'all' to get the entire log. |
| Timestamps | Whether to include timestamps in the logs. |
Output
JSON
logs- The logs retrieved from the specified container, including stdout and/or stderr as requested, optionally with timestamps.
Dependencies
- Portainer API with an API key credential for authentication
Troubleshooting
- Ensure the Environment ID and Container ID are correct and the container is running or has logs available.
- If logs are empty, verify that the container has produced output and that the correct stdout/stderr options are set.
- Check API key permissions to ensure access to container logs is allowed.
- Timeout or network issues may occur if the Portainer endpoint is unreachable or slow; adjust timeout settings if needed.
Links
- Portainer API - Get Container Logs - Official Portainer API documentation for retrieving container logs.