class RequestLogAnalyzer::FileFormat::Haproxy::Request
Define a custom Request
class for the HAProxy file format to speed up timestamp handling. Shamelessly copied from apache.rb
Constants
- MONTHS
Public Instance Methods
convert_nillable_duration(value, definition)
click to toggle source
Make sure that -1 is parsed as a nil value.
# File lib/request_log_analyzer/file_format/haproxy.rb 223 def convert_nillable_duration(value, definition) 224 value == '-1' ? nil : convert_duration(value, definition) 225 end
convert_nillable_string(value, _definition)
click to toggle source
Make sure that the strings ‘-’ or ‘{}’ or ” are parsed as a nil value.
# File lib/request_log_analyzer/file_format/haproxy.rb 218 def convert_nillable_string(value, _definition) 219 value =~ /-|\{\}|^$/ ? nil : value 220 end
convert_timestamp(value, _definition)
click to toggle source
Do not use DateTime.parse, but parse the timestamp ourselves to return a integer to speed up parsing.
# File lib/request_log_analyzer/file_format/haproxy.rb 213 def convert_timestamp(value, _definition) 214 "#{value[7, 4]}#{MONTHS[value[3, 3]]}#{value[0, 2]}#{value[12, 2]}#{value[15, 2]}#{value[18, 2]}".to_i 215 end