<?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: Is it possible to define tags using regex? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-define-tags-using-regex/m-p/223672#M65854</link>
    <description>&lt;P&gt;The regex should look like: host=st123[1-3] for "foo" and host=st123[4-7] for "bar"&lt;/P&gt;</description>
    <pubDate>Tue, 21 Jun 2016 09:06:03 GMT</pubDate>
    <dc:creator>tgdvopab</dc:creator>
    <dc:date>2016-06-21T09:06:03Z</dc:date>
    <item>
      <title>Is it possible to define tags using regex?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-define-tags-using-regex/m-p/223671#M65853</link>
      <description>&lt;P&gt;I would like to define a tag in splunk using a regex.&lt;/P&gt;

&lt;P&gt;Example:&lt;BR /&gt;
host=st1231, host=1232, host=1233 --&amp;gt; the name of the tag should be "foo"&lt;BR /&gt;
host=st1234, host=1235, host=1236, host=1237 -&amp;gt; the name of the tag should be "bar"&lt;/P&gt;

&lt;P&gt;Is it possible to define these tags above using a regex? Or do I have to define for each host its own tag?&lt;/P&gt;</description>
      <pubDate>Tue, 21 Jun 2016 08:52:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-define-tags-using-regex/m-p/223671#M65853</guid>
      <dc:creator>tgdvopab</dc:creator>
      <dc:date>2016-06-21T08:52:10Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to define tags using regex?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-define-tags-using-regex/m-p/223672#M65854</link>
      <description>&lt;P&gt;The regex should look like: host=st123[1-3] for "foo" and host=st123[4-7] for "bar"&lt;/P&gt;</description>
      <pubDate>Tue, 21 Jun 2016 09:06:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-define-tags-using-regex/m-p/223672#M65854</guid>
      <dc:creator>tgdvopab</dc:creator>
      <dc:date>2016-06-21T09:06:03Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to define tags using regex?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-define-tags-using-regex/m-p/223673#M65855</link>
      <description>&lt;P&gt;Don't believe &lt;CODE&gt;tags&lt;/CODE&gt; support wildcards or regex. Alternatively you could use &lt;CODE&gt;search macros&lt;/CODE&gt; and &lt;CODE&gt;regex&lt;/CODE&gt;. Something like this should work&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[foo]
definition = index=st123* | regex host="st123[1-3]"

[bar]
definition = index=st123* | regex host="st123[4-7]"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;In your search, you could use&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;`foo` 

OR 

