Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix parsing of apache trace log levels #28717

Merged
merged 4 commits into from
Nov 23, 2021
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d
- Add support for username in cisco asa security negotiation logs {pull}26975[26975]
- Relax time parsing and capture group and session type in Cisco ASA module {issue}24710[24710] {pull}28325[28325]
- Correctly track bytes read when max_bytes is exceeded. {issue}28317[28317] {pull}28352[28352]
- Fix parsing of apache log levels including numbers. {pull}28717[28717]
- Upgrade azure-eventhub sdk reference, contains potential checkpoint fixes. {pull}28919[28919]
- Revert usageDetails api version to 2019-01-01. {pull}28995[28995]
- Fix in `aws-s3` input regarding provider discovery through endpoint {pull}28963[28963]
Expand Down
4 changes: 3 additions & 1 deletion filebeat/module/apache/error/ingest/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@ processors:
patterns:
- \[%{APACHE_TIME:apache.error.timestamp}\] \[%{LOGLEVEL:log.level}\]( \[client
%{IPORHOST:source.address}(:%{POSINT:source.port})?\])? %{GREEDYDATA:message}
- \[%{APACHE_TIME:apache.error.timestamp}\] \[%{DATA:apache.error.module}:%{LOGLEVEL:log.level}\]
- \[%{APACHE_TIME:apache.error.timestamp}\] \[%{DATA:apache.error.module}:%{APACHE_LOGLEVEL:log.level}\]
\[pid %{NUMBER:process.pid:long}(:tid %{NUMBER:process.thread.id:long})?\](
\[client %{IPORHOST:source.address}(:%{POSINT:source.port})?\])? %{GREEDYDATA:message}
pattern_definitions:
# Apache log level can have numeric sub-levels such as trace1.
APACHE_LOGLEVEL: '%{LOGLEVEL}[0-9]*'
APACHE_TIME: '%{DAY} %{MONTH} %{MONTHDAY} %{TIME} %{YEAR}'
ignore_missing: true
- grok:
Expand Down
2 changes: 2 additions & 0 deletions filebeat/module/apache/error/test/sublevel.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[Wed Oct 20 19:20:59.121211 2021] [rewrite:trace3] [pid 121591:tid 140413273032448] mod_rewrite.c(470): [client 10.121.192.8:38350] 10.121.192.8 - - [api-dev.onintranet.com/sid#55a374e851c8][rid#7fb438083ac0/initial] applying pattern '^/bankimport/?(.*)$' to uri '/'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: don't need to obfuscate this line? Does it contain any customer-specific data?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I will change the urls.


21 changes: 21 additions & 0 deletions filebeat/module/apache/error/test/sublevel.log-expected.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
[
{
"@timestamp": "2021-10-20T19:20:59.121-02:00",
"apache.error.module": "rewrite",
"event.category": "web",
"event.dataset": "apache.error",
"event.kind": "event",
"event.module": "apache",
"event.original": "[Wed Oct 20 19:20:59.121211 2021] [rewrite:trace3] [pid 121591:tid 140413273032448] mod_rewrite.c(470): [client 10.121.192.8:38350] 10.121.192.8 - - [api-dev.onintranet.com/sid#55a374e851c8][rid#7fb438083ac0/initial] applying pattern '^/bankimport/?(.*)$' to uri '/'",
"event.timezone": "-02:00",
"event.type": "info",
"fileset.name": "error",
"input.type": "log",
"log.level": "trace3",
"log.offset": 0,
"message": "mod_rewrite.c(470): [client 10.121.192.8:38350] 10.121.192.8 - - [api-dev.onintranet.com/sid#55a374e851c8][rid#7fb438083ac0/initial] applying pattern '^/bankimport/?(.*)$' to uri '/'",
"process.pid": 121591,
"process.thread.id": 140413273032448,
"service.type": "apache"
}
]