Class: CloudwatchQuery::Parsers::Rails::RequestSubParser
- Inherits:
-
Object
- Object
- CloudwatchQuery::Parsers::Rails::RequestSubParser
- Includes:
- SubParser
- Defined in:
- lib/cloudwatch_query/parsers/rails/sub_parsers.rb
Overview
Parses: "Started GET "/path" for 1.2.3.4 at 2026-02-04 18:37:21 +0000"
Constant Summary collapse
- REQUEST_REGEX =
/Started\s+(?<http_method>GET|POST|PUT|PATCH|DELETE|HEAD|OPTIONS)\s+"(?<path>[^"]+)"\s+for\s+(?<ip_address>[\d.]+)\s+at\s+(?<timestamp>.+)$/
Class Method Summary collapse
Methods included from SubParser
Class Method Details
.matches?(message) ⇒ Boolean
29 30 31 32 33 34 |
# File 'lib/cloudwatch_query/parsers/rails/sub_parsers.rb', line 29 def self.matches?() .include?("Started ") && (.include?(" GET ") || .include?(" POST ") || .include?(" PUT ") || .include?(" PATCH ") || .include?(" DELETE ")) end |
.parse(message, _base_data) ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/cloudwatch_query/parsers/rails/sub_parsers.rb', line 36 def self.parse(, _base_data) match = .match(REQUEST_REGEX) return {} unless match { line_type: :request, http_method: match[:http_method], path: match[:path], ip_address: match[:ip_address], request_timestamp: match[:timestamp] } end |