<?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 use the append command based on an If condition ? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-can-i-use-the-append-command-based-on-an-If-condition/m-p/405218#M117139</link>
    <description>&lt;P&gt;Hi   @FrankVl ,&lt;BR /&gt;
It is working.   Thanks&lt;/P&gt;</description>
    <pubDate>Wed, 28 Nov 2018 10:37:10 GMT</pubDate>
    <dc:creator>harishalipaka</dc:creator>
    <dc:date>2018-11-28T10:37:10Z</dc:date>
    <item>
      <title>How can i use the append command based on an If condition ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-i-use-the-append-command-based-on-an-If-condition/m-p/405215#M117136</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;

&lt;P&gt;i have a base search ,with field A  ,  &lt;/P&gt;

&lt;P&gt;If field A &amp;gt;0 , I have to append another search query that returns multi columns.&lt;/P&gt;</description>
      <pubDate>Wed, 28 Nov 2018 06:57:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-i-use-the-append-command-based-on-an-If-condition/m-p/405215#M117136</guid>
      <dc:creator>harishalipaka</dc:creator>
      <dc:date>2018-11-28T06:57:31Z</dc:date>
    </item>
    <item>
      <title>Re: How can i use the append command based on an If condition ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-i-use-the-append-command-based-on-an-If-condition/m-p/405216#M117137</link>
      <description>&lt;P&gt;If the base search is not overly heavy, you could include the base search in the appended subsearch, filter for A&amp;gt;0 in the subsearch and then only return the columns that you actually wanted to add.&lt;/P&gt;

&lt;P&gt;So in pseudo code:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;base search
| append [ base search | append [ subsearch ] | where A&amp;gt;0 | table subsearchfieldX subsearchfieldY ]
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 28 Nov 2018 09:25:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-i-use-the-append-command-based-on-an-If-condition/m-p/405216#M117137</guid>
      <dc:creator>FrankVl</dc:creator>
      <dc:date>2018-11-28T09:25:35Z</dc:date>
    </item>
    <item>
      <title>Re: How can i use the append command based on an If condition ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-i-use-the-append-command-based-on-an-If-condition/m-p/405217#M117138</link>
      <description>&lt;P&gt;@FrankVl Superb one! &lt;BR /&gt;
i learnt this append tidbit from you.&lt;BR /&gt;
(learning and using this append, appendcols are difficult areas, even for many experienced splunk admins)&lt;/P&gt;</description>
      <pubDate>Wed, 28 Nov 2018 09:38:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-i-use-the-append-command-based-on-an-If-condition/m-p/405217#M117138</guid>
      <dc:creator>inventsekar</dc:creator>
      <dc:date>2018-11-28T09:38:36Z</dc:date>
    </item>
    <item>
      <title>Re: How can i use the append command based on an If condition ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-i-use-the-append-command-based-on-an-If-condition/m-p/405218#M117139</link>
      <description>&lt;P&gt;Hi   @FrankVl ,&lt;BR /&gt;
It is working.   Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 28 Nov 2018 10:37:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-i-use-the-append-command-based-on-an-If-condition/m-p/405218#M117139</guid>
      <dc:creator>harishalipaka</dc:creator>
      <dc:date>2018-11-28T10:37:10Z</dc:date>
    </item>
    <item>
      <title>Re: How can i use the append command based on an If condition ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-i-use-the-append-command-based-on-an-If-condition/m-p/405219#M117140</link>
      <description>&lt;P&gt;Note, the code was just pseudo code. If you really use append like that it will not work, as append adds it as extra lines, so you cannot filter this. It might help if you give a more concrete example of what your search looks like (without the filter).&lt;/P&gt;

&lt;P&gt;Something like this works:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval A=1
| table A
| appendcols [ | makeresults | eval A=1 | appendcols [ | makeresults | eval b=1,c=2,d=3 ] | where A&amp;gt;0 | table b,c,d ]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This returns all 4 fields. When running the same example but with A=0, it only returns A:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval A=0
| table A
| appendcols [ | makeresults | eval A=0 | appendcols [ | makeresults | eval b=1,c=2,d=3 ] | where A&amp;gt;0 | table b,c,d ]
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 28 Nov 2018 10:47:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-i-use-the-append-command-based-on-an-If-condition/m-p/405219#M117140</guid>
      <dc:creator>FrankVl</dc:creator>
      <dc:date>2018-11-28T10:47:52Z</dc:date>
    </item>
  </channel>
</rss>

