Instrument a Java application
Instrument a Java application for Secure Application.
Follow the steps that correspond to your Java application's environment:
Instrument a Java application in a non-Kubernetes environment
Instrument a Java application with the Secure Application JVM extension.
Secure Application integrates runtime security detection into your Java application through a JVM extension (splunk-otel-javaagent-csa) that works with the Splunk Distribution of OpenTelemetry Java. This extension sends the OpenTelemetry events and logs that Secure Application needs to Splunk Observability Cloud. Follow these steps to add this extension to your Java application.
To monitor attacks your applications must be running on Java versions 8 - 23. Java 24+ is not universally supported.
-
Complete Step 2: Deploy a supported OpenTelemetry Collector.
-
Confirm that you meet the Java instrumentation requirements.
-
Have an active Splunk Observability Cloud account with a Secure Application license.
Your Java application launches with the JVM agent enabled. The JVM agent does the following:
-
Collects a list of runtime libraries and sends the data to the Splunk Observability Cloud back end.
-
Collects potential attack events at runtime.
-
Reports library data once at application startup and then every 24 hours thereafter.
Instrument a Java application in a Kubernetes environment
Use zero-code instrumentation to send Java application security telemetry to Secure Application from a Kubernetes environment.
Before you begin, make sure that your Kubernetes environment meets the following requirements:
- You deploy the Splunk Distribution of OpenTelemetry Collector by using the Splunk OpenTelemetry Collector Helm chart.
- The Splunk OpenTelemetry Collector Helm chart has the OpenTelemetry Operator activated with
operator.enabled=true. - Your Java application runs in a Kubernetes namespace that you can annotate.
- You don't override
instrumentation.spec.java.imagein the OpenTelemetry Operator instrumentation resource. Let the Helm chart manage the Java instrumentation image.
Follow this Kubernetes workflow when you already use, or plan to use, the OpenTelemetry Operator to inject Java instrumentation. In this workflow, the Helm chart configures the Secure Application Java instrumentation image, the namespace annotation triggers injection for Java pods, and a JVM startup flag activates security event collection.
After the pods restart, Secure Application receives security events from your Java application. Attack events appear on the Attacks page within a few minutes of pod start.
Upgrade Java instrumentation in a Kubernetes environment
Add Secure Application to an existing Java zero-code instrumentation deployment in Kubernetes.
If you already use the OpenTelemetry Operator to inject Java instrumentation for Splunk APM, you can add Secure Application without changing your application image. Activate splunkObservability.secureAppEnabled=true in the Splunk OpenTelemetry Collector Helm chart, annotate the namespace, and restart your Java application pods.
Use the following guardrails when you add Secure Application to an existing Kubernetes instrumentation deployment:
-
Let the Helm chart manage the Java instrumentation image. If you previously set a custom
instrumentation.spec.java.imagevalue, remove that override before you activate Secure Application. -
Use the namespace annotation value for your Splunk OpenTelemetry Collector Helm release, such as
instrumentation.opentelemetry.io/inject-java=splunk-otel-collector. Don't usetrueas the annotation value for this workflow. -
Keep the Secure Application activation flag,
-Dargento.allow.security.events=true, in the JVM arguments for your Java application. Without this flag, Splunk APM traces can continue to appear while Secure Application attack events don't appear. -
Restart your Java application pods after you change Helm values, annotations, or JVM arguments. The OpenTelemetry Operator injects instrumentation when Kubernetes creates the pods.
When the Helm chart manages the Java instrumentation image, existing Splunk APM trace collection continues and Secure Application receives the additional security telemetry it needs.