<?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: Matching nulls in LINE_BREAKER removing first letter x? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Matching-nulls-in-LINE-BREAKER-removing-first-letter-x/m-p/48023#M11462</link>
    <description>&lt;P&gt;Whether they're merged seems to depend on the timing: when lines are added to the source rapidly (1/sec or so) they're merged, otherwise each entry is a separate event.&lt;/P&gt;

&lt;P&gt;I now have:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[sourcetype]
NO_BINARY_CHECK = true
SEDCMD-stripnull = s/\\x00/ZzZ/g
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I've verified with btool that this is being applied to my sourcetype, but after creating new events, there are no ZzZ strings showing up... Am I misunderstanding something?&lt;/P&gt;</description>
    <pubDate>Tue, 22 Feb 2011 04:51:00 GMT</pubDate>
    <dc:creator>mikel8</dc:creator>
    <dc:date>2011-02-22T04:51:00Z</dc:date>
    <item>
      <title>Matching nulls in LINE_BREAKER removing first letter x?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Matching-nulls-in-LINE-BREAKER-removing-first-letter-x/m-p/48018#M11457</link>
      <description>&lt;P&gt;Hopefully this is just a stupid regex error:&lt;/P&gt;

&lt;P&gt;I'm using SplunkLightForwarder on AIX to send a few .sh_history logs to an indexer on Windows. Unfortunately ksh uses nulls as deliminators between commands--and it sometimes throws an extra null in for no apparent reason. This makes the Splunk events look something like this:&lt;/P&gt;

&lt;P&gt;Event 1&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;cd /etc
\x00\x00ls
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Event 2&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;mkdir test
\x00cd test    
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;In other words, multiple events are incorrectly merged, and nulls are sprinkled throughout the logs. I spent a good deal of time trying to solve this (line merge/break settings, transforms, etc.). I ended up with the following in props.conf on my indexer:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[sourcetype]
LINE_BREAKER=(\\x00+)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This works beautifully, except when I exit the shell after testing this out, what shows up in Splunk?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;eit
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I can't figure out how in the world my regex is matching the x in exit. I later changed it to&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;LINE_BREAKER=((?:\\x00)+)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;but it still eats the first 'x' in every event (axbxcx becomes abxcx). I've verified that there are no nulls adjacent to the x in the source.&lt;/P&gt;

&lt;P&gt;Thanks in advance for your help!&lt;/P&gt;

&lt;P&gt;Example data, zipped: &lt;A href="http://www.mediafire.com/file/wwckoeo36v8p0v6/ksh-history-example.zip" rel="nofollow"&gt;http://www.mediafire.com/file/wwckoeo36v8p0v6/ksh-history-example.zip&lt;/A&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;$ tr "\000" "@" &amp;lt; ksh-history-example
mkdir -p test1/test2/test3
@cd test1
@ls
@cd test2
@ls
@cd test3
@ls
@cd ..
@@cd ..
@@ls
@cd ..
@@pwd
@@
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 21 Feb 2011 12:33:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Matching-nulls-in-LINE-BREAKER-removing-first-letter-x/m-p/48018#M11457</guid>
      <dc:creator>mikel8</dc:creator>
      <dc:date>2011-02-21T12:33:26Z</dc:date>
    </item>
    <item>
      <title>Re: Matching nulls in LINE_BREAKER removing first letter x?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Matching-nulls-in-LINE-BREAKER-removing-first-letter-x/m-p/48019#M11458</link>
      <description>&lt;P&gt;You can strip them using SEDCMD, instead of using LINE_BREAKER to break on the nulls:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[mysourcetype]
NO_BINARY_CHECK = true
SEDCMD-stripnull = s/\\x00//g
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;EDIT:&lt;/P&gt;

