Class: Racknga::AccessLogParser
- Inherits:
-
Object
- Object
- Racknga::AccessLogParser
- Includes:
- Enumerable
- Defined in:
- lib/racknga/access_log_parser.rb
Overview
Supported formats:
* combined (nginx's default format)
* combined (Apache's predefined format)
* combined_with_time_nginx (custom format with runtime)
* combined_with_time_apache (custom format with runtime)
Configurations:
* combined
* nginx
log_format combined '$remote_addr - $remote_user [$time_local] '
'"$request" $status $body_bytes_sent '
'"$http_referer" "$http_user_agent"';
access_log log/access.log combined
* Apache
CustomLog ${APACHE_LOG_DIR}/access.log combined
* combined_with_time_nginx
* nginx
log_format combined_with_time '$remote_addr - $remote_user '
'[$time_local, $upstream_http_x_runtime, $request_time] '
'"$request" $status $body_bytes_sent '
'"$http_referer" "$http_user_agent"';
access_log log/access.log combined_with_time
* combined_with_time_apache
* Apache
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\" %{X-Runtime}o %D" combined_with_time
CustomLog ${APACHE_LOG_DIR}/access.log combined_with_time
Direct Known Subclasses
Defined Under Namespace
Classes: FormatError
Instance Method Summary collapse
- #each ⇒ Object
-
#initialize(line_reader) ⇒ AccessLogParser
constructor
A new instance of AccessLogParser.
Constructor Details
#initialize(line_reader) ⇒ AccessLogParser
Returns a new instance of AccessLogParser.
58 59 60 |
# File 'lib/racknga/access_log_parser.rb', line 58 def initialize(line_reader) @line_reader = line_reader end |
Instance Method Details
#each ⇒ Object
62 63 64 65 66 67 |
# File 'lib/racknga/access_log_parser.rb', line 62 def each @line_reader.each do |line| line.force_encoding("UTF-8") yield(parse_line(line)) if line.valid_encoding? end end |