<?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 Re: Identifying compliant logins - including last login time. in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Identifying-compliant-logins-including-last-login-time/m-p/706788#M239137</link>
    <description>&lt;P&gt;Glad it works out. &amp;nbsp;JSON allows for semantic expression. &amp;nbsp;The more traditional "Splunk" trick is to use string concatenation then split after stats. &amp;nbsp;tojson command is present in all Splunk versions; in this case, it is also very concise.&lt;/P&gt;&lt;P&gt;If you remove the rest of search after that chart, you'll see something like this:&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;_raw&lt;/TD&gt;&lt;TD&gt;false&lt;/TD&gt;&lt;TD&gt;true&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;{"lastLogin":"2024-12-12T23:42:47","userPrincipalName":"yliu"}&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;28&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;{"lastLogin":"2024-12-13T00:58:38","userPrincipalName":"splunk-system-user"}&lt;/TD&gt;&lt;TD&gt;290&lt;/TD&gt;&lt;TD&gt;150&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;The intent is to construct a chart that will render the desired table layout while retaining all the data needed to produce final presentation. (This is why I ask for a mockup table so I know how you want to present data. &amp;nbsp;Presentation does influence solution.)&lt;/P&gt;</description>
    <pubDate>Fri, 13 Dec 2024 23:26:51 GMT</pubDate>
    <dc:creator>yuanliu</dc:creator>
    <dc:date>2024-12-13T23:26:51Z</dc:date>
    <item>
      <title>Identifying compliant logins - including last login time.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Identifying-compliant-logins-including-last-login-time/m-p/706166#M239005</link>
      <description>&lt;P&gt;Working on supplementing a search we are using to implement conditional access policies. The search identifies successful logins and produces a percentage of compliant logins over a period. What I am trying to add, is the last login time which is identified by the "createdDateTime" in the logs.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Here is the current search:&amp;nbsp;&lt;BR /&gt;index="audit" sourcetype="signin" userPrincipalName="*domain.com" status.errorCode=0&lt;BR /&gt;| eval DeviceCompliance='deviceDetail.isCompliant'&lt;BR /&gt;| chart count by userPrincipalName DeviceCompliance&lt;BR /&gt;| eval total=true + false&lt;BR /&gt;| rename true as compliant&lt;BR /&gt;| eval percent=((compliant/total)*100)&lt;BR /&gt;| table userPrincipalName compliant total percent&lt;BR /&gt;&lt;BR /&gt;I have tried adding / modifying pipes like "stats latest(createdDateTime) by userPrincilaName compliant total percent" but this is inserting the time into the true / false fields. I feel that I am modifying the data too much up front and maybe need to change around the piping order perhaps? All suggestions welcomed.&lt;/P&gt;</description>
      <pubDate>Fri, 06 Dec 2024 16:46:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Identifying-compliant-logins-including-last-login-time/m-p/706166#M239005</guid>
      <dc:creator>DLevine_</dc:creator>
      <dc:date>2024-12-06T16:46:41Z</dc:date>
    </item>
    <item>
      <title>Re: Identifying compliant logins - including last login time.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Identifying-compliant-logins-including-last-login-time/m-p/706183#M239010</link>
      <description>&lt;P&gt;Two critical question you haven't answered:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;What is defined as "&lt;SPAN&gt;last login time" in relation to DeviceCompliance? &amp;nbsp;Is it the very last regardless of compliance? &amp;nbsp;Or is it the last time in each compliance state?&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;How do you want to display this value in your presentation? &amp;nbsp;Use a mockup table to illustrate.&lt;/SPAN&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 06 Dec 2024 18:00:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Identifying-compliant-logins-including-last-login-time/m-p/706183#M239010</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2024-12-06T18:00:46Z</dc:date>
    </item>
    <item>
      <title>Re: Identifying compliant logins - including last login time.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Identifying-compliant-logins-including-last-login-time/m-p/706200#M239015</link>
      <description>&lt;P&gt;Thanks for the reply.&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. The logs identify a&amp;nbsp;'&lt;SPAN&gt;createdDateTime' for each login entry. There is no direct relationship to compliance, however, I am searching for successful logins in the search, then defining what percentage of those are compliant.&amp;nbsp; So, here I am trying to get the very last attempt, regardless of compliance.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;2.Ideally the table would look something like this:&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="125"&gt;&lt;P&gt;userPrincipalName&lt;/P&gt;&lt;/TD&gt;&lt;TD width="125"&gt;&lt;P&gt;Compliant&lt;/P&gt;&lt;/TD&gt;&lt;TD width="125"&gt;&lt;P&gt;Total&lt;/P&gt;&lt;/TD&gt;&lt;TD width="125"&gt;&lt;P&gt;Percent&lt;/P&gt;&lt;/TD&gt;&lt;TD width="125"&gt;&lt;P&gt;lastLogin&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="125"&gt;&lt;P&gt;&lt;A href="mailto:Joe.Camel@domain.com" target="_blank"&gt;Joe.Camel@domain.com&lt;/A&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD width="125"&gt;&lt;P&gt;4&lt;/P&gt;&lt;/TD&gt;&lt;TD width="125"&gt;&lt;P&gt;4&lt;/P&gt;&lt;/TD&gt;&lt;TD width="125"&gt;&lt;P&gt;100&lt;/P&gt;&lt;/TD&gt;&lt;TD width="125"&gt;&lt;P&gt;2024-12-06T18:14:50Z&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="125"&gt;&lt;P&gt;&lt;A href="mailto:Drake.Mallard@domain.com" target="_blank"&gt;Drake.Mallard@domain.com&lt;/A&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD width="125"&gt;&lt;P&gt;1&lt;/P&gt;&lt;/TD&gt;&lt;TD width="125"&gt;&lt;P&gt;4&lt;/P&gt;&lt;/TD&gt;&lt;TD width="125"&gt;&lt;P&gt;25&lt;/P&gt;&lt;/TD&gt;&lt;TD width="125"&gt;&lt;P&gt;2024-12-05T22:56:25Z&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="125"&gt;&lt;P&gt;&lt;A href="mailto:Jane.Doe@domain.com" target="_blank"&gt;Jane.Doe@domain.com&lt;/A&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD width="125"&gt;&lt;P&gt;0&lt;/P&gt;&lt;/TD&gt;&lt;TD width="125"&gt;&lt;P&gt;8&lt;/P&gt;&lt;/TD&gt;&lt;TD width="125"&gt;&lt;P&gt;0&lt;/P&gt;&lt;/TD&gt;&lt;TD width="125"&gt;&lt;P&gt;2024-11-25T07:13:22Z&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Where the 'lastLogin' column is the entry for the very last 'createdDateTime' login entry per user.&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 06 Dec 2024 18:43:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Identifying-compliant-logins-including-last-login-time/m-p/706200#M239015</guid>
      <dc:creator>DLevine_</dc:creator>
      <dc:date>2024-12-06T18:43:41Z</dc:date>
    </item>
    <item>
      <title>Re: Identifying compliant logins - including last login time.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Identifying-compliant-logins-including-last-login-time/m-p/706227#M239021</link>
      <description>&lt;P&gt;Now this is a well-defined problem. &amp;nbsp;As you suspected, you will have to manipulate data one way or another &amp;nbsp;if you want this chart format. &amp;nbsp;So here is one option&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index="audit" sourcetype="signin" userPrincipalName="*domain.com" status.errorCode=0
