<?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: Filter results based on timeframe in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-filter-results-based-on-timeframe/m-p/658615#M227490</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/126376"&gt;@alexspunkshell&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;if period_count=1 means that the event is present only before last 24 hours or inside last 24 hours, but not in both the periods.&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
    <pubDate>Mon, 25 Sep 2023 15:02:50 GMT</pubDate>
    <dc:creator>gcusello</dc:creator>
    <dc:date>2023-09-25T15:02:50Z</dc:date>
    <item>
      <title>How to filter results based on timeframe?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-filter-results-based-on-timeframe/m-p/658588#M227476</link>
      <description>&lt;P&gt;In my search results, I am getting &lt;STRONG&gt;IP and user&lt;/STRONG&gt;&amp;nbsp;details.&lt;/P&gt;
&lt;P&gt;I want to filter my search results if the same IP has been used by any user "&lt;STRONG&gt;*@xyz.com&lt;/STRONG&gt;" in last &lt;STRONG&gt;30 days.&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="alexspunkshell_0-1695646883290.png" style="width: 1313px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/27307iA50D056984CBA0A6/image-dimensions/1313x105?v=v2" width="1313" height="105" role="button" title="alexspunkshell_0-1695646883290.png" alt="alexspunkshell_0-1695646883290.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Sep 2023 16:51:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-filter-results-based-on-timeframe/m-p/658588#M227476</guid>
      <dc:creator>alexspunkshell</dc:creator>
      <dc:date>2023-09-25T16:51:17Z</dc:date>
    </item>
    <item>
      <title>Re: Filter results based on timeframe</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-filter-results-based-on-timeframe/m-p/658591#M227477</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/126376"&gt;@alexspunkshell&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;could you share your search?&lt;/P&gt;&lt;P&gt;anyway, you could run something like this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;your_search&amp;gt;
