Getting Data In

How do you collect log within 1 hour from file log rotate?

hiepdv4
New Member

Dear all,

I have file log access /var/log/secure .
Use log rotate ( setting daily)
I need collect log login fail 3 times on 1 IP within 1 hour from file log /var/log/secure.
I used the following query:

> source="/var/log/secure" sourcetype=linux_secure process=sshd "password for" NOT pam_unix NOT Accepted earliest=-24h latest=now | rex field=_raw "(?Accepted|Failed) password for (?\w+) from (?[0-9A-Fa-f:\.]+)" | stats count by ipaddr | where count >=3

I need support collecting logs with 1 hours
Please support me.

Tags (2)
0 Karma
1 Solution

sudosplunk
Motivator

Use timechart instead of stats, ...| timechart span=1h count by ipaddr | where count>2

OR

Use bin command, index=index source=source | bin _time span=1h |...rest of the search...|stats count by ipaddr | where count >2

View solution in original post

0 Karma

sudosplunk
Motivator

Use timechart instead of stats, ...| timechart span=1h count by ipaddr | where count>2

OR

Use bin command, index=index source=source | bin _time span=1h |...rest of the search...|stats count by ipaddr | where count >2

0 Karma
Get Updates on the Splunk Community!

Index This | When is October more than just the tenth month?

October 2025 Edition  Hayyy Splunk Education Enthusiasts and the Eternally Curious!   We’re back with this ...

Observe and Secure All Apps with Splunk

  Join Us for Our Next Tech Talk: Observe and Secure All Apps with SplunkAs organizations continue to innovate ...

What’s New & Next in Splunk SOAR

 Security teams today are dealing with more alerts, more tools, and more pressure than ever.  Join us for an ...