Getting Data In

How do i stop a file from being segmented?

MikeBertelsen
Communicator

This is the beginning of the file, line numbers for clarity:
1. Log File for: BatchJobOutput_20150801-0139_13516_MonthlyBatchJob_SAMM191.log
2. Started: Sat Aug 1 01:39:22 CDT 2015
3. Using path to access.properties: /opt/WebSphere/AppServer/lib/app
4. --------------------------
5. /usr/java64/jdk1.6.0_43/bin:/bin:/usr/bin:/opt/gnome/bin:/usr/X11/bin:/home/cd7543/scripts

This is the end of the file:
159. Ended: Sat Aug 1 01:40:55 CDT 2015
160.

There are many date references between these two sections and Splunk takes this one file and splits it up which is then displayed to the end user segmented, in reverse order.

How do I get Splunk to index this as one contiguous file?

0 Karma
1 Solution

somesoni2
Revered Legend

Try something like this for your props.conf

[YourSourceType]
BREAK_ONLY_BEFORE=^Log\s*File\s*for:
MAX_TIMESTAMP_LOOKAHEAD=150
NO_BINARY_CHECK=1
SHOULD_LINEMERGE=true
TIME_PREFIX=Started:\s*

View solution in original post

somesoni2
Revered Legend

Try something like this for your props.conf

[YourSourceType]
BREAK_ONLY_BEFORE=^Log\s*File\s*for:
MAX_TIMESTAMP_LOOKAHEAD=150
NO_BINARY_CHECK=1
SHOULD_LINEMERGE=true
TIME_PREFIX=Started:\s*

MikeBertelsen
Communicator

Of the solutions offered, this one works the best.
But I am exceeding the 10000 byte limit and the file is being truncated.
Suggestions?

somesoni2
Revered Legend

10000 bytes limits in the preview screen? If you see data truncated in Preview, don't worry actual data will not get truncated.
If you see the actual data getting truncated, add following to props.conf stanza.

TRUNCATE = 0

martin_mueller
SplunkTrust
SplunkTrust

Do not set settings such as TRUNCATE to zero, ever.

Pick a value that seems outlandishly large, sure - but not zero. If something breaks at your source, Splunk will attempt to build infinitely large events...

MikeBertelsen
Communicator

yes in the preview screen

0 Karma

somesoni2
Revered Legend

You want all 160 lines to appear into one big single event with timestamp being taken from line 2?

MikeBertelsen
Communicator

Yes that is correct.

0 Karma

woodcock
Esteemed Legend

Add this to your props.conf:

TIME_PREFIX = ^Started:\s+

This won't work if the other timestamps start with the same RegEx.

0 Karma

MikeBertelsen
Communicator

That helps a lot. the file is now broken up into two segments. the first line and the second which contains the timestamp.
I can make do with this but if needed how do I get the previous line included?

0 Karma

woodcock
Esteemed Legend

Add these, too:

 BREAK_ONLY_BEFORE_DATE = false
 BREAK_ONLY_BEFORE = ^Log File for:\s+
 SHOULD_LINEMERGE = true
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!

How much can you really learn in 3 minutes?

Observability can certainly be hard to understand – there's a lot of jargon and buzzwords and it seems to ...

Event Series: The Agentic SOC: Trust Before Autonomy

AI is fundamentally changing security operations, but true progress requires more than just automation—it ...

Free Professional Services for .conf26 Attendees

This year at .conf26, we are doing something a little different. We are bringing the best minds from ...