<?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: regex help in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/regex-help/m-p/45676#M10865</link>
    <description>&lt;P&gt;Perhaps something like this then:&lt;/P&gt;

&lt;P&gt;props.conf&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;[your source or sourcetype]&lt;BR /&gt;
TRANSFORMS-filter = discard, keepField3, keepField4, keepField7&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;transforms.conf&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;[discard]&lt;/CODE&gt;&lt;BR /&gt;
&lt;CODE&gt;REGEX = .&lt;BR /&gt;
DEST_KEY = queue&lt;BR /&gt;
FORMAT = nullQueue&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;[keepField3]&lt;BR /&gt;
REGEX = (?:[^\|]+\|){2}(NormalizedCPUInfo|NormalizedMemoryInfo)&lt;BR /&gt;
DEST_KEY = queue&lt;BR /&gt;
FORMAT = indexQueue&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;[keepField4]&lt;BR /&gt;
REGEX = (?:[^\|]+\|){3}(Utilization|BitsIn)&lt;BR /&gt;
DEST_KEY = queue&lt;BR /&gt;
FORMAT = indexQueue&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;[keepField7]&lt;BR /&gt;
REGEX = (?:[^\|]+\|){6}WC&lt;BR /&gt;
DEST_KEY = queue&lt;BR /&gt;
FORMAT = indexQueue&lt;/CODE&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 26 Aug 2013 17:54:16 GMT</pubDate>
    <dc:creator>lukejadamec</dc:creator>
    <dc:date>2013-08-26T17:54:16Z</dc:date>
    <item>
      <title>regex help</title>
      <link>https://community.splunk.com/t5/Splunk-Search/regex-help/m-p/45667#M10856</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I'm setting up some null parsing via transforms.conf, and I want to include only a certain set of devices.  I have it working with a generic regex, but now I want to get more specific.  My feed looks like this:&lt;/P&gt;

&lt;P&gt;1377442800000|522334|NormalizedCPUInfo|Utilization|2|CPU|WCMK2DC01|CPU1&lt;/P&gt;

&lt;P&gt;1377442800000|522334|NormalizedCPUInfo|cpuIdleUtilization|98|CPU|WCMK2DC01|CPU1&lt;/P&gt;

&lt;P&gt;1377442800000|522682|NormalizedMemoryInfo|Total|42948878336|Memory|WCNGDCC02|Bluecoat Memory&lt;/P&gt;

&lt;P&gt;1377442800000|522682|NormalizedMemoryInfo|Utilization|12|Memory|WCNGDCC02|Bluecoat Memory&lt;/P&gt;

&lt;P&gt;1377442800000|522700|NormalizedCPUInfo|Utilization|2|CPU|WCNGMMK01|CPU5&lt;/P&gt;

&lt;P&gt;1377442800000|522700|NormalizedCPUInfo|cpuIdleUtilization|98|CPU|WCNGMMK01|CPU5&lt;/P&gt;

&lt;P&gt;I want to include only data from field7 that has certain data. My regex is as follows:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;REGEX = .\|.\|.\|.\|.\|.\|.\|[Ww][Cc].
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This isn't working.  Any suggestions?  Is there a good tool/website where I can test this stuff out? &lt;/P&gt;</description>
      <pubDate>Sun, 25 Aug 2013 15:12:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/regex-help/m-p/45667#M10856</guid>
      <dc:creator>a212830</dc:creator>
      <dc:date>2013-08-25T15:12:28Z</dc:date>
    </item>
    <item>
      <title>Re: regex help</title>
      <link>https://community.splunk.com/t5/Splunk-Search/regex-help/m-p/45668#M10857</link>
      <description>&lt;P&gt;You can use splunk search bar to try on a sample indexed (see the regex command)&lt;BR /&gt;
for regex ressources :&lt;A href="http://www.regular-expressions.info/"&gt;http://www.regular-expressions.info/&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 25 Aug 2013 15:46:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/regex-help/m-p/45668#M10857</guid>
      <dc:creator>yannK</dc:creator>
      <dc:date>2013-08-25T15:46:14Z</dc:date>
    </item>
    <item>
      <title>Re: regex help</title>
      <link>https://community.splunk.com/t5/Splunk-Search/regex-help/m-p/45669#M10858</link>
      <description>&lt;P&gt;Do you want to extract the 7th field? Or do you want to send some events to the nullQueue based on the value of field 7?&lt;/P&gt;

