Instrument your Java application with the Secure Application JVM agent.
The Secure Application Java Virtual Machine (JVM) agent, splunk-otel-javaagent-csa, adds APM instrumentation to your Java application and sends the data it collects to the Splunk Distribution of OpenTelemetry Collector. Follow these steps to add the JVM agent to your application and to configure it to send the OpenTelemetry events and logs that Secure Application needs.
- Identify the version of the Secure Application JVM agent that you want to install from https://repo1.maven.org/maven2/com/splunk/splunk-otel-javaagent-csa/. Use version 2.21.1.
- Download the JAR file for the version you want to install:
curl -L https://repo1.maven.org/maven2/com/splunk/splunk-otel-javaagent-csa/version/splunk-otel-javaagent-csa-version.jar -o splunk-otel-javaagent-csa.jar
Note: The name you give to the downloaded JAR file must contain splunk-otel-javaagent.
- Start your application with the JVM agent.
On the command line, configure the agent using system properties or environment variables. System properties override environment variables.
-
Syntax
-
java -javaagent:./splunk-otel-javaagent-csa.jar \
-Dotel.service.name=service-name \
-Dotel.resource.attributes=deployment.environment.name=environment-name,service.name=service-name,service.namespace=namespace-name \
-Dotel.exporter.otlp.endpoint=http://collector-endpoint:collector-port \
-jar application-name.jar
Substitute placeholders with values specific to your environment.
-
Example
-
java -javaagent:./splunk-otel-javaagent-csa.jar \
-Dotel.service.name=myService \
-Dotel.resource.attributes=deployment.environment.name=us0,service.name=myService,service.namespace=myServiceNamespace \
-Dotel.exporter.otlp.endpoint=http://otel-collector:4318 \
-jar myapp.jar
Your Java application launches with the JVM agent enabled. The JVM agent gathers a list of runtime libraries, formats them as OTLP logs, and sends the data to the OTLP exporter endpoint specified above. The JVM agent reports library data once at application startup and then every 24 hours thereafter.