<?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 and BREAK_ONLY_BEFORE in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/regex-and-BREAK-ONLY-BEFORE/m-p/39827#M9128</link>
    <description>&lt;P&gt;Actually, as a follow-up question to Brian and gkanapthy... &lt;BR /&gt;
I have those two lines as part of the output:&lt;BR /&gt;
    0     fscsi0/hdisk1    OPEN    NORMAL    123456    0&lt;BR /&gt;
    1     fscsi1/hdisk2    OPEN    NORMAL    345667    0&lt;/P&gt;

&lt;P&gt;I'd like to create a regular expression that pulls out the fields from the first line, then a regular expression to pull the fields from the second line (though the fields would have slightly different names from one line to another). In other words, I'd like a path_num0 and a path_num1 field. How do I use regex to distinguish one line from the next? &lt;BR /&gt;
Thanks!&lt;/P&gt;</description>
    <pubDate>Mon, 28 Sep 2020 09:16:52 GMT</pubDate>
    <dc:creator>Branden</dc:creator>
    <dc:date>2020-09-28T09:16:52Z</dc:date>
    <item>
      <title>regex and BREAK_ONLY_BEFORE</title>
      <link>https://community.splunk.com/t5/Splunk-Search/regex-and-BREAK-ONLY-BEFORE/m-p/39823#M9124</link>
      <description>&lt;P&gt;I have a script that sends something like the following to stdout:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;DEV#:    0    DEVICE NAME: vpath0    TYPE: 2107900    POLICY: Optimized
SERIAL: 123bac
=======================================================================
Path#         Adapter/Hard Disk       State    Mode      Select  Errors
   0             fscsi0/hidsk22       Open     NORMAL    123456       0
   1             fscsi0/hidsk29       Open     NORMAL    456789       0

DEV#:    1    DEVICE NAME: vpath1    TYPE: 2107900    POLICY: Optimized
SERIAL: 123bac
=======================================================================
Path#         Adapter/Hard Disk       State    Mode      Select  Errors
   0             fscsi0/hidsk21       Open     NORMAL    123456       0
   1             fscsi0/hidsk28       Open     NORMAL    456789       0
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;etc... This list goes on for as many vpaths as there are on the host.&lt;/P&gt;

&lt;P&gt;I'd like to capture this via Splunk, but I need to split it up by vpath entry; I don't want the entire output to be one big entry.&lt;/P&gt;

&lt;P&gt;The script runs from $PLUNK_HOME/etc/apps/fc/bin/foo.sh on the forwarder and gets indexed as sourcetype "datapath-device"
I added a props.conf on the forwarder in $SPLUNK_HOME/etc/apps/fc/local with the following entry:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[datapath-device]
BREAK_ONLY_BEFORE = ^DEV#:\s+\d+\s\w+\s\w+:\s\w\s+\w+:\s\w+\s+\w+:\w+
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Unfortunately, it's not breaking up the output. Instead I get one huge entry with info on all the vpaths. I'm not sure if my regular expression is wrong or if props.conf is in the wrong place. &lt;/P&gt;

&lt;P&gt;Any suggestions are appreciated.&lt;/P&gt;

&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Tue, 31 Aug 2010 00:12:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/regex-and-BREAK-ONLY-BEFORE/m-p/39823#M9124</guid>
      <dc:creator>Branden</dc:creator>
      <dc:date>2010-08-31T00:12:40Z</dc:date>
    </item>
    <item>
      <title>Re: regex and BREAK_ONLY_BEFORE</title>
      <link>https://community.splunk.com/t5/Splunk-Search/regex-and-BREAK-ONLY-BEFORE/m-p/39824#M9125</link>
      <description>&lt;P&gt;You need to update the props.conf in $SPLUNK_HOME/etc/system/local on the indexer, not the forwarder..&lt;/P&gt;

&lt;P&gt;I was able to use the following entry (replace TEST with what your sourcetype is)&lt;/P&gt;

&lt;BLOCKQUOTE&gt;
  &lt;P&gt;[test]&lt;/P&gt;
  
  &lt;P&gt;BREAK_ONLY_BEFORE = ^DEV#:&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;Edit: Also, you may have to re-index the data to pick up the changes...&lt;/P&gt;

