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
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

[Puzzles] Solve, Learn, Repeat: Character substitutions with Regular Expressions

This challenge was first posted on Slack #puzzles channelFor BORE at .conf23, we had a puzzle question which ...

Splunk Community Badges!

  Hey everyone! Ready to earn some serious bragging rights in the community? Along with our existing badges ...

[Puzzles] Solve, Learn, Repeat: Matching cron expressions

This puzzle (first published here) is based on matching timestamps to cron expressions.All the timestamps ...