<?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: SEDCMD not replacing comment lines during indexing in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/SEDCMD-not-replacing-comment-lines-during-indexing/m-p/499826#M85191</link>
    <description>&lt;PRE&gt;&lt;CODE&gt;SHOULD_LINEMERGE = false
LINE_BREAKER = ([\r\n]+)
SEDCMD-comments = s/#.*//g
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;maybe, &lt;CODE&gt;\n&lt;/CODE&gt; is missing.&lt;BR /&gt;
and try PREAMBLE_REGEX&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;SHOULD_LINEMERGE = false
LINE_BREAKER = ([\r\n]+)
PREAMBLE_REGEX = #
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 24 Mar 2020 21:15:29 GMT</pubDate>
    <dc:creator>to4kawa</dc:creator>
    <dc:date>2020-03-24T21:15:29Z</dc:date>
    <item>
      <title>SEDCMD not replacing comment lines during indexing</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/SEDCMD-not-replacing-comment-lines-during-indexing/m-p/499825#M85190</link>
      <description>&lt;P&gt;I'm monitoring hosts files on Windows machines, but I don't want the comment lines when I ingest the file.  However, my SEDCMD never seems to prevent the comment lines from being indexed.&lt;/P&gt;

&lt;P&gt;My &lt;CODE&gt;props.conf&lt;/CODE&gt;:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; [source::C:\\Windows\\System32\\drivers\\etc\\hosts]
 CHECK_METHOD = entire_md5
 SEDCMD-comments = s/\#.*\n//g
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;A sample of the standard hosts file.  In this example, I only want the last line in my event, &lt;CODE&gt;255.255.255.255 wpad&lt;/CODE&gt;:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;# Copyright (c) 1993-2009 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
#      102.54.94.97     rhino.acme.com          # source server
#       38.25.63.10     x.acme.com              # x client host

# localhost name resolution is handled within DNS itself.
#   127.0.0.1       localhost
#   ::1             localhost
255.255.255.255 wpad
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Any advice on where my SEDCMD is wrong?  The command seems to work fine in a search when I run &lt;CODE&gt;| rex mode=sed "s/\#.*\n//g"&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 24 Mar 2020 20:32:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/SEDCMD-not-replacing-comment-lines-during-indexing/m-p/499825#M85190</guid>
      <dc:creator>54638</dc:creator>
      <dc:date>2020-03-24T20:32:12Z</dc:date>
    </item>
    <item>
      <title>Re: SEDCMD not replacing comment lines during indexing</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/SEDCMD-not-replacing-comment-lines-during-indexing/m-p/499826#M85191</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;SHOULD_LINEMERGE = false
LINE_BREAKER = ([\r\n]+)
SEDCMD-comments = s/#.*//g
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;maybe, &lt;CODE&gt;\n&lt;/CODE&gt; is missing.&lt;BR /&gt;
and try PREAMBLE_REGEX&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;SHOULD_LINEMERGE = false
LINE_BREAKER = ([\r\n]+)
PREAMBLE_REGEX = #
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 24 Mar 2020 21:15:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/SEDCMD-not-replacing-comment-lines-during-indexing/m-p/499826#M85191</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-03-24T21:15:29Z</dc:date>
    </item>
    <item>
      <title>Re: SEDCMD not replacing comment lines during indexing</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/SEDCMD-not-replacing-comment-lines-during-indexing/m-p/499827#M85192</link>
      <description>&lt;P&gt;What you &lt;EM&gt;really&lt;/EM&gt; should be doing is stripping all of the wasteful comments like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[YourSourcetypeHere]
SHOULD_LINEMERGE = false
LINE_BREAKER = ((?:^|[\r\n]+)(?:\s*#[^\r\n]*|\s*))
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If you do that, then all you have left is the one line.&lt;/P&gt;</description>
      <pubDate>Tue, 24 Mar 2020 23:23:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/SEDCMD-not-replacing-comment-lines-during-indexing/m-p/499827#M85192</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2020-03-24T23:23:18Z</dc:date>
    </item>
    <item>
      <title>Re: SEDCMD not replacing comment lines during indexing</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/SEDCMD-not-replacing-comment-lines-during-indexing/m-p/499828#M85193</link>
      <description>&lt;P&gt;Thanks.  I will try it, but what is the benefit of doing it this way as opposed to using SEDCMD?  Doesn't SEDCMD strip the comments as well?&lt;/P&gt;

&lt;P&gt;Also, if there are multiple lines at the end of the file, will each line show up as a different event this way?&lt;/P&gt;</description>
      <pubDate>Wed, 25 Mar 2020 13:49:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/SEDCMD-not-replacing-comment-lines-during-indexing/m-p/499828#M85193</guid>
      <dc:creator>54638</dc:creator>
      <dc:date>2020-03-25T13:49:08Z</dc:date>
    </item>
    <item>
      <title>Re: SEDCMD not replacing comment lines during indexing</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/SEDCMD-not-replacing-comment-lines-during-indexing/m-p/499829#M85194</link>
      <description>&lt;P&gt;It gets dropped as the very first step in processing, instead of a bit later ( &lt;CODE&gt;SEDCMD&lt;/CODE&gt; ) or at the very end ( &lt;CODE&gt;nullQueue&lt;/CODE&gt; ).  It is also simpler.  Yes, it should work for multiple non-comment lines.&lt;/P&gt;</description>
      <pubDate>Wed, 25 Mar 2020 14:03:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/SEDCMD-not-replacing-comment-lines-during-indexing/m-p/499829#M85194</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2020-03-25T14:03:50Z</dc:date>
    </item>
  </channel>
</rss>

