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

Extract dstuser nginx decoders #151

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all 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
17 changes: 16 additions & 1 deletion decoders/0170-nginx_decoders.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,30 @@
-->

<!--
- Will extract the srcip.
- Will extract the srcip. Additionally extract the username for basic authentication if present.
- Examples:
- 2009/09/15 20:55:40 [error] 63858#0: *3663 open() "/srv/www/ossec.net/robots.txt" failed (2: No such file or directory), client: 1.2.3.4, server: ossec.net, request: "GET /robots.txt HTTP/1.1", host: "www.ossec.net"
- 2009/09/15 19:51:07 [error] 37992#0: accept() failed (53: Software caused connection abort)
- 2018/05/26 06:46:11 [error] 31963#31963: *28769 user "test user" was not found in "/etc/nginx/conf.d/users.htpasswd", client: 1.2.3.4, server: example.com, request: "GET / HTTP/1.1", host: "example.com"
- 2018/05/27 10:22:20 [error] 31972#31972: *52363 user "user2": password mismatch, client: 1.2.3.4, server: example.com, request: "GET / HTTP/2.0", host: "example.com"
-->
<decoder name="nginx-errorlog">
<prematch>^20\d\d/\d\d/\d\d \d\d:\d\d:\d\d [</prematch>
</decoder>

<decoder name="nginx-errorlog-user-ip">
<parent>nginx-errorlog</parent>
<prematch offset="after_parent"> user "\.+"</prematch>
<regex offset="after_parent"> user "(\.+)"</regex>
<order>dstuser</order>
</decoder>

<decoder name="nginx-errorlog-user-ip">
<parent>nginx-errorlog</parent>
<regex offset="after_regex">client: (\S+),</regex>
<order>srcip</order>
</decoder>

<decoder name="nginx-errorlog-ip">
<parent>nginx-errorlog</parent>
<prematch offset="after_parent">, client: \S+, server: \S+, request: "\S+ </prematch>
Expand Down