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!

Observe and Secure All Apps with Splunk

  Join Us for Our Next Tech Talk: Observe and Secure All Apps with SplunkAs organizations continue to innovate ...

Splunk Decoded: Business Transactions vs Business IQ

It’s the morning of Black Friday, and your e-commerce site is handling 10x normal traffic. Orders are flowing, ...

Fastest way to demo Observability

I’ve been having a lot of fun learning about Kubernetes and Observability. I set myself an interesting ...