| rename "deviceDetail.isCompliant" as DeviceCompliance
| stats count latest(createdDateTime) as lastLogin by userPrincipalName DeviceCompliance
| eventstats max(lastLogin) as lastLogin by userPrincipalName
| tojson userPrincipalName lastLogin
| chart sum(count) as count over _raw by DeviceCompliance
| fillnull true false
| eval total=true + false
| rename true as compliant
| eval percent=((compliant/total)*100)
| spath
| table userPrincipalName compliant total percent lastLogin&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is an emulation to test this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index = _audit action IN (artifact_deleted, quota)
| eval action = if(action == "quota", "true", "false")
| rename user AS userPrincipalName, action AS DeviceCompliance, _time as createdDateTime
| eval createdDateTime = strftime(createdDateTime, "%FT%H:%M:%S")
``` the above emulates
index="audit" sourcetype="signin" userPrincipalName="*domain.com" status.errorCode=0
| rename "deviceDetail.isCompliant" as DeviceCompliance
```&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Combine these, I get&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;userPrincipalName&lt;/TD&gt;&lt;TD&gt;compliant&lt;/TD&gt;&lt;TD&gt;total&lt;/TD&gt;&lt;TD&gt;percent&lt;/TD&gt;&lt;TD&gt;lastLogin&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;yliu&lt;/TD&gt;&lt;TD&gt;46&lt;/TD&gt;&lt;TD&gt;46&lt;/TD&gt;&lt;TD&gt;100&lt;/TD&gt;&lt;TD&gt;2024-12-05T22:04:13&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;splunk-system-user&lt;/TD&gt;&lt;TD&gt;134&lt;/TD&gt;&lt;TD&gt;392&lt;/TD&gt;&lt;TD&gt;34.183673469387756&lt;/TD&gt;&lt;TD&gt;2024-12-06T03:06:08&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
      <pubDate>Sat, 07 Dec 2024 04:23:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Identifying-compliant-logins-including-last-login-time/m-p/706227#M239021</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2024-12-07T04:23:55Z</dc:date>
    </item>
    <item>
      <title>Re: Identifying compliant logins - including last login time.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Identifying-compliant-logins-including-last-login-time/m-p/706740#M239134</link>
      <description>&lt;P&gt;Thank you, this does work wonderfully.&amp;nbsp;I am still learning and not wanting to be spoon-fed.&amp;nbsp;&lt;BR /&gt;Can you explain why you chose to json at the point you did and what is this portion of the piping doing?&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;| chart sum(count) as count over _raw by DeviceCompliance&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;The rest of it makes complete sense when I work through it out loud.&lt;/P&gt;</description>
      <pubDate>Fri, 13 Dec 2024 14:06:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Identifying-compliant-logins-including-last-login-time/m-p/706740#M239134</guid>
      <dc:creator>DLevine_</dc:creator>
      <dc:date>2024-12-13T14:06:12Z</dc:date>
    </item>
    <item>
      <title>Re: Identifying compliant logins - including last login time.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Identifying-compliant-logins-including-last-login-time/m-p/706788#M239137</link>
      <description>&lt;P&gt;Glad it works out. &amp;nbsp;JSON allows for semantic expression. &amp;nbsp;The more traditional "Splunk" trick is to use string concatenation then split after stats. &amp;nbsp;tojson command is present in all Splunk versions; in this case, it is also very concise.&lt;/P&gt;&lt;P&gt;If you remove the rest of search after that chart, you'll see something like this:&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;_raw&lt;/TD&gt;&lt;TD&gt;false&lt;/TD&gt;&lt;TD&gt;true&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;{"lastLogin":"2024-12-12T23:42:47","userPrincipalName":"yliu"}&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;28&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;{"lastLogin":"2024-12-13T00:58:38","userPrincipalName":"splunk-system-user"}&lt;/TD&gt;&lt;TD&gt;290&lt;/TD&gt;&lt;TD&gt;150&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;The intent is to construct a chart that will render the desired table layout while retaining all the data needed to produce final presentation. (This is why I ask for a mockup table so I know how you want to present data. &amp;nbsp;Presentation does influence solution.)&lt;/P&gt;</description>
      <pubDate>Fri, 13 Dec 2024 23:26:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Identifying-compliant-logins-including-last-login-time/m-p/706788#M239137</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2024-12-13T23:26:51Z</dc:date>
    </item>
  </channel>
</rss>

