Getting Data In

Couldn't parse and extract mixed data (json and text)

nareshinsvu
Builder

Hi,

I am not able to send my logfile into 2 sourcetypes (json and non-json). Below is my config. I know the fix might be a simple one. It's just that I am not getting anywhere near it. Need your expertise solution.

:::::::::::::::::inputs.conf:::::::::::::::: Only 1 monitor stanza is being picked. How can I parse the log file into two source types? Or any better solution?

[monitor://\\server1\sdata$\] 
sourcetype = Custom_W22 
index=0_nojson 
whitelist = (app1.log) 
recursive=false 
interval = 10 
crcSalt = <SOURCE> 


[monitor://\\server1\sdata$] 
sourcetype = myjson 
index=0_myjson 
whitelist = (\app1.log) 
recursive=false 
interval = 10 
crcSalt = <SOURCE> 

::::::::::::props.conf::::::::::::::::::::::::::::::
-----Here I have used current DATETIME_CONFIG which ignores my timestamps. I can fix the timestamps after indexing. Otherwise, the parsing was slow---------

[Custom_W22] 
NO_BINARY_CHECK = true 
SHOULD_LINEMERGE = false 
category = Miscellaneous 
TRANSFORMS-set = discardAll,queue2resp
disabled = false 
pulldown_type = true 
DATETIME_CONFIG = CURRENT 
TRUNCATE = 100000 

[myjson] 
SEDCMD-strip_prefix = s/^[^{]+//g 
INDEXED_EXTRACTIONS=JSON 
NO_BINARY_CHECK = true 
category = Custom 
description = myjson custom 
disabled = false 
pulldown_type = true 
TRUNCATE = 100000 
MAX_EVENTS = 10000 

::::::::::::::::::transforms.conf::::::::::::::::::::::::::

[discardAll] 
REGEX=. 
DEST_KEY=queue 
FORMAT=nullQueue 

[queue2resp] 
REGEX=(\<Tracker\s+\[pointer) 
DEST_KEY=queue 
FORMAT=indexQueue 
0 Karma

nareshinsvu
Builder

More observations:
1)
Both the stanzas work fine if the source logfile is different. My requirement is that I need ONE logfile parsed to TWO sourcetypes.

2) While testing JSON data alone, found that "crcSalt = <SOURCE> " is not working. A new line addition at the tail of the log is re-indexing the whole log and duplicating my splunk events.
I am able to fix it by using below config. Need to know if there are any drawbacks with this approach in the future? Note: followTail is working fine even if the logfile gets archived and a new file with same name gets created.

crcSalt = <SOURCE>
followTail = 1
0 Karma

nareshinsvu
Builder

:::::::::::::::::::Work around::::::::::::

Monitor JSON of 1.log - configure input, props and transforms at Forwarder end to push data to the Indexer
Monitor Non-json of same 1.log - configure input, props and transforms at Indexer end to pull data from Forwarder

I am not sure if this a recommended approach. Splunkexperts - please suggest

0 Karma

sandyIscream
Communicator

@nareshinsvu Please go through the following document and let me know if it helps!

https://docs.splunk.com/Documentation/Splunk/6.2.0/Data/Advancedsourcetypeoverrides

0 Karma

nareshinsvu
Builder

Hi @sandyIscream - This doesn't help as myjson of my props doesn't need transforms.conf. So, I cant use transforms regex and seperate json events to a different index / sourcetype.

A working example of the config will actually help me to try and test

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!

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 ...

Step into “Hunt the Insider: An Splunk ES Premier Mystery” to catch a cybercriminal ...

After a whole week of being on call, you fell asleep on your keyboard, and you hit a sequence of buttons that ...