Portainer icon

Portainer

Work with Portainer API data to manage Docker

Service → Get Logs

AI-generated

Overview

This node operation retrieves logs for a specified Docker Swarm service within a given environment in Portainer. It is useful for monitoring and debugging services by accessing their stdout and stderr logs, optionally including timestamps and limiting the number of log lines returned.

Use Case Examples

  1. A DevOps engineer wants to check the recent logs of a Docker Swarm service to diagnose an issue.
  2. A system administrator needs to monitor the output logs of a service to ensure it is running correctly.

Properties

Name Meaning
Environment ID The ID of the environment/endpoint in Portainer where the service is running.
Service ID The ID of the Docker Swarm service whose logs are to be retrieved.
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 retrieve all lines.
Timestamps Whether to include timestamps in the logs.

Output

JSON

  • logs - The logs retrieved from the Docker Swarm service, including stdout and/or stderr as specified, optionally with timestamps and limited by tail lines.

Dependencies

  • Requires Portainer API access with an API key credential.

Troubleshooting

  • Ensure the Environment ID and Service ID are correct and correspond to existing resources in Portainer.
  • If logs are empty, verify that the service is running and producing output.
  • Check API key permissions to ensure access to service logs is allowed.
  • Timeouts may occur if the log size is very large; consider using the 'Tail Lines' property to limit the output.

Links

Discussion