Ce produit n'est pas pris en charge par le site Datadog que vous avez sélectionné. ().

You can enable App and API Protection for Java services with the following setup options:

  1. If your Java service already has APM tracing set up and running, then skip to service configuration.
  2. If your Java service doesn't have APM tracing set up, you can easily enable App and API Protection with Datadog's Automatic Installation.
  3. Otherwise, continue reading the manual setup instructions below.

Overview

App and API Protection leverages the Datadog Java library to monitor and secure your Java service. The library integrates seamlessly with your existing application without requiring code changes.

For detailed compatibility information, including supported Java versions, frameworks, and deployment environments, see Java Compatibility Requirements.

This guide explains how to set up App and API Protection (AAP) for Java applications. The setup involves:

  1. Installing the Datadog Agent.
  2. Enabling App and API Protection monitoring.
  3. Running your Java application with the Datadog Agent.
  4. Verifying the setup.

Prérequis

  • Système d’exploitation Linux
  • Application Java
  • Privilèges root ou sudo
  • Systemd (pour la gestion des services)
  • Votre clé d’API Datadog
  • SDK Java Datadog (voir les exigences de version ici)

1. Installation du Datadog Agent

Installez le Datadog Agent en suivant les instructions d’installation pour les hosts Linux.

2. Activation de la surveillance de la protection des applications et des API

Automatically enabling App and API Protection through Remote Configuration

You can enable services with remote configuration on your services dashboard. Check the box for the service you want to enable App and API Protection for under Activate on your APM services.

Activation manuelle de la surveillance de la protection des applications et des API

Téléchargez la dernière version de la bibliothèque Java Datadog :

wget -O dd-java-agent.jar 'https://dtdg.co/latest-java-tracer'

Démarrez votre application Java avec le Datadog Agent et App and API Protection activé en utilisant les propriétés système :

java -javaagent:/path/to/dd-java-agent.jar -Ddd.appsec.enabled=true -Ddd.service=<MY_SERVICE> -Ddd.env=<MY_ENV> -jar path/to/app.jar

Définissez les variables d’environnement requises et démarrez votre application Java :

export DD_APPSEC_ENABLED=true
export DD_SERVICE=<YOUR_SERVICE_NAME>
export DD_ENV=<YOUR_ENVIRONMENT>

java -javaagent:/path/to/dd-java-agent.jar -jar path/to/app.jar

Pour désactiver le traçage APM tout en conservant la protection des applications et des API activée, vous devez définir la variable de traçage APM sur false.

Démarrez votre application Java avec le Datadog Agent et App and API Protection activé en utilisant les propriétés système :

java -javaagent:/path/to/dd-java-agent.jar -Ddd.appsec.enabled=true -Ddd.apm.tracing.enabled=false -Ddd.service=<MY_SERVICE> -Ddd.env=<MY_ENV> -jar path/to/app.jar

Définissez les variables d’environnement requises et démarrez votre application Java :

export DD_APPSEC_ENABLED=true
export DD_APM_TRACING_ENABLED=false
export DD_SERVICE=<YOUR_SERVICE_NAME>
export DD_ENV=<YOUR_ENVIRONMENT>

java -javaagent:/path/to/dd-java-agent.jar -jar path/to/app.jar

3. Exécutez votre application

Démarrez votre application Java avec les paramètres ci-dessus.

4. Verify setup

To verify that App and API Protection is working correctly:

  1. Send some traffic to your application
  2. Check the Application Signals Explorer in Datadog
  3. Look for security signals and vulnerabilities

Dépannage

Si vous rencontrez des problèmes lors de la configuration d’App and API Protection pour votre application Java, consultez le Java App and API Protection troubleshooting guide.

Pour aller plus loin