Getting Data In

Splunk Log4J2 Appender in Spring Boot with Maven

ssdarkside2
Explorer

I have a simple Maven configuration where I know the following is on the classpath (I can verify it at runtime before Spring Boot starts up in my application class):

com.splunk.logging:splunk-library-javalogging:1.6.2

The Maven dependency looks like:

<dependency>
  <groupId>com.splunk.logging</groupId>
  <artifactId>splunk-library-javalogging</artifactId>
  <version>1.6.2</version>
</dependency>

 

I made sure that Spring Boot is loaded this way:

<dependency>
  <groupId>org.springframework.boot</groupId>
  <artifactId>spring-boot-starter-web</artifactId>
  <version>${version.spring.boot}</version>
  <exclusions>
    <exclusion>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-logging</artifactId>
    </exclusion>
  </exclusions>
</dependency>

<dependency>
  <groupId>org.springframework.boot</groupId>
  <artifactId>spring-boot-starter-log4j2</artifactId>
  <version>2.5.4</version>
</dependency>
  

 

I created an appender this way:

<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="info" name="LoggingTesting" packages="">
  <Appenders>
    <SplunkHttp name="SPLUNK_APPENDER_1"
                url="http://SPLUNK_IP:8088/services/collector/event"
                token="MY_TOKEN"
                source="SampleJavaAppender1"
                messageFormat="text"
                batch_size_bytes="0"
                batch_size_count="5"
                batch_interval="0"
                connect_timeout="5000"
                disableCertificateValidation="true">
      <PatternLayout pattern="%m"/>
    </SplunkHttp>

 

When I launch my application, I get this error:

main ERROR Error processing element SplunkHttp ([Appenders: null]): CLASS_NOT_FOUND
main ERROR Unable to locate appender "SPLUNK_APPENDER_1" for logger config "root"

This was all based on the sample Log4J2 configuration .

What am I missing in my configuration?

Labels (1)
0 Karma
Get Updates on the Splunk Community!

Splunk Enterprise Security: Your Command Center for PCI DSS Compliance

Every security professional knows the drill. The PCI DSS audit is approaching, and suddenly everyone's asking ...

Developer Spotlight with Guilhem Marchand

From Splunk Engineer to Founder: The Journey Behind TrackMe    After spending over 12 years working full time ...

Cisco Catalyst Center Meets Splunk ITSI: From 'Payments Are Down' to Root Cause in ...

The Problem: When Networks and Services Don't Talk Payment systems fail at a retail location. Customers are ...