Skip to content

Add parser/apache.md - #652

Merged
kenhys merged 1 commit into
fluent:1.0from
Watson1978:docs-add-parser-apache
Jul 28, 2026
Merged

Add parser/apache.md#652
kenhys merged 1 commit into
fluent:1.0from
Watson1978:docs-add-parser-apache

Conversation

@Watson1978

Copy link
Copy Markdown
Contributor

lib/fluent/plugin/parser_apache.rb registers the "apache" parser via Plugin.register_parser("apache", self), but it had no documentation page while apache2 and apache_error do.

The plugin is a RegexpParser subclass with only two defaults:

config_set_default :expression, /^(?<host>[^ ]*) [^ ]* (?<user>[^ ]*) \[(?<time>[^\]]*)\] "(?<method>\S+)(?: +(?<path>[^ ]*) +\S*)?" (?<code>[^ ]*) (?<size>[^ ]*)(?: "(?<referer>[^\"]*)" "(?<agent>[^\"]*)")?$/
config_set_default :time_format, "%d/%b/%Y:%H:%M:%S %z"

The page follows parser/nginx.md, which documents the other RegexpParser subclass. The Example output was verified by running the parser against the sample line: all fields are returned as String and "-" is kept verbatim, unlike apache2 which casts code/size to Integer and maps "-" to nil.

lib/fluent/plugin/parser_apache.rb registers the "apache" parser via
`Plugin.register_parser("apache", self)`, but it had no documentation page
while apache2 and apache_error do.

The plugin is a RegexpParser subclass with only two defaults:

    config_set_default :expression, /^(?<host>[^ ]*) [^ ]* (?<user>[^ ]*) \[(?<time>[^\]]*)\] "(?<method>\S+)(?: +(?<path>[^ ]*) +\S*)?" (?<code>[^ ]*) (?<size>[^ ]*)(?: "(?<referer>[^\"]*)" "(?<agent>[^\"]*)")?$/
    config_set_default :time_format, "%d/%b/%Y:%H:%M:%S %z"

The page follows parser/nginx.md, which documents the other RegexpParser
subclass. The Example output was verified by running the parser against the
sample line: all fields are returned as String and "-" is kept verbatim,
unlike apache2 which casts code/size to Integer and maps "-" to nil.

The new page is linked from the three places that list the built-in
parsers: SUMMARY.md, parser/README.md and configuration/parse-section.md.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Shizuo Fujita <fujita@clear-code.com>
@Watson1978
Watson1978 requested a review from kenhys July 28, 2026 01:58
@kenhys
kenhys merged commit 872c551 into fluent:1.0 Jul 28, 2026
2 checks passed
@Watson1978
Watson1978 deleted the docs-add-parser-apache branch July 28, 2026 02:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants