Dashboards & Visualizations

search help, token issue

selvam_sekar
Path Finder

Hi,

if i run this query in simple search bar it works fine. However, when i create panel and add the below, i'm getting error as waiting for input.

Please could you advise?

index=hello sourcetype=welcome
| stats max(DATETIME) as LatestTime
| map search="search index=hello sourcetype=welcome DATETIME=$LatestTime$"
| stats sum(HOUSE_TRADE_COUNT) as HOUSE_Trade_Count

Thanks,

selvam.

Labels (1)
0 Karma
1 Solution

ITWhisperer
SplunkTrust
SplunkTrust

Try doubling up the $'s as single $ are for tokens in dashboards.

index=hello sourcetype=welcome
| stats max(DATETIME) as LatestTime
| map search="search index=hello sourcetype=welcome DATETIME=$$LatestTime$$"
| stats sum(HOUSE_TRADE_COUNT) as HOUSE_Trade_Count

View solution in original post

selvam_sekar
Path Finder

Thanks @ITWhisperer .

I also found an issue, if I run this query for yesterday I am getting the result as 44Million count but when I run the search for last 7 days I am getting only 23Million results.

Any suggestion to fix?

index=hello sourcetype=welcome
| stats max(DATETIME) as LatestTime
| map search="search index=hello sourcetype=welcome DATETIME=$$LatestTime$$"
| stats sum(HOUSE_TRADE_COUNT) as HOUSE_Trade_Count
0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Suggestion is "don't use map". Map is an expensive, resource intensive, and slow command. Other ways to achieve this might be

index=hello sourcetype=welcome
| eventstats max(DATETIME) as LatestTime
| where DATETIME=LatestTime
| stats sum(HOUSE_TRADE_COUNT) as HOUSE_Trade_Count
0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Try doubling up the $'s as single $ are for tokens in dashboards.

index=hello sourcetype=welcome
| stats max(DATETIME) as LatestTime
| map search="search index=hello sourcetype=welcome DATETIME=$$LatestTime$$"
| stats sum(HOUSE_TRADE_COUNT) as HOUSE_Trade_Count
Get Updates on the Splunk Community!

Index This | I’m short for "configuration file.” What am I?

May 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with a Special ...

New Articles from Academic Learning Partners, Help Expand Lantern’s Use Case Library, ...

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...

Your Guide to SPL2 at .conf24!

So, you’re headed to .conf24? You’re in for a good time. Las Vegas weather is just *chef’s kiss* beautiful in ...