Splunk Search

How can i use Global Time Picker in my search

gauravkumar85
Path Finder

 I have dataset which have field INSERT_DATE now i want to perform search based the date which is match with Global Time Picker

gauravkumar85_0-1732814482612.png

Search what i want to is 

index = ******* host=transaction source=prd | spath
| mvexpand message
| rename message as _raw
| fields - {}.* ``` optional ```
| spath path={}
| mvexpand {}
| fields - _* ``` optional ```
| spath input={}
| search TARGET_SYSTEM="EAS"
| eval _time=strptime(INSERT_DATE, "%m/%d/%Y")
| chart sum(TRANSACTION_COUNT) as TRANSACTION_COUNT by INSERT_DATE
| where INSERT_DATE =strftime($global_time.latest$, "%m/%d/%Y")  

0 Karma
1 Solution

PickleRick
SplunkTrust
SplunkTrust

I think @marnall meant

| where _time=info_max_time

(Or whatever other meta field) instead of eval.

View solution in original post

PickleRick
SplunkTrust
SplunkTrust

The $notation$ is only used within dashboards and with map command and it's substituted with a value before a (sub)search is spawned. The normal search interface doesn't have this functionality. You need to use @marnall 's way to add the search metadata to the results.

0 Karma

marnall
Motivator

You could use the addinfo command then use the info_min_time field to contain the epoch time of your earliest time boundary in your time picker:

<your search>
| addinfo
| eval _time = info_min_time

gauravkumar85
Path Finder

i modified my search  but not getting any result 

index = ****** host=transaction source=prd | spath
| mvexpand message
| rename message as _raw
| fields - {}.* ``` optional ```
| spath path={}
| mvexpand {}
| fields - _* ``` optional ```
| spath input={}
| search TARGET_SYSTEM="EAS"
| chart sum(TRANSACTION_COUNT) as TRANSACTION_COUNT by INSERT_DATE
| addinfo
| eval _time =info_min_time
| where INSERT_DATE=_time

My ROW Data:

[{"ID":"115918","TARGET_SYSTEM":"EAS","REVIEW":"CPW_00011H","TOTAL_INVENTORY":0,"TOTAL_HITS":0,"TRANSACTION_TYPE":"MQ","TRANSACTION_NAME":"HO620I","TRANSACTION_COUNT":4,"PROCESS_DATE":"11/26/2024","INSERT_DATE":"11/27/2024"}
,{"ID":"115919","TARGET_SYSTEM":"EAS","REVIEW":"CPW_00011H","TOTAL_INVENTORY":0,"TOTAL_HITS":0,"TRANSACTION_TYPE":"MQ","TRANSACTION_NAME":"HO626I","TRANSACTION_COUNT":39,"PROCESS_DATE":"11/26/2024","INSERT_DATE":"11/27/2024"}]

When i am not using where condition its giving me data. 

index = **** host=transaction source=prd | spath
| mvexpand message
| rename message as _raw
| fields - {}.* ``` optional ```
| spath path={}
| mvexpand {}
| fields - _* ``` optional ```
| spath input={}
| search TARGET_SYSTEM="EAS"
| chart sum(TRANSACTION_COUNT) as TRANSACTION_COUNT by INSERT_DATE
| addinfo
| eval _time =info_min_time 

gauravkumar85_0-1732820840869.png

 

0 Karma

PickleRick
SplunkTrust
SplunkTrust

I think @marnall meant

| where _time=info_max_time

(Or whatever other meta field) instead of eval.

gauravkumar85
Path Finder

finally its working . Thank you all for your help 

| mvexpand message
| rename message as _raw
| fields - {}.* ``` optional ```
| spath path={}
| mvexpand {}
| fields - _* ``` optional ```
| spath input={}
| search TARGET_SYSTEM="EAS"
| eval lookupfiledatestart =strftime(INSERT_DATE,"%m/%d/%Y") | addinfo | eval _time = strftime(info_min_time,"%m/%d/%Y")
| where _time=INSERT_DATE
| chart sum(TRANSACTION_COUNT) as TRANSACTION_COUNT by INSERT_DATE
0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Community Content Calendar, September edition

Welcome to another insightful post from our Community Content Calendar! We're thrilled to continue bringing ...

Splunkbase Unveils New App Listing Management Public Preview

Splunkbase Unveils New App Listing Management Public PreviewWe're thrilled to announce the public preview of ...

Leveraging Automated Threat Analysis Across the Splunk Ecosystem

Are you leveraging automation to its fullest potential in your threat detection strategy?Our upcoming Security ...