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!

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics GA in US-AWS!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...