22description : Pipeline for apache modsecurity audit log.
33processors :
44 - rename :
5+ tag : rename_json_transaction_time_to__temps_date_3f87beb3
56 field : json.transaction.time
67 target_field : _temps.date
78 ignore_missing : true
89 - grok :
10+ tag : grok__temps_date_46a5f44c
911 field : _temps.date
1012 patterns :
1113 - " %{DATE}"
@@ -15,31 +17,37 @@ processors:
1517 TZ : " (?:[APMCE][SD]T|UTC|[-+]\\ d{2}:?\\ d{2})"
1618 ignore_failure : true
1719 - gsub :
20+ tag : gsub__temps_tz_8e2cb4b7
1821 field : _temps.tz
1922 pattern : " ^([-+]\\ d{2})(\\ d{2})$"
2023 replacement : " $1:$2"
2124 if : ctx._temps?.tz != null
2225
2326 # Time zone can come from three sources, choose in order: log, config, locale, default to UTC.
2427 - set :
28+ tag : set__temps_tz_5d08e94e
2529 field : _temps.tz
2630 copy_from : _conf.tz_offset
2731 override : false
2832 if : ctx._conf?.tz_offset != null && ctx._conf?.tz_offset != 'local'
2933 - set :
34+ tag : set__temps_tz_421d98a4
3035 field : _temps.tz
3136 copy_from : event.timezone
3237 override : false
3338 if : ctx.event?.timezone != null
3439 - set :
40+ tag : set__temps_tz_56876443
3541 field : _temps.tz
3642 value : UTC
3743 override : false
3844 - set :
45+ tag : set_event_timezone_8476ef7a
3946 field : event.timezone
4047 copy_from : _temps.tz
4148
4249 - date :
50+ tag : date__temps_date_7135cc5a
4351 field : _temps.date
4452 timezone : " {{{ event.timezone }}}"
4553 formats :
@@ -52,6 +60,7 @@ processors:
5260 on_failure :
5361 # Try to re-parse as UTC to catch when TZ is invalid or unknown.
5462 - remove :
63+ tag : remove_event_timezone_907d6fea
5564 field : event.timezone
5665 ignore_missing : true
5766 - date :
@@ -66,98 +75,122 @@ processors:
6675 - d/MMM/yyyy:HH:mm:ss.SSSSSS Z
6776 on_failure :
6877 - append :
78+ tag : append_error_message_4cacfde8
6979 field : error.message
7080 value : " fail-{{{ _ingest.on_failure_processor_tag }}}"
7181 - fail :
82+ tag : fail_1b60673b
7283 message : " Processor {{{ _ingest.on_failure_processor_type }}} with tag {{{ _ingest.on_failure_processor_tag }}} in pipeline {{{ _ingest.on_failure_pipeline }}} failed with message: {{{ _ingest.on_failure_message }}}"
7384
7485 # rename ecs
7586 - rename :
87+ tag : rename_json_transaction_remote_address_to_source_ip_88854519
7688 field : json.transaction.remote_address
7789 target_field : source.ip
7890 ignore_missing : true
7991 - rename :
92+ tag : rename_json_transaction_local_address_to_destination_ip_f86eeb8f
8093 field : json.transaction.local_address
8194 target_field : destination.ip
8295 ignore_missing : true
8396 - rename :
97+ tag : rename_json_transaction_remote_port_to_source_port_fac313c8
8498 field : json.transaction.remote_port
8599 target_field : source.port
86100 ignore_missing : true
87101 - grok :
102+ tag : grok_json_request_request_line_e2746bce
88103 field : json.request.request_line
89104 patterns :
90105 - " %{NOTSPACE:http.request.method} %{URIPATHPARAM:url.original}(?: HTTP/%{NUMBER:http.version})"
91106 - rename :
107+ tag : rename_json_transaction_request_headers_host_to_json_transaction_request_headers_Host_50a00924
92108 field : json.transaction.request.headers.host
93109 target_field : json.transaction.request.headers.Host
94110 ignore_missing : true
95111 - set :
112+ tag : set__temps_url_68a0b8bb
96113 field : _temps.url
97114 if : ctx.json.transaction.local_port == 443
98115 value : " https://{{{json.request.headers.Host}}}:{{json.transaction.#local_port}}{{{url.original}}}"
99116 - set :
117+ tag : set__temps_url_70f6c2f5
100118 field : _temps.url
101119 if : ctx.json.transaction.local_port == 80
102120 value : " http://{{{json.request.headers.Host}}}:{{json.transaction.#local_port}}{{{url.original}}}"
103121 - uri_parts :
122+ tag : uri_parts__temps_url_1e26796c
104123 field : _temps.url
105124 ignore_failure : true
106125 keep_original : true
107126 remove_if_successful : true
108127 - rename :
128+ tag : rename_json_response_status_to_http_response_status_code_6bcbe6ae
109129 field : json.response.status
110130 target_field : http.response.status_code
111131 ignore_missing : true
112132 - rename :
133+ tag : rename_json_transaction_transaction_id_to_transaction_id_e2288765
113134 field : json.transaction.transaction_id
114135 target_field : transaction.id
115136 ignore_missing : true
116137 - rename :
138+ tag : rename_json_response_headers_Content-Type_to_http_response_mime_type_02c1b535
117139 field : json.response.headers.Content-Type
118140 target_field : http.response.mime_type
119141 ignore_missing : true
120142 - rename :
143+ tag : rename_json_request_headers_Content-Type_to_http_request_mime_type_7000f4e5
121144 field : json.request.headers.Content-Type
122145 target_field : http.request.mime_type
123146 ignore_missing : true
124147 - rename :
148+ tag : rename_json_response_headers_Content-Length_to_http_response_bytes_832f1a93
125149 field : json.response.headers.Content-Length
126150 target_field : http.response.bytes
127151 ignore_missing : true
128152 - convert :
153+ tag : convert_http_response_bytes_4e4d07d3
129154 field : http.response.bytes
130155 ignore_missing : true
131156 type : long
132157 - rename :
158+ tag : rename_json_request_headers_Content-Length_to_http_request_bytes_8dea5ba3
133159 field : json.request.headers.Content-Length
134160 target_field : http.request.bytes
135161 ignore_missing : true
136162 - convert :
163+ tag : convert_http_request_bytes_74307b8d
137164 field : http.request.bytes
138165 ignore_missing : true
139166 type : long
140167 - rename :
168+ tag : rename_json_request_body_to_http_request_body_content_04999987
141169 field : json.request.body
142170 target_field : http.request.body.content
143171 ignore_missing : true
144172 - rename :
173+ tag : rename_json_response_body_to_http_response_body_content_7ee417e7
145174 field : json.response.body
146175 target_field : http.response.body.content
147176 ignore_missing : true
148177 - rename :
178+ tag : rename_json_request_headers_REMOTE_USER_to_user_name_1fae39b7
149179 field : json.request.headers.REMOTE_USER
150180 target_field : user.name
151181 ignore_missing : true
152182 - rename :
183+ tag : rename_json_request_headers_Referer_to_http_request_referrer_f0fa4826
153184 field : json.request.headers.Referer
154185 target_field : http.request.referrer
155186 ignore_missing : true
156187 - rename :
188+ tag : rename_json_audit_data_messages_to_modsec_audit_details_91d47bde
157189 field : json.audit_data.messages
158190 target_field : modsec.audit.details
159191 ignore_missing : true
160192 - script :
193+ tag : script_7497121c
161194 lang : painless
162195 ignore_failure : true
163196 source : |
@@ -185,13 +218,16 @@ processors:
185218
186219 # user agent and geoip enrich
187220 - user_agent :
221+ tag : user_agent_json_request_headers_User-Agent_977fb883
188222 field : json.request.headers.User-Agent
189223 ignore_missing : true
190224 - geoip :
225+ tag : geoip_source_ip_to_source_geo_da2e41b2
191226 field : source.ip
192227 target_field : source.geo
193228 ignore_missing : true
194229 - geoip :
230+ tag : geoip_source_ip_to_source_as_28d69883
195231 database_file : GeoLite2-ASN.mmdb
196232 field : source.ip
197233 target_field : source.as
@@ -200,10 +236,12 @@ processors:
200236 - organization_name
201237 ignore_missing : true
202238 - geoip :
239+ tag : geoip_destination_ip_to_destination_geo_ab5e2968
203240 field : destination.ip
204241 target_field : destination.geo
205242 ignore_missing : true
206243 - geoip :
244+ tag : geoip_destination_ip_to_destination_as_8a007787
207245 database_file : GeoLite2-ASN.mmdb
208246 field : destination.ip
209247 target_field : destination.as
@@ -212,31 +250,39 @@ processors:
212250 - organization_name
213251 ignore_missing : true
214252 - rename :
253+ tag : rename_source_as_asn_to_source_as_number_a917047d
215254 field : source.as.asn
216255 target_field : source.as.number
217256 ignore_missing : true
218257 - rename :
258+ tag : rename_source_as_organization_name_to_source_as_organization_name_f1362d0b
219259 field : source.as.organization_name
220260 target_field : source.as.organization.name
221261 ignore_missing : true
222262 - rename :
263+ tag : rename_destination_as_asn_to_destination_as_number_3b459fcd
223264 field : destination.as.asn
224265 target_field : destination.as.number
225266 ignore_missing : true
226267 - rename :
268+ tag : rename_destination_as_organization_name_to_destination_as_organization_name_814bd459
227269 field : destination.as.organization_name
228270 target_field : destination.as.organization.name
229271 ignore_missing : true
230272 - set :
273+ tag : set_event_kind_de80643c
231274 field : event.kind
232275 value : event
233276 - append :
277+ tag : append_event_category_4595ee28
234278 field : event.category
235279 value : web
236280 - append :
281+ tag : append_event_type_f8289914
237282 field : event.type
238283 value : access
239284 - remove :
285+ tag : remove_d7845b70
240286 field :
241287 - json
242288 - _conf
@@ -249,4 +295,8 @@ on_failure:
249295 value : pipeline_error
250296 - append :
251297 field : error.message
252- value : ' {{{ _ingest.on_failure_message }}}'
298+ value : >-
299+ Processor '{{{ _ingest.on_failure_processor_type }}}'
300+ {{#_ingest.on_failure_processor_tag}}with tag '{{{ _ingest.on_failure_processor_tag }}}'
301+ {{/_ingest.on_failure_processor_tag}}in pipeline '{{{ _ingest.pipeline }}}'
302+ failed with message '{{{ _ingest.on_failure_message }}}'
0 commit comments