Skip to content

Commit

Permalink
Update: Add support for x_forwarded_for headers in apaches access logs
Browse files Browse the repository at this point in the history
This Pr is heavily inpired by the work done in [this PR](elastic/beats#4417)
It is adressing [this ER](elastic/enhancements#14402).

`Grok` pattern has been updated to match logs starting with a list of IP
adresses and store all those ip in `apache.access.remote_ip`.
This pattern is heavily insipred by the one in the nginx integration.

I also decided to fill a new field `network.forwarded_ip` as it seems to
be the perfect fit.
  • Loading branch information
redcinelli committed Jul 18, 2022
1 parent 1fc6a88 commit c953563
Show file tree
Hide file tree
Showing 17 changed files with 1,208 additions and 824 deletions.
2 changes: 1 addition & 1 deletion packages/apache/_dev/deploy/docker/httpd.conf
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ LogLevel warn
# The following directives define some format nicknames for use with
# a CustomLog directive (see below).
#
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common

<IfModule logio_module>
Expand Down
5 changes: 5 additions & 0 deletions packages/apache/changelog.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
# newer versions go on top
- version: "1.55555.0"
changes:
- description: Add support for x_forwarded_for header
type: enhancement
link: https://github.com/elastic/integrations/pull/3249
- version: "1.4.1"
changes:
- description: Add correct field mapping for event.created
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@
172.17.0.1 - - [29/May/2017:19:02:48 +0000] "GET /stringpatch HTTP/1.1" 404 612 "-" "Mozilla/5.0 (Windows NT 6.1; rv:15.0) Gecko/20120716 Firefox/15.0a2" "-"
monitoring-server - - [29/May/2017:19:02:48 +0000] "GET /status HTTP/1.1" 200 612 "-" "Mozilla/5.0 (Windows NT 6.1; rv:15.0) Gecko/20120716 Firefox/15.0a2" "-"
127.0.0.1 - - [02/Feb/2019:05:38:45 +0100] "-" 408 152 "-" "-"
monitoring-server - - [29/May/2017:19:02:48 +0000] "GET /A%20Beka%20G1%20Howe/029_AND_30/15%20reading%20elephants.mp4 HTTP/1.1" 200 612 "-" "Mozilla/5.0 (Windows NT 6.1; rv:15.0) Gecko/20120716 Firefox/15.0a2" "-"
monitoring-server - - [29/May/2017:19:02:48 +0000] "GET /A%20Beka%20G1%20Howe/029_AND_30/15%20reading%20elephants.mp4 HTTP/1.1" 200 612 "-" "Mozilla/5.0 (Windows NT 6.1; rv:15.0) Gecko/20120716 Firefox/15.0a2" "-"
10.0.0.2, 10.0.0.1, 89.160.20.112 - - [29/May/2017:19:02:48 +0000] "GET /A%20Beka%20G1%20Howe/029_AND_30/15%20reading%20elephants.mp4 HTTP/1.1" 200 612 "-" "Mozilla/5.0 (Windows NT 6.1; rv:15.0) Gecko/20120716 Firefox/15.0a2" "-"
2a02:cf40:add:4002:91f2:a9b2:e09a:6fc6, 10.225.192.17, 10.2.2.121 - - [29/May/2017:19:02:48 +0000] "GET /A%20Beka%20G1%20Howe/029_AND_30/15%20reading%20elephants.mp4 HTTP/1.1" 200 612 "-" "Mozilla/5.0 (Windows NT 6.1; rv:15.0) Gecko/20120716 Firefox/15.0a2" "-"
Loading

0 comments on commit c953563

Please sign in to comment.