&lt;P&gt;There's only limited room for comments.  You can use this SEDCMD to replace with linebreaks:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[mysourcetype]
NO_BINARY_CHECK = true
SEDCMD-stripnull = s/\\x00/\n/g
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 22 Feb 2011 04:15:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Matching-nulls-in-LINE-BREAKER-removing-first-letter-x/m-p/48019#M11458</guid>
      <dc:creator>Ron_Naken</dc:creator>
      <dc:date>2011-02-22T04:15:13Z</dc:date>
    </item>
    <item>
      <title>Re: Matching nulls in LINE_BREAKER removing first letter x?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Matching-nulls-in-LINE-BREAKER-removing-first-letter-x/m-p/48020#M11459</link>
      <description>&lt;P&gt;I appended some nulls and 'exit' and some more nulls to your sample data.  The SEDCMD seems to do the job.&lt;/P&gt;</description>
      <pubDate>Tue, 22 Feb 2011 04:24:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Matching-nulls-in-LINE-BREAKER-removing-first-letter-x/m-p/48020#M11459</guid>
      <dc:creator>Ron_Naken</dc:creator>
      <dc:date>2011-02-22T04:24:16Z</dc:date>
    </item>
    <item>
      <title>Re: Matching nulls in LINE_BREAKER removing first letter x?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Matching-nulls-in-LINE-BREAKER-removing-first-letter-x/m-p/48021#M11460</link>
      <description>&lt;P&gt;Thanks for the help! Your solution both removes the nulls and doesn't touch 'x's, but multiple commands are now merged into one event, even when adding SHOULD_LINEMERGE=false...&lt;/P&gt;</description>
      <pubDate>Tue, 22 Feb 2011 04:32:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Matching-nulls-in-LINE-BREAKER-removing-first-letter-x/m-p/48021#M11460</guid>
      <dc:creator>mikel8</dc:creator>
      <dc:date>2011-02-22T04:32:45Z</dc:date>
    </item>
    <item>
      <title>Re: Matching nulls in LINE_BREAKER removing first letter x?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Matching-nulls-in-LINE-BREAKER-removing-first-letter-x/m-p/48022#M11461</link>
      <description>&lt;P&gt;Interesting. I'm using a Mac, and stripping the nulls allows it to break the lines properly. At least with SEDCMD, you could substitute a newline or custom linebreak for the nulls.&lt;/P&gt;</description>
      <pubDate>Tue, 22 Feb 2011 04:40:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Matching-nulls-in-LINE-BREAKER-removing-first-letter-x/m-p/48022#M11461</guid>
      <dc:creator>Ron_Naken</dc:creator>
      <dc:date>2011-02-22T04:40:07Z</dc:date>
    </item>
    <item>
      <title>Re: Matching nulls in LINE_BREAKER removing first letter x?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Matching-nulls-in-LINE-BREAKER-removing-first-letter-x/m-p/48023#M11462</link>
      <description>&lt;P&gt;Whether they're merged seems to depend on the timing: when lines are added to the source rapidly (1/sec or so) they're merged, otherwise each entry is a separate event.&lt;/P&gt;

&lt;P&gt;I now have:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[sourcetype]
NO_BINARY_CHECK = true
SEDCMD-stripnull = s/\\x00/ZzZ/g
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I've verified with btool that this is being applied to my sourcetype, but after creating new events, there are no ZzZ strings showing up... Am I misunderstanding something?&lt;/P&gt;</description>
      <pubDate>Tue, 22 Feb 2011 04:51:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Matching-nulls-in-LINE-BREAKER-removing-first-letter-x/m-p/48023#M11462</guid>
      <dc:creator>mikel8</dc:creator>
      <dc:date>2011-02-22T04:51:00Z</dc:date>
    </item>
    <item>
      <title>Re: Matching nulls in LINE_BREAKER removing first letter x?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Matching-nulls-in-LINE-BREAKER-removing-first-letter-x/m-p/48024#M11463</link>
      <description>&lt;P&gt;It appears that | extract reload=true is insufficient--the SEDCMD is working as expected after restarting splunk. I'll see if I can use it to set up a custom linebreak as you suggested.&lt;/P&gt;</description>
      <pubDate>Tue, 22 Feb 2011 05:12:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Matching-nulls-in-LINE-BREAKER-removing-first-letter-x/m-p/48024#M11463</guid>
      <dc:creator>mikel8</dc:creator>
      <dc:date>2011-02-22T05:12:19Z</dc:date>
    </item>
    <item>
      <title>Re: Matching nulls in LINE_BREAKER removing first letter x?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Matching-nulls-in-LINE-BREAKER-removing-first-letter-x/m-p/48025#M11464</link>
      <description>&lt;P&gt;Posting here due to the limited comment space:&lt;/P&gt;

