Splunk Search

How to compare field with current weeks Monday?

ojtoids
Explorer

These are ticket platform logs with field 'lastupdated' which contains time and date [2022-04-12 12:12:17.160000+00:00] .
Trying to build a weekly chart where only results that contains "lastupdated" after present weeks monday should be displayed. 

Something like 

if ( lastupdated > monday)

Labels (1)
0 Karma
1 Solution

bowesmana
SplunkTrust
SplunkTrust

You want to do something like this

| where strptime(lastupdated, "%F")>relative_time(now(), "@w0")

That is saying 

  • Parse last updated time with %F format (same as %Y-%m-%d)
  • Make sure that time is greater than the previous Sunday (@w0 as relative time to now)

 

View solution in original post

bowesmana
SplunkTrust
SplunkTrust

You want to do something like this

| where strptime(lastupdated, "%F")>relative_time(now(), "@w0")

That is saying 

  • Parse last updated time with %F format (same as %Y-%m-%d)
  • Make sure that time is greater than the previous Sunday (@w0 as relative time to now)

 

Get Updates on the Splunk Community!

Detecting Remote Code Executions With the Splunk Threat Research Team

WATCH NOWRemote code execution (RCE) vulnerabilities pose a significant risk to organizations. If exploited, ...

Enter the Splunk Community Dashboard Challenge for Your Chance to Win!

The Splunk Community Dashboard Challenge is underway! This is your chance to showcase your skills in creating ...

.conf24 | Session Scheduler is Live!!

.conf24 is happening June 11 - 14 in Las Vegas, and we are thrilled to announce that the conference catalog ...