<?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 How to keep only the first 5 lines of a multi-line event? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-keep-only-the-first-5-lines-of-a-multi-line-event/m-p/196064#M56524</link>
    <description>&lt;P&gt;In my logs I have a lot of java errors that are about 100 lines long. I would like to filter the event at the universal forwarder and keep only the first 5 lines. I would like single line events to be unaffected.&lt;/P&gt;

&lt;P&gt;I have the following settings, but they don't seem to be working for me.&lt;/P&gt;

&lt;P&gt;In inputs.conf&lt;BR /&gt;&lt;BR /&gt;
&lt;CODE&gt;  [monitor:///app/tmp/test-GP/test*]&lt;BR /&gt;
  sourcetype = test-GP&lt;BR /&gt;
  index = test-gp&lt;BR /&gt;
  disabled = 0&lt;BR /&gt;
  whitelist = .log$&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;In props.conf&lt;BR /&gt;&lt;BR /&gt;
&lt;CODE&gt;  [test-GP]&lt;BR /&gt;
  TRANSFORMS-shortenEvents = keepOnly5Lines  &lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;In transforms.conf&lt;BR /&gt;&lt;BR /&gt;
&lt;CODE&gt;  [keepOnly5Lines]&lt;BR /&gt;
  REGEX = (?m)^(.*\n){1,5}&lt;BR /&gt;
  FORMAT = $1&lt;TRUNCATED&gt;&lt;BR /&gt;
  DEST_KEY = _raw&lt;/TRUNCATED&gt;&lt;/CODE&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 26 Aug 2014 23:41:41 GMT</pubDate>
    <dc:creator>garypark</dc:creator>
    <dc:date>2014-08-26T23:41:41Z</dc:date>
    <item>
      <title>How to keep only the first 5 lines of a multi-line event?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-keep-only-the-first-5-lines-of-a-multi-line-event/m-p/196064#M56524</link>
      <description>&lt;P&gt;In my logs I have a lot of java errors that are about 100 lines long. I would like to filter the event at the universal forwarder and keep only the first 5 lines. I would like single line events to be unaffected.&lt;/P&gt;

&lt;P&gt;I have the following settings, but they don't seem to be working for me.&lt;/P&gt;

&lt;P&gt;In inputs.conf&lt;BR /&gt;&lt;BR /&gt;
&lt;CODE&gt;  [monitor:///app/tmp/test-GP/test*]&lt;BR /&gt;
  sourcetype = test-GP&lt;BR /&gt;
  index = test-gp&lt;BR /&gt;
  disabled = 0&lt;BR /&gt;
  whitelist = .log$&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;In props.conf&lt;BR /&gt;&lt;BR /&gt;
&lt;CODE&gt;  [test-GP]&lt;BR /&gt;
  TRANSFORMS-shortenEvents = keepOnly5Lines  &lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;In transforms.conf&lt;BR /&gt;&lt;BR /&gt;
&lt;CODE&gt;  [keepOnly5Lines]&lt;BR /&gt;
  REGEX = (?m)^(.*\n){1,5}&lt;BR /&gt;
  FORMAT = $1&lt;TRUNCATED&gt;&lt;BR /&gt;
  DEST_KEY = _raw&lt;/TRUNCATED&gt;&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Aug 2014 23:41:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-keep-only-the-first-5-lines-of-a-multi-line-event/m-p/196064#M56524</guid>
      <dc:creator>garypark</dc:creator>
      <dc:date>2014-08-26T23:41:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to keep only the first 5 lines of a multi-line event?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-keep-only-the-first-5-lines-of-a-multi-line-event/m-p/196065#M56525</link>
      <description>&lt;P&gt;Try this for your transforms.conf (keeping everything else same, your current config just keeps first 5 line in the file and remove all other entries)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[keepOnly5Lines] 
REGEX = (?m)^((.*\n){5})((.*\n)*)
FORMAT = $1
DEST_KEY = _raw
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 27 Aug 2014 02:37:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-keep-only-the-first-5-lines-of-a-multi-line-event/m-p/196065#M56525</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2014-08-27T02:37:15Z</dc:date>
    </item>
  </channel>
</rss>

