Splunk Search

Storing a REGEX filed into a DataModel

robertlynch2020
Motivator

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
Motivator

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
Get Updates on the Splunk Community!

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics GA in US-AWS!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...