Splunk Search

How to display the time in _time?

nive00
Engager

I need to display the maximum count of users logged in per day (at what time).

I am able to get the max user count from below query. but I am not sure on how to get the time at which maximo user's were logged in.

index=hwm_* sourcetype=was:maximo:sysout UID=* OR uid=* asset_env=PROD  | eval username=coalesce(UID,uid) | timechart span=1h dc(username) as usercount | timechart span=1d max(usercount)
Tags (1)
0 Karma
1 Solution

martin_mueller
SplunkTrust
SplunkTrust

If you want the maximum number of users attempting to login in an hour per day plus the hour that maximum occurred in, try this:

 index=hwm_* sourcetype=was:maximo:sysout UID=* OR uid=* asset_env=PROD  | eval username=coalesce(UID,uid)
| bin _time span=1h | stats dc(username) as users by _time
| bin _time as day span=1d | eventstats max(users) as max by day
| where users=max | fields - day max

Note, this will yield multiple hours per day if the maximum occurs multiple times that day.

View solution in original post

martin_mueller
SplunkTrust
SplunkTrust

If you want the maximum number of users attempting to login in an hour per day plus the hour that maximum occurred in, try this:

 index=hwm_* sourcetype=was:maximo:sysout UID=* OR uid=* asset_env=PROD  | eval username=coalesce(UID,uid)
| bin _time span=1h | stats dc(username) as users by _time
| bin _time as day span=1d | eventstats max(users) as max by day
| where users=max | fields - day max

Note, this will yield multiple hours per day if the maximum occurs multiple times that day.

nive00
Engager

Thank you!

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