This article is available in French.
1. Collecter #
Agent et sources.
Configuration #
# datadog.yaml
logs_enabled: true
# conf.d/app.d/conf.yaml
logs:
- type: file
path: /var/log/app/*.log
service: checkout
source: python
log_processing_rules:
- type: mask_sequences
name: masquer_cartes
pattern: '\b\d{4}[ -]?\d{4}[ -]?\d{4}[ -]?\d{4}\b'
replace_placeholder: "[CARTE MASQUÉE]"
- type: exclude_at_match
name: sans_healthcheck
pattern: GET /healthBonne Pratique : Masquer et filtrer dans l'agent évite d'envoyer (et de payer) des données inutiles ou sensibles.
2. Structurer #
Pipelines et facettes.
Pipelines #
Les pipelines transforment les logs à l'ingestion : un grok parser extrait des attributs, des remappers désignent la date, le statut et le service, d'autres processeurs enrichissent (géolocalisation IP, user-agent, tables de correspondance). Les logs de sources connues (nginx, postgres...) ont des pipelines d'intégration prêts.
regle_acces %{ip:network.client.ip} - - \[%{date("dd/MMM/yyyy:HH:mm:ss Z"):date}\] "%{word:http.method} %{notSpace:http.url} HTTP/%{number:http.version}" %{integer:http.status_code} %{integer:network.bytes_written}Un attribut devient une facette (ou une mesure, pour les nombres) pour être filtré et agrégé dans l'explorateur :
service:checkout status:error @http.status_code:>=500 -@http.url:"/health"
@network.client.ip:10.0.* @duration:>20000000003. Maîtriser le volume #
Logging without Limits.
Ingestion, index, archives #
| Étape | Coût | Usage |
|---|---|---|
| Ingestion | Par Go | Tous les logs passent par les pipelines |
| Métriques générées | Faible | Compter erreurs et latences sans indexer |
| Indexation | Par million d'événements, selon la rétention | Recherche rapide |
| Archives | Stockage objet (le vôtre) | Conservation longue, réhydratation à la demande |
- Filtres d'exclusion par index (par exemple : n'indexer que 10 % des logs
status:info). - Plusieurs index avec des rétentions différentes (erreurs 30 jours, debug 3 jours).
- Quota journalier par index pour éviter les surprises.
Erreur Courante : Un log exclu de l'index n'est pas perdu s'il est archivé, mais il n'est plus consultable sans réhydratation. Décidez avec les équipes ce qui doit rester cherchable immédiatement.
My progress
Sign in to track your progress and take notes. Sign in
Recommended Articles
Understanding the concept of score
The concept of score allows Elasticsearch to rank your documents by relevance during a search.
Understanding the Elastic Common Schema (ECS)
As always in our consulting engagements, we recommend that companies harmonise and standardise: k...
License consumption types
Understand the evolution of billing in Dynatrace: the difference between the old licensing model ...
Grafana Alloy: The importance of Self-Monitoring
Discover why and how to configure Grafana Alloy so that it monitors itself, collecting its own lo...
Grafana Alloy: Understanding and exploiting the User Interface (UI)
Discover how to enable, secure, and use Grafana Alloy's built-in web interface to visualize your ...
Grafana Alloy: Introduction and Architecture
Discover the fundamental concepts of Grafana Alloy, the transition from the static Agent to Alloy...
Grafana Alloy: Syntax and Configuration (Alloy Language: River)
As part of a Grafana training or observability training, master the declarative syntax of Grafana...
Grafana Alloy: Metrics Collection (Prometheus & Ecosystem)
Learn how to configure Grafana Alloy to collect, transform, and forward metrics using the Prometh...
Grafana Alloy: Log Management with Loki
Discover how to configure Grafana Alloy to read log files, journald, or network streams, process ...