<?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: Execute regex based on condition in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Execute-regex-based-on-condition/m-p/197887#M57214</link>
    <description>&lt;P&gt;OK, I think I misunderstood your question initially, and my first suggestion isn't really valid. But the second one should help a bit:&lt;/P&gt;

&lt;P&gt;sourcetype="PerfmonMk:Processor" | table sourcetype %* | append [search sourcetype="PerfmonMk:.Net CLR Exceptions" | table #* %*]&lt;/P&gt;

&lt;P&gt;The problem with field names is that they can only be referred to by wildcards, not by regex. Hopefully this will work well enough for you.&lt;/P&gt;</description>
    <pubDate>Mon, 16 Jun 2014 14:16:04 GMT</pubDate>
    <dc:creator>aweitzman</dc:creator>
    <dc:date>2014-06-16T14:16:04Z</dc:date>
    <item>
      <title>Execute regex based on condition</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Execute-regex-based-on-condition/m-p/197882#M57209</link>
      <description>&lt;P&gt;I have to display the counters starting with # and also % if the sourcetype is "PerfmonMk:.Net CLR Exceptions" and for other sourcetype(PerfmonMk:Processor) i have to display the counters starting with % only. I use the following regex commands,&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Counters starting with # and % : |  regex column="#[_A-Za-z]*|%[_A-Za-z]*"
Counters starting with % : |  regex column="%[_A-Za-z]*"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Is there any way to do this?&lt;/P&gt;</description>
      <pubDate>Fri, 13 Jun 2014 10:34:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Execute-regex-based-on-condition/m-p/197882#M57209</guid>
      <dc:creator>vaishnavi07</dc:creator>
      <dc:date>2014-06-13T10:34:35Z</dc:date>
    </item>
    <item>
      <title>Re: Execute regex based on condition</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Execute-regex-based-on-condition/m-p/197883#M57210</link>
      <description>&lt;P&gt;Just construct the one regex to match all your cases.  I can't see what the issue is with matching &lt;CODE&gt;[#%][_A-Za-z]*&lt;/CODE&gt; (which is just a contraction of your first example regex).  If hash is never present, what's the big deal?  The regex will still match.&lt;/P&gt;</description>
      <pubDate>Fri, 13 Jun 2014 11:27:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Execute-regex-based-on-condition/m-p/197883#M57210</guid>
      <dc:creator>grijhwani</dc:creator>
      <dc:date>2014-06-13T11:27:59Z</dc:date>
    </item>
    <item>
      <title>Re: Execute regex based on condition</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Execute-regex-based-on-condition/m-p/197884#M57211</link>
      <description>&lt;P&gt;If i write single regex command and select sourcetype as "PerfmonMk:Processor" then the counters starting with # will get displayed. I don't need that. Only if i select  the sourcetype "PerfmonMk:.Net CLR Exceptions" the counters that starts with # should get displayed.&lt;/P&gt;</description>
      <pubDate>Fri, 13 Jun 2014 12:22:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Execute-regex-based-on-condition/m-p/197884#M57211</guid>
      <dc:creator>vaishnavi07</dc:creator>
      <dc:date>2014-06-13T12:22:08Z</dc:date>
    </item>
    <item>
      <title>Re: Execute regex based on condition</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Execute-regex-based-on-condition/m-p/197885#M57212</link>
      <description>&lt;OL&gt;
&lt;LI&gt;&lt;P&gt;You could use the single regex as described, and then use a 'where' clause to eliminate the events you don't want.&lt;/P&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;P&gt;You could run two different searches with your two different regexes and use 'append' to turn them into a single result set.&lt;/P&gt;&lt;/LI&gt;
&lt;/OL&gt;</description>
      <pubDate>Fri, 13 Jun 2014 16:55:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Execute-regex-based-on-condition/m-p/197885#M57212</guid>
      <dc:creator>aweitzman</dc:creator>
      <dc:date>2014-06-13T16:55:29Z</dc:date>
    </item>
    <item>
      <title>Re: Execute regex based on condition</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Execute-regex-based-on-condition/m-p/197886#M57213</link>
      <description>&lt;P&gt;Hi Can you please give me an example?&lt;/P&gt;</description>
      <pubDate>Mon, 16 Jun 2014 08:40:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Execute-regex-based-on-condition/m-p/197886#M57213</guid>
      <dc:creator>vaishnavi07</dc:creator>
      <dc:date>2014-06-16T08:40:18Z</dc:date>
    </item>
    <item>
      <title>Re: Execute regex based on condition</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Execute-regex-based-on-condition/m-p/197887#M57214</link>
      <description>&lt;P&gt;OK, I think I misunderstood your question initially, and my first suggestion isn't really valid. But the second one should help a bit:&lt;/P&gt;

&lt;P&gt;sourcetype="PerfmonMk:Processor" | table sourcetype %* | append [search sourcetype="PerfmonMk:.Net CLR Exceptions" | table #* %*]&lt;/P&gt;

&lt;P&gt;The problem with field names is that they can only be referred to by wildcards, not by regex. Hopefully this will work well enough for you.&lt;/P&gt;</description>
      <pubDate>Mon, 16 Jun 2014 14:16:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Execute-regex-based-on-condition/m-p/197887#M57214</guid>
      <dc:creator>aweitzman</dc:creator>
      <dc:date>2014-06-16T14:16:04Z</dc:date>
    </item>
  </channel>
</rss>

