Splunk Search

How to convert timestamp to date for below timestamp to just date 2022-10-04?

monicateja
Explorer

How can i convert timestamp to date for below timestamp to just date 2022-10-04.

timestamp: 2022-10-04 19:52:00.151 -0500

Requirement is to visualize values in last 7 days based on date

 

Labels (1)
0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi @monicateja,

do you want to display data in a timechart command or what else (table, stats)?

if in timechart command, you have to insert in the timechart the option "span=1d"

If in table or in stats command, you have to use the bin command.

| bin span=1d _time

Ciao.

Giuseppe

0 Karma

monicateja
Explorer

Need both in table & also in stats but need to filter by just date not by entire timestamp

0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi @monicateja,

with the bin command (for more infos see at https://docs.splunk.com/Documentation/Splunk/9.0.1/SearchReference/Bin9 you give to each event a timestamp compressed to the 00:00:00.

so you can group them.

To display a timestamp without time in the format you like, you can use eval strftime

| timestamp=strftime(_time,"%Y-%m-%d")

 Ciao.

Giuseppe

0 Karma
Get Updates on the Splunk Community!

Webinar Recap | Revolutionizing IT Operations: The Transformative Power of AI and ML ...

The Transformative Power of AI and ML in Enhancing Observability   In the realm of IT operations, the ...

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...