sam traces
This page provides reference information for the Amazon Serverless Application Model Command Line Interface (Amazon SAM CLI)
sam traces
command.
For an introduction to the Amazon SAM CLI, see What is the Amazon SAM CLI?.
The sam traces
command fetches Amazon X-Ray traces in your Amazon Web Services account in the Amazon Web Services Region.
Usage
$
sam traces
<options>
Options
--config-env
TEXT
-
The environment name specifying the default parameter values in the configuration file to use. The default value is "default". For more information about configuration files, see Amazon SAM CLI configuration file.
--config-file
PATH
-
The path and file name of the configuration file containing default parameter values to use. The default value is "
samconfig.toml
" in the root of the project directory. For more information about configuration files, see Amazon SAM CLI configuration file. --end-time
TEXT
-
Fetches traces up to this time. The time can be relative values like '5mins ago', 'tomorrow', or a formatted timestamp like '2018-01-01 10:10:10'.
--output
TEXT
-
Specifies the output format for logs. To print formatted logs, specify
text
. To print the logs as JSON, specifyjson
. --save-params
-
Save the parameters that you provide at the command line to the Amazon SAM configuration file.
--start-time
TEXT
-
Fetches traces starting at this time. The time can be relative values like '5mins ago', 'yesterday', or a formatted timestamp like '2018-01-01 10:10:10'. It defaults to '10mins ago'.
--tail
-
Tails the trace output. This ignores the end time argument and continues to display traces as they become available.
--trace-id
TEXT
-
The unique identifier for an X-Ray trace.
Examples
Run the following command to fetch X-Ray traces by ID.
$
sam traces --trace-id
tracing-id-1
--trace-idtracing-id-2
Run the following command to tail X-Ray traces as they become available.
$
sam traces --tail