<?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 to write the regex to filter events by contents of a specific field in transforms.conf? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-write-the-regex-to-filter-events-by-contents-of-a/m-p/223190#M65698</link>
    <description>&lt;P&gt;Thanks for the input...&lt;/P&gt;

&lt;P&gt;This is on the indexer under ..\system\local\ and it indexes everything and not filtering by the country codes.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Nov 10 10:42:23 SymantecServer SERVER01: KR-PC-098763,Continue,,File Read
Nov 10 14:22:23 SymantecServer SERVER01: CN-PC-012345,Continue,,File Read
Nov 10 15:32:23 SymantecServer SERVER01: SG-PC-054323,Continue,,File Read
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I tested with the following and it appeared to work fine.&lt;BR /&gt;
    index=av   | regex _raw="SERVER01:\s+(KR|SG|IN|PH|TW|TH)"&lt;/P&gt;</description>
    <pubDate>Tue, 10 Nov 2015 10:52:20 GMT</pubDate>
    <dc:creator>pjohnson1</dc:creator>
    <dc:date>2015-11-10T10:52:20Z</dc:date>
    <item>
      <title>How to write the regex to filter events by contents of a specific field in transforms.conf?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-write-the-regex-to-filter-events-by-contents-of-a/m-p/223186#M65694</link>
      <description>&lt;P&gt;I am creating a filter to only keep certain events which contain a specific country code (they are actually hostnames which contain the country code).&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;props.conf&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[log*]
TRANSFORMS-keep-LOG = setnull,keep-LOG_transform
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;transforms.conf&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[setnull]
REGEX = .
DEST_KEY = queue
FORMAT = nullQueue

[keep-LOG_transform]
REGEX = SERVER01:\s+(KR|SG|IN|PH|TW|TH)
DEST_KEY = queue
FORMAT = indexQueue
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;How can I create a REGEX on a specific field?  &lt;/P&gt;

&lt;P&gt;Field extraction is complete with this data source, but I would like to filter all events with KR,SG,IN,PH,TW,TH in a specific field like &lt;STRONG&gt;host&lt;/STRONG&gt;.&lt;/P&gt;

&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Tue, 10 Nov 2015 01:53:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-write-the-regex-to-filter-events-by-contents-of-a/m-p/223186#M65694</guid>
      <dc:creator>pjohnson1</dc:creator>
      <dc:date>2015-11-10T01:53:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to write the regex to filter events by contents of a specific field in transforms.conf?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-write-the-regex-to-filter-events-by-contents-of-a/m-p/223187#M65695</link>
      <description>&lt;P&gt;I referenced this &lt;A href="https://answers.splunk.com/answers/47982/extracting-field-from-a-field-other-than-raw-in-props-conf.html"&gt;https://answers.splunk.com/answers/47982/extracting-field-from-a-field-other-than-raw-in-props-conf.html&lt;/A&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[keep-LOG_transform]
SOURCE_KEY = host
REGEX = (KR|SG|IN|PH|TW|TH)
DEST_KEY = queue
FORMAT = indexQueue
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;But still no joy.  Any guidance please...&lt;/P&gt;

&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Tue, 10 Nov 2015 02:58:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-write-the-regex-to-filter-events-by-contents-of-a/m-p/223187#M65695</guid>
      <dc:creator>pjohnson1</dc:creator>
      <dc:date>2015-11-10T02:58:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to write the regex to filter events by contents of a specific field in transforms.conf?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-write-the-regex-to-filter-events-by-contents-of-a/m-p/223188#M65696</link>
      <description>&lt;P&gt;Not sure if it's a typo in your question or in your settings, but there is a space in your transforms stanza name which is not there in your props.conf.&lt;/P&gt;

&lt;P&gt;Where did you place these settings in your environment? It should be either directly on your indexer or on a heavy forwarder, depending on where your events are parsed.&lt;/P&gt;

&lt;P&gt;Also, how does the setting fail? Is every event still indexed regardless of country code, or are none of them?&lt;/P&gt;

&lt;P&gt;My guess is that these settings (even when applied properly) don't work for you because the transform is applied to _raw, and your raw data either doesn't contain &lt;CODE&gt;SERVER01:&lt;/CODE&gt;, or that all of them do (assuming that &lt;CODE&gt;SERVER01&lt;/CODE&gt; is the value of your host field). So can we please see a small sample of an event? (Mask any sensitive data).&lt;/P&gt;</description>
      <pubDate>Tue, 10 Nov 2015 10:15:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-write-the-regex-to-filter-events-by-contents-of-a/m-p/223188#M65696</guid>
      <dc:creator>jeffland</dc:creator>
      <dc:date>2015-11-10T10:15:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to write the regex to filter events by contents of a specific field in transforms.conf?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-write-the-regex-to-filter-events-by-contents-of-a/m-p/223189#M65697</link>
      <description>&lt;P&gt;Please check this link and let me know how it goes.&lt;/P&gt;