&lt;P&gt;Brian&lt;/P&gt;</description>
      <pubDate>Tue, 31 Aug 2010 00:23:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/regex-and-BREAK-ONLY-BEFORE/m-p/39824#M9125</guid>
      <dc:creator>Brian_Osburn</dc:creator>
      <dc:date>2010-08-31T00:23:00Z</dc:date>
    </item>
    <item>
      <title>Re: regex and BREAK_ONLY_BEFORE</title>
      <link>https://community.splunk.com/t5/Splunk-Search/regex-and-BREAK-ONLY-BEFORE/m-p/39825#M9126</link>
      <description>&lt;P&gt;Worked beautifully, thanks!!!&lt;/P&gt;</description>
      <pubDate>Tue, 31 Aug 2010 00:35:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/regex-and-BREAK-ONLY-BEFORE/m-p/39825#M9126</guid>
      <dc:creator>Branden</dc:creator>
      <dc:date>2010-08-31T00:35:46Z</dc:date>
    </item>
    <item>
      <title>Re: regex and BREAK_ONLY_BEFORE</title>
      <link>https://community.splunk.com/t5/Splunk-Search/regex-and-BREAK-ONLY-BEFORE/m-p/39826#M9127</link>
      <description>&lt;P&gt;Yeah, as Brian Osburn says, this configuration must go where-ever the parsing phase occurs. See &lt;A href="http://www.splunk.com/wiki/Where_do_I_configure_my_Splunk_settings%3F" rel="nofollow"&gt;here&lt;/A&gt;. &lt;/P&gt;

&lt;P&gt;I notice there are also no timestamps, so you might want to add a line:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;DATETIME_CONFIG = CURRENT
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;(or some other more complicated config if you need to get it from the file name)&lt;/P&gt;</description>
      <pubDate>Tue, 31 Aug 2010 00:39:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/regex-and-BREAK-ONLY-BEFORE/m-p/39826#M9127</guid>
      <dc:creator>gkanapathy</dc:creator>
      <dc:date>2010-08-31T00:39:23Z</dc:date>
    </item>
    <item>
      <title>Re: regex and BREAK_ONLY_BEFORE</title>
      <link>https://community.splunk.com/t5/Splunk-Search/regex-and-BREAK-ONLY-BEFORE/m-p/39827#M9128</link>
      <description>&lt;P&gt;Actually, as a follow-up question to Brian and gkanapthy... &lt;BR /&gt;
I have those two lines as part of the output:&lt;BR /&gt;
    0     fscsi0/hdisk1    OPEN    NORMAL    123456    0&lt;BR /&gt;
    1     fscsi1/hdisk2    OPEN    NORMAL    345667    0&lt;/P&gt;

&lt;P&gt;I'd like to create a regular expression that pulls out the fields from the first line, then a regular expression to pull the fields from the second line (though the fields would have slightly different names from one line to another). In other words, I'd like a path_num0 and a path_num1 field. How do I use regex to distinguish one line from the next? &lt;BR /&gt;
Thanks!&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 09:16:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/regex-and-BREAK-ONLY-BEFORE/m-p/39827#M9128</guid>
      <dc:creator>Branden</dc:creator>
      <dc:date>2020-09-28T09:16:52Z</dc:date>
    </item>
    <item>
      <title>Re: regex and BREAK_ONLY_BEFORE</title>
      <link>https://community.splunk.com/t5/Splunk-Search/regex-and-BREAK-ONLY-BEFORE/m-p/39828#M9129</link>
      <description>&lt;P&gt;You're not going to be able to do this very well with search-time regex. What you probably need is the "multikv" command. You &lt;EM&gt;might&lt;/EM&gt; need to do a change on _raw (using &lt;CODE&gt;eval _raw=replace(_raw,...&lt;/CODE&gt; and/or &lt;CODE&gt;rex&lt;/CODE&gt; first) to clear out the header after extracting useful information from those. Actually it might be better to post this as another question, it needs fuller answer than I have room for here.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 09:16:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/regex-and-BREAK-ONLY-BEFORE/m-p/39828#M9129</guid>
      <dc:creator>gkanapathy</dc:creator>
      <dc:date>2020-09-28T09:16:55Z</dc:date>
    </item>
  </channel>
</rss>