&lt;P&gt;The basic flaw with your regex is that there are no quantifiers for you wildcards. A single dot will only match one character.&lt;/P&gt;

&lt;P&gt;For a &lt;CODE&gt;nullQueue&lt;/CODE&gt; setup I'd recommend the following transform stanza where field7 starts with 'WC' or 'Wc or 'wC' or 'wc'&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[discard_wc]
REGEX = (?:[^\|]+\|){6}[Ww][Cc]
DEST_KEY = queue
FORMAT = nullQueue
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;HR /&gt;

&lt;P&gt;UPDATE:&lt;/P&gt;

&lt;P&gt;Further explanation of the process, following the multitude of comments below.&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;\d{4}\s(bob|alice)&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;will match four digits, followed by a space, followed by either &lt;CODE&gt;bob&lt;/CODE&gt; or &lt;CODE&gt;alice&lt;/CODE&gt;.&lt;/P&gt;

&lt;P&gt;If that is what you mean. If you are talking about the TRANSFORM-stanzas, they are all applied to each event matching the props.conf stanza (e.g. &lt;CODE&gt;[your_sourcetype]&lt;/CODE&gt;)&lt;/P&gt;

&lt;P&gt;Any event of that sourcetype will then pass through the four transforms, &lt;CODE&gt;discard, keep3, keep4&lt;/CODE&gt; and &lt;CODE&gt;keep7&lt;/CODE&gt;, in that order (important), before the event is returned for further processing.&lt;/P&gt;

&lt;P&gt;When it enters this part of the processing pipeline, the &lt;CODE&gt;queue&lt;/CODE&gt; is set to &lt;CODE&gt;indexQueue&lt;/CODE&gt; by default. &lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;&lt;P&gt;The first transform (discard) will set &lt;CODE&gt;queue&lt;/CODE&gt; to &lt;CODE&gt;nullQueue&lt;/CODE&gt;, because the regex (.) will match any event.&lt;/P&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;P&gt;The second transform (keep3) will change the &lt;CODE&gt;queue&lt;/CODE&gt; to &lt;CODE&gt;indexQueue&lt;/CODE&gt; if the regex matches, otherwise leave the &lt;CODE&gt;queue&lt;/CODE&gt; value unchanged.&lt;/P&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;P&gt;The same goes for the third and the fourth.&lt;/P&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;P&gt;When the event has passed through the last transform, it will be processed according to the value of &lt;CODE&gt;queue&lt;/CODE&gt; (store it in the index, or throw it away)&lt;/P&gt;&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;Hope this makes it a bit clearer.&lt;/P&gt;

&lt;P&gt;/K&lt;/P&gt;</description>
      <pubDate>Sun, 25 Aug 2013 17:56:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/regex-help/m-p/45669#M10858</guid>
      <dc:creator>kristian_kolb</dc:creator>
      <dc:date>2013-08-25T17:56:12Z</dc:date>
    </item>
    <item>
      <title>Re: regex help</title>
      <link>https://community.splunk.com/t5/Splunk-Search/regex-help/m-p/45670#M10859</link>
      <description>&lt;P&gt;Thanks.  Given that this is going to be a relativly high-volume feed (60gb an hour), and I have about a dozen wildcards to filter on, which would be more efficient - filtering in, or out?&lt;/P&gt;</description>
      <pubDate>Sun, 25 Aug 2013 18:50:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/regex-help/m-p/45670#M10859</guid>
      <dc:creator>a212830</dc:creator>
      <dc:date>2013-08-25T18:50:01Z</dc:date>
    </item>
    <item>
      <title>Re: regex help</title>
      <link>https://community.splunk.com/t5/Splunk-Search/regex-help/m-p/45671#M10860</link>
      <description>&lt;P&gt;I’m not sure that filtering in or out at index time makes much of a difference from an in or out stand point alone.  What you really want to do is be as precise as possible when implementing a configuration (at index or search time).&lt;/P&gt;</description>
      <pubDate>Sun, 25 Aug 2013 19:48:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/regex-help/m-p/45671#M10860</guid>
      <dc:creator>lukejadamec</dc:creator>
      <dc:date>2013-08-25T19:48:20Z</dc:date>
    </item>
    <item>
      <title>Re: regex help</title>
      <link>https://community.splunk.com/t5/Splunk-Search/regex-help/m-p/45672#M10861</link>
      <description>&lt;P&gt;For example: If you tell Splunk 6 different specific ways you can drop an event, then Splunk will examine each of those 6 on each event;  Whereas, if you tell Splunk 1 specific way to keep an event and drop all others, then Splunk searches for only that one specific thing for each event.&lt;/P&gt;

