Splunk Dev

splunk-library-javalogging upgrade

splunkuser61
New Member

Currently all our applications are using 1.6.0 version of splunk-library-javalogging. This dependency has the vulnerable log4j2 version and I am trying to upgrade the to the latest version 1.11.3. I downloaded the dependency from splunk website and tried installing using maven. The installation is successful but this version is unable to recognize the appenders we have configured on log4j2.xml. Below are the errors I am  seeing when using the latest splunk-library-javalogging dependency.

2021-12-22 14:12:55,484 WrapperListener_start_runner ERROR Error processing element HttpSplunk ([AppenderSet: null]): CLASS_NOT_FOUND

2021-12-22 14:12:55,485 WrapperListener_start_runner ERROR Error processing element HttpSplunk ([AppenderSet: null]): CLASS_NOT_FOUND

2021-12-22 14:12:55,642 WrapperListener_start_runner ERROR No node named SplunkDevAppender in org.apache.logging.log4j.core.appender.AppenderSet@7ac97772

2021-12-22 14:12:55,643 WrapperListener_start_runner ERROR Null object returned for ScriptAppenderSelector in Appenders.

 

2021-12-22 14:12:55,649 WrapperListener_start_runner ERROR Unable to locate appender "SelectSplunkInstance" for logger config "root"

 

Log4J2 Configuration:

=============================

<Configuration  status="warn" name="splunk-cloudhub" packages="com.splunk.logging,com.mulesoft.ch.logging.appender">

   <Properties>

   <Property name="target.env">${sys:env}</Property>

       <Property name="target.app">${project.name}</Property>

        <Property name="dev.splunk.host">{{host}}</Property>

        <Property name="dev.splunk.token">{{token}}</Property>

    </Properties>

    <Appenders>

  <ScriptAppenderSelector name="SelectSplunkInstance">

      <Script language="JavaScript"><![CDATA[

        "${target.env}".search("prd") > -1 ? "SplunkPrdAppender" : "SplunkDevAppender";]]>

      </Script>

      <AppenderSet>

        <HttpSplunk name="SplunkDevAppender"

              url="https://${dev.splunk.host}"

              token="${dev.splunk.token}"

              host=""

              index="index1"

              source="${target.app}-${target.env}"

              sourcetype="application"

  messageFormat="json"

              middleware=""

              send_mode="sequential"

              batch_size_bytes="0"

              batch_size_count="0"

              batch_interval="0"

              disableCertificateValidation="true">

            <PatternLayout pattern="%m"/>

        </HttpSplunk>

        <HttpSplunk name="SplunkPrdAppender"

              url="https://${prd.splunk.host}"

              token="${prd.splunk.token}"

              host=""

              index="index2"

              source="${target.app}-${target.env}"

              sourcetype="application"

  messageFormat="json"

              middleware=""

              send_mode="sequential"

              batch_size_bytes="0"

              batch_size_count="0"

              batch_interval="0"

              disableCertificateValidation="true">

            <PatternLayout pattern="%m"/>

        </HttpSplunk>

      </AppenderSet>

    </ScriptAppenderSelector>         

    </Appenders>

=============================

Could you please let us know if there are any additional steps that we have to follow to get this to work. Attaching our log4j2 file for your reference.

0 Karma

vmalaviya
Splunk Employee
Splunk Employee

As per our analysis, there aren't any breaking changes that cause this error.
but you can try https://github.com/splunk/splunk-library-javalogging/releases/tag/1.6.2-0-2 this patch and see if it fixes the error.

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Recap | Agentic Operations Start with Context: Build the Right Data Foundation

Agentic Operations Start with Context: Build the Right Data Foundation   By Courtney Wright, Product Marketing ...

Recap | Assisted, Augmented or Agentic? Choose Your Splunk Starting Point

Assisted, Augmented or Agentic? Choose Your Splunk Starting Point   By Courtney Wright, Product Marketing ...

Session 2 | Beyond the Thread: Operationalizing AI with Confidence

Session 2   Beyond the Thread: Operationalizing AI with Confidence    The true power of the Cisco Data Fabric ...