class RequestLogAnalyzer::FileFormat::Rails3::Request

Constants

MONTHS

Used to handle conversion of abbrev. month name to a digit

Public Instance Methods

convert_timestamp(value, _definition) click to toggle source
    # File lib/request_log_analyzer/file_format/rails3.rb
112 def convert_timestamp(value, _definition)
113   # the time value can be in 2 formats:
114   # - 2010-10-26 02:27:15 +0000 (ruby 1.9.2)
115   # - Thu Oct 25 16:15:18 -0800 2010
116   if value =~ /^#{CommonRegularExpressions::TIMESTAMP_PARTS['Y']}/
117     value.gsub!(/\W/, '')
118     value[0..13].to_i
119   else
120     value.gsub!(/\W/, '')
121     time_as_str = value[-4..-1] # year
122     # convert the month to a 2-digit representation
123     month = MONTHS.index(value[3..5]) + 1
124     month < 10 ? time_as_str << "0#{month}" : time_as_str << month.to_s
125 
126     time_as_str << value[6..13] # day of month + time
127     time_as_str.to_i
128   end
129 end
sanitize_parameters(parameter_string) click to toggle source
    # File lib/request_log_analyzer/file_format/rails3.rb
132 def sanitize_parameters(parameter_string)
133   parameter_string.force_encoding("UTF-8")
134     .gsub(/#</, '"')
135     .gsub(/>, \"/, '", "')
136     .gsub(/>>}/, '\""}') # #< ... >>}
137     .gsub(/>>, \"/, '\"", "') # #< ... >>, "
138     .gsub(/", @/, '\", @') # #< ... @content_type="image/jpeg", @ ... >>
139     .gsub(/="/, '=\"') # #< ... filename="IMG_2228.JPG" Content-Type: image/jpeg", ... >>
140     .gsub(/=\\", "/, '=", "') # redo "...hSMjag0w=\\",
141     .gsub(/=\\"}/, '="}') # redo "...hSMjag0w=\\"}
142     .gsub(/\\0/, '')
143 end