Splunk Search

Dynamic search for multi sources

Laxman24
Explorer

Hi All,

I need some help in searching,
so I have 1 index but it has multiple sources,

Index = Index1

and within the index, it has few sources

file_2021-05-14.csv
file_2021-05-15.csv
file_2021-05-16.csv

I'd like to make a search that the source will be dynamically depending on today date,

Index=Index1 source = "file_yyyy_mm_dd.csv" 

is this possible?

Thank you!

Labels (2)
0 Karma
1 Solution

kamlesh_vaghela
SplunkTrust
SplunkTrust

@Laxman24 

Can you please try this?

index=index1 [| makeresults | eval source="file_".strftime(now(),"%Y-%m-%d").".csv" | table source]

 

Thanks
KV
▄︻̷̿┻̿═━一

If any of my reply helps you to solve the problem Or gain knowledge, an upvote would be appreciated. 

View solution in original post

kamlesh_vaghela
SplunkTrust
SplunkTrust

@Laxman24 

Can you please try this?

index=index1 [| makeresults | eval source="file_".strftime(now(),"%Y-%m-%d").".csv" | table source]

 

Thanks
KV
▄︻̷̿┻̿═━一

If any of my reply helps you to solve the problem Or gain knowledge, an upvote would be appreciated. 

Laxman24
Explorer

@kamlesh_vaghela 

Hey Thanks!!

yes it worked the way i wanted,

thanks again!

0 Karma
Get Updates on the Splunk Community!

Splunk Observability for AI

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

Splunk Enterprise Security 8.x: The Essential Upgrade for Threat Detection, ...

Watch On Demand the Tech Talk on November 6 at 11AM PT, and empower your SOC to reach new heights! Duration: ...

Splunk Observability as Code: From Zero to Dashboard

For the details on what Self-Service Observability and Observability as Code is, we have some awesome content ...