Hi Folks,
I thought I'd be able to use the filebeat apache module out of the box, but then I noticed the handling of X-Forwarded-For. It only seems to get the inner-most IP from it (which is a proxy, and not the end-user IP).
HTTPD Log Format
LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\""
Sample:
2.2.2.2, 10.100.49.203 - - [21/May/2019:21:20:41 +0000] "GET /resource/reportmanagement/published/ESD_900000010053582_05112019_900000010189257_1526056201037.docx HTTP/1.1" 301 353 "-" "Mozilla/5.0 (Linux; Android 6.0.1; Nexus 5X Build/MMB29P) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.96 Mobile Safari/537.36 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)"
2.2.2.2, 10.100.48.62 - - [21/May/2019:21:20:41 +0000] "GET /onecpd/includes/themes/hudexchange/images/favicon.ico HTTP/1.1" 200 3638 "-" "Mozilla/5.0 (Windows NT 6.1; Trident/7.0; rv:11.0) like Gecko"
2.2.2.2, 10.100.49.203 - - [21/May/2019:21:20:41 +0000] "GET /trainings/courses HTTP/1.1" 200 7175 "-" "PiplBot (+http://www.pipl.com/bot/)"
2.2.2.2, 10.100.49.203 - - [21/May/2019:21:20:41 +0000] "GET /s3redirect/?ref=/resource/reportmanagement/published/ESD_900000010053582_05112019_900000010189257_1526056201037.docx HTTP/1.1" 301 86 "-" "Mozilla/5.0 (Linux; Android 6.0.1; Nexus 5X Build/MMB29P) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.96 Mobile Safari/537.36 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)"
I want the 2.2.2.2
addresses, but I get the 10.100.*
addresses:
{
"_index": "filebeat-7.1.0-2019.05.20-000001",
"_type": "_doc",
"_id": "1JRv2GoBZOU7qiPlQNcD",
"_version": 1,
"_score": null,
"_source": {
"agent": {
"hostname": "f64aab1e2619",
"id": "38dfc846-4fec-47df-a33b-cde479c27f11",
"type": "filebeat",
"ephemeral_id": "6fe6e7e5-36d1-4d04-a9a4-ae263c6a345b",
"version": "7.1.0"
},
"log": {
"file": {
"path": "/var/log/apache2/access_log"
},
"offset": 0
},
"source": {
"address": "10.100.49.203",
"ip": "10.100.49.203"
},
"fileset": {
"name": "access"
},
"url": {
"original": "/resource/reportmanagement/published/ESD_900000010053582_05112019_900000010189257_1526056201037.docx"
},
"input": {
"type": "log"
},
"apache": {
"access": {}
},
"@timestamp": "2019-05-21T21:20:41.000Z",
"ecs": {
"version": "1.0.0"
},
"service": {
"type": "apache"
},
"host": {
"name": "f64aab1e2619"
},
"http": {
"request": {
"referrer": "-",
"method": "GET"
},
"response": {
"status_code": 301,
"body": {
"bytes": 353
}
},
"version": "1.1"
},
"event": {
"created": "2019-05-21T03:28:09.661Z",
"module": "apache",
"dataset": "apache.access"
},
"user": {
"name": "-"
},
"user_agent": {
"original": "Mozilla/5.0 (Linux; Android 6.0.1; Nexus 5X Build/MMB29P) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.96 Mobile Safari/537.36 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)",
"os": {
"name": "Android",
"version": "6.0.1",
"full": "Android 6.0.1"
},
"name": "Googlebot",
"device": {
"name": "Spider"
},
"version": "2.1"
}
},
"fields": {
"suricata.eve.timestamp": [
"2019-05-21T21:20:41.000Z"
],
"@timestamp": [
"2019-05-21T21:20:41.000Z"
],
"event.created": [
"2019-05-21T03:28:09.661Z"
]
},
"sort": [
1558473641000
]
}
I'd like to leverage as much of the auto fanciness as possible. Is there any tweak I can do to keep this in filebeat instead of cobbling something together with logstash?
I saw some similar topics from a few years back, but I wasn't sure if there had been any beat developments in the meantime.
Thanks,
Jamie