cloudwatch_logs_url_builder
Generate AWS Console URL for Amazon CloudWatch Insights.
Installation
gem 'cloudwatch_logs_insights_url_builder'
Usage
require 'cloudwatch_logs_insights_url_builder'
builder = CloudWatchLogsInsightsUrlBuilder.new
builder.time_type = 'ABSOLUTE'
builder.start_time = Time.utc(2023, 1, 27, 0, 0, 0)
builder.end_time = Time.utc(2023, 1, 27, 23, 59, 59)
builder.timezone = 'UTC'
builder.log_groups = ['/aws/cloudtrail']
# https://us-east-1.console.aws.amazon.com/cloudwatch/home?...
builder.log_insights_url("fields @timestamp, @message, @logStream, @log\n| sort @timestamp desc\n| limit 20")
The generated URL can be used to open the CloudWatch Insights page from a browser.