|
171 | 171 | end |
172 | 172 | end |
173 | 173 | end |
| 174 | + |
| 175 | +describe "ALB_ACCESS_LOG" do |
| 176 | + |
| 177 | + let(:pattern) { "ALB_ACCESS_LOG" } |
| 178 | + |
| 179 | + context "parsing a ALB (Application Load Balancer) access log" do |
| 180 | + |
| 181 | + let(:value) { "https 2020-04-09T23:51:41.309191Z app/OJProdLoadBalancer/278a3c7472bb5054 63.143.42.244:23863 172.31.2.30:5001 0.002 0.217 0.000 200 200 448 348 \"HEAD https://abc.com:443/packages HTTP/1.1\" \"Mozilla/5.0+(compatible; UptimeRobot/2.0; http://www.uptimerobot.com/)\" ECDHE-RSA-AES128-GCM-SHA256 TLSv1.2 arn:aws:elasticloadbalancing:ap-south-1:855430014109:targetgroup/ABC-FrontEnd/8c8983a24851ee4a \"Root=1-5e8fb50d-df9a95404831631626fb545e\" \"abc.com\" \"arn:aws:acm:ap-south-1:855430014109:certificate/e3fb2074-0c09-4be9-a32c-5c985e540144\" 0 2020-04-09T23:51:41.090000Z \"forward\" \"-\" \"-\" \"172.31.2.30:5001\" \"200\"" } |
| 182 | + |
| 183 | + subject { grok_match(pattern, value) } |
| 184 | + |
| 185 | + it { should include("request_type" => "https" ) } |
| 186 | + it { should include("timestamp" => "2020-04-09T23:51:41.309191Z" ) } |
| 187 | + it { should include("alb_resource_id" => "app/OJProdLoadBalancer/278a3c7472bb5054" ) } |
| 188 | + it { should include("clientip" => "63.143.42.244" ) } |
| 189 | + it { should include("target_ip" => "172.31.2.30" ) } |
| 190 | + it { should include("verb" => "HEAD" ) } |
| 191 | + it { should include("request" => "https://abc.com:443/packages/maldives" ) } |
| 192 | + it { should include("httpversion" => 1.1 ) } |
| 193 | + it { should include("userAgent" => "Mozilla/5.0+(compatible; UptimeRobot/2.0; http://www.uptimerobot.com/" ) } |
| 194 | + it { should include("agent" => "Mozilla/5.0%2520(Windows%2520NT%25206.1;%2520WOW64)%2520AppleWebKit/537.36%2520(KHTML,%2520like%2520Gecko)%2520Chrome/51.0.2704.79%2520Safari/537.36" ) } |
| 195 | + it { should include("ssl_cipher" => "ECDHE-RSA-AES128-GCM-SHA256" ) } |
| 196 | + it { should include("ssl_protocol" => "TLSv1.2" ) } |
| 197 | + it { should include("target_group_arn" => "arn:aws:elasticloadbalancing:ap-south-1:855430014109:targetgroup/ABC-FrontEnd/8c8983a24851ee4a") } |
| 198 | + it { should include("trace_id" => "Root=1-5e8fb50d-df9a95404831631626fb545e" ) } |
| 199 | + it { should include("domain_name" => "abc.com" ) } |
| 200 | + it { should include("chosen_cert_arn" => "arn:aws:acm:ap-south-1:855430014109:certificate/e3fb2074-0c09-4be9-a32c-5c985e540144" ) } |
| 201 | + it { should include("request_creation_time" => "2020-04-09T23:51:41.090000Z" ) } |
| 202 | + it { should include("actions_executed" => "forward" ) } |
| 203 | + it { should include("error_reason" => "-" ) } |
| 204 | + it { should include("target_port_list" => "172.31.2.30:5001" ) } |
| 205 | + it { should include("target_status_code_list" => "200" ) } |
| 206 | + |
| 207 | + ["tags", "params"].each do |attribute| |
| 208 | + it "have #{attribute} as nil" do |
| 209 | + expect(subject[attribute]).to be_nil |
| 210 | + end |
| 211 | + end |
| 212 | + end |
| 213 | + end |
0 commit comments