| eval period=if(_time&amp;gt;now()-86400,"Last 24 hours","Previous")
| stats 
   dc(period) AS period_count 
   values(period) AS period
   latest(if(evalperiod="Last 24 hours",_time,"") AS latest_last_24_hours
   latest(if(evalperiod="Previous",_time,"") AS latest_previous
   BY IP user
| where period_count12 AND period="Previous"
| eval latest_previous=strftime(latest_last_24_hours,"%Y-%m-%d %H:%M:%S")
| table IP user latest_previous&lt;/LI-CODE&gt;&lt;P&gt;Anyway, see my approach and adapt it to your requirements.&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Mon, 25 Sep 2023 13:31:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-filter-results-based-on-timeframe/m-p/658591#M227477</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2023-09-25T13:31:31Z</dc:date>
    </item>
    <item>
      <title>Re: Filter results based on timeframe</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-filter-results-based-on-timeframe/m-p/658592#M227478</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/161352"&gt;@gcusello&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;index=test
eventType IN (security.threat.detected, security.internal.threat.detected)
|rename client.userAgent.rawUserAgent as User_Agent client.geographicalContext.city as Src_City client.geographicalContext.state as src_state client.geographicalContext.country as src_country displayMessage as Threat_Description signature as Signature client.device as Client_Device client.userAgent.browser as Client_Browser
| stats count min(_time) as firstTime max(_time) as lastTime by src_ip user Signature Threat_Description Client_Device eventType Src_Details Src_City User_Agent Client_Browser&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 25 Sep 2023 16:50:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-filter-results-based-on-timeframe/m-p/658592#M227478</guid>
      <dc:creator>alexspunkshell</dc:creator>
      <dc:date>2023-09-25T16:50:31Z</dc:date>
    </item>
    <item>
      <title>Re: Filter results based on timeframe</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-filter-results-based-on-timeframe/m-p/658600#M227479</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/126376"&gt;@alexspunkshell&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;I don't understand the structure of your search,&lt;/P&gt;&lt;P&gt;anyway, the raw "&lt;SPAN&gt;| search NOT idp_user" requires something after the field, otherwise Splunk excludes only events with the string "idp_user".&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;like the following | search NOT idp_accountname IN (*idp*references*): you'll never have results and you cannot check it because you are working with the NOT operator.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;You could modify the stats command using my approach and the following check:&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=test
| rex field=_raw "user (?&amp;lt;idp_user&amp;gt;\d+\S+)"
| search NOT idp_user=* NOT actor.alternateId="*idp*" eventType IN (security.threat.detected, security.internal.threat.detected)
| rex field=debugContext.debugData.url "\S+username\=(?&amp;lt;idp_accountname&amp;gt;\S+idp-references)"
| regex src_ip!="47.37.\d{1,3}.\d{1,3}" 
| search NOT idp_accountname IN ("*idp*references*")
|rename  client.userAgent.rawUserAgent as User_Agent client.geographicalContext.city as Src_City client.geographicalContext.state as src_state client.geographicalContext.country as src_country displayMessage as Threat_Description signature as Signature client.device as Client_Device client.userAgent.browser as Client_Browser
| strcat "Outcome Reason: " outcome.reason ", Outcome Result: " outcome.result Outcome_Details 
| strcat "Source Country: " src_country ", Source State: " src_state  Src_Details
| eval period=if(_time&amp;gt;now()-86400,"Last 24 hours","Previous")
| eventstats 
   dc(period) AS period_count 
   BY IP user
| stats 
   count 
   values(period_count) AS period_count 
   min(_time) as firstTime 
   max(_time) as lastTime 
   by src_ip user Signature Threat_Description Client_Device eventType Src_Details Src_City  Outcome_Details User_Agent Client_Browser outcome.reason
| where period_count=1
| `security_content_ctime(firstTime)`
| `security_content_ctime(lastTime)`
| `okta_threatinsight_suspected_passwordspray_attack_filter` 
| `okta_threatinsight_threat_detected_filter`&lt;/LI-CODE&gt;&lt;P&gt;As I said, try to adapt the approach of my search to your.&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Sep 2023 14:09:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-filter-results-based-on-timeframe/m-p/658600#M227479</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2023-09-25T14:09:05Z</dc:date>
    </item>
    <item>
      <title>Re: Filter results based on timeframe</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-filter-results-based-on-timeframe/m-p/658613#M227489</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/161352"&gt;@gcusello&lt;/a&gt;&amp;nbsp;Thanks for your help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried all the changes in the SPL too. However,&amp;nbsp;&lt;STRONG&gt;period_count&lt;/STRONG&gt; is showing 1.&lt;/P&gt;&lt;P&gt;Hence i am unable to filter in results.&lt;/P&gt;</description>
      <pubDate>Mon, 25 Sep 2023 15:00:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-filter-results-based-on-timeframe/m-p/658613#M227489</guid>
      <dc:creator>alexspunkshell</dc:creator>
      <dc:date>2023-09-25T15:00:00Z</dc:date>
    </item>
    <item>
      <title>Re: Filter results based on timeframe</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-filter-results-based-on-timeframe/m-p/658615#M227490</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/126376"&gt;@alexspunkshell&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;if period_count=1 means that the event is present only before last 24 hours or inside last 24 hours, but not in both the periods.&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Mon, 25 Sep 2023 15:02:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-filter-results-based-on-timeframe/m-p/658615#M227490</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2023-09-25T15:02:50Z</dc:date>
    </item>
    <item>
      <title>Re: Filter results based on timeframe</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-filter-results-based-on-timeframe/m-p/658645#M227499</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/161352"&gt;@gcusello&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For all the results i am getting&amp;nbsp;&lt;STRONG&gt;period_count=1.&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Whereas only a few &lt;STRONG&gt;IP&lt;/STRONG&gt;&amp;nbsp;are used my &lt;STRONG&gt;user="*@xyz.com*"&lt;/STRONG&gt;&amp;nbsp;in the last 30 days.&lt;/P&gt;&lt;P&gt;I want to particularly filter if, the IPs were used by user="*@xyz.com*".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Sep 2023 18:21:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-filter-results-based-on-timeframe/m-p/658645#M227499</guid>
      <dc:creator>alexspunkshell</dc:creator>
      <dc:date>2023-09-25T18:21:59Z</dc:date>
    </item>
    <item>
      <title>Re: Filter results based on timeframe</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-filter-results-based-on-timeframe/m-p/658651#M227500</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/161352"&gt;@gcusello&lt;/a&gt;&amp;nbsp; SPL Used&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=test
|rename  client.userAgent.rawUserAgent as User_Agent client.geographicalContext.city as Src_City client.geographicalContext.state as src_state client.geographicalContext.country as src_country displayMessage as Threat_Description signature as Signature client.device as Client_Device client.userAgent.browser as Client_Browser
| strcat "Outcome Reason: " outcome.reason ", Outcome Result: " outcome.result Outcome_Details  
| strcat "Source Country: " src_country ", Source State: " src_state  Src_Details | eval period=if(_time&amp;gt;now()-86400,"Last 24 hours","Previous")
| eventstats 
   dc(period) AS period_count 
   BY src_ip user
| stats 
   count 
   values(period_count) AS period_count 
   min(_time) as firstTime 
   max(_time) as lastTime 
   by src_ip user Signature Threat_Description Client_Device eventType Src_Details Src_City  Outcome_Details User_Agent Client_Browser outcome.reason&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Sep 2023 18:26:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-filter-results-based-on-timeframe/m-p/658651#M227500</guid>
      <dc:creator>alexspunkshell</dc:creator>
      <dc:date>2023-09-25T18:26:33Z</dc:date>
    </item>
    <item>
      <title>Re: Filter results based on timeframe</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-filter-results-based-on-timeframe/m-p/658713#M227516</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/126376"&gt;@alexspunkshell&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;please try this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=test
|rename  client.userAgent.rawUserAgent as User_Agent client.geographicalContext.city as Src_City client.geographicalContext.state as src_state client.geographicalContext.country as src_country displayMessage as Threat_Description signature as Signature client.device as Client_Device client.userAgent.browser as Client_Browser
| strcat "Outcome Reason: " outcome.reason ", Outcome Result: " outcome.result Outcome_Details  
| strcat "Source Country: " src_country ", Source State: " src_state  Src_Details | eval period=if(_time&amp;gt;now()-86400,"Last 24 hours","Previous")
| eval period=if(_time&amp;gt;now()-86400,"Last 24 hours","Previous")
| stats 
   count 
   dc(period) AS period_count 
   min(_time) as firstTime 
   max(_time) as lastTime 
   values(Signature) AS Signature
   values(Threat_Description) AS Threat_Description 
   values(Client_Device) AS Client_Device
   values(eventType) AS eventType
   values(Src_Details) AS Src_Details
   values(Src_City) AS Src_City
   values(Outcome_Details) AS Outcome_Details
   values(User_Agent) AS User_Agent
   values(Client_Browser) AS Client_Browser
   values(outcome.reason) AS outcome_reason
   by src_ip user 
| where period_count=1&lt;/LI-CODE&gt;&lt;P&gt;You can debug your search deleting the last row.&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Tue, 26 Sep 2023 06:29:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-filter-results-based-on-timeframe/m-p/658713#M227516</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2023-09-26T06:29:56Z</dc:date>
    </item>
  </channel>
</rss>

