<?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: Character Encoding in log4j in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Character-Encoding-in-log4j/m-p/110614#M183584</link>
    <description>&lt;P&gt;Firstly ,org.apache.log4j.net.SocketAppender sends &lt;STRONG&gt;serialized&lt;/STRONG&gt; LoggingEvent objects over the wire ie: binary data. You need to send textual data to Splunk. So this is not going to work.&lt;/P&gt;

&lt;P&gt;Secondly , I would suggest looking at the Splunk log4j appenders on github : &lt;/P&gt;

&lt;P&gt;&lt;A href="https://github.com/splunk/splunk-library-javalogging"&gt;https://github.com/splunk/splunk-library-javalogging&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;With these appenders you can setup your log4j logging configuration to send your log events to Splunk over raw TCP or via HTTP REST.&lt;/P&gt;</description>
    <pubDate>Wed, 23 Oct 2013 05:05:14 GMT</pubDate>
    <dc:creator>Damien_Dallimor</dc:creator>
    <dc:date>2013-10-23T05:05:14Z</dc:date>
    <item>
      <title>Character Encoding in log4j</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Character-Encoding-in-log4j/m-p/110613#M183583</link>
      <description>&lt;P&gt;Setting up Splunk I'm getting rsyslog messages showing up fine but when I point a little test log4j app at it I start getting \xabc\x00 type lines showing up. I've tried the usual suspects with varying results. UTF-8 gets the ASCII characters right but still has lots of \xabc\xedf interspersed. UTF-16 is all an asian character set with a couple \x00 (specifially \x00 and no others). LATIN1 gets ascii right but again lots of \xabc\xedf.&lt;/P&gt;

&lt;P&gt;edit: says I don't have enough karma to post external links or upload a picture so the image is at&lt;BR /&gt;
imgur.com/uZaTifZ&lt;/P&gt;

&lt;P&gt;Some engineers threw together a quick java program to give me the ability to test log4j.properties and configuring splunk. Below is log4j.properties and the code to make the same program (its setup using gradle).&lt;/P&gt;

&lt;P&gt;log4j.properties&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;  1 log4j.rootLogger=DEBUG, server, FILE
  2 log4j.appender.server=org.apache.log4j.net.SocketAppender
  3 log4j.appender.server.Port=4712
  4 log4j.appender.server.RemoteHost=stg-logs01.sjc01.baynote.net
  5 log4j.appender.server.ReconnectionDelay=10000
  6 log4j.appender.server.layout = org.apache.log4j.PatternLayout
  7 log4j.appender.server.layout.conversionPattern = %m%n
  8 log = /tmp/
  9 log4j.appender.FILE = org.apache.log4j.FileAppender
 10 log4j.appender.FILE.File = ${log}/log.out
 11 log4j.appender.FILE.layout = org.apache.log4j.PatternLayout
 12 log4j.appender.FILE.layout.conversionPattern = %m%n
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;edit2: I've also tried adding log4j.appender.server.encoding = UTF-8 to the properties file and still getting \xaB\xCD&lt;/P&gt;

&lt;P&gt;and the code&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;  1 package com;
  2
  3 import org.apache.log4j.Logger;
  4
  5 public class Log4JTester {
  6         static Logger logger = Logger.getLogger(Log4JTester.class);
  7
  8         public static void main(String[] args) {
  9                 logger.info("...HI....");
 10         }
 11 }
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 22 Oct 2013 23:43:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Character-Encoding-in-log4j/m-p/110613#M183583</guid>
      <dc:creator>tscanlon</dc:creator>
      <dc:date>2013-10-22T23:43:04Z</dc:date>
    </item>
    <item>
      <title>Re: Character Encoding in log4j</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Character-Encoding-in-log4j/m-p/110614#M183584</link>
      <description>&lt;P&gt;Firstly ,org.apache.log4j.net.SocketAppender sends &lt;STRONG&gt;serialized&lt;/STRONG&gt; LoggingEvent objects over the wire ie: binary data. You need to send textual data to Splunk. So this is not going to work.&lt;/P&gt;

&lt;P&gt;Secondly , I would suggest looking at the Splunk log4j appenders on github : &lt;/P&gt;

&lt;P&gt;&lt;A href="https://github.com/splunk/splunk-library-javalogging"&gt;https://github.com/splunk/splunk-library-javalogging&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;With these appenders you can setup your log4j logging configuration to send your log events to Splunk over raw TCP or via HTTP REST.&lt;/P&gt;</description>
      <pubDate>Wed, 23 Oct 2013 05:05:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Character-Encoding-in-log4j/m-p/110614#M183584</guid>
      <dc:creator>Damien_Dallimor</dc:creator>
      <dc:date>2013-10-23T05:05:14Z</dc:date>
    </item>
    <item>
      <title>Re: Character Encoding in log4j</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Character-Encoding-in-log4j/m-p/110615#M183585</link>
      <description>&lt;P&gt;Thanks looks like I'm going to have to rework the setup.&lt;/P&gt;</description>
      <pubDate>Wed, 23 Oct 2013 23:33:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Character-Encoding-in-log4j/m-p/110615#M183585</guid>
      <dc:creator>tscanlon</dc:creator>
      <dc:date>2013-10-23T23:33:11Z</dc:date>
    </item>
  </channel>
</rss>

