I'm trying to log to splunk directly in my Java application using the logback appender for splunk.
Nothing seems to be going to splunk, but when I manually issue a post command in a REST client i'm seeing my data in splunk.
I wasn't able to get the official splunk logback test to work either.
logback.xml
<appender name="SPLUNK" class="com.splunk.logging.HttpEventCollectorLogbackAppender">
<url>http://mySplunkUrl:8088/services/collector</url>
<token>1234566789</token>
<disableCertificateValidation>true</disableCertificateValidation>
<batch_size_count>1</batch_size_count>
<layout class="ch.qos.logback.classic.PatternLayout">
<pattern>%msg</pattern>
</layout>
</appender>
<root level="trace">
<appender-ref ref="SPLUNK" />
</root>
</configuration>
Unit test
@Test
public void splunkLogger() {
Logger logger = LoggerFactory.getLogger(LogFactoryTest.class);
Date date = new Date();
String jsonMsg = String.format("{event:'CancerCenterTest'}");
logger.info("CancerCenterTest");
logger.info(jsonMsg);
}
This is the documentation I was trying to use: http://dev.splunk.com/view/splunk-logging-java/SP-CAAAE7M
Am I missing something obvious?
EDIT Here's a link to my project - https://github.com/toymachiner62/splunk-logging