Getting Data In

Timestmap extraction for multiple events in single sourcetype

darshm
New Member

Hi folks,
I have a use case where I am having different types of events in a single sourcetype. I want to apply different timestamp extractions for both the events.
I am using TIME_PREFIX and MAX_TIMESTAMP_LOOKAHEAD to extract the timestamp from event #1. However, the same rules won't be useful for event #2.

Is there a way to extract the timestamp values from both the events in a single sourcetype?

Event #1 Timestamp should be extracted as (Oct  9 23:57:37.887)
Oct 10 05:27:48 192.168.100.1 593155: *Oct  9 23:57:37.887: blah blah blah

Event #2 Timestamp should be extracted as (Feb 13 11:27:46)
Feb 13 11:27:46 100.80.8.22 %abc-INFO-000: blah blah blah

TIME_PREFIX = \s[^\s]+\s\d{1,3}.\d{1,3}.\d{1,3}.\d{1,3}\s[^\s]+:\s|\s[^\s]+\s\d{1,3}.\d{1,3}.\d{1,3}.\d{1,3}\s

MAX_TIMESTAMP_LOOKAHEAD = 30
Labels (2)
0 Karma

darshm
New Member
Hi @gcusello @ITWhisperer , Thanks for your response.
 
Regarding the solution which you are recommending, I agree to your point. Ideally, the sourcetypes should be different for different types of events.

However, in our case, we are having parent-child relationship of the sourcetypes. We are bifurcating the child sourcetype from the parent sourcetype.
We observed that the TIME_PREFIX extractions were not getting applied if we defined them in the child stanza. Seems like Splunk first performs the timestamp extractions from parent and then the renaming of the sourcetype happens.

So, we are trying to figure out a way in which we can handle multiple event format in the parent sourcetype stanza itself.
0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi @darshm ,

if you're sure that in your events there's only one date and time, you could leave Splunk to choose the timestamp, but, my hint is the same of @ITWhisperer : different formats should have different sourcetypes, eventually with a similar name (e.g. for fortinet there are fortigate_events, fortigate_logs, fortigate_utm, etc...).

Ciao.

Giuseppe

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

The short answer is that the different log formats should be in different sourcetypes.

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!

Kick the Tires Before You Commit: A Hands-On Tour of the Splunk Observability Cloud ...

Evaluating an enterprise observability platform usually goes like this: fill out a form, get a free trial with ...

Deep insights, no barriers: Splunk Observability Cloud Free Edition

As software delivery cycles continue to accelerate, observability shouldn’t be a luxury — it should be a ...

Monitoring AI Agents with Splunk Observability Cloud

Let’s say I’m running a travel planning AI app in production. A user asks for three concise hotel options in ...