&lt;P&gt;In your example, I would not include both upper and lowercase WwCc if you will only ever see uppercase.&lt;/P&gt;</description>
      <pubDate>Sun, 25 Aug 2013 19:48:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/regex-help/m-p/45672#M10861</guid>
      <dc:creator>lukejadamec</dc:creator>
      <dc:date>2013-08-25T19:48:27Z</dc:date>
    </item>
    <item>
      <title>Re: regex help</title>
      <link>https://community.splunk.com/t5/Splunk-Search/regex-help/m-p/45673#M10862</link>
      <description>&lt;P&gt;This was a big help.  Is there a way to filter out on fields 3, 4 and 7? The existing one filters on 7. Sorry, I'm working on my regex skills, but this is beyond me.&lt;/P&gt;</description>
      <pubDate>Mon, 26 Aug 2013 15:20:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/regex-help/m-p/45673#M10862</guid>
      <dc:creator>a212830</dc:creator>
      <dc:date>2013-08-26T15:20:26Z</dc:date>
    </item>
    <item>
      <title>Re: regex help</title>
      <link>https://community.splunk.com/t5/Splunk-Search/regex-help/m-p/45674#M10863</link>
      <description>&lt;P&gt;You need to be more specific.&lt;BR /&gt;&lt;BR /&gt;
What exactly are the values of field 3 that you want to keep?&lt;BR /&gt;
What exactly are the values of field 4 that you want to keep?&lt;BR /&gt;
What exactly are the values of field 7 that you want to keep?&lt;/P&gt;</description>
      <pubDate>Mon, 26 Aug 2013 17:08:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/regex-help/m-p/45674#M10863</guid>
      <dc:creator>lukejadamec</dc:creator>
      <dc:date>2013-08-26T17:08:51Z</dc:date>
    </item>
    <item>
      <title>Re: regex help</title>
      <link>https://community.splunk.com/t5/Splunk-Search/regex-help/m-p/45675#M10864</link>
      <description>&lt;P&gt;Thanks. I was more looking for a template, rather than the values.  For example, I want to filter on NormalizedCPUInfo and NormalizedMemoryInfo in field3, Utilization and BitsIn in field 4.  I already have field 7 working.&lt;/P&gt;</description>
      <pubDate>Mon, 26 Aug 2013 17:16:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/regex-help/m-p/45675#M10864</guid>
      <dc:creator>a212830</dc:creator>
      <dc:date>2013-08-26T17:16:28Z</dc:date>
    </item>
    <item>
      <title>Re: regex help</title>
      <link>https://community.splunk.com/t5/Splunk-Search/regex-help/m-p/45676#M10865</link>
      <description>&lt;P&gt;Perhaps something like this then:&lt;/P&gt;

&lt;P&gt;props.conf&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;[your source or sourcetype]&lt;BR /&gt;
TRANSFORMS-filter = discard, keepField3, keepField4, keepField7&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;transforms.conf&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;[discard]&lt;/CODE&gt;&lt;BR /&gt;
&lt;CODE&gt;REGEX = .&lt;BR /&gt;
DEST_KEY = queue&lt;BR /&gt;
FORMAT = nullQueue&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;[keepField3]&lt;BR /&gt;
REGEX = (?:[^\|]+\|){2}(NormalizedCPUInfo|NormalizedMemoryInfo)&lt;BR /&gt;
DEST_KEY = queue&lt;BR /&gt;
FORMAT = indexQueue&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;[keepField4]&lt;BR /&gt;
REGEX = (?:[^\|]+\|){3}(Utilization|BitsIn)&lt;BR /&gt;
DEST_KEY = queue&lt;BR /&gt;
FORMAT = indexQueue&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;[keepField7]&lt;BR /&gt;
REGEX = (?:[^\|]+\|){6}WC&lt;BR /&gt;
DEST_KEY = queue&lt;BR /&gt;
FORMAT = indexQueue&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 26 Aug 2013 17:54:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/regex-help/m-p/45676#M10865</guid>
      <dc:creator>lukejadamec</dc:creator>
      <dc:date>2013-08-26T17:54:16Z</dc:date>
    </item>
    <item>
      <title>Re: regex help</title>
      <link>https://community.splunk.com/t5/Splunk-Search/regex-help/m-p/45677#M10866</link>
      <description>&lt;P&gt;As you can see from lukejadamec's post, the pattern (or template if you like) is based on the number of non-pipe-characters-followed-by-a-pipe sequences.&lt;/P&gt;

