<?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 How to optimize the current query? in Deployment Architecture</title>
    <link>https://community.splunk.com/t5/Deployment-Architecture/How-to-optimize-the-current-query/m-p/623895#M26444</link>
    <description>&lt;P&gt;&lt;SPAN&gt;Hi&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;hope you are doing good.&lt;/P&gt;
&lt;P&gt;im working on a use case which will trigger if any user is trying to connect from non business country.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;attaching the snap for the query.&lt;/P&gt;
&lt;P&gt;my query&amp;nbsp;&lt;/P&gt;
&lt;P&gt;want to optimize it more if one user is trying is log in from more than 2-3 country than it will trigger.&lt;/P&gt;
&lt;P&gt;can you please help me with the query&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;thanks&amp;nbsp;&lt;/P&gt;
&lt;P&gt;debjit&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="75F75914-F270-48E1-BB99-2FE20B70A9E9.jpeg" style="width: 1591px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/22948iB2B3D6A27380C7E6/image-size/medium?v=v2&amp;amp;px=400" role="button" title="75F75914-F270-48E1-BB99-2FE20B70A9E9.jpeg" alt="75F75914-F270-48E1-BB99-2FE20B70A9E9.jpeg" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt; &lt;/P&gt;</description>
    <pubDate>Fri, 16 Dec 2022 19:47:09 GMT</pubDate>
    <dc:creator>debjit_k</dc:creator>
    <dc:date>2022-12-16T19:47:09Z</dc:date>
    <item>
      <title>How to optimize the current query?</title>
      <link>https://community.splunk.com/t5/Deployment-Architecture/How-to-optimize-the-current-query/m-p/623895#M26444</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Hi&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;hope you are doing good.&lt;/P&gt;
&lt;P&gt;im working on a use case which will trigger if any user is trying to connect from non business country.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;attaching the snap for the query.&lt;/P&gt;
&lt;P&gt;my query&amp;nbsp;&lt;/P&gt;
&lt;P&gt;want to optimize it more if one user is trying is log in from more than 2-3 country than it will trigger.&lt;/P&gt;
&lt;P&gt;can you please help me with the query&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;thanks&amp;nbsp;&lt;/P&gt;
&lt;P&gt;debjit&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="75F75914-F270-48E1-BB99-2FE20B70A9E9.jpeg" style="width: 1591px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/22948iB2B3D6A27380C7E6/image-size/medium?v=v2&amp;amp;px=400" role="button" title="75F75914-F270-48E1-BB99-2FE20B70A9E9.jpeg" alt="75F75914-F270-48E1-BB99-2FE20B70A9E9.jpeg" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt; &lt;/P&gt;</description>
      <pubDate>Fri, 16 Dec 2022 19:47:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Deployment-Architecture/How-to-optimize-the-current-query/m-p/623895#M26444</guid>
      <dc:creator>debjit_k</dc:creator>
      <dc:date>2022-12-16T19:47:09Z</dc:date>
    </item>
    <item>
      <title>Re: need to optimize the current query</title>
      <link>https://community.splunk.com/t5/Deployment-Architecture/How-to-optimize-the-current-query/m-p/623898#M26445</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/243225"&gt;@debjit_k&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;the first possible optimization is to move the search "Keywords="*Audit Success*) in the main search and leave only the search for country at the end of the search.&lt;/P&gt;&lt;P&gt;Then, if possible, try a different string to search because to have asterisk at the beginning of a string isn't efficient.&lt;/P&gt;&lt;P&gt;Then what's the sense of use IP and other fields in a stats command and then dedup by IP, in this way you have a longer search and you loose (or not use) some information,&lt;/P&gt;&lt;P&gt;Then you could put iplocation command after the stats command.&lt;/P&gt;&lt;P&gt;so you could use a different stats:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=sdp_siem_win (host=AZPLTADFS1 OR host=AZPLTADFS1) keywords="*Audit Success*)
| rex "first regex"
| rex "second regex"
| stats values(Username) AS Username values(Keyword) AS Keyword values(EventCode) AS EventCode count BY IP
| iplocation IP 
| search NOT [inputlookup SDP_Country.csv | dedup Country | fields Country]
| table IP Country Username keyword EventCode count&lt;/LI-CODE&gt;&lt;P&gt;Next time, please, don't share your search using a screenshot but put it as text in a Code Sample window.&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>Sat, 10 Dec 2022 09:59:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Deployment-Architecture/How-to-optimize-the-current-query/m-p/623898#M26445</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2022-12-10T09:59:56Z</dc:date>
    </item>
    <item>
      <title>Re: need to optimize the current query</title>
      <link>https://community.splunk.com/t5/Deployment-Architecture/How-to-optimize-the-current-query/m-p/623901#M26446</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Hi&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://community.splunk.com/t5/user/viewprofilepage/user-id/161352" target="_blank" rel="noopener"&gt;@gcusello&lt;/A&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thank you for the updated query but im looking for a query which will only trigger if a single is log from 2 different country&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;example&lt;/P&gt;&lt;P&gt;ip &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; user &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; country&lt;/P&gt;&lt;P&gt;10.0.0.0 &amp;nbsp; &amp;nbsp; &amp;nbsp; debjit &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; india&lt;/P&gt;&lt;P&gt;10.0.0.0 &amp;nbsp; &amp;nbsp; &amp;nbsp; debjit &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; japan&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;can you please help me to fig out the above solution&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;&lt;P&gt;debjit&lt;/P&gt;</description>
      <pubDate>Sat, 10 Dec 2022 10:46:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Deployment-Architecture/How-to-optimize-the-current-query/m-p/623901#M26446</guid>
      <dc:creator>debjit_k</dc:creator>
      <dc:date>2022-12-10T10:46:04Z</dc:date>
    </item>
    <item>
      <title>Re: need to optimize the current query</title>
      <link>https://community.splunk.com/t5/Deployment-Architecture/How-to-optimize-the-current-query/m-p/623902#M26447</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/243225"&gt;@debjit_k&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;please try something like this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=sdp_siem_win (host=AZPLTADFS1 OR host=AZPLTADFS1) keywords="*Audit Success*)
| rex "first regex"
| rex "second regex"
| iplocation IP 
| search NOT [inputlookup SDP_Country.csv | dedup Country | fields Country]
| stats values(IP) AS IP dc(Country) AS Country_count values(Country) AS Country BY Username
| where Country_count&amp;gt;1&lt;/LI-CODE&gt;&lt;P&gt;please, next time share your search as text!&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Sat, 10 Dec 2022 10:53:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Deployment-Architecture/How-to-optimize-the-current-query/m-p/623902#M26447</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2022-12-10T10:53:04Z</dc:date>
    </item>
  </channel>
</rss>

