Splunk Search

How to sort events in ascending order by date with the correct date format?

abovebeyond
Communicator

Hello,

I'm trying to order specific events from our application log for visualization.

search string :

index="applicationlogsindex" Credit card was declined | stats count as NumEvents by date_mday

i have 2 problems :

1) for some reason the dates are ordered by the first number.
how can i sort it by the the correct date in ascending order?

2) the date shown up is just a single number. For example today is the 15th, i need a date like DD\MM

Thanks

Tags (4)
0 Karma
1 Solution

fdi01
Motivator

1) to ascending order, use sort command like this:

index="applicationlogsindex" Credit card was declined | stats count as NumEvents by date_mday|sort  date_mday

2) to shown up the date, use _time field like this:

index="applicationlogsindex" Credit card was declined | stats count as NumEvents by _time

or

index="applicationlogsindex" Credit card was declined|sort _time|eval  date_mday=_time| stats count as NumEvents by date_mday

View solution in original post

fdi01
Motivator

1) to ascending order, use sort command like this:

index="applicationlogsindex" Credit card was declined | stats count as NumEvents by date_mday|sort  date_mday

2) to shown up the date, use _time field like this:

index="applicationlogsindex" Credit card was declined | stats count as NumEvents by _time

or

index="applicationlogsindex" Credit card was declined|sort _time|eval  date_mday=_time| stats count as NumEvents by date_mday

abovebeyond
Communicator

Thanks !

0 Karma
Get Updates on the Splunk Community!

What's new in Splunk Cloud Platform 9.1.2312?

Hi Splunky people! We are excited to share the newest updates in Splunk Cloud Platform 9.1.2312! Analysts can ...

What’s New in Splunk Security Essentials 3.8.0?

Splunk Security Essentials (SSE) is an app that can amplify the power of your existing Splunk Cloud Platform, ...

Let’s Get You Certified – Vegas-Style at .conf24

Are you ready to level up your Splunk game? Then, let’s get you certified live at .conf24 – our annual user ...