Monitoring Splunk

How can I index login events to the web gui?

balbano
Contributor

Hi all,

I noticed 2 things today:

  1. Doesn't look like my indexers are indexing any login events to the GUI.
  2. When going to $splunk_home/var/log/splunk/web-service* , I only see successful login events being logged and not failed login event.

I would like to get both successful and failed login events indexed via Splunk so I can create alerts for multiple failed logins.

Any help you can provide on this would be great.

Thanks.

Brian

Tags (1)
1 Solution

hexx
Splunk Employee
Splunk Employee

Those events are logged to the _audit index and can be retrieved with the following search :

index=_audit action="login attempt" info=failed

View solution in original post

sideview
SplunkTrust
SplunkTrust

UPDATE:

The audit index already tracks everything you should need:

index=_audit action="login attempt" | stats count by user info


ORIGINAL:

1- when a user logs in succcessfully, there's an event that happens in SplunkWeb's splunk web_service log, that can be matched by the search:

index=_internal sourcetype=splunk_web_service user=* action="login" status="success"

Unfortunately though this log declines to log anything at all when a login fails. Possibly if you change log level to DEBUG it might, but that will make it an extremely chatty log.

2- All of the POST's to the /login endpoint will show up in SplunkWeb's web_access log: for instance many events will match this search:

index=_internal sourcetype="splunk_web_access" POST "/en-US/account/login" status=200

Unfortunately SplunkWeb returns 200 even when login fails (and when it should thus return 401).

From what I've seen, and granted I haven't looked into it very long, there's not a good way of differentiating a failed login event from a successful login event. However there's a bad and messy way that might at least stimulate someone else's thinking on the matter.

index=_internal ( sourcetype=splunk_web_service user=* action="login" status="success") OR ( sourcetype="splunk_web_access" POST "/en-US/account/login" status=200 ) | eval loginstatus=if(sourcetype="splunk_web_service",status,loginstatus) | transaction clientip endswith="sourcetype=splunk_web_access" | fillnull loginstatus value="failed" | fillnull user value="unknown" | stats count by user loginstatus clientip

balbano
Contributor

Good to know!!! Thanks Nick!!!

0 Karma

hexx
Splunk Employee
Splunk Employee

Those events are logged to the _audit index and can be retrieved with the following search :

index=_audit action="login attempt" info=failed

balbano
Contributor

awesome!!! Thanks dude!!!

0 Karma

sideview
SplunkTrust
SplunkTrust

index=_audit action="login attempt" info=failed | stats count by user | where count>4

balbano
Contributor

Thanks Hex. Do you know what would be the best way to alert for any user who has failed login more than 5 times? The current query kinda just shows everyone but want to alert for any user who fails more than 5 times. Any assistance you can provide in that would be great.

Thanks.
Brian

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

What Is Splunk? Here’s What You Can Do with Splunk

Hey Splunk Community, we know you know Splunk. You likely leverage its unparalleled ability to ingest, index, ...

Level Up Your .conf25: Splunk Arcade Comes to Boston

With .conf25 right around the corner in Boston, there’s a lot to look forward to — inspiring keynotes, ...

Manual Instrumentation with Splunk Observability Cloud: How to Instrument Frontend ...

Although it might seem daunting, as we’ve seen in this series, manual instrumentation can be straightforward ...