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!

Splunk Decoded: Service Maps vs Service Analyzer Tree View vs Flow Maps

It’s Monday morning, and your phone is buzzing with alert escalations – your customer-facing portal is running ...

What’s New in Splunk Observability – September 2025

What's NewWe are excited to announce the latest enhancements to Splunk Observability, designed to help ITOps ...

Fun with Regular Expression - multiples of nine

Fun with Regular Expression - multiples of nineThis challenge was first posted on Slack #regex channel ...