Splunk Search

How to join 2 datamodels searches with different timeranges

fernandopaixao
New Member

Hi everyone,

I need to join two different searches using different time ranges in the alert search.
Normally the earliest parameter would solve it but the following syntax doesn't work

| datamodel dm-evaluation evaluation search earliest=@d

Do you know how to solve it?

Thank you

Tags (1)
0 Karma

woodcock
Esteemed Legend

Fist of all, I wouldn't use | datamodel because it was recently broken and no longer returns all fields (only the ones in the datamodel). Instead use the macro described here (it will need adjustment because it is hard-coded for CIM):

https://answers.splunk.com/answers/716936/splunk-server-field-is-not-available-when-we-searc.html#an...

Then you can use as many time specifier clauses as you can like this:

`SIEMMacro_datamodel(dm-evaluation, dm-evaluation)` evaluation search ((earliest=e1 latest=l1) OR (earliest=e2 latest=l2) OR ... OR (earliest=eZ latest=lZ))
0 Karma

to4kawa
Ultra Champion

How long are the two search periods?
There is the way that

Time range can be covered two data models,
Search by `summariesonly = t` and `timechart` ,
Create flag (e.g. datamodelA or datamodelB)  ,
Combine the two search results by `append`, 
Select time and data model(flag) by `where`

How about this?

0 Karma
Get Updates on the Splunk Community!

Splunk + ThousandEyes: Correlate frontend, app, and network data to troubleshoot ...

 Are you tired of troubleshooting delays caused by siloed frontend, application, and network data? We've got a ...

Splunk Observability for AI

Don’t miss out on an exciting Tech Talk on Splunk Observability for AI!Discover how Splunk’s agentic AI ...

🔐 Trust at Every Hop: How mTLS in Splunk Enterprise 10.0 Makes Security Simpler

From Idea to Implementation: Why Splunk Built mTLS into Splunk Enterprise 10.0  mTLS wasn’t just a checkbox ...