&lt;P&gt;E.g. for &lt;CODE&gt;[keepField3]&lt;/CODE&gt; there should be two &lt;CODE&gt;{2}&lt;/CODE&gt; sequences of non-pipe-characters &lt;CODE&gt;[^\|]+&lt;/CODE&gt; before you match on either &lt;CODE&gt;NormalizedCPUInfo&lt;/CODE&gt; or  &lt;CODE&gt;NormalizedMemoryInfo&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;/K&lt;/P&gt;

&lt;P&gt;took the liberty to fix some parenthesis and set the markup to &lt;CODE&gt;code&lt;/CODE&gt;, which shows special characters.&lt;/P&gt;</description>
      <pubDate>Mon, 26 Aug 2013 19:19:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/regex-help/m-p/45677#M10866</guid>
      <dc:creator>kristian_kolb</dc:creator>
      <dc:date>2013-08-26T19:19:03Z</dc:date>
    </item>
    <item>
      <title>Re: regex help</title>
      <link>https://community.splunk.com/t5/Splunk-Search/regex-help/m-p/45678#M10867</link>
      <description>&lt;P&gt;Oh, cool. Didn't know that I could do something like that. Thanks!&lt;/P&gt;</description>
      <pubDate>Mon, 26 Aug 2013 19:27:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/regex-help/m-p/45678#M10867</guid>
      <dc:creator>a212830</dc:creator>
      <dc:date>2013-08-26T19:27:49Z</dc:date>
    </item>
    <item>
      <title>Re: regex help</title>
      <link>https://community.splunk.com/t5/Splunk-Search/regex-help/m-p/45679#M10868</link>
      <description>&lt;P&gt;which of them? pattern matching or code highlighting &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 26 Aug 2013 19:29:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/regex-help/m-p/45679#M10868</guid>
      <dc:creator>kristian_kolb</dc:creator>
      <dc:date>2013-08-26T19:29:35Z</dc:date>
    </item>
    <item>
      <title>Re: regex help</title>
      <link>https://community.splunk.com/t5/Splunk-Search/regex-help/m-p/45680#M10869</link>
      <description>&lt;P&gt;Are these OR statements?&lt;/P&gt;</description>
      <pubDate>Tue, 27 Aug 2013 02:41:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/regex-help/m-p/45680#M10869</guid>
      <dc:creator>a212830</dc:creator>
      <dc:date>2013-08-27T02:41:26Z</dc:date>
    </item>
    <item>
      <title>Re: regex help</title>
      <link>https://community.splunk.com/t5/Splunk-Search/regex-help/m-p/45681#M10870</link>
      <description>&lt;P&gt;see update in my original answer. /K&lt;/P&gt;</description>
      <pubDate>Tue, 27 Aug 2013 06:38:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/regex-help/m-p/45681#M10870</guid>
      <dc:creator>kristian_kolb</dc:creator>
      <dc:date>2013-08-27T06:38:00Z</dc:date>
    </item>
    <item>
      <title>Re: regex help</title>
      <link>https://community.splunk.com/t5/Splunk-Search/regex-help/m-p/45682#M10871</link>
      <description>&lt;P&gt;&lt;A href="http://gskinner.com/RegExr/"&gt;http://gskinner.com/RegExr/&lt;/A&gt; is an online regex tester where you can copy sample data and test your regex on them to see what they match.&lt;/P&gt;

&lt;P&gt;Also, if you are absolutely sure that "WC" can only occur after a pipe, then you can use a lookbehind regex.&lt;/P&gt;

&lt;BLOCKQUOTE&gt;
&lt;P&gt;(?&amp;lt;=|)WC&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;</description>
      <pubDate>Tue, 27 Aug 2013 06:38:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/regex-help/m-p/45682#M10871</guid>
      <dc:creator>lcrielaa</dc:creator>
      <dc:date>2013-08-27T06:38:07Z</dc:date>
    </item>
  </channel>
</rss>

