<?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 do I formulate a regex to discard events when applying sourcetype? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-formulate-a-regex-to-discard-events-when-applying/m-p/371545#M162997</link>
    <description>&lt;P&gt;Is your props.conf and transforms.conf files are in indexer/HWF?&lt;BR /&gt;
I tried regex in splunk, it works as expected..&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|makeresults|eval _raw="\"Server\",\"Job\",\"Status\",\"Start\",\"End\",\"\",\"Command\""|rex "(?&amp;lt;nulldata&amp;gt;(^|[\r\n])(.+,.+,.+,.+,\"\",.+))"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 09 Feb 2018 14:29:59 GMT</pubDate>
    <dc:creator>493669</dc:creator>
    <dc:date>2018-02-09T14:29:59Z</dc:date>
    <item>
      <title>How do I formulate a regex to discard events when applying sourcetype?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-formulate-a-regex-to-discard-events-when-applying/m-p/371539#M162991</link>
      <description>&lt;P&gt;Hello,&lt;BR /&gt;
I'm currently creating a new sourcetype that has a &lt;CODE&gt;TRANSFORMS-null&lt;/CODE&gt; setting with value &lt;CODE&gt;discardit&lt;/CODE&gt;.  Within my &lt;CODE&gt;transforms.conf&lt;/CODE&gt; file I have created the appropriate stanza:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[discardit]
REGEX=(^|[\r\n])(.+,.+,.+,.+,"",.+)
DEST_KEY = queue
FORMAT = nullQueue
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The regex that I've written is currently not working and I would like some help in formulating it.&lt;/P&gt;

&lt;P&gt;The events are coming from csv files with the following header:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;"Server","Job","Status","Start","End","Run Machine","Command"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;My objective is to not index the events that have no value for &lt;CODE&gt;End&lt;/CODE&gt;, so events that look like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;"Server1","Job1","Running","2018-02-01 00:00:00","","Machine 1","Command 1"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The regex that I've written basically counts 4 commas and then checks to see whether the two characters after the fourth comma are &lt;CODE&gt;""&lt;/CODE&gt; (meaning that the value for &lt;CODE&gt;Run&lt;/CODE&gt; is blank).&lt;/P&gt;

&lt;P&gt;What am I missing?&lt;/P&gt;

&lt;P&gt;Best regards,&lt;/P&gt;

&lt;P&gt;Andrew&lt;/P&gt;</description>
      <pubDate>Fri, 09 Feb 2018 11:04:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-formulate-a-regex-to-discard-events-when-applying/m-p/371539#M162991</guid>
      <dc:creator>andrewtrobec</dc:creator>
      <dc:date>2018-02-09T11:04:06Z</dc:date>
    </item>
    <item>
      <title>Re: How do I formulate a regex to discard events when applying sourcetype?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-formulate-a-regex-to-discard-events-when-applying/m-p/371540#M162992</link>
      <description>&lt;P&gt;Hi @andrewtrobec,&lt;BR /&gt;
