<?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: Multiline field in modular input getting newline removed while indexed in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Multiline-field-in-modular-input-getting-newline-removed-while/m-p/404976#M71876</link>
    <description>&lt;P&gt;I'm going to mark this as resolved.&lt;/P&gt;

&lt;P&gt;The problem wasn't during indexing. It was actually here:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;     csvdata = [row for row in csv.reader(data.splitlines())]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;It mishandled the newlines. Getting rid of that and spliting on "\r\n" solved the problem&lt;/P&gt;</description>
    <pubDate>Fri, 10 Aug 2018 17:16:33 GMT</pubDate>
    <dc:creator>scottsavareseat</dc:creator>
    <dc:date>2018-08-10T17:16:33Z</dc:date>
    <item>
      <title>Multiline field in modular input getting newline removed while indexed</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Multiline-field-in-modular-input-getting-newline-removed-while/m-p/404975#M71875</link>
      <description>&lt;P&gt;I am creating a modular input. My input is a CSV and I convert it to JSON to be imported as a new event in Splunk. Several of the fields have newlines in the data. However, once indexed the newlines are removed. Here is the code that does it:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;    csvdata = [row for row in csv.reader(data.splitlines())]
    header = csvdata.pop(0)
    for row in csvdata:
        e = {}
        for col, val in zip( header, row ):
            col = col.replace( " ", "_" )
            e[col] = val
        event_time = calendar.timegm(time.strptime(e["timefield"], time_pattern))
        event = helper.new_event(data=json.dumps(e), time=event_time, index=index, unbroken=True)
        ew.write_event(event)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;One thing I've tried is adding the SHOULD_LINEMERGE=0 to props.conf which didn't work. Is there a way to tell Splunk not to remove the newlines from fields?&lt;/P&gt;

&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Thu, 09 Aug 2018 15:21:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Multiline-field-in-modular-input-getting-newline-removed-while/m-p/404975#M71875</guid>
      <dc:creator>scottsavareseat</dc:creator>
      <dc:date>2018-08-09T15:21:02Z</dc:date>
    </item>
    <item>
      <title>Re: Multiline field in modular input getting newline removed while indexed</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Multiline-field-in-modular-input-getting-newline-removed-while/m-p/404976#M71876</link>
      <description>&lt;P&gt;I'm going to mark this as resolved.&lt;/P&gt;

&lt;P&gt;The problem wasn't during indexing. It was actually here:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;     csvdata = [row for row in csv.reader(data.splitlines())]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;It mishandled the newlines. Getting rid of that and spliting on "\r\n" solved the problem&lt;/P&gt;</description>
      <pubDate>Fri, 10 Aug 2018 17:16:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Multiline-field-in-modular-input-getting-newline-removed-while/m-p/404976#M71876</guid>
      <dc:creator>scottsavareseat</dc:creator>
      <dc:date>2018-08-10T17:16:33Z</dc:date>
    </item>
  </channel>
</rss>

