I have a 3rd party app that spits out a text file with multiple lines for a single event. An event has a consistent start line and an end line.
I have tried filebeat configurations that grab everything after a specific regex, everything before a specific regex, and everything between two regexes.
I've toggled 'negate' off and on and switched the main pattern from my start to my end patterns.
I've changed my regex from being just a match at the start of a line, to being that start of the line match plus a .* to grab the entire line.
None of these changes "do anything" - I still end up with every line of the file as a distinct record in elastic.
My yaml is valid, I double checked indentation with yamllint and filebeat is loading and running everything else (including the 'add field' processor immediately below the multiline part that it seems to be ignoring.
Even though I'm using some of the predefined modules for other files, I've just defined these two particular log patterns directly in my filebeat.yml. The relevant top portion (beyond this is just the kibana/elastic setup portions)
filebeat.config.modules:
# Glob pattern for configuration loading
path: ${path.config}/modules.d/*.yml
reload.enabled: true
reload.period: 300s
# Extra inputs
filebeat.inputs:
- type: filestream
paths:
- /var/log/apcupsd*.events
processors:
- add_fields:
target: apc
fields:
source: apcupsd-event
- type: filestream
paths:
- /var/log/apcupsd*.status
prospector.scanner.resend_on_touch: true
multiline:
type: pattern
pattern: '^APC'
negate: true
match: after
# flush_pattern: '^END APC'
processors:
- add_fields:
target: apc
fields:
source: apcupsd-status
And the log file is simple:
APC : 001,037,0875
DATE : 2021-11-28 15:12:21 -0800
HOSTNAME : apc-pi
VERSION : 3.14.14 (31 May 2016) debian
UPSNAME : APC1500
CABLE : USB Cable
DRIVER : USB UPS Driver
UPSMODE :
STARTTIME: 2021-11-28 14:07:41 -0800
SHARE :
MODEL : Back-UPS RS 1500G
STATUS : ONLINE
LINEV : 121.0 Volts
LOADPCT : 17.0 Percent
BCHARGE : 100.0 Percent
TIMELEFT : 114.8 Minutes
MBATTCHG : -1 Percent
MINTIMEL : -1 Minutes
MAXTIME : 0 Seconds
SENSE : Medium
LOTRANS : 88.0 Volts
HITRANS : 147.0 Volts
ALARMDEL : No alarm
BATTV : 27.2 Volts
LASTXFER : Unacceptable line voltage changes
NUMXFERS : 0
TONBATT : 0 Seconds
CUMONBATT: 0 Seconds
XOFFBATT : N/A
SELFTEST : NO
STATFLAG : 0x05000008
SERIALNO : 3B1511X09577
BATTDATE : 2015-03-11
NOMINV : 120 Volts
NOMBATTV : 24.0 Volts
NOMPOWER : 865 Watts
FIRMWARE : 865.L5 .D USB FW:L5
END APC : 2021-11-28 15:12:22 -0800
No matter how many permutations I go through, I can't get a multiline message to go through though...