cloudwatch_logs_url_builder

rspec License: MIT

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 = - (24 * 3600)
builder.end_time = 0
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 2")

The generated URL can be used to open the CloudWatch Insights page from a browser.

Screen Shot 2023-01-28 at 12 45 11