Splunk Search

Parsing not working as expected

a508184
Explorer

New to splunk, need your help.

Data:

4/5/2022 9:02 PM | Audit | hi user | something.MoveFiles | Copied File from C:\hello.txt to server/something.txt 4/5/2022 9:02 AM | Audit | hi user | something.MoveFiles | Copied File from D:\reportsSuccess\_CMS.txt to \\server_CMS.txt 12/15/2022 10:02 PM | Audit | hi user | something.MoveFiles | Copied File from D:\reportsSuccess\_CMS.txt to \\server_CMS.txt 4/4/2022 5:00 AM | Audit | hi user | FileSplitter.ProcessFiles | Started Processing : ID 4/4/2022 5:00 AM | Audit | hi user | FileSplitter.ProcessFiles | Started Processing 4/4/2022 5:00 AM | Audit | hi user | FileReader.FileReader | FileReader for D:\reportsInput\tsst.TXT initilized 4/4/2022 5:00 AM | Audit | hi user | something.something. 11/4/2022 5:00 AM | Audit | hi user | something.something. 10/4/2021 5:00 AM | Audit | hi user | something.something.

a508184_0-1649213303857.png

 

12/15/2022 is taking as 2/15/22. Below is the props.conf am using it.

 

SHOULD_LINEMERGE=true
LINE_BREAKER=([/r/n]*)[0-9]+\/[0-9]+\/\d{4}\s[0-9]+:[0-9]+\s[P|A]M
TZ=EST
TIME_PREFIX =^
BREAK_ONLY_BEFORE=[0-9]+\/[0-9]+\/\d{4}\s[0-9]+:[0-9]+\s[P|A]M


Can you please help me to get the correct parsing?  Thanks in advance.

 

 

Labels (1)
0 Karma
1 Solution

VatsalJagani
SplunkTrust
SplunkTrust

Using SHOULD_LINEMERGE=true is performance ineffective. Use the below configuration.

SHOULD_LINEMERGE = false
LINE_BREAKER = ([\s\n\r]+)[0-9]+\/[0-9]+\/\d{4}\s[0-9]+:[0-9]+\s[P|A]M\s+
TZ = EST
TIME_PREFIX = ^
TIME_FORMAT = %m/%d/%Y %I:%M %p
MAX_TIMESTAMP_LOOKAHEAD = 25

 

By the looks of it from the data you pasted, it is not necessary to have all the events in a new line. But if that is the case (each event in a new line) then updating the LINE_BREAKER below will improve performance and reduce the chances of incorrect line-breaking.

([\n\r]+)[0-9]+\/[0-9]+\/\d{4}\s[0-9]+:[0-9]+\s[P|A]M\s+

 

I hope this helps!!!

View solution in original post

VatsalJagani
SplunkTrust
SplunkTrust

Using SHOULD_LINEMERGE=true is performance ineffective. Use the below configuration.

SHOULD_LINEMERGE = false
LINE_BREAKER = ([\s\n\r]+)[0-9]+\/[0-9]+\/\d{4}\s[0-9]+:[0-9]+\s[P|A]M\s+
TZ = EST
TIME_PREFIX = ^
TIME_FORMAT = %m/%d/%Y %I:%M %p
MAX_TIMESTAMP_LOOKAHEAD = 25

 

By the looks of it from the data you pasted, it is not necessary to have all the events in a new line. But if that is the case (each event in a new line) then updating the LINE_BREAKER below will improve performance and reduce the chances of incorrect line-breaking.

([\n\r]+)[0-9]+\/[0-9]+\/\d{4}\s[0-9]+:[0-9]+\s[P|A]M\s+

 

I hope this helps!!!

venkatasri
SplunkTrust
SplunkTrust

Your TIME_PREFIX = ^ that means starting of the event, what you have highlighted is not being considered as _time for that reason.

When you set TIME_PREFIX alone, starting of the event is 4/5/2022 9:02 PM assuming line_breaking is fine.

you should look at TIME_FORMAT and set the TIME_PREFIX correctly for the timestamp you want to consider for _time.

The screenshot and events pasted looks completely different.

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!

Persistent Queue at TcpOut — One of Splunk's Most Practical Features

Splunk introduced persistent queueing at the tcpout layer as one of the most practical resilience features in ...

Skip the Awkward Silence: Have a .conf-ersation at .conf26

Picture this. You arrive at .conf26 already having your socializing and networking plans mapped out. No ...

Rethinking Zero Trust: From Product Purchases to Logical Control Evidence

Note: This post outlines a proposed architecture and serves as an interest check. If we secure commitments ...