Getting Data In

Date

Khuzair81
Path Finder

I want to get the data only from yesterday Date is there anyway to write it in Query

Can i use  | where Date=-1d@d

 

I'm trying | eval today=strftime(now(), "%d")   | where Date=Today-1

Labels (1)
0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi @Khuzair81,

to take only the yesterday events, you have to add to your main search the time variables earliest and latest, something like this:

index=your_index earliest=-d@d latest=@d
| ...

Ciao.

Giuseppe

0 Karma

Khuzair81
Path Finder

Hi @gcusello there is field value in events like every day there are new events and some of them is updating from past few days so i just wanted the new events that came in yesterday. So i want to compare a field value with yesterday

0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi @Khuzair81,

in this case you can use eval:

| eval yesterday_start=relative_time(now(),"-1d@d"), yesterday_end=yesterday_start+86400

in this way you have the time borders of yesterday (in epochtime) and you can transform your Date in epochtime and filter your events.

Ciao.

Giuseppe

0 Karma
Get Updates on the Splunk Community!

Built-in Service Level Objectives Management to Bridge the Gap Between Service & ...

Wednesday, May 29, 2024  |  11AM PST / 2PM ESTRegister now and join us to learn more about how you can ...

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer Certification at ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...

Share Your Ideas & Meet the Lantern team at .Conf! Plus All of This Month’s New ...

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