Getting Data In

parsing events...

a212830
Champion

Hi,

How would I parse a file that has two linebreaking formats? The first is when the line begins and ends with asterisks (*), and the other is when they start with a date. The asterisk appears to be multi-line, and the date appears to be single-line.

Tags (2)
0 Karma

vincesesto
Communicator

Hi a212830,

Try something like the following for your props.conf:

BREAK_ONLY_BEFORE=^\*\*\s+\w+|^\[
NO_BINARY_CHECK=1
SHOULD_LINEMERGE=true

The BREAK_ONLY_BEFORE is in two parts to have two separate event:
1. ^\*\*\s+\w+ - this is looking for a newline starting with 2 asterisk a space then a word
2. |^\[ - OR a square bracket at the start of a line.

Of course you can make this as complicated as you like depending on your events, but from what you have shown me the regex of ^\*\*\s+\w+|^\[ should work as an event break for your data.

Regards,

Vince

0 Karma

vincesesto
Communicator

Hi a212830,

If you create you own source type and you use the BREAK_ONLY_BEFORE option to create a regex that will look for the two linebreaking formats:
http://docs.splunk.com/Documentation/Splunk/5.0.2/Admin/Propsconf

Without knowing much more information on what you are currently working on, you could set it to something like:
BREAK_ONLY_BEFORE = (^*|^date)

Hope this helps, if you would like to provide some examples, I would be happy to help set up the props.conf file with you.

Regards,

Vince

a212830
Champion

Thanks.

I have lines like this:

*********** blah blah blah start of this event with no date/time stamp ***
stuff
stuff
********* blah blah blah end of this event

and lines like this

[10/29/12 6:40:34:438 EDT] 000001ae SystemErr R [Fatal Error] :-1:-1: Premature end of file.

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Agent Mode Engaged! Enchaining Agentic Operations with Splunk AI Assistant 2.0

    Are you ready to transform how your team handles complex data requests? We invite you to our upcoming ...

Announcing Modern Navigation: A New Era of Splunk User Experience

We are excited to introduce the Modern Navigation feature in the Splunk Platform, available to both cloud and ...

Modernize your Splunk Apps – Introducing Python 3.13 in Splunk

We are excited to announce that the upcoming releases of Splunk Enterprise 10.2.x and Splunk Cloud Platform ...