&lt;P&gt;&lt;A href="https://answers.splunk.com/answers/321460/how-to-edit-my-regex-to-filter-out-images-in-apach.html#answer-320651"&gt;Click Me&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Nov 2015 10:19:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-write-the-regex-to-filter-events-by-contents-of-a/m-p/223189#M65697</guid>
      <dc:creator>krish3</dc:creator>
      <dc:date>2015-11-10T10:19:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to write the regex to filter events by contents of a specific field in transforms.conf?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-write-the-regex-to-filter-events-by-contents-of-a/m-p/223190#M65698</link>
      <description>&lt;P&gt;Thanks for the input...&lt;/P&gt;

&lt;P&gt;This is on the indexer under ..\system\local\ and it indexes everything and not filtering by the country codes.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Nov 10 10:42:23 SymantecServer SERVER01: KR-PC-098763,Continue,,File Read
Nov 10 14:22:23 SymantecServer SERVER01: CN-PC-012345,Continue,,File Read
Nov 10 15:32:23 SymantecServer SERVER01: SG-PC-054323,Continue,,File Read
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I tested with the following and it appeared to work fine.&lt;BR /&gt;
    index=av   | regex _raw="SERVER01:\s+(KR|SG|IN|PH|TW|TH)"&lt;/P&gt;</description>
      <pubDate>Tue, 10 Nov 2015 10:52:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-write-the-regex-to-filter-events-by-contents-of-a/m-p/223190#M65698</guid>
      <dc:creator>pjohnson1</dc:creator>
      <dc:date>2015-11-10T10:52:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to write the regex to filter events by contents of a specific field in transforms.conf?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-write-the-regex-to-filter-events-by-contents-of-a/m-p/223191#M65699</link>
      <description>&lt;P&gt;If that's the raw data, that should work, so it would have to be something before actually applying the regex that isn't working as indended in that case. I'm curious, if you leave out the &lt;CODE&gt;keep-LOG_transform&lt;/CODE&gt; stanza in the list of transforms applied in your props.conf, are events still indexed? That would mean changing your props.conf to&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[log*]
TRANSFORMS-keep-LOG = setnull
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If yes, then these settings aren't applied to the sourcetype at all. What exactly is your sourcetype named? Is using an asterisk in your stanza required, or could you temporarily use the precise sourcetype name to see if that helps? Also, is there another setting that may override this setting (settings for sourcetype are overridden by settings for host:: and source::)?&lt;/P&gt;</description>
      <pubDate>Tue, 10 Nov 2015 17:27:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-write-the-regex-to-filter-events-by-contents-of-a/m-p/223191#M65699</guid>
      <dc:creator>jeffland</dc:creator>
      <dc:date>2015-11-10T17:27:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to write the regex to filter events by contents of a specific field in transforms.conf?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-write-the-regex-to-filter-events-by-contents-of-a/m-p/223192#M65700</link>
      <description>&lt;P&gt;The events are still indexed if just using TRANSFORMS-keep-LOG = setnull.&lt;/P&gt;

&lt;P&gt;I have changed to the precise sourcetype and check via search but events are still being indexed.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[host:123.456.789]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;and&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[sep12:behavior]
[sep12:traffic]
[sep12:agt_system]
[sep12:scan]    
[sep12:risk]    
[sep12:log]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I have another props/transform which works perfectly for something else but this one is baffelling...&lt;/P&gt;</description>
      <pubDate>Tue, 10 Nov 2015 23:09:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-write-the-regex-to-filter-events-by-contents-of-a/m-p/223192#M65700</guid>
      <dc:creator>pjohnson1</dc:creator>
      <dc:date>2015-11-10T23:09:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to write the regex to filter events by contents of a specific field in transforms.conf?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-write-the-regex-to-filter-events-by-contents-of-a/m-p/223193#M65701</link>
      <description>&lt;P&gt;Hi, sorry for taking so long to come back to you.&lt;BR /&gt;
I see you are using &lt;CODE&gt;[host:123]&lt;/CODE&gt;, which I believe is supposed to be &lt;CODE&gt;[host::123]&lt;/CODE&gt;. And the other stanzas, is your sourcetype &lt;CODE&gt;sep12:behavior&lt;/CODE&gt;, and other settings are applied properly to this stanza?&lt;/P&gt;</description>
      <pubDate>Fri, 20 Nov 2015 10:18:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-write-the-regex-to-filter-events-by-contents-of-a/m-p/223193#M65701</guid>
      <dc:creator>jeffland</dc:creator>
      <dc:date>2015-11-20T10:18:09Z</dc:date>
    </item>
  </channel>
</rss>

