Splunk Search

Problems using where command to compare times and filter results

rjashton
Engager

I'm having trouble with using the where command to compare times. The search that I'm running is this:

 

 

 

index=jamf sourcetype=JamfModularInput "computer.general.last_contact_time_epoch"=* "computer.general.last_contact_time_epoch"!=0| dedup computer.pagination.serial_number 
| rename computer.general.last_contact_time_epoch as checkinepoch  
| eval thirtydays=relative_time(now(),"-30d")
| rename computer.general.last_contact_time as "Last Check-In"
| where "thirtydays">"checkinepoch" 
| table thirtydays,checkinepoch,"Last Check-In"

 

The problem I have is that it returns no results with the where command being using less than (<), and then if I use greater than (>) it returns all of the results without filtering the ones that I want. Here is an example of the output with that search:Screen Shot 2021-11-11 at 16.19.28.png
As you can see I am getting results returned where checkinepoch is larger than thirtydays.

Does the where command treat the decimal in the thirtydays number as a multiplation operator (like x*y = xy)? The effect of this could be that it calculates that value as 1634051921 * 000000 = 0 

Super confused by this 😄 please help!

Labels (1)
0 Karma
1 Solution

ITWhisperer
SplunkTrust
SplunkTrust

Your epoch time is in milliseconds and your thirtydays is in seconds which is a factor of 1000 different - either multiply or divide one of them to get to the same units.

View solution in original post

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Your epoch time is in milliseconds and your thirtydays is in seconds which is a factor of 1000 different - either multiply or divide one of them to get to the same units.

0 Karma

rjashton
Engager

I knew I was doing something pretty silly but I just couldn't see! Thanks very much!

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 ...