RousselTMLEARNING

Article · Datadog: from discovery to expertise

Logs in Datadog

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 /health
Good practice: Masking and filtering in the agent avoids sending (and paying for) useless or sensitive data.

2. Structuring #

Pipelines and facets.

Pipelines #

Journey of a log
Non-indexed logs can still be used to generate metrics and can be archived.

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:>2000000000

3. Controlling volume #

Logging without Limits.

Ingestion, indexes, archives #

StageCostUsage
IngestionPer GBAll logs go through the pipelines
Generated metricsLowCount errors and latencies without indexing
IndexingPer million events, depending on retentionFast search
ArchivesObject storage (your own)Long-term retention, rehydration on demand
  • Exclusion filters per index (for example: index only 10% of status:info logs).
  • 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.

📄 Logs in Datadog: collection, pipelines, indexes and volume control →

My progress

  • ⏱ Estimated time : ≈ 5 min

Sign in to track your progress and take notes. Sign in

💬 Recent discussions about this course

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...

Support us

♥ SUPPORT US

Support RousselTM Learning

Courses, articles, labs and certificates stay free with no intrusive ads. A voluntary contribution, of any amount you choose, pays for hosting, lab environments and new content.

Contribute with PayPal Any amount · card or PayPal accountLearn more
QR code PayPal
Or scan this QR code with your phone

Thank you, every contribution counts!