<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Splunk GUI User Audit needed for LogIn and LogOut in Security</title>
    <link>https://community.splunk.com/t5/Security/Splunk-GUI-User-Audit-needed-for-LogIn-and-LogOut/m-p/488771#M11214</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I have a need for auditing Splunk GUI Users for auditing. Our configuration is with LDAP and SSO. Therefore, _audit and _internal indexes won't work  so I am using below REST unless advised otherwise.&lt;/P&gt;

&lt;P&gt;I need User LogIn data for time frame in AGe section in below SPL. This should also include the users who have not LoggedIn/Used Splunk.&lt;/P&gt;

&lt;P&gt;Fields to include:&lt;/P&gt;

&lt;P&gt;User Name&lt;BR /&gt;
User Email&lt;BR /&gt;
User Role&lt;BR /&gt;
Time Accessed/Log In&lt;BR /&gt;
Time Accessed/Log Out&lt;BR /&gt;
Total Logged Session Duration&lt;BR /&gt;
Last LogIn&lt;BR /&gt;
Splunk Server&lt;BR /&gt;
Client/User IP&lt;BR /&gt;
Time Passed/Age since Last LogIn&lt;/P&gt;

&lt;P&gt;REST used:&lt;BR /&gt;
| rest /services/authentication/httpauth-tokens&lt;BR /&gt;
| search userName!="splunk-system-user"&lt;/P&gt;

&lt;H2&gt;| table splunk_server, id, searchId, userName, timeAccessed&lt;/H2&gt;

&lt;P&gt;_audit and _internal indexes used:&lt;/P&gt;

&lt;P&gt;Sample timestamp value: 09-19-2019 07:08:41.775&lt;BR /&gt;
Sample _time value: 2019-09-19 03:08:41.775&lt;BR /&gt;
(There is a difference noticed between timestamp and _time. It might be because of actual occurrence of event v/s the time Splunk data ingestion/event time. Also need assistance stripping these fields as appropriate)&lt;/P&gt;

&lt;P&gt;index=_audit sourcetype=audittrail "action=login attempt"&lt;BR /&gt;
| rename info as status&lt;/P&gt;

&lt;P&gt;| replace succeeded with success in status&lt;BR /&gt;
| replace failed with failure in status&lt;BR /&gt;
| replace "login attempt" with login in action&lt;/P&gt;

&lt;P&gt;| stats count by user host action status timestamp, _time&lt;/P&gt;

&lt;P&gt;| append [search index=_internal sourcetype=splunk_web_service "action=login attempt"&lt;BR /&gt;
| stats count by user host action status timestamp _time]&lt;/P&gt;

&lt;P&gt;| join type=OUTER user [search index=_internal (component=UiAuth OR sourcetype=splunk_web_service)&lt;BR /&gt;
| stats first(host) as host by user]&lt;/P&gt;

&lt;P&gt;| eval age=ceiling((now()-strptime(_time,"%Y-%m-%d %H:%M:%S.%3N"))/86400)&lt;BR /&gt;
| eval Session_Age=case(&lt;BR /&gt;
age&amp;lt;30,"1_Less than 30 Days",&lt;BR /&gt;
age&amp;gt;=365,"7_Older than 1 Year",&lt;BR /&gt;
age&amp;gt;=180,"6_Older than 180 Days",&lt;BR /&gt;
age&amp;gt;=120,"5_Older than 120 Days",&lt;BR /&gt;
age&amp;gt;=90,"4_Older than 90 Days",&lt;BR /&gt;
age&amp;gt;=60,"3_Older than 60 Days",&lt;BR /&gt;
age&amp;gt;=30,"2_Older than 30 Days",&lt;BR /&gt;
0==0,"8_No Age Data")&lt;/P&gt;

&lt;P&gt;| table timestamp, _time, Session_Age, user, host, action, status, count&lt;/P&gt;

&lt;P&gt;Goal is to have details of users that have not logged in or are not here any more and delete their unused artifacts e.g. AdHoc dashboards, reports, lookups etc. to remove clutter. Splunk ES is not the option on the table at the moment. I am executing above commands on Search Heads but they are not giving me what I need. What am I missing? Thanks in Advance!!!&lt;/P&gt;</description>
    <pubDate>Wed, 30 Sep 2020 02:19:16 GMT</pubDate>
    <dc:creator>mbasharat</dc:creator>
    <dc:date>2020-09-30T02:19:16Z</dc:date>
    <item>
      <title>Splunk GUI User Audit needed for LogIn and LogOut</title>
      <link>https://community.splunk.com/t5/Security/Splunk-GUI-User-Audit-needed-for-LogIn-and-LogOut/m-p/488771#M11214</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I have a need for auditing Splunk GUI Users for auditing. Our configuration is with LDAP and SSO. Therefore, _audit and _internal indexes won't work  so I am using below REST unless advised otherwise.&lt;/P&gt;

