<?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: Multi-line event field extraction in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Multi-line-event-field-extraction/m-p/28581#M5678</link>
    <description>&lt;P&gt;Assuming that all lines are seperate events, you can use such a regex:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=disk sourcetype="disk_logs" | rex "^(?&amp;lt;fs&amp;gt;.+?)\s+(?&amp;lt;fs_total&amp;gt;\d+)\s+(?&amp;lt;fs_used&amp;gt;\d+)$"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Otherwise you can split the events into seperate results: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=disk sourcetype="disk_logs" | rex "(?m)^(?&amp;lt;line&amp;gt;\V+)$" max_match=10000 | table line | mvexpand line | rex field=line "^(?&amp;lt;fs&amp;gt;.+?)\s+(?&amp;lt;fs_total&amp;gt;\d+)\s+(?&amp;lt;fs_used&amp;gt;\d+)$"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 15 Jun 2011 18:23:41 GMT</pubDate>
    <dc:creator>ziegfried</dc:creator>
    <dc:date>2011-06-15T18:23:41Z</dc:date>
    <item>
      <title>Multi-line event field extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Multi-line-event-field-extraction/m-p/28580#M5677</link>
      <description>&lt;P&gt;I have logs being indexed that look like:&lt;/P&gt;

&lt;P&gt;/some/filesystem/path 1234567890 1500&lt;BR /&gt;&lt;BR /&gt;
/some/filesystem/path2 1256320145 452633&lt;BR /&gt;&lt;BR /&gt;
/some/filesystem2/path 2365800125 1122233&lt;BR /&gt;&lt;BR /&gt;
/some/filesystem2/path2 6539025630 553222&lt;BR /&gt;&lt;BR /&gt;
...&lt;/P&gt;

&lt;P&gt;I am trying to get each line extracted into 3 fields (for example fs, fs_total, fs_used). Some logs will have 1 line, and some logs will have 400+ lines. &lt;/P&gt;

&lt;P&gt;I have tried rex like&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;index=disk sourcetype="disk_logs"| rex field=_raw "(?i)(?m)[0-9]{1,15}(?&amp;lt;filesystem_used&amp;gt;.*)"&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;and that will give me the last column, but I'm not sure how to get all 3 columns into 3 fields for all the lines per log.&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jun 2011 18:14:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Multi-line-event-field-extraction/m-p/28580#M5677</guid>
      <dc:creator>joshrabinowitz</dc:creator>
      <dc:date>2011-06-15T18:14:09Z</dc:date>
    </item>
    <item>
      <title>Re: Multi-line event field extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Multi-line-event-field-extraction/m-p/28581#M5678</link>
      <description>&lt;P&gt;Assuming that all lines are seperate events, you can use such a regex:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=disk sourcetype="disk_logs" | rex "^(?&amp;lt;fs&amp;gt;.+?)\s+(?&amp;lt;fs_total&amp;gt;\d+)\s+(?&amp;lt;fs_used&amp;gt;\d+)$"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Otherwise you can split the events into seperate results: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=disk sourcetype="disk_logs" | rex "(?m)^(?&amp;lt;line&amp;gt;\V+)$" max_match=10000 | table line | mvexpand line | rex field=line "^(?&amp;lt;fs&amp;gt;.+?)\s+(?&amp;lt;fs_total&amp;gt;\d+)\s+(?&amp;lt;fs_used&amp;gt;\d+)$"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 15 Jun 2011 18:23:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Multi-line-event-field-extraction/m-p/28581#M5678</guid>
      <dc:creator>ziegfried</dc:creator>
      <dc:date>2011-06-15T18:23:41Z</dc:date>
    </item>
    <item>
      <title>Re: Multi-line event field extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Multi-line-event-field-extraction/m-p/28582#M5679</link>
      <description>&lt;P&gt;works great! except for the events that have multiple lines. the largest is 442 lines in one event. not sure how to go about reading each line and extracting the 3 fields.&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jun 2011 18:29:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Multi-line-event-field-extraction/m-p/28582#M5679</guid>
      <dc:creator>joshrabinowitz</dc:creator>
      <dc:date>2011-06-15T18:29:03Z</dc:date>
    </item>
    <item>
      <title>Re: Multi-line event field extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Multi-line-event-field-extraction/m-p/28583#M5680</link>
      <description>&lt;P&gt;Is this by intention?&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jun 2011 18:36:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Multi-line-event-field-extraction/m-p/28583#M5680</guid>
      <dc:creator>ziegfried</dc:creator>
      <dc:date>2011-06-15T18:36:55Z</dc:date>
    </item>
    <item>
      <title>Re: Multi-line event field extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Multi-line-event-field-extraction/m-p/28584#M5681</link>
      <description>&lt;P&gt;even if you did not generate the logs, you can still configure how splunk is doing the line breaking&lt;/P&gt;

&lt;P&gt;transforms.conf&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[disk_logs]
SHOULD_LINEMERGE = false
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 15 Jun 2011 19:26:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Multi-line-event-field-extraction/m-p/28584#M5681</guid>
      <dc:creator>ziegfried</dc:creator>
      <dc:date>2011-06-15T19:26:45Z</dc:date>
    </item>
    <item>
      <title>Re: Multi-line event field extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Multi-line-event-field-extraction/m-p/28585#M5682</link>
      <description>&lt;P&gt;makes the perfect table, thank you so much! now i just need to figure out how to make some pretty graphs with each fs_total and fs_used as the y-axis and time as the x-axis (each event has a unix m-time which splunk seems to respect) and make a graph per fs&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 09:40:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Multi-line-event-field-extraction/m-p/28585#M5682</guid>
      <dc:creator>joshrabinowitz</dc:creator>
      <dc:date>2020-09-28T09:40:44Z</dc:date>
    </item>
    <item>
      <title>Re: Multi-line event field extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Multi-line-event-field-extraction/m-p/28586#M5683</link>
      <description>&lt;P&gt;Great! Please accept the answer.&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jun 2011 23:50:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Multi-line-event-field-extraction/m-p/28586#M5683</guid>
      <dc:creator>ziegfried</dc:creator>
      <dc:date>2011-06-15T23:50:01Z</dc:date>
    </item>
  </channel>
</rss>

