eb logs
Description
The eb logs command has three distinct purposes: to enable or disable log streaming to CloudWatch Logs, to retrieve instance logs or CloudWatch Logs logs,
and to request AI-powered analysis of your environment.
With the --cloudwatch-logs (-cw) option, the command enables or disables log streaming. With the --analyze
(-ai) option, the command requests an AI-powered analysis of your environment's logs, events, and instance health. Without either of these
options, it retrieves logs.
When retrieving logs, specify the --all, --zip, or --stream option to retrieve complete logs. If you don't
specify any of these options, Elastic Beanstalk retrieves tail logs.
The command processes logs for the specified or default environment. Relevant logs vary by container type. If the root directory contains a
platform.yaml file specifying a custom platform, this command also processes logs for the builder environment.
For more information, see Using Elastic Beanstalk with Amazon CloudWatch Logs. For more information about AI-powered analysis, see AI-powered environment analysis.
Syntax
To enable or disable log streaming to CloudWatch Logs:
eb logs --cloudwatch-logs [enable | disable] [--cloudwatch-log-source instance | environment-health | all] [environment-name]
To retrieve instance logs:
eb logs [-all | --zip | --stream] [--cloudwatch-log-source instance] [--instance instance-id] [--log-group log-group] [environment-name]
To retrieve environment health logs:
eb logs [-all | --zip | --stream] --cloudwatch-log-source environment-health [environment-name]
To request AI-powered analysis:
eb logs --analyze [environment-name]
Options
|
Name |
Description |
|---|---|
|
or
|
Enables or disables log streaming to CloudWatch Logs. If no argument is supplied, log streaming is enabled. If the
|
|
or
|
Specifies the source of logs when working with CloudWatch Logs. With the enable or disable form of the command, these are the logs for which to enable or disable CloudWatch Logs streaming. With the retrieval form of the command, these are the logs to retrieve from CloudWatch Logs. Valid values:
Value meanings:
|
|
or
|
Retrieves complete logs and saves them to the |
|
or
|
Retrieves complete logs, compresses them into a |
|
|
Streams (continuously outputs) complete logs. With this option, the command keeps running until you interrupt it (press
|
|
or
|
Retrieves logs for the specified instance only. |
|
or
|
Specifies the CloudWatch Logs log group from which to retrieve logs. The option is valid only when instance log streaming to CloudWatch Logs is enabled. If instance log streaming is enabled, and you don't specify the
For information about the log group corresponding to each log file, see How Elastic Beanstalk sets up CloudWatch Logs. |
|
or
|
Requests an AI-powered analysis of your environment's logs, events, and instance health. The analysis uses Amazon Bedrock to identify root causes and recommend solutions for environment health issues. The command sends the request, waits for the analysis to complete, and then displays the results. This option is not compatible with For prerequisites and required permissions, see AI-powered environment analysis. |
Output
By default, displays the logs directly in the terminal. Uses a paging program to display the output. Press Q or q to exit.
With --stream, shows existing logs in the terminal and keeps running. Press Ctrl+C to exit.
With --all and --zip, saves the logs to local files and displays the file location.
With --analyze, displays the AI-generated analysis directly in the terminal after the analysis completes.
Examples
The following example enables instance log streaming to CloudWatch Logs.
$ eb logs -cw enable
Enabling instance log streaming to CloudWatch for your environment
After the environment is updated you can view your logs by following the link:
https://console.aws.amazon.com/cloudwatch/home?region=us-east-1#logs:prefix=/aws/elasticbeanstalk/environment-name/
Printing Status:
2018-07-11 21:05:20 INFO: Environment update is starting.
2018-07-11 21:05:27 INFO: Updating environment environment-name's configuration settings.
2018-07-11 21:06:45 INFO: Successfully deployed new configuration to environment.
The following example retrieves instance logs into a .zip file.
$ eb logs --zip
Retrieving logs...
Logs were saved to /home/workspace/environment/.elasticbeanstalk/logs/150622_173444.zip
The following example requests an AI-powered analysis of the environment.
$ eb logs --analyze
Analyzing environment...
No critical issues detected. Environment appears healthy.
---
Note: This analysis was generated by AI.