Skip to content

Commit

Permalink
modsecurity: relax timestamp parsing and improve error handling (elas…
Browse files Browse the repository at this point in the history
  • Loading branch information
efd6 authored and agithomas committed Mar 20, 2023
1 parent cbe0ca8 commit c1234e8
Show file tree
Hide file tree
Showing 7 changed files with 120 additions and 4 deletions.
8 changes: 8 additions & 0 deletions packages/modsecurity/changelog.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
# newer versions go on top
- version: "1.6.0"
changes:
- description: Handle sub-second resolution timestamps.
type: bugfix
link: https://github.com/elastic/integrations/pull/5418
- description: Improve error handling.
type: enhancement
link: https://github.com/elastic/integrations/pull/5418
- version: "1.5.1"
changes:
- description: Add support for time zone configuration.
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -45,20 +45,31 @@ processors:
formats:
- d/MMM/yyyy:HH:mm:ss
- d/MMM/yyyy:HH:mm:ss Z
- d/MMM/yyyy:HH:mm:ss.SSS
- d/MMM/yyyy:HH:mm:ss.SSS Z
- d/MMM/yyyy:HH:mm:ss.SSSSSS
- d/MMM/yyyy:HH:mm:ss.SSSSSS Z
on_failure:
# Try to re-parse as UTC to catch when TZ is invalid or unknown.
- remove:
field: event.timezone
ignore_missing: true
- date:
field: _temps.date
tag: "time_date"
formats:
- d/MMM/yyyy:HH:mm:ss
- d/MMM/yyyy:HH:mm:ss Z
- d/MMM/yyyy:HH:mm:ss.SSS
- d/MMM/yyyy:HH:mm:ss.SSS Z
- d/MMM/yyyy:HH:mm:ss.SSSSSS
- d/MMM/yyyy:HH:mm:ss.SSSSSS Z
on_failure:
- append:
field: error.message
value: "{{{ _ingest.on_failure_message }}}"
value: "fail-{{{ _ingest.on_failure_processor_tag }}}"
- fail:
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 }}"

# rename ecs
- rename:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,8 @@ processors:

on_failure:
- set:
field: event.kind
value: pipeline_error
- append:
field: error.message
value: "{{ _ingest.on_failure_message }}"
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,31 @@ processors:
formats:
- E MMM dd HH:mm:ss yyyy
- E MMM d HH:mm:ss yyyy
- d/MMM/yyyy:HH:mm:ss.SSS
- d/MMM/yyyy:HH:mm:ss.SSS Z
- d/MMM/yyyy:HH:mm:ss.SSSSSS
- d/MMM/yyyy:HH:mm:ss.SSSSSS Z
on_failure:
# Try to re-parse as UTC to catch when TZ is invalid or unknown.
- remove:
field: event.timezone
ignore_missing: true
- date:
field: _temps.date
tag: "time_date"
formats:
- E MMM dd HH:mm:ss yyyy
- E MMM d HH:mm:ss yyyy
- d/MMM/yyyy:HH:mm:ss.SSS
- d/MMM/yyyy:HH:mm:ss.SSS Z
- d/MMM/yyyy:HH:mm:ss.SSSSSS
- d/MMM/yyyy:HH:mm:ss.SSSSSS Z
on_failure:
- append:
field: error.message
value: "{{{ _ingest.on_failure_message }}}"
value: "fail-{{{ _ingest.on_failure_processor_tag }}}"
- fail:
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 }}"

# rename ecs
- rename:
Expand Down
2 changes: 1 addition & 1 deletion packages/modsecurity/manifest.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
format_version: 1.0.0
name: modsecurity
title: "ModSecurity Audit"
version: "1.5.1"
version: "1.6.0"
license: basic
description: Collect logs from ModSecurity with Elastic Agent
type: integration
Expand Down

0 comments on commit c1234e8

Please sign in to comment.