Splunk Search

Storing a REGEX filed into a DataModel

robertlynch2020
Influencer

Hi All

I am looking for the best approach to an issues i have.

I have multiple files that start with the following.

mxtiming_<PID>_<HOST>_<NPID>.log                                                 
mxtiming_acg_<NPID>.log                                                                        
mxtiming_dap_<PID>_<HOST>_<NPID>.log  

etc...

So i have worked out the REGEX to take in all the strings into a DataModel.

(?<MX_TIMING_STRING>mxtiming\S*)\.log

From this i then create multiple additional fields off the "MX_TIMING_STRING" with regex again.

mxtiming_(?<STANDARD>\d*_[^_]*_\d*)
mxtiming_(?<ACCOUNTING>acg_\d*)
mxtiming_(?<DATAPUBLISHER>dap_*_\d*_[^_]*_\d*)

What i am trying to to is to get one type MXTIMING.TYPE to be = to STANDARD or ACCOUNTING or DATAPUBLISHER etc.. As pending on the regex it can only be one. So I want to store in the Datamodel the type type of file it is.

I have tried a few things. Like the eval functions + regex but nothing is working...

if(isnull(STANDARD),NONE ,"STANDARD")
if(isnull(ACCOUNTING),NONE ,"ACCOUNTING")
if(isnull(DATAPUBLISHER),NONE ,"DATAPUBLISHER")
...

Any ideas 🙂

0 Karma

robertlynch2020
Influencer

Hi

I have found a Hardcoded solution to this, that i am 50-50 with.

I have created multiple datamodles tables each filling in the blanks bit by bit and then i pass it on to the next datamodel.
So it is like filling in the swiss cheese, hower the only issue is when a new MXTIMING COMES along i will have to update the datamodel with new REGEX. This is the bit i dont like.

if(isnull(WAREHOUSE),NULL,"WAREHOUSE")
if(isnull(TYPE), if(isnull(RATE_CURVE),NULL,"RATE_CURVE"),TYPE)
if(isnull(TYPE2), if(isnull(REALTIMEREFRESH),NULL,"REALTIMEREFRESH"),TYPE2)
if(isnull(TYPE3), if(isnull(TRADE_REPOSITORY_ENGINE),NULL,"TRADE_REPOSITORY_ENGINE"),TYPE3)
if(isnull(TYPE4), if(isnull(OBJECT_REPOSITORY_RISK_ENGINE),NULL,"OBJECT_REPOSITORY_RISK_ENGINE"),TYPE4)
if(isnull(TYPE5), if(isnull(DATAPUBLISHER),NULL,"DATAPUBLISHER"),TYPE5)
if(isnull(TYPE6), if(isnull(ACCOUNTING),NULL,"ACCOUNTING"),TYPE6)
if(isnull(TYPE7), if(isnull(STANDARD),NULL,"STANDARD"),TYPE7)

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