RousselTMLEARNING

Observability

Agent policies, integrations, data streams and pipelines

Build agent policies, add integrations (System, Nginx, Custom Logs), choose namespaces, customise ingestion with @custom pipelines and processors, and manage variables.

1. Designing policies #

One policy per role.

Breakdown #

A policy groups what a set of hosts must collect. Split by role (web servers, databases, Windows desktops) and by environment through the namespace, rather than one giant policy for the whole fleet.

PolicyIntegrationsNamespace
web-prodSystem, Nginxprod
db-prodSystem, PostgreSQLprod
windows-postesSystem, Windows, Elastic Defendcorp

Policy settings #

  • Default namespace, data output and monitoring output.
  • Collection of the agent's own logs and metrics (monitoring).
  • Unenrollment timeout for inactive agents, uninstall protection (Elastic Defend).

2. Integrations #

System, Nginx, Custom Logs.

What an integration contains #

Source, integration, pipeline, data stream, Kibana.

An integration provides the collection configuration, the ingest pipelines that structure data (ECS), the mappings and dashboards. Its assets are installed in Elasticsearch and Kibana as soon as it is added to a policy.

Custom logs #

# Intégration « Custom Logs (Filestream) » : paramètres principaux
paths:
  - /var/log/monapp/*.log
data_stream.dataset: monapp
parsers:
  - multiline:
      type: pattern
      pattern: '^\d{4}-\d{2}-\d{2}'
      negate: true
      match: after
processors:
  - add_fields:
      target: ''
      fields:
        service.name: monapp

3. Customising ingestion #

Without changing managed assets.

The @custom pipeline #

Each integration data stream calls a <type>-<dataset>@custom pipeline if it exists. This is where to add your processing: it survives integration upgrades.

PUT _ingest/pipeline/logs-nginx.access@custom
{
  "processors": [
    { "set": { "field": "labels.equipe", "value": "web" } },
    { "drop": { "if": "ctx.url?.original?.startsWith('/health') == true" } }
  ]
}
Common mistake: Editing the integration's managed pipeline (logs-nginx.access-1.x.y) directly: the next upgrade overwrites it.

Variables and secrets #

Good practice: For integration passwords (databases, APIs), use Fleet secret fields: they are stored encrypted and do not appear in the exported policy.

Related articles

Elastic Agent: architecture, Fleet and integrations

Understand Elastic Agent: single collection agent, Fleet and Fleet Server, agent policies, integrations, data…

Elastic Agent or Beats? Choosing and migrating

Compare Elastic Agent and Beats (Filebeat, Metricbeat, Winlogbeat), know when to keep Beats, and migrate step…

Installing Fleet Server and enrolling Elastic Agents

Set up Fleet Server, create a policy, enroll Linux, Windows and Docker agents, understand tokens and certific…

Keep learning

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!