Splunk Search

Ignore milliseconds of _time when grouping

dukeatcoding
Engager

I need to ignore the milliseconds when I group by _time

stats avg(instance_internal) as amount by _time, unit_id, instance_id

Because of the milliseconds there are too much entires in the end.

How do I ignore the ms ?

Tags (1)
1 Solution

somesoni2
Revered Legend

Try this

your base search | bucket span=1s _time |stats avg(instance_internal) as amount by _time, unit_id, instance_id

OR

your base search | eval _time=strptime(strftime(_time,"%F %T"),"%F %T")|stats avg(instance_internal) as amount by _time, unit_id, instance_id

OR

your base search | eval _time=round(_time)|stats avg(instance_internal) as amount by _time, unit_id, instance_id

View solution in original post

somesoni2
Revered Legend

Try this

your base search | bucket span=1s _time |stats avg(instance_internal) as amount by _time, unit_id, instance_id

OR

your base search | eval _time=strptime(strftime(_time,"%F %T"),"%F %T")|stats avg(instance_internal) as amount by _time, unit_id, instance_id

OR

your base search | eval _time=round(_time)|stats avg(instance_internal) as amount by _time, unit_id, instance_id

dukeatcoding
Engager

great thanks 😉 span=1m works also perfect

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