Dashboards & Visualizations

show last 7 days trend using date from data field.

koreamit3483
Explorer

I have data coming in which has field as "Log_date" in DD/MM/YYY format. i need to show last 7 days data from today in the dashboard.

I used below to filter last 7 days data, but its not showing as results.

where Log_date>=relative_time(Log_date, "-6d@d")

I need to use date only from the field "Log_date".

Can some one please guide.

Labels (1)
0 Karma

PickleRick
SplunkTrust
SplunkTrust

If you have date as string, you have to parse it first to use it in calculations and comparisons.

Use strptime.

<your search>
| eval Log_timestamp=strptime(Log_date,"%D/%M/%Y")
| where Log_timestamp>...

There are two caveats though

1) In order to find and filter the events splunk has to firstly extract the field from all events from your search range and parse them.

2) If your events have _time completely unrelated to this Log_time field, you have to search from a relatively larger time range.

If this is your primary timestamp in those events, consider reconfiguring sourcetype to parse it as _time.

0 Karma
Get Updates on the Splunk Community!

Fastest way to demo Observability

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

September Community Champions: A Shoutout to Our Contributors!

As we close the books on another fantastic month, we want to take a moment to celebrate the people who are the ...

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