you need to escape quotes by using back slashes&lt;BR /&gt;
try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[discardit]
 REGEX=(^|[\r\n])(.+,.+,.+,.+,\"\",.+)
 DEST_KEY = queue
 FORMAT = nullQueue
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 09 Feb 2018 11:11:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-formulate-a-regex-to-discard-events-when-applying/m-p/371540#M162992</guid>
      <dc:creator>493669</dc:creator>
      <dc:date>2018-02-09T11:11:46Z</dc:date>
    </item>
    <item>
      <title>Re: How do I formulate a regex to discard events when applying sourcetype?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-formulate-a-regex-to-discard-events-when-applying/m-p/371541#M162993</link>
      <description>&lt;P&gt;Do you really need that complex bit with the \r\n?&lt;/P&gt;

&lt;P&gt;Shouldn't this regex suffice (&lt;A href="https://regex101.com/r/rbEHqz/1):"&gt;https://regex101.com/r/rbEHqz/1):&lt;/A&gt; &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;REGEX=^.+,.+,.+,.+,"",.+
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Apart from that: what does your Splunk environment look like? Single instance, or distributed? If distributed, where did you deploy this config (should be on the first heavy instance, either HF or Indexer)?&lt;/P&gt;</description>
      <pubDate>Fri, 09 Feb 2018 11:17:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-formulate-a-regex-to-discard-events-when-applying/m-p/371541#M162993</guid>
      <dc:creator>FrankVl</dc:creator>
      <dc:date>2018-02-09T11:17:52Z</dc:date>
    </item>
    <item>
      <title>Re: How do I formulate a regex to discard events when applying sourcetype?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-formulate-a-regex-to-discard-events-when-applying/m-p/371542#M162994</link>
      <description>&lt;P&gt;Thanks for the suggestion.  unfortunately adding the back slashes did not work.  Do you have any other suggestions?&lt;/P&gt;</description>
      <pubDate>Fri, 09 Feb 2018 13:27:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-formulate-a-regex-to-discard-events-when-applying/m-p/371542#M162994</guid>
      <dc:creator>andrewtrobec</dc:creator>
      <dc:date>2018-02-09T13:27:35Z</dc:date>
    </item>
    <item>
      <title>Re: How do I formulate a regex to discard events when applying sourcetype?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-formulate-a-regex-to-discard-events-when-applying/m-p/371543#M162995</link>
      <description>&lt;P&gt;@FrankVl Thanks for the suggestion.  This doesn't solve the problem, and I've no idea why.  I will continue to make changes and test until something starts working.&lt;/P&gt;

&lt;P&gt;My Splunk environment is a single instance.  The config is in the $SPLUNK_HOME/etc/apps//local folder.&lt;/P&gt;

&lt;P&gt;If you have any additional suggestions then please let me know!&lt;/P&gt;</description>
      <pubDate>Fri, 09 Feb 2018 14:08:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-formulate-a-regex-to-discard-events-when-applying/m-p/371543#M162995</guid>
      <dc:creator>andrewtrobec</dc:creator>
      <dc:date>2018-02-09T14:08:38Z</dc:date>
    </item>
    <item>
      <title>Re: How do I formulate a regex to discard events when applying sourcetype?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-formulate-a-regex-to-discard-events-when-applying/m-p/371544#M162996</link>
      <description>&lt;P&gt;Where is this props/transforms in place? On the indexer, heavy forwarder, universal forwarder, or search head?&lt;/P&gt;</description>
      <pubDate>Fri, 09 Feb 2018 14:19:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-formulate-a-regex-to-discard-events-when-applying/m-p/371544#M162996</guid>
      <dc:creator>micahkemp</dc:creator>
      <dc:date>2018-02-09T14:19:26Z</dc:date>
    </item>
    <item>
      <title>Re: How do I formulate a regex to discard events when applying sourcetype?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-formulate-a-regex-to-discard-events-when-applying/m-p/371545#M162997</link>
      <description>&lt;P&gt;Is your props.conf and transforms.conf files are in indexer/HWF?&lt;BR /&gt;
I tried regex in splunk, it works as expected..&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|makeresults|eval _raw="\"Server\",\"Job\",\"Status\",\"Start\",\"End\",\"\",\"Command\""|rex "(?&amp;lt;nulldata&amp;gt;(^|[\r\n])(.+,.+,.+,.+,\"\",.+))"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 09 Feb 2018 14:29:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-formulate-a-regex-to-discard-events-when-applying/m-p/371545#M162997</guid>
      <dc:creator>493669</dc:creator>
      <dc:date>2018-02-09T14:29:59Z</dc:date>
    </item>
    <item>
      <title>Re: How do I formulate a regex to discard events when applying sourcetype?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-formulate-a-regex-to-discard-events-when-applying/m-p/371546#M162998</link>
      <description>&lt;P&gt;Yes, I am currently working on a single server instance.  To test I am using the Add data wizard to see whether the lines disappear in the preview, and they do not.  Am I correct to expect them to get removed there, or do I need to go ahead and index?&lt;/P&gt;</description>
      <pubDate>Fri, 09 Feb 2018 15:34:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-formulate-a-regex-to-discard-events-when-applying/m-p/371546#M162998</guid>
      <dc:creator>andrewtrobec</dc:creator>
      <dc:date>2018-02-09T15:34:17Z</dc:date>
    </item>
    <item>
      <title>Re: How do I formulate a regex to discard events when applying sourcetype?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-formulate-a-regex-to-discard-events-when-applying/m-p/371547#M162999</link>
      <description>&lt;P&gt;@micahkemp They are both in the $SPLUNK_HOME/etc/apps//local folder.  It's a single server instance.&lt;/P&gt;</description>
      <pubDate>Fri, 09 Feb 2018 15:38:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-formulate-a-regex-to-discard-events-when-applying/m-p/371547#M162999</guid>
      <dc:creator>andrewtrobec</dc:creator>
      <dc:date>2018-02-09T15:38:53Z</dc:date>
    </item>
  </channel>
</rss>

