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 Observability as Code: From Zero to Dashboard

For the details on what Self-Service Observability and Observability as Code is, we have some awesome content ...

[Puzzles] Solve, Learn, Repeat: Character substitutions with Regular Expressions

This challenge was first posted on Slack #puzzles channelFor BORE at .conf23, we had a puzzle question which ...

Shape the Future of Splunk: Join the Product Research Lab!

Join the Splunk Product Research Lab and connect with us in the Slack channel #product-research-lab to get ...