<?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: Splunk Raw text showing backslashes before double quotes in event data in Splunk Dev</title>
    <link>https://community.splunk.com/t5/Splunk-Dev/Splunk-Raw-text-showing-backslashes-before-double-quotes-in/m-p/333183#M4915</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;Is the field extraction working fine?&lt;BR /&gt;
You can refer the following doc:&lt;BR /&gt;
&lt;A href="https://docs.splunk.com/Documentation/Splunk/7.0.2/Admin/Transformsconf"&gt;https://docs.splunk.com/Documentation/Splunk/7.0.2/Admin/Transformsconf&lt;/A&gt;&lt;BR /&gt;
And use parameter FORMAT&lt;BR /&gt;
Let me know if this helps!!&lt;/P&gt;</description>
    <pubDate>Fri, 09 Mar 2018 07:20:50 GMT</pubDate>
    <dc:creator>deepashri_123</dc:creator>
    <dc:date>2018-03-09T07:20:50Z</dc:date>
    <item>
      <title>Splunk Raw text showing backslashes before double quotes in event data</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Splunk-Raw-text-showing-backslashes-before-double-quotes-in/m-p/333181#M4913</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I am using log4j2 &amp;amp; splunk-library-javalogging to log event(data) to SplunkHEC HTTP Event Collector.&lt;/P&gt;

&lt;P&gt;My event(data) is typically JSON objects containing key value pairs.&lt;/P&gt;

&lt;P&gt;Below is how it looks in Splunk (Syntax Highlighted format). This looks good.&lt;BR /&gt;
{   [-] &lt;BR /&gt;
     logger:     tlrSplunkLogger&lt;BR /&gt;&lt;BR /&gt;
     message:    {"event":"data has " double quotes "}&lt;BR /&gt;&lt;BR /&gt;
     severity:   INFO&lt;BR /&gt;&lt;BR /&gt;
     thread:     main&lt;BR /&gt;&lt;BR /&gt;
}&lt;/P&gt;

&lt;P&gt;But when I view in Raw text format, it looks below:&lt;BR /&gt;
{"severity":"INFO","logger":"tlrSplunkLogger","thread":"main","message":"{\"event\":\"data has \" double quotes \"}"}&lt;/P&gt;

&lt;P&gt;Note the backslashes before double quotes e,g,  \"event\"&lt;BR /&gt;
In above event(data) their is a key named "Message" and its value starts with double quotes(") due to this all contents containing double quotes are escaped like \"event\"&lt;BR /&gt;
Is this the default/correct behaviour in Splunk?&lt;BR /&gt;
Can I somehow do anything before/while logging event(data) to Splunk so as backslashes are not present in raw text?&lt;BR /&gt;
I tried lot of things from JSONLayout to encode data, so as, raw text do not have backslashes but nothing worked.&lt;BR /&gt;
Does this need to taken care on Splunk side?&lt;/P&gt;

&lt;P&gt;Any information on this would he highly appreciated.&lt;/P&gt;

&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Wed, 07 Mar 2018 07:19:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Splunk-Raw-text-showing-backslashes-before-double-quotes-in/m-p/333181#M4913</guid>
      <dc:creator>gaikwadaditya</dc:creator>
      <dc:date>2018-03-07T07:19:00Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk Raw text showing backslashes before double quotes in event data</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Splunk-Raw-text-showing-backslashes-before-double-quotes-in/m-p/333182#M4914</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;Can you share sample data before indexing?&lt;/P&gt;</description>
      <pubDate>Fri, 09 Mar 2018 06:47:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Splunk-Raw-text-showing-backslashes-before-double-quotes-in/m-p/333182#M4914</guid>
      <dc:creator>p_gurav</dc:creator>
      <dc:date>2018-03-09T06:47:05Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk Raw text showing backslashes before double quotes in event data</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Splunk-Raw-text-showing-backslashes-before-double-quotes-in/m-p/333183#M4915</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;Is the field extraction working fine?&lt;BR /&gt;
You can refer the following doc:&lt;BR /&gt;
&lt;A href="https://docs.splunk.com/Documentation/Splunk/7.0.2/Admin/Transformsconf"&gt;https://docs.splunk.com/Documentation/Splunk/7.0.2/Admin/Transformsconf&lt;/A&gt;&lt;BR /&gt;
And use parameter FORMAT&lt;BR /&gt;
Let me know if this helps!!&lt;/P&gt;</description>
      <pubDate>Fri, 09 Mar 2018 07:20:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Splunk-Raw-text-showing-backslashes-before-double-quotes-in/m-p/333183#M4915</guid>
      <dc:creator>deepashri_123</dc:creator>
      <dc:date>2018-03-09T07:20:50Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk Raw text showing backslashes before double quotes in event data</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Splunk-Raw-text-showing-backslashes-before-double-quotes-in/m-p/333184#M4916</link>
      <description>&lt;P&gt;Hi, &lt;/P&gt;

&lt;P&gt;Thanks for the solutions.&lt;/P&gt;

&lt;P&gt;After debugging lot of code I found out the issue.&lt;/P&gt;

&lt;P&gt;splunk-library-javalogging(1.5.3) internally uses library json-simple-1.1.1 jar for converting JSONObject to string and vice versa.&lt;/P&gt;

&lt;P&gt;The JSONObject's toString method has a bug which puts an escape character.&lt;/P&gt;

&lt;P&gt;If we fetch the value of JSONObject with the help of get(key) method it is correct but toString method messes the data.&lt;/P&gt;

&lt;P&gt;Due to above bug I took another approach of consuming SplunkHEC through apache HTTPAsyncClient which works fine.&lt;/P&gt;

&lt;P&gt;Thanks,&lt;BR /&gt;
Aditya&lt;/P&gt;</description>
      <pubDate>Mon, 12 Mar 2018 08:57:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Splunk-Raw-text-showing-backslashes-before-double-quotes-in/m-p/333184#M4916</guid>
      <dc:creator>gaikwadaditya</dc:creator>
      <dc:date>2018-03-12T08:57:24Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk Raw text showing backslashes before double quotes in event data</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Splunk-Raw-text-showing-backslashes-before-double-quotes-in/m-p/333185#M4917</link>
      <description>&lt;P&gt;Hi, @gaikwadaditya.  If your problem is resolved, please accept the answer to help future readers.&lt;/P&gt;</description>
      <pubDate>Mon, 12 Mar 2018 12:36:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Splunk-Raw-text-showing-backslashes-before-double-quotes-in/m-p/333185#M4917</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2018-03-12T12:36:15Z</dc:date>
    </item>
  </channel>
</rss>

