<?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: Looping in SPLUNK Query in Splunk Enterprise</title>
    <link>https://community.splunk.com/t5/Splunk-Enterprise/Looping-in-SPLUNK-Query/m-p/518346#M3293</link>
    <description>&lt;P&gt;there could be many events in a single sourcetype that matches one particular IP, this will create search performance issue and it may take hours/days if you are searching in GBs of data.&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;sourcetype!="IPs" 
    [ search sourcetype="IPs" 
    | stats count by IP 
    | table IP 
    | rename IP as search 
    | format] 
| table sourcetype,_raw&lt;/LI-CODE&gt;&lt;P&gt;The reason for not using IP field in sub search is because your other source types may not have have field IP as I can see you provided only table sourcetype, _raw. The above search will do basic search with just IPs rather than IP and IP_value. we can't group the sourcetype and _raw by IP because IP field could be different in different sourcetypes, if you think IP field is present in all source types, you can add below to the search.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| stats values(sourcetype) as sourcetype values(_raw) as _raw by IP&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;give a thumps up if my answer gives a clue.&lt;/P&gt;</description>
    <pubDate>Tue, 08 Sep 2020 05:48:46 GMT</pubDate>
    <dc:creator>thambisetty</dc:creator>
    <dc:date>2020-09-08T05:48:46Z</dc:date>
    <item>
      <title>Looping in SPLUNK Query</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/Looping-in-SPLUNK-Query/m-p/518209#M3266</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I have a table of IP's and my requirement is to fetch raw data for all the IP's from each and every sourcetype having the IP.&lt;/P&gt;&lt;P&gt;My query is like below,&lt;/P&gt;&lt;P&gt;1.sourcetype="IPs"|dedup ip|table ip&lt;/P&gt;&lt;P&gt;So I want to use below logic,&lt;/P&gt;&lt;P&gt;For each and every IP in the table, run the below query,&lt;/P&gt;&lt;P&gt;2.sourcetype!="IPs"|table sourcetype,_raw&lt;/P&gt;&lt;P&gt;Help me to run the second query for each and every IP in 1st query and merge the tables.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 07 Sep 2020 11:24:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/Looping-in-SPLUNK-Query/m-p/518209#M3266</guid>
      <dc:creator>Janani_Krish</dc:creator>
      <dc:date>2020-09-07T11:24:03Z</dc:date>
    </item>
    <item>
      <title>Re: Looping in SPLUNK Query</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/Looping-in-SPLUNK-Query/m-p/518213#M3267</link>
      <description>&lt;P&gt;can you explain your query with examples?&lt;/P&gt;</description>
      <pubDate>Mon, 07 Sep 2020 11:54:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/Looping-in-SPLUNK-Query/m-p/518213#M3267</guid>
      <dc:creator>thambisetty</dc:creator>
      <dc:date>2020-09-07T11:54:22Z</dc:date>
    </item>
    <item>
      <title>Re: Looping in SPLUNK Query</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/Looping-in-SPLUNK-Query/m-p/518214#M3268</link>
      <description>&lt;P&gt;Have you tried the join command to link the two queries by ip?&lt;/P&gt;</description>
      <pubDate>Mon, 07 Sep 2020 12:06:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/Looping-in-SPLUNK-Query/m-p/518214#M3268</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2020-09-07T12:06:13Z</dc:date>
    </item>
    <item>
      <title>Re: Looping in SPLUNK Query</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/Looping-in-SPLUNK-Query/m-p/518255#M3278</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225168"&gt;@ITWhisperer&lt;/a&gt;&amp;nbsp;,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I cannot use join because I do not have a single meta in my second sub query.&lt;/P&gt;&lt;P&gt;1.In my 1st part of query I have single sourcetpe which is IPs and meta as IP.&lt;/P&gt;&lt;P&gt;2.My second part of query has to search for the ip address in all sourcetype other than sourcetype=IPs.&lt;/P&gt;&lt;P&gt;So since Ip is captured in different metas in rest all sourcetype,this makes it difficult to use join command.&lt;/P&gt;&lt;P&gt;Eg: It is src_ip in sourcetype1, dst_ip in sourcetype 2 etc.,&lt;/P&gt;</description>
      <pubDate>Mon, 07 Sep 2020 14:36:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/Looping-in-SPLUNK-Query/m-p/518255#M3278</guid>
      <dc:creator>Janani_Krish</dc:creator>
      <dc:date>2020-09-07T14:36:16Z</dc:date>
    </item>
    <item>
      <title>Re: Looping in SPLUNK Query</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/Looping-in-SPLUNK-Query/m-p/518262#M3280</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/129407"&gt;@thambisetty&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;Currently I have my query in 2 parts.&lt;BR /&gt;1. sourcetype="IPs"|dedup IP|table IP&lt;BR /&gt;2. sourcetype!="IPs"|table sourcetype,_raw&lt;/P&gt;&lt;P&gt;Currently I have the data as below from 1st part of query.&lt;BR /&gt;128.0.0.9&lt;BR /&gt;234.56.78.98&lt;BR /&gt;45.76.89.98&lt;/P&gt;&lt;P&gt;I want these Ips to be mapped with its respective raw logs where the IP may or may not be captured in different/more than one sourcetype as below by combining the second part of query.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;128.0.0.9&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; sourcetype 1 raw log&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;sourcetype 2 raw log&lt;BR /&gt;234.56.78.98&amp;nbsp; sourcetype 2 raw log&lt;BR /&gt;45.76.89.98&amp;nbsp; &amp;nbsp; sourcetype 3 raw log&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;sourcetype n raw log&lt;/P&gt;</description>
      <pubDate>Mon, 07 Sep 2020 14:55:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/Looping-in-SPLUNK-Query/m-p/518262#M3280</guid>
      <dc:creator>Janani_Krish</dc:creator>
      <dc:date>2020-09-07T14:55:54Z</dc:date>
    </item>
    <item>
      <title>Re: Looping in SPLUNK Query</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/Looping-in-SPLUNK-Query/m-p/518346#M3293</link>
      <description>&lt;P&gt;there could be many events in a single sourcetype that matches one particular IP, this will create search performance issue and it may take hours/days if you are searching in GBs of data.&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;sourcetype!="IPs" 
    [ search sourcetype="IPs" 
    | stats count by IP 
    | table IP 
    | rename IP as search 
    | format] 
| table sourcetype,_raw&lt;/LI-CODE&gt;&lt;P&gt;The reason for not using IP field in sub search is because your other source types may not have have field IP as I can see you provided only table sourcetype, _raw. The above search will do basic search with just IPs rather than IP and IP_value. we can't group the sourcetype and _raw by IP because IP field could be different in different sourcetypes, if you think IP field is present in all source types, you can add below to the search.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| stats values(sourcetype) as sourcetype values(_raw) as _raw by IP&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;give a thumps up if my answer gives a clue.&lt;/P&gt;</description>
      <pubDate>Tue, 08 Sep 2020 05:48:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/Looping-in-SPLUNK-Query/m-p/518346#M3293</guid>
      <dc:creator>thambisetty</dc:creator>
      <dc:date>2020-09-08T05:48:46Z</dc:date>
    </item>
  </channel>
</rss>

