1. Collecting #
Agent and 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 /healthGood practice: Masking and filtering in the agent avoids sending (and paying for) useless or sensitive data.
2. Structuring #
Pipelines and facets.
Pipelines #
Pipelines transform logs at ingestion: a grok parser extracts attributes, remappers designate the date, status and service, and other processors enrich (IP geolocation, user agent, lookup tables). Logs from known sources (nginx, postgres...) have ready-made integration pipelines.
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}An attribute becomes a facet (or a measure, for numbers) so it can be filtered and aggregated in the explorer:
service:checkout status:error @http.status_code:>=500 -@http.url:"/health"
@network.client.ip:10.0.* @duration:>20000000003. Controlling volume #
Logging without Limits.
Ingestion, indexes, archives #
| Stage | Cost | Usage |
|---|---|---|
| Ingestion | Per GB | All logs go through the pipelines |
| Generated metrics | Low | Count errors and latencies without indexing |
| Indexing | Per million events, depending on retention | Fast search |
| Archives | Object storage (your own) | Long-term retention, rehydration on demand |
- Exclusion filters per index (for example: index only 10% of
status:infologs). - Several indexes with different retentions (errors 30 days, debug 3 days).
- Daily quota per index to avoid surprises.
Common mistake: A log excluded from the index is not lost if it is archived, but it can no longer be viewed without rehydration. Decide with the teams what must remain immediately searchable.
My progress
Sign in to track your progress and take notes. Sign in
💬 Recent discussions about this course
- Datadog : relier traces, logs et métriques du même service✓ solved · 1 reply(ies)
Ask a question about this lesson →See all discussions about this course
Recommended Articles
Advanced Datadog logs: indexes, exclusion filters, Flex Logs, archives and Sensitive Data Scanner
Control the cost and compliance of Datadog logs: pipelines and processors, indexes and retention,...
Datadog APM and OpenTelemetry: traces, services and correlation with logs
Instrument applications for Datadog APM (dd-trace, single step instrumentation, OpenTelemetry), u...
Datadog best practices: tags, costs, alerts and governance
Checklist for using Datadog effectively: unified tagging, cost control (hosts, logs, custom metri...
Advanced Datadog metrics: types, aggregations, cardinality and Metrics without Limits
Master Datadog metrics: types (count, rate, gauge, histogram, distribution), time and space aggre...
Advanced Datadog APM: sampling, retention, profiler and Software Catalog
Go further with Datadog APM: ingestion control and sampling, retention filters, trace metrics, Co...
Metrics and tags in Datadog: unified tagging, DogStatsD and cardinality
Use Datadog metrics: unified tagging (env, service, version), queries and aggregations, custom me...
Datadog: the SaaS observability platform at a glance
What Datadog is, its products (infrastructure, logs, APM, RUM, synthetics, security), its concept...
Datadog costs and governance: usage, attribution, RBAC and tag policies
Control the bill and govern Datadog: tracking usage and estimates, cost attribution per team, usa...
Monitors, SLOs, dashboards and Datadog as code
Create effective monitors (metrics, logs, APM, composites, anomalies), SLOs, dashboards, and mana...