Skip to content

Commit 6d53789

Browse files
committed
Merge pull request #10 from equick/master
updates for Redhat based systems
2 parents 07b1890 + aac415b commit 6d53789

2 files changed

Lines changed: 23 additions & 11 deletions

File tree

README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,23 @@ This config file for whatever reason will not run if you try to add the "-- web"
2929

3030
Also recommend you start logstash like "java -jar logstash-x.x.x-flatjar.jar agent -v -f /yourConf.conf" The "-v" will give verbose output and help you debug issues. Also DON'T run in "-v" mode in a prod environment as you will end up outputting a ton of data to your console and/or logstash stdout capture file. (if you have one)
3131

32+
Further note for Centos/Red Hat/Fedora Systems
33+
----------------------------------------------
3234

35+
If logstash has been installed from the logstash repository (http://www.logstash.net/docs/1.4.2/repositories), follow these steps:
36+
37+
1. Set the path in logstash-modsecurity.conf to path => "/var/log/httpd/modsec_audit.log"
38+
2. Copy logstash-modsecurity.conf to /etc/logstash/conf.d
39+
3. Copy logstash_modsecurity_patterns to /opt/logstash/patterns/
40+
4. Give read access to the logstash user on /var/log/httpd/modsec_audit.log
41+
42+
`setfacl -m u:logstash:r /var/log/httpd/modsec_audit.log`
43+
44+
5. Restart the logstash agent
45+
46+
`systemctl restart logstash`
47+
48+
6. Confirm mod_security messages are logged to standard output
49+
50+
`tail -f /var/log/logstash/logstash.stdout`
3351

logstash-modsecurity.conf

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ input {
4444
# that your server writes these log files in
4545
charset => "US-ASCII"
4646
path => "/path/to/your/modsec/audit/logs/*.log"
47+
type => "mod_security"
4748
}
4849
}
4950

@@ -59,6 +60,7 @@ filter {
5960
pattern => "^--[a-fA-F0-9]{8}-A--$"
6061
negate => true
6162
what => previous
63+
type => "mod_security"
6264
}
6365

6466

@@ -180,7 +182,7 @@ filter {
180182
match => {
181183
"rawSectionF" => "(?<serverProtocol>.+?)\s(?<responseStatus>.+)$"
182184
}
183-
patterns_dir => "./patterns/modsecurity_grok_patterns"
185+
patterns_dir => "./patterns/logstash_modsecurity_patterns"
184186
}
185187

186188
# response section (WITH headers)
@@ -191,7 +193,7 @@ filter {
191193
match => {
192194
"rawSectionF" => "(?<serverProtocol>.+?)\s(?<responseStatus>.+)\n{1}"
193195
}
194-
patterns_dir => "./patterns/modsecurity_grok_patterns"
196+
patterns_dir => "./patterns/logstash_modsecurity_patterns"
195197
}
196198

197199
}
@@ -431,14 +433,6 @@ output {
431433
# turn this off when ready to run in a
432434
# real prod environment and get rid of the
433435
# "-v" flag when starting logstash
434-
stdout {
435-
debug => true
436-
}
436+
stdout { }
437437

438-
# ideally you do NOT want to be running an
439-
# embedded elasticsearch in your logstash
440-
# process, you should be writing to a remote
441-
# elasticsearch instance (i.e. at least another
442-
# separate process from the logstash engine)
443-
elasticsearch { embedded => true }
444438
}

0 commit comments

Comments
 (0)