&lt;P&gt;I need User LogIn data for time frame in AGe section in below SPL. This should also include the users who have not LoggedIn/Used Splunk.&lt;/P&gt;

&lt;P&gt;Fields to include:&lt;/P&gt;

&lt;P&gt;User Name&lt;BR /&gt;
User Email&lt;BR /&gt;
User Role&lt;BR /&gt;
Time Accessed/Log In&lt;BR /&gt;
Time Accessed/Log Out&lt;BR /&gt;
Total Logged Session Duration&lt;BR /&gt;
Last LogIn&lt;BR /&gt;
Splunk Server&lt;BR /&gt;
Client/User IP&lt;BR /&gt;
Time Passed/Age since Last LogIn&lt;/P&gt;

&lt;P&gt;REST used:&lt;BR /&gt;
| rest /services/authentication/httpauth-tokens&lt;BR /&gt;
| search userName!="splunk-system-user"&lt;/P&gt;

&lt;H2&gt;| table splunk_server, id, searchId, userName, timeAccessed&lt;/H2&gt;

&lt;P&gt;_audit and _internal indexes used:&lt;/P&gt;

&lt;P&gt;Sample timestamp value: 09-19-2019 07:08:41.775&lt;BR /&gt;
Sample _time value: 2019-09-19 03:08:41.775&lt;BR /&gt;
(There is a difference noticed between timestamp and _time. It might be because of actual occurrence of event v/s the time Splunk data ingestion/event time. Also need assistance stripping these fields as appropriate)&lt;/P&gt;

&lt;P&gt;index=_audit sourcetype=audittrail "action=login attempt"&lt;BR /&gt;
| rename info as status&lt;/P&gt;

&lt;P&gt;| replace succeeded with success in status&lt;BR /&gt;
| replace failed with failure in status&lt;BR /&gt;
| replace "login attempt" with login in action&lt;/P&gt;

&lt;P&gt;| stats count by user host action status timestamp, _time&lt;/P&gt;

&lt;P&gt;| append [search index=_internal sourcetype=splunk_web_service "action=login attempt"&lt;BR /&gt;
| stats count by user host action status timestamp _time]&lt;/P&gt;

&lt;P&gt;| join type=OUTER user [search index=_internal (component=UiAuth OR sourcetype=splunk_web_service)&lt;BR /&gt;
| stats first(host) as host by user]&lt;/P&gt;

&lt;P&gt;| eval age=ceiling((now()-strptime(_time,"%Y-%m-%d %H:%M:%S.%3N"))/86400)&lt;BR /&gt;
| eval Session_Age=case(&lt;BR /&gt;
age&amp;lt;30,"1_Less than 30 Days",&lt;BR /&gt;
age&amp;gt;=365,"7_Older than 1 Year",&lt;BR /&gt;
age&amp;gt;=180,"6_Older than 180 Days",&lt;BR /&gt;
age&amp;gt;=120,"5_Older than 120 Days",&lt;BR /&gt;
age&amp;gt;=90,"4_Older than 90 Days",&lt;BR /&gt;
age&amp;gt;=60,"3_Older than 60 Days",&lt;BR /&gt;
age&amp;gt;=30,"2_Older than 30 Days",&lt;BR /&gt;
0==0,"8_No Age Data")&lt;/P&gt;

&lt;P&gt;| table timestamp, _time, Session_Age, user, host, action, status, count&lt;/P&gt;

&lt;P&gt;Goal is to have details of users that have not logged in or are not here any more and delete their unused artifacts e.g. AdHoc dashboards, reports, lookups etc. to remove clutter. Splunk ES is not the option on the table at the moment. I am executing above commands on Search Heads but they are not giving me what I need. What am I missing? Thanks in Advance!!!&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 02:19:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Security/Splunk-GUI-User-Audit-needed-for-LogIn-and-LogOut/m-p/488771#M11214</guid>
      <dc:creator>mbasharat</dc:creator>
      <dc:date>2020-09-30T02:19:16Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk GUI User Audit needed for LogIn and LogOut</title>
      <link>https://community.splunk.com/t5/Security/Splunk-GUI-User-Audit-needed-for-LogIn-and-LogOut/m-p/488772#M11215</link>
      <description>&lt;P&gt;After looking into several factors explained in the question above, I ended up looking at the user's last search activities to consider an anchor of user's last time access. Used below query to produce results:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=_audit host="*sh*" action=search
| stats latest(_time) as _time by user, host, search
| sort _time, user Desc
| dedup user
| fields user, host, search, _time
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 29 Sep 2019 12:15:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Security/Splunk-GUI-User-Audit-needed-for-LogIn-and-LogOut/m-p/488772#M11215</guid>
      <dc:creator>mbasharat</dc:creator>
      <dc:date>2019-09-29T12:15:44Z</dc:date>
    </item>
  </channel>
</rss>

