<?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: How can I create a query where I can show whether a user has or hasn't logged in within the last 90 days and create a visualization of my results? in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/How-can-I-create-a-query-where-I-can-show-whether-a-user-has-or/m-p/299053#M56564</link>
    <description>&lt;P&gt;For example, it is calculated in this way.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|noop|stats count as text|eval text="19-Feb-17 09:55:05 AM"
|eval lastlogontime=strptime(text,"%d-%b-%y")
|eval timediff_s=now()-lastlogontime
|eval timediff_day=floor(timediff_s/60/60/24)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 20 Feb 2018 05:01:41 GMT</pubDate>
    <dc:creator>HiroshiSatoh</dc:creator>
    <dc:date>2018-02-20T05:01:41Z</dc:date>
    <item>
      <title>How can I create a query where I can show whether a user has or hasn't logged in within the last 90 days and create a visualization of my results?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-can-I-create-a-query-where-I-can-show-whether-a-user-has-or/m-p/299050#M56561</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I am trying to write a search for figuring out whether a user has logged in within the last 90 days.  At the end of the process, I want to show some visualization showing the number of users that have logged in in the last 90 days and the number of users that haven't logged in in the last 90 days.  &lt;/P&gt;

&lt;P&gt;The log file is a PowerShell generated CSV file (doing a get-aduser with various selects). One of those variables is "LastLogonDate".  The CSV inputs this as "19-Feb-18 2:28:46 PM" for example.  I have extracted from this the date so have an extracted field called "DateLastLogon" that shows as "19-Feb-18".&lt;/P&gt;

&lt;P&gt;My calculation is meant to look at this extracted field and compare it to the current time (timenow) and do a count of the number of users where DateLastLogon is greater than 90 days and a second search where the DateLastLogon is less than 90 days.&lt;/P&gt;

&lt;P&gt;To start off with I tried this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="myindex"
| eval lastlogontime=strftime(DateLastLogon,"%d-%b-%y")
| eval timenow=strftime(now(),"%d-%b-%y")
| eval timediff=(timenow-lastlogontime)
| table timediff
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I also tried &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="myindex"
| eval lastlogontime=strftime(DateLastLogon,"%d-%m-%y")
| eval timenow=strftime(now(),"%d-%m-%y")
| eval timediff=(timenow-lastlogontime)
| table timediff
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I am now stuck and require assistance as while both pieces of code will run and not error, I am getting "no results" found &lt;/P&gt;</description>
      <pubDate>Tue, 20 Feb 2018 00:58:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-can-I-create-a-query-where-I-can-show-whether-a-user-has-or/m-p/299050#M56561</guid>
      <dc:creator>willadams</dc:creator>
      <dc:date>2018-02-20T00:58:14Z</dc:date>
    </item>
    <item>
      <title>Re: How can I create a query where I can show whether a user has or hasn't logged in within the last 90 days and create a visualization of my results?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-can-I-create-a-query-where-I-can-show-whether-a-user-has-or/m-p/299051#M56562</link>
      <description>&lt;P&gt;I suggest you try re-running your searches and making them either the last 24 hours, or perhaps even All Time. Are you certain that there is data in the "myindex" that you are searching, for the right time period? Remove the line "| table timediff", what fields are being calculated (lastlogontime, timenow, timediff).&lt;/P&gt;</description>
      <pubDate>Tue, 20 Feb 2018 03:46:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-can-I-create-a-query-where-I-can-show-whether-a-user-has-or/m-p/299051#M56562</guid>
      <dc:creator>sduff_splunk</dc:creator>
      <dc:date>2018-02-20T03:46:58Z</dc:date>
    </item>
    <item>
      <title>Re: How can I create a query where I can show whether a user has or hasn't logged in within the last 90 days and create a visualization of my results?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-can-I-create-a-query-where-I-can-show-whether-a-user-has-or/m-p/299052#M56563</link>
      <description>&lt;P&gt;I get the same result whether it's "24 hours" or "All Time".  There is data in the log that is produced.  For example:&lt;/P&gt;

&lt;P&gt;"CN=User1", "True", "19-Feb-17 09:55:05 AM", "29-Jan-2016 8:35:01 AM", "False", "False"&lt;/P&gt;

&lt;P&gt;This log is just "username", "state", "lastlogon", "passwordlastset", othervariable1, othervariable2&lt;/P&gt;

&lt;P&gt;I extracted fields from this so that lastlogon is just showing "19-Feb-17"&lt;/P&gt;

&lt;P&gt;So my extract field for the information I am interested in is "19-Feb-17".  I am not using the time column from the index input.  &lt;/P&gt;</description>
      <pubDate>Tue, 20 Feb 2018 04:02:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-can-I-create-a-query-where-I-can-show-whether-a-user-has-or/m-p/299052#M56563</guid>
      <dc:creator>willadams</dc:creator>
      <dc:date>2018-02-20T04:02:56Z</dc:date>
    </item>
    <item>
      <title>Re: How can I create a query where I can show whether a user has or hasn't logged in within the last 90 days and create a visualization of my results?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-can-I-create-a-query-where-I-can-show-whether-a-user-has-or/m-p/299053#M56564</link>
      <description>&lt;P&gt;For example, it is calculated in this way.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|noop|stats count as text|eval text="19-Feb-17 09:55:05 AM"
|eval lastlogontime=strptime(text,"%d-%b-%y")
|eval timediff_s=now()-lastlogontime
|eval timediff_day=floor(timediff_s/60/60/24)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 20 Feb 2018 05:01:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-can-I-create-a-query-where-I-can-show-whether-a-user-has-or/m-p/299053#M56564</guid>
      <dc:creator>HiroshiSatoh</dc:creator>
      <dc:date>2018-02-20T05:01:41Z</dc:date>
    </item>
  </channel>
</rss>

