Skip to content

Lambda Error links not included when LogInsight logs exported to a file

0

I have below LogInsights query for multiple log group. Results have link to the error logs but when I exported the results to table (or json, csv). Links are not available anymore. How can I keep the logs in the exported file?

| filter level = 'ERROR'
| display @timestamp, @message, @logStream, @log 
| sort @timestamp desc
| limit 500
1 Answer
0

When exporting CloudWatch Log Insights query results to a file (such as CSV, JSON, or table format), the clickable links to specific log streams are not preserved. This is because the exported file is a static representation of the data and doesn't maintain the interactive features available in the CloudWatch console.

However, you can still include the necessary information in your exported file to manually reconstruct the links or locate the specific log entries. Your current query is already including the essential fields:

  1. @timestamp: Provides the exact time of the log entry
  2. @message: Contains the actual log message
  3. @logStream: Identifies the specific log stream
  4. @log: Indicates which log group the entry belongs to (important when querying multiple log groups)

By including these fields in your export, you'll have all the information needed to locate the specific log entries in the CloudWatch console manually. While it's not as convenient as having clickable links, it allows you to pinpoint the exact location of each error log.

If you need to programmatically access these logs later, you can use the AWS CLI or SDKs to retrieve the specific log events using the log group, log stream, and timestamp information from your exported file.

Remember that the ability to generate clickable links in the CloudWatch console is a feature of the web interface and is not something that can be directly replicated in a static exported file. The export functionality is designed to provide the raw data, which you can then use for further analysis or processing as needed.

Sources
CloudWatch Log Insights results @LogStream not always clickable. | AWS re:Post
Searching in a log group no longer shows hyperlink to go to log stream | AWS re:Post

answered a year ago

AWS
SUPPORT ENGINEER

reviewed a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.