<?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: Hunk - Conditional Record Format in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Hunk-Conditional-Record-Format/m-p/152397#M31026</link>
    <description>&lt;P&gt;Many thanks for answering.&lt;/P&gt;

&lt;P&gt;I will work through these solutions, but overall I think you are right in that this data is pretty unusual. Splitting the data prior to HDFS might well be the best idea.&lt;/P&gt;</description>
    <pubDate>Mon, 17 Feb 2014 13:16:47 GMT</pubDate>
    <dc:creator>tt1</dc:creator>
    <dc:date>2014-02-17T13:16:47Z</dc:date>
    <item>
      <title>Hunk - Conditional Record Format</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Hunk-Conditional-Record-Format/m-p/152395#M31024</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I have an input file in the format as follows;&lt;/P&gt;

&lt;P&gt;1|{json_data}&lt;/P&gt;

&lt;P&gt;1|{more_json_data}&lt;/P&gt;

&lt;P&gt;2|aa|bb|cc&lt;/P&gt;

&lt;P&gt;3|11|aa|bb|dd&lt;/P&gt;

&lt;P&gt;The 1's  would always be the JSON, and the 2's and 3's would always be the csv (2 format being slightly different to 3).&lt;/P&gt;

&lt;P&gt;I would probably use the 1's separately from the others.&lt;/P&gt;

&lt;P&gt;How can you handle different formats? &lt;/P&gt;

&lt;P&gt;Any thoughts appreciated?&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 15:54:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Hunk-Conditional-Record-Format/m-p/152395#M31024</guid>
      <dc:creator>tt1</dc:creator>
      <dc:date>2020-09-28T15:54:10Z</dc:date>
    </item>
    <item>
      <title>Re: Hunk - Conditional Record Format</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Hunk-Conditional-Record-Format/m-p/152396#M31025</link>
      <description>&lt;P&gt;Having different kinds of formatted data in the same file is pretty unusual, but there are a couple of ways you can go about parsing this:&lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt;Use props/transforms.conf to parse the data (see examples below)&lt;/LI&gt;
&lt;LI&gt;Write a custom data &lt;A href="http://blogs.splunk.com/2013/10/18/images-search-with-splunk-and-hunk/"&gt;preprocessor&lt;/A&gt; to parse the data &lt;/LI&gt;
&lt;/OL&gt;

&lt;P&gt;.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;system/local/props.conf
[source::/path/to/source]
KV_MODE = JSON
SHOULD_LINEMERGE = false
# uncomment line below if your data has no timestamps
#DATETIME_CONFIG = NONE

REPORT-recs = handle-record-2, handle-record-3
SEDCMD-json = s/^1\|(.*)/\1/g

system/local/transforms.conf
[handle-record-2]
REGEX = ^2\|(?&amp;lt;field1&amp;gt;[^\|]+)\|

[handle-record-3]
REGEX = ^3\|(?&amp;lt;field1&amp;gt;[^\|]+)\|
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Here's an &lt;A href="http://docs.splunk.com/Documentation/Splunk/6.0.1/Data/Anonymizedatausingconfigurationfiles"&gt;link&lt;/A&gt; that shows how you can anonymize data in Splunk which you might find useful.&lt;/P&gt;</description>
      <pubDate>Sun, 16 Feb 2014 22:23:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Hunk-Conditional-Record-Format/m-p/152396#M31025</guid>
      <dc:creator>Ledion_Bitincka</dc:creator>
      <dc:date>2014-02-16T22:23:06Z</dc:date>
    </item>
    <item>
      <title>Re: Hunk - Conditional Record Format</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Hunk-Conditional-Record-Format/m-p/152397#M31026</link>
      <description>&lt;P&gt;Many thanks for answering.&lt;/P&gt;

&lt;P&gt;I will work through these solutions, but overall I think you are right in that this data is pretty unusual. Splitting the data prior to HDFS might well be the best idea.&lt;/P&gt;</description>
      <pubDate>Mon, 17 Feb 2014 13:16:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Hunk-Conditional-Record-Format/m-p/152397#M31026</guid>
      <dc:creator>tt1</dc:creator>
      <dc:date>2014-02-17T13:16:47Z</dc:date>
    </item>
  </channel>
</rss>

