Splunk Search

splunk

Siddharthnegi
Contributor

lets say i have a query which is giving no result at present date but may give in future . 
In this query I have calculated timeval = strftime(_time,"%y-%m-%d")  , since there is not data coming so "_time" will be empty hence timeval does not give any result . But still I have to show timeval with the help of present time , how can i do that .
 i also used at the end of query appendpipe[stats count| where count==0
 eval timeval=strftime(now(),%d/%m/%Y) | where count==0] but still no result.

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Your time format string should be in double quotes

| makeresults
| where false()
| appendpipe
    [stats count
    | where count=0
    | eval timeval=strftime(now(), "%d/%m/%Y")
    | where count = 0]
0 Karma

Siddharthnegi
Contributor

sorry , I have put them in double inverted commas , still no results

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

If you run the code snippet I shared, you should see results i.e. it works. This seems to imply that there is something else going on in your search which is causing you to have no results. Please share your full search in a code block </>

0 Karma
Get Updates on the Splunk Community!

Splunk Mobile: Your Brand-New Home Screen

Meet Your New Mobile Hub  Hello Splunk Community!  Staying connected to your data—no matter where you are—is ...

Introducing Value Insights (Beta): Understand the Business Impact your organization ...

Real progress on your strategic priorities starts with knowing the business outcomes your teams are delivering ...

Enterprise Security (ES) Essentials 8.3 is Now GA — Smarter Detections, Faster ...

As of today, Enterprise Security (ES) Essentials 8.3 is now generally available, helping SOC teams simplify ...