Class: Ralf::ClfTranslator
- Inherits:
-
Object
- Object
- Ralf::ClfTranslator
- Defined in:
- lib/ralf/clf_translator.rb
Constant Summary collapse
- AMAZON_LOG_FORMAT =
Regexp.new('([^ ]*) ([^ ]*) \[([^\]]*)\] ([^ ]*) ([^ ]*) ([^ ]*) ([^ ]*) ([^ ]*) "([^"]*)" ([^ ]*) ([^ ]*) ([^ ]*) ([^ ]*) ([^ ]*) ([^ ]*) "([^"]*)" "([^"]*)"')
- AMAZON_LOG_COPY_FORMAT =
Regexp.new('([^ ]*) ([^ ]*) \[([^\]]*)\] ([^ ]*) ([^ ]*) ([^ ]*) (REST.COPY.OBJECT_GET) ([^ ]*) (-) ([^ ]*) (-) (-) ([^ ]*) (-) (-) (-) (-) (-)')
Instance Attribute Summary collapse
-
#bucket ⇒ Object
readonly
Returns the value of attribute bucket.
-
#bytes_sent ⇒ Object
readonly
Returns the value of attribute bytes_sent.
-
#duration ⇒ Object
readonly
Returns the value of attribute duration.
-
#http_status ⇒ Object
readonly
Returns the value of attribute http_status.
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#line ⇒ Object
readonly
Returns the value of attribute line.
-
#object_size ⇒ Object
readonly
Returns the value of attribute object_size.
-
#operation ⇒ Object
readonly
Returns the value of attribute operation.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#owner ⇒ Object
readonly
Returns the value of attribute owner.
-
#referrer ⇒ Object
readonly
Returns the value of attribute referrer.
-
#remote_ip ⇒ Object
readonly
Returns the value of attribute remote_ip.
-
#request_id ⇒ Object
readonly
Returns the value of attribute request_id.
-
#request_uri ⇒ Object
readonly
Returns the value of attribute request_uri.
-
#request_version_id ⇒ Object
readonly
Returns the value of attribute request_version_id.
-
#s3_error_code ⇒ Object
readonly
Returns the value of attribute s3_error_code.
-
#timestamp ⇒ Object
readonly
Returns the value of attribute timestamp.
-
#total_time_in_ms ⇒ Object
readonly
Returns the value of attribute total_time_in_ms.
-
#turn_around_time_in_ms ⇒ Object
readonly
Returns the value of attribute turn_around_time_in_ms.
-
#user_agent ⇒ Object
readonly
Returns the value of attribute user_agent.
Instance Method Summary collapse
-
#initialize(line, options = {}) ⇒ ClfTranslator
constructor
options: :recalculate_partial_content => false (default) If request is ‘206 Partial Content’ estimate the actual bytes when apparent bandwidth has exceeded 2Mbit/sec.
- #to_s ⇒ Object
Constructor Details
#initialize(line, options = {}) ⇒ ClfTranslator
options:
:recalculate_partial_content => false (default)
If request is '206 Partial Content' estimate the actual bytes when apparent bandwidth has exceeded 2Mbit/sec.
S3 caches content to edge servers with a burst which never reaches the client
15 16 17 18 19 20 |
# File 'lib/ralf/clf_translator.rb', line 15 def initialize(line, = {}) @options = @error = false @line = line @translate_successfull = translate end |
Instance Attribute Details
#bucket ⇒ Object (readonly)
Returns the value of attribute bucket.
7 8 9 |
# File 'lib/ralf/clf_translator.rb', line 7 def bucket @bucket end |
#bytes_sent ⇒ Object (readonly)
Returns the value of attribute bytes_sent.
7 8 9 |
# File 'lib/ralf/clf_translator.rb', line 7 def bytes_sent @bytes_sent end |
#duration ⇒ Object (readonly)
Returns the value of attribute duration.
7 8 9 |
# File 'lib/ralf/clf_translator.rb', line 7 def duration @duration end |
#http_status ⇒ Object (readonly)
Returns the value of attribute http_status.
7 8 9 |
# File 'lib/ralf/clf_translator.rb', line 7 def http_status @http_status end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
7 8 9 |
# File 'lib/ralf/clf_translator.rb', line 7 def key @key end |
#line ⇒ Object (readonly)
Returns the value of attribute line.
6 7 8 |
# File 'lib/ralf/clf_translator.rb', line 6 def line @line end |
#object_size ⇒ Object (readonly)
Returns the value of attribute object_size.
7 8 9 |
# File 'lib/ralf/clf_translator.rb', line 7 def object_size @object_size end |
#operation ⇒ Object (readonly)
Returns the value of attribute operation.
7 8 9 |
# File 'lib/ralf/clf_translator.rb', line 7 def operation @operation end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
8 9 10 |
# File 'lib/ralf/clf_translator.rb', line 8 def @options end |
#owner ⇒ Object (readonly)
Returns the value of attribute owner.
7 8 9 |
# File 'lib/ralf/clf_translator.rb', line 7 def owner @owner end |
#referrer ⇒ Object (readonly)
Returns the value of attribute referrer.
7 8 9 |
# File 'lib/ralf/clf_translator.rb', line 7 def referrer @referrer end |
#remote_ip ⇒ Object (readonly)
Returns the value of attribute remote_ip.
7 8 9 |
# File 'lib/ralf/clf_translator.rb', line 7 def remote_ip @remote_ip end |
#request_id ⇒ Object (readonly)
Returns the value of attribute request_id.
7 8 9 |
# File 'lib/ralf/clf_translator.rb', line 7 def request_id @request_id end |
#request_uri ⇒ Object (readonly)
Returns the value of attribute request_uri.
7 8 9 |
# File 'lib/ralf/clf_translator.rb', line 7 def request_uri @request_uri end |
#request_version_id ⇒ Object (readonly)
Returns the value of attribute request_version_id.
7 8 9 |
# File 'lib/ralf/clf_translator.rb', line 7 def request_version_id @request_version_id end |
#s3_error_code ⇒ Object (readonly)
Returns the value of attribute s3_error_code.
7 8 9 |
# File 'lib/ralf/clf_translator.rb', line 7 def s3_error_code @s3_error_code end |
#timestamp ⇒ Object (readonly)
Returns the value of attribute timestamp.
7 8 9 |
# File 'lib/ralf/clf_translator.rb', line 7 def @timestamp end |
#total_time_in_ms ⇒ Object (readonly)
Returns the value of attribute total_time_in_ms.
7 8 9 |
# File 'lib/ralf/clf_translator.rb', line 7 def total_time_in_ms @total_time_in_ms end |
#turn_around_time_in_ms ⇒ Object (readonly)
Returns the value of attribute turn_around_time_in_ms.
7 8 9 |
# File 'lib/ralf/clf_translator.rb', line 7 def turn_around_time_in_ms @turn_around_time_in_ms end |
#user_agent ⇒ Object (readonly)
Returns the value of attribute user_agent.
7 8 9 |
# File 'lib/ralf/clf_translator.rb', line 7 def user_agent @user_agent end |
Instance Method Details
#to_s ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/ralf/clf_translator.rb', line 22 def to_s if @translate_successfull "%s - %s [%s] \"%s\" %s %s \"%s\" \"%s\" %d" % [remote_ip, requester, , request_uri, http_status, bytes_sent, referrer, user_agent, duration] else nil end end |