<?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: Iteration Function Syntax in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Iteration-Function-Syntax/m-p/98793#M25465</link>
    <description>&lt;P&gt;nah, this doesnt work the way i need. this only gives table of the top 10 src for the top 5 error codes. i need the table to show top 10 src per each of the top 5 error codes. so the output table will have 50 IP's, 10 per error_code, etc.&lt;/P&gt;

&lt;P&gt;and to add more complexity, would like a "count(src) by error_code" next to each of the IP's (this will indicate how many times this IP caused the event with this error code).&lt;/P&gt;</description>
    <pubDate>Thu, 22 Mar 2012 13:59:45 GMT</pubDate>
    <dc:creator>cvajs</dc:creator>
    <dc:date>2012-03-22T13:59:45Z</dc:date>
    <item>
      <title>Iteration Function Syntax</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Iteration-Function-Syntax/m-p/98791#M25463</link>
      <description>&lt;P&gt;v4.3.1 linux&lt;BR /&gt;
how do you create a search that mimics iteration like in bash&lt;BR /&gt;
for i in &lt;CODE&gt;ls /root&lt;/CODE&gt; ;do ls -al $i &amp;gt; out.txt ;done&lt;/P&gt;

&lt;P&gt;as example:&lt;BR /&gt;
for error_code in [search index=cisco_firewall | top error_code limit=5] --&amp;gt; search index=cisco_firewall error_code=$error_code$ | top src limit=10&lt;/P&gt;

&lt;P&gt;so, for each of the top 5 error_code i want the top 10 IP's associated with each error_code&lt;/P&gt;

&lt;P&gt;then if possible, the count(error_code) by IP for each uniq error_code&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 11:33:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Iteration-Function-Syntax/m-p/98791#M25463</guid>
      <dc:creator>cvajs</dc:creator>
      <dc:date>2020-09-28T11:33:25Z</dc:date>
    </item>
    <item>
      <title>Re: Iteration Function Syntax</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Iteration-Function-Syntax/m-p/98792#M25464</link>
      <description>&lt;P&gt;This should work,&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=cisco_firewall [search index=cisco_firewall | top 5 error_code| fields + error_code] | top 10 src
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The following link will explain in more detail.&lt;/P&gt;

&lt;P&gt;&lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/User/HowSubsearchesWork"&gt;http://docs.splunk.com/Documentation/Splunk/latest/User/HowSubsearchesWork&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;/Kristian&lt;/P&gt;</description>
      <pubDate>Thu, 22 Mar 2012 02:19:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Iteration-Function-Syntax/m-p/98792#M25464</guid>
      <dc:creator>kristian_kolb</dc:creator>
      <dc:date>2012-03-22T02:19:09Z</dc:date>
    </item>
    <item>
      <title>Re: Iteration Function Syntax</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Iteration-Function-Syntax/m-p/98793#M25465</link>
      <description>&lt;P&gt;nah, this doesnt work the way i need. this only gives table of the top 10 src for the top 5 error codes. i need the table to show top 10 src per each of the top 5 error codes. so the output table will have 50 IP's, 10 per error_code, etc.&lt;/P&gt;

&lt;P&gt;and to add more complexity, would like a "count(src) by error_code" next to each of the IP's (this will indicate how many times this IP caused the event with this error code).&lt;/P&gt;</description>
      <pubDate>Thu, 22 Mar 2012 13:59:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Iteration-Function-Syntax/m-p/98793#M25465</guid>
      <dc:creator>cvajs</dc:creator>
      <dc:date>2012-03-22T13:59:45Z</dc:date>
    </item>
    <item>
      <title>Re: Iteration Function Syntax</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Iteration-Function-Syntax/m-p/98794#M25466</link>
      <description>&lt;P&gt;index=cisco_firewall [search index=cisco_firewall | top 5 error_code| fields + error_code] | top 10 src by error_code&lt;/P&gt;

&lt;P&gt;IF you add the "by error_code" at the end, does this do it?&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 11:33:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Iteration-Function-Syntax/m-p/98794#M25466</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2020-09-28T11:33:41Z</dc:date>
    </item>
    <item>
      <title>Re: Iteration Function Syntax</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Iteration-Function-Syntax/m-p/98795#M25467</link>
      <description>&lt;P&gt;ok, i get a weird output. i am expecting 50 lines in my table, but it only shows 28 and only 3 of the top 5 error codes. my table display is 50 per page. let me run some tests.&lt;/P&gt;

&lt;P&gt;ok, ran some tests, found why. there's an extraction issue for some events with specific event codes. as example: %ASA-5-304001 does not follow the same log format as say %ASA-4-106021 or %ASA-4-106023. could be a daunting task to find all of the problem codes and fix the extraction for each, but maybe not so bad for say top 10 or 20 error codes, etc.&lt;/P&gt;</description>
      <pubDate>Thu, 22 Mar 2012 20:31:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Iteration-Function-Syntax/m-p/98795#M25467</guid>
      <dc:creator>cvajs</dc:creator>
      <dc:date>2012-03-22T20:31:16Z</dc:date>
    </item>
  </channel>
</rss>

