View flatten.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def flatten(arr, flat=[]) | |
arr.each_with_object(flat) do |item, result| | |
if item.is_a?(Array) | |
flatten(item, flat) | |
else | |
result << item | |
end | |
end | |
end |
View cloud_front.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CloudFront < RequestLogAnalyzer::FileFormat::Base | |
extend RequestLogAnalyzer::FileFormat::CommonRegularExpressions | |
line_definition :access do |line| | |
line.header = true | |
line.footer = true | |
line.regexp = /^(#{timestamp('%Y-%m-%d %H:%M:%S')})\s(\w+)\s(\d+)\s(#{ip_address})\s(\w+)\s(\S+)\s(\S+)\s(\d+)\s(\S+)\s(\S+)\s(\S+)\s(\S+)\s(\w+)\s(\S+)\s(\S+)\s(\w+)\s(\d+)\s(\S+)\s(#{ip_address}|-)\s+(\S+)\s(\S+)\s(\w+)\s(\S+)/ | |
line.capture(:timestamp).as(:timestamp) |
View Gemfile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source 'https://rubygems.org' | |
gem 'nokogiri' | |
gem 'aws-sdk' | |
gem 'fake_sqs' | |
gem 'newrelic_rpm' |
View Gemfile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source 'https://rubygems.org' | |
#gem 'nokogiri' | |
gem 'aws-sdk', '~> 2' |