<?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 include queried text string in a table output? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-include-queried-text-string-in-a-table-output/m-p/201917#M58552</link>
    <description>&lt;P&gt;Something like:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval searched_text=if(match(_raw,"Starting"),"Starting",if(match(_raw,"Stopping"),"Stopping",""))
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;assuming you don't have events which match both "Starting..." and "Stopping...".&lt;/P&gt;

&lt;P&gt;This is good if you have just a few possible search terms, but may get ugly quickly. You can also have series of eval each creating (or not creating) a different field and then coalesce them into one.&lt;/P&gt;

&lt;P&gt;Hope I gave you enough ideas &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 19 Dec 2016 16:27:56 GMT</pubDate>
    <dc:creator>arkadyz1</dc:creator>
    <dc:date>2016-12-19T16:27:56Z</dc:date>
    <item>
      <title>How can I include queried text string in a table output?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-include-queried-text-string-in-a-table-output/m-p/201916#M58551</link>
      <description>&lt;P&gt;Greetings,&lt;/P&gt;

&lt;P&gt;I'm search my Linux hosts for when the local firewall starts/stops.  So I'm using the query:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index= host=* source=/var/log/messages "Starting IPv4 firewall with iptables" (or Stopping when Applicable)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;How can I create a table column that displays the text "Starting IPv4 . . . ".  I'd like to add that to the table with the time and host name.  The first two are easy.  However, since the text isn't a field I can add that.  Can anyone provide any suggestions or help?  Thanks.&lt;/P&gt;</description>
      <pubDate>Mon, 19 Dec 2016 15:24:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-include-queried-text-string-in-a-table-output/m-p/201916#M58551</guid>
      <dc:creator>SplunkLunk</dc:creator>
      <dc:date>2016-12-19T15:24:29Z</dc:date>
    </item>
    <item>
      <title>Re: How can I include queried text string in a table output?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-include-queried-text-string-in-a-table-output/m-p/201917#M58552</link>
      <description>&lt;P&gt;Something like:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval searched_text=if(match(_raw,"Starting"),"Starting",if(match(_raw,"Stopping"),"Stopping",""))
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;assuming you don't have events which match both "Starting..." and "Stopping...".&lt;/P&gt;

&lt;P&gt;This is good if you have just a few possible search terms, but may get ugly quickly. You can also have series of eval each creating (or not creating) a different field and then coalesce them into one.&lt;/P&gt;

&lt;P&gt;Hope I gave you enough ideas &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Dec 2016 16:27:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-include-queried-text-string-in-a-table-output/m-p/201917#M58552</guid>
      <dc:creator>arkadyz1</dc:creator>
      <dc:date>2016-12-19T16:27:56Z</dc:date>
    </item>
    <item>
      <title>Re: How can I include queried text string in a table output?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-include-queried-text-string-in-a-table-output/m-p/201918#M58553</link>
      <description>&lt;P&gt;You can create your own search time field extraction for Starting IPv4 firewall with iptables and Stopping IPv4 firewall with iptables as Status = Starting or Status=Stopping.&lt;/P&gt;

&lt;P&gt;You can do the same through rex, erex or interactive field extraction in Splunk during search time through Extract new fields. You can also do the same through props.conf.&lt;/P&gt;

&lt;P&gt;Would it be possible for your to share couple of example events?&lt;/P&gt;</description>
      <pubDate>Mon, 19 Dec 2016 18:36:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-include-queried-text-string-in-a-table-output/m-p/201918#M58553</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2016-12-19T18:36:15Z</dc:date>
    </item>
    <item>
      <title>Re: How can I include queried text string in a table output?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-include-queried-text-string-in-a-table-output/m-p/201919#M58554</link>
      <description>&lt;P&gt;Like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index= host=* source=/var/log/messages "Starting IPv4 firewall with iptables" OR "Stopping when Applicable"
| eval IPv4_Firewall_with_iptables=if(searchmatch("Starting IPv4 firewall with iptables"), "Starting ", "Stopping")
| table _time IPv4_Firewall_with_iptables
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 06 Apr 2017 14:39:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-include-queried-text-string-in-a-table-output/m-p/201919#M58554</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2017-04-06T14:39:26Z</dc:date>
    </item>
  </channel>
</rss>

