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!

Building Reliable Asset and Identity Frameworks in Splunk ES

 Accurate asset and identity resolution is the backbone of security operations. Without it, alerts are ...

Cloud Monitoring Console - Unlocking Greater Visibility in SVC Usage Reporting

For Splunk Cloud customers, understanding and optimizing Splunk Virtual Compute (SVC) usage and resource ...

Automatic Discovery Part 3: Practical Use Cases

If you’ve enabled Automatic Discovery in your install of the Splunk Distribution of the OpenTelemetry ...