2929# Recommend you run this without the "-- web" option and just
3030# hook up Kibana separately.
3131#
32+ # Enable the "-v" verbose option when starting logstash
33+ # to aid in debugging things. Disable the "-v" option
34+ # when running in real/non-debug environment
35+ #
36+ #
3237##########################################################
3338##########################################################
3439
@@ -62,7 +67,7 @@ filter {
6267 # which modsec sections (A-K) may or may not be in each
6368 # log entry, we run some custom ruby code that will
6469 # split on each modsec "section" and store each found in
65- # new fields named "section[X ]" as appropriate, the value
70+ # new fields named "rawSection[A-K ]" as appropriate, the value
6671 # of each of these fields contains the raw un-parsed data
6772 # from that modsec section. Sections that are non-existant
6873 # will not have a key in "fields"
@@ -71,6 +76,12 @@ filter {
7176 # just doing this w/ grok patterns, this ended up being the
7277 # most reliable way to break up this in-consistent format into
7378 # more usable blocks
79+ #
80+ # @see https://github.com/SpiderLabs/ModSecurity/wiki/ModSecurity-2-Data-Formats
81+ #
82+ # READ the above to get a good understanding of the sections
83+ # and which ones can actively contain data depending on your modsec
84+ # version and environment!
7485 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
7586
7687 ruby {
@@ -144,6 +155,15 @@ filter {
144155 }
145156
146157 }
158+
159+ #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
160+ # Optionally deal w/ Section E (intended response data)
161+ # this is not always present
162+ #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
163+
164+ if [rawSectionE] =~ /.+/ {
165+ # you can deal w/ this if you want to here...
166+ }
147167
148168
149169 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -393,8 +413,18 @@ filter {
393413}
394414
395415output {
416+
417+ # turn this off when ready to run in a
418+ # real prod environment and get rid of the
419+ # "-v" flag when starting logstash
396420 stdout {
397421 debug => true
398422 }
399- elasticsearch { embedded => true }
423+
424+ # ideally you do NOT want to be running an
425+ # embedded elasticsearch in your logstash
426+ # process, you should be writing to a remote
427+ # elasticsearch instance (i.e. at least another
428+ # separate process from the logstash engine)
429+ elasticsearch { embedded => true }
400430}
0 commit comments