`bar`
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 21 Jun 2016 11:53:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-define-tags-using-regex/m-p/223673#M65855</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2016-06-21T11:53:02Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to define tags using regex?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-define-tags-using-regex/m-p/223674#M65856</link>
      <description>&lt;P&gt;The only way that you can do any wildcarding is to use &lt;CODE&gt;*&lt;/CODE&gt; in an &lt;CODE&gt;eventtype&lt;/CODE&gt; definition and then you create a &lt;CODE&gt;tag&lt;/CODE&gt; with a value like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;eventtype=&amp;lt;Your eventtype Name Here&amp;gt;`
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Even so, you cannot use pipes &lt;CODE&gt;|&lt;/CODE&gt; in your eventtype so you are cannot use the &lt;CODE&gt;RegEx-ish&lt;/CODE&gt; commands like &lt;CODE&gt;regex&lt;/CODE&gt;, so this is not really an answer, other than to assure you that there is no answer.&lt;/P&gt;</description>
      <pubDate>Tue, 21 Jun 2016 11:53:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-define-tags-using-regex/m-p/223674#M65856</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2016-06-21T11:53:03Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to define tags using regex?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-define-tags-using-regex/m-p/223675#M65857</link>
      <description>&lt;P&gt;Thanks for your answer!&lt;/P&gt;

&lt;P&gt;Would it be possible to make a list of hosts in a tag? &lt;BR /&gt;
Example: host=(st1231 OR host=1232 OR host=1233) as tag "foo"?&lt;/P&gt;</description>
      <pubDate>Tue, 21 Jun 2016 11:58:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-define-tags-using-regex/m-p/223675#M65857</guid>
      <dc:creator>tgdvopab</dc:creator>
      <dc:date>2016-06-21T11:58:14Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to define tags using regex?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-define-tags-using-regex/m-p/223676#M65858</link>
      <description>&lt;P&gt;Thanks for your answer!&lt;/P&gt;

&lt;P&gt;Would it be possible to make a list of hosts in a tag? &lt;BR /&gt;
Example: host=(st1231 OR host=1232 OR host=1233) as tag "foo"?&lt;/P&gt;</description>
      <pubDate>Tue, 21 Jun 2016 11:58:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-define-tags-using-regex/m-p/223676#M65858</guid>
      <dc:creator>tgdvopab</dc:creator>
      <dc:date>2016-06-21T11:58:22Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to define tags using regex?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-define-tags-using-regex/m-p/223677#M65859</link>
      <description>&lt;P&gt;No, but&lt;/P&gt;

&lt;P&gt;1: You can use a list in your &lt;CODE&gt;eventtype&lt;/CODE&gt;.  If you are using the GUI, when you create an &lt;CODE&gt;eventtype&lt;/CODE&gt; with a search string, there is place to assign it a &lt;CODE&gt;tag&lt;/CODE&gt; name, too. &lt;BR /&gt;
2: You can create multiple &lt;CODE&gt;tag&lt;/CODE&gt; definitions, one-by-one, recycling the same &lt;CODE&gt;tag&lt;/CODE&gt; name, one for each host KVP.&lt;/P&gt;</description>
      <pubDate>Tue, 21 Jun 2016 12:02:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-define-tags-using-regex/m-p/223677#M65859</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2016-06-21T12:02:24Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to define tags using regex?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-define-tags-using-regex/m-p/223678#M65860</link>
      <description>&lt;P&gt;@woodcock, I tried creating an event type, but it wouldn't let me include search commands in the event type. I'm on 6.4.3.&lt;/P&gt;

&lt;P&gt;Can you help me understand why this is the case?&lt;/P&gt;</description>
      <pubDate>Thu, 05 Jan 2017 16:34:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-define-tags-using-regex/m-p/223678#M65860</guid>
      <dc:creator>_jgpm_</dc:creator>
      <dc:date>2017-01-05T16:34:20Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to define tags using regex?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-define-tags-using-regex/m-p/223679#M65861</link>
      <description>&lt;P&gt;Tags CAN be created with wildcards:&lt;BR /&gt;
&amp;nbsp;&amp;nbsp; Settings &amp;gt; Tags &amp;gt; All unique tag objects &amp;gt; New Tag:&lt;BR /&gt;
    &amp;nbsp;Tag name = privileged_user&lt;BR /&gt;
    &amp;nbsp;Field name = user&lt;BR /&gt;
    &amp;nbsp;Field value = &lt;EM&gt;admin&lt;/EM&gt;&lt;/P&gt;

&lt;P&gt;Search: tag=privileged_user  (will find admin, sysadmin, adminsap, etc)&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jun 2019 21:16:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-define-tags-using-regex/m-p/223679#M65861</guid>
      <dc:creator>mfleischman_spl</dc:creator>
      <dc:date>2019-06-19T21:16:22Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to define tags using regex?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-define-tags-using-regex/m-p/223680#M65862</link>
      <description>&lt;P&gt;I have clarified my answer.&lt;/P&gt;</description>
      <pubDate>Thu, 20 Jun 2019 22:57:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-define-tags-using-regex/m-p/223680#M65862</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-06-20T22:57:26Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to define tags using regex?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-define-tags-using-regex/m-p/223681#M65863</link>
      <description>&lt;P&gt;You can dow this with &lt;A href="https://www.compressware.in/2019/06/windows-8-highly-compressed.html"&gt;Python&lt;/A&gt; also.,Ya its You can dow with this This is a known problem with &lt;A href="https://www.compressware.in/2019/06/windows-8-highly-compressed.html"&gt;regex&lt;/A&gt; - you can't match pairs. Matching is either greedy, in which it matches the last one it finds, or non-greedy, in which it matches the first. You can't persuade a regex to count opening and closing brackets.&lt;/P&gt;

&lt;P&gt;I would recommend loading it into a DOM and using that. If you are trying to implement an HTML parser, I would recommend using regex to lex it, then a left-right parser to parse the output of your lexer.&lt;/P&gt;</description>
      <pubDate>Fri, 21 Jun 2019 07:38:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-define-tags-using-regex/m-p/223681#M65863</guid>
      <dc:creator>ram148280</dc:creator>
      <dc:date>2019-06-21T07:38:59Z</dc:date>
    </item>
  </channel>
</rss>

