<?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: How do I get the first 96 bytes of a file? in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/How-do-I-get-the-first-96-bytes-of-a-file/m-p/396566#M70672</link>
    <description>&lt;P&gt;Use this instead:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;SHOULD_LINEMERGE = false
LINE_BREAKER = (?!)
TRUNCATE = 96
# SEDCMD-keep_first_96_bytes = s/^(.{96}).*$/\1/
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Sat, 12 Jan 2019 05:15:02 GMT</pubDate>
    <dc:creator>woodcock</dc:creator>
    <dc:date>2019-01-12T05:15:02Z</dc:date>
    <item>
      <title>How do I get the first 96 bytes of a file?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-do-I-get-the-first-96-bytes-of-a-file/m-p/396564#M70670</link>
      <description>&lt;P&gt;All, &lt;/P&gt;

&lt;P&gt;I have a file just packed full of garbage. I really just want the first 96 characters of the file. I thought I could set TRUNCATE=96 on props.conf on my intermediate heavy forwarders and it would limit that to 96 characters, but that does not seem to the case. &lt;/P&gt;

&lt;P&gt;Any recommendations? What I might be missing? &lt;/P&gt;</description>
      <pubDate>Fri, 11 Jan 2019 00:40:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-do-I-get-the-first-96-bytes-of-a-file/m-p/396564#M70670</guid>
      <dc:creator>daniel333</dc:creator>
      <dc:date>2019-01-11T00:40:31Z</dc:date>
    </item>
    <item>
      <title>Re: How do I get the first 96 bytes of a file?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-do-I-get-the-first-96-bytes-of-a-file/m-p/396565#M70671</link>
      <description>&lt;P&gt;Truncate works event by event, so if splunk breaks up the file into multiple events (e.g. 1 per line), then it will truncate each of those to 96 bytes.&lt;/P&gt;

&lt;P&gt;So to make that truncate work, you'd have to make sure to set your linebreaking config such that it considers the whole file as 1 event.&lt;/P&gt;

&lt;P&gt;But this might be one of those cases where it would be easier (and more efficient) to perhaps put some script in place that takes the first 96 bytes and writes it to a separate file for Splunk to read. That also resolves the challenge of dealing with the universal forwarder sending part of the file to one HF and part of the file to another due to auto load balancing.&lt;/P&gt;</description>
      <pubDate>Fri, 11 Jan 2019 07:21:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-do-I-get-the-first-96-bytes-of-a-file/m-p/396565#M70671</guid>
      <dc:creator>FrankVl</dc:creator>
      <dc:date>2019-01-11T07:21:36Z</dc:date>
    </item>
    <item>
      <title>Re: How do I get the first 96 bytes of a file?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-do-I-get-the-first-96-bytes-of-a-file/m-p/396566#M70672</link>
      <description>&lt;P&gt;Use this instead:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;SHOULD_LINEMERGE = false
LINE_BREAKER = (?!)
TRUNCATE = 96
# SEDCMD-keep_first_96_bytes = s/^(.{96}).*$/\1/
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 12 Jan 2019 05:15:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-do-I-get-the-first-96-bytes-of-a-file/m-p/396566#M70672</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-01-12T05:15:02Z</dc:date>
    </item>
    <item>
      <title>Re: How do I get the first 96 bytes of a file?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-do-I-get-the-first-96-bytes-of-a-file/m-p/396567#M70673</link>
      <description>&lt;P&gt;SEDCMD works on _raw, after linebreaking/merging, right? So that is not really going to do any better than truncate?&lt;/P&gt;</description>
      <pubDate>Mon, 14 Jan 2019 07:15:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-do-I-get-the-first-96-bytes-of-a-file/m-p/396567#M70673</guid>
      <dc:creator>FrankVl</dc:creator>
      <dc:date>2019-01-14T07:15:08Z</dc:date>
    </item>
    <item>
      <title>Re: How do I get the first 96 bytes of a file?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-do-I-get-the-first-96-bytes-of-a-file/m-p/396568#M70674</link>
      <description>&lt;P&gt;Good point, see updated answer.&lt;/P&gt;</description>
      <pubDate>Mon, 14 Jan 2019 21:12:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-do-I-get-the-first-96-bytes-of-a-file/m-p/396568#M70674</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-01-14T21:12:38Z</dc:date>
    </item>
  </channel>
</rss>

