Dashboards & Visualizations

How do you transform a subsearch into a string literal and not SPL?

pcatasus
Engager

I have a token I want to set up when I first init dashboard:
[stats count | eval search=strftime(now(), "mysearch%y%m%d%H%M%S.csv")]
But this gets interpreted dynamically throughout changing the name of the file. I just want to have a timestamp literal I can reuse. Been at it for a while using fieldformat, print, etc. Thanks!

Labels (1)
Tags (1)
0 Karma
1 Solution

manjunathmeti
Champion

You can init strftime(now(), "mysearch%y%m%d%H%M%S.csv") first then use it in the actual token.

<init>
    <eval token="filename">strftime(now(), "mysearch%y%m%d%H%M%S.csv")</eval>
    <set token="search">[stats count | eval search=$filename$]</set>
  </init>

View solution in original post

manjunathmeti
Champion

You can init strftime(now(), "mysearch%y%m%d%H%M%S.csv") first then use it in the actual token.

<init>
    <eval token="filename">strftime(now(), "mysearch%y%m%d%H%M%S.csv")</eval>
    <set token="search">[stats count | eval search=$filename$]</set>
  </init>

pcatasus
Engager

Worked like a charm! Thank you!

0 Karma

manjunathmeti
Champion

Please accept answer.

0 Karma

pcatasus
Engager

Sorry! Done.

0 Karma
Get Updates on the Splunk Community!

Detecting Remote Code Executions With the Splunk Threat Research Team

REGISTER NOWRemote code execution (RCE) vulnerabilities pose a significant risk to organizations. If ...

Observability | Use Synthetic Monitoring for Website Metadata Verification

If you are on Splunk Observability Cloud, you may already have Synthetic Monitoringin your observability ...

More Ways To Control Your Costs With Archived Metrics | Register for Tech Talk

Tuesday, May 14, 2024  |  11AM PT / 2PM ET Register to Attend Join us for this Tech Talk and learn how to ...