&lt;P&gt;Thanks for all your help ron! Replacing with \n is ALMOST perfect. If that's all that's in the stanza, the events are still not split. All of the following set ups DO split the events, but there are newlines at the start of some events, which throws a wrench into trying to match those events up later on. Any ideas on how to get rid of the newlines?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[mysourcetype]
NO_BINARY_CHECK=true
SEDCMD-stripnull=s/\\x00/\n/g
SHOULD_LINEMERGE=false

[mysourcetype]
NO_BINARY_CHECK=true
SEDCMD-stripnull=s/\\x00/\n/g
SHOULD_LINEMERGE=true
LINE_BREAKER=([\n]+)
BREAK_ONLY_BEFORE_DATE=false

[mysourcetype]
NO_BINARY_CHECK=true
SEDCMD-stripnewline=s/[\r\n]+//g
SEDCMD-stripnull=s/\\x00/\n/g
SHOULD_LINEMERGE=true
LINE_BREAKER=([\n]+)
BREAK_ONLY_BEFORE_DATE=false
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Side note: After quite a bit of testing, I can say for certain that changing SEDCMD (and possibly other settings) in props.conf on the indexer shows up immediately in btool output, but it is not applied to forwarded input until Splunk is restarted! Frustrating.&lt;/P&gt;</description>
      <pubDate>Tue, 22 Feb 2011 05:51:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Matching-nulls-in-LINE-BREAKER-removing-first-letter-x/m-p/48025#M11464</guid>
      <dc:creator>mikel8</dc:creator>
      <dc:date>2011-02-22T05:51:55Z</dc:date>
    </item>
    <item>
      <title>Re: Matching nulls in LINE_BREAKER removing first letter x?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Matching-nulls-in-LINE-BREAKER-removing-first-letter-x/m-p/48026#M11465</link>
      <description>&lt;P&gt;(Posted reply as an answer.)&lt;/P&gt;</description>
      <pubDate>Tue, 22 Feb 2011 05:52:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Matching-nulls-in-LINE-BREAKER-removing-first-letter-x/m-p/48026#M11465</guid>
      <dc:creator>mikel8</dc:creator>
      <dc:date>2011-02-22T05:52:14Z</dc:date>
    </item>
    <item>
      <title>Re: Matching nulls in LINE_BREAKER removing first letter x?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Matching-nulls-in-LINE-BREAKER-removing-first-letter-x/m-p/48027#M11466</link>
      <description>&lt;P&gt;Just had to change the sed to replace multiple nulls with one \n: SEDCMD-stripnull = s/(?:\x00)+/\n/g. Thanks again ron!&lt;/P&gt;</description>
      <pubDate>Tue, 22 Feb 2011 06:04:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Matching-nulls-in-LINE-BREAKER-removing-first-letter-x/m-p/48027#M11466</guid>
      <dc:creator>mikel8</dc:creator>
      <dc:date>2011-02-22T06:04:29Z</dc:date>
    </item>
    <item>
      <title>Re: Matching nulls in LINE_BREAKER removing first letter x?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Matching-nulls-in-LINE-BREAKER-removing-first-letter-x/m-p/48028#M11467</link>
      <description>&lt;P&gt;Awesome, glad you were able to get it to work!  Next time you need to use SEDCMD, keep in mind that you can use multiple sed's with a single SEDCMD.  For instance:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[nulls]
NO_BINARY_CHECK = true
SEDCMD-stripnull = s/\\x00/\n/g s/\n{2,}/\n/g s/^[\n]*$//g
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;In addition to replacing nulls with \n's, this should strip any lines that contain all \n's, as well as convert any multiple \n's into singles.  (Posted to illustrate 3 sed's in 1)&lt;/P&gt;

&lt;P&gt;Cheers&lt;/P&gt;</description>
      <pubDate>Tue, 22 Feb 2011 09:35:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Matching-nulls-in-LINE-BREAKER-removing-first-letter-x/m-p/48028#M11467</guid>
      <dc:creator>Ron_Naken</dc:creator>
      <dc:date>2011-02-22T09:35:05Z</dc:date>
    </item>
  </channel>
</rss>

