When an application fails or a host experiences a security breach, inspecting log files across dozens of individual servers is slow and inefficient. Decentralized logs also disappear if an attacker compromises a machine and cleans up local audit trails to cover their tracks.

Centralized logging aggregates log data from endpoints, operating systems, and network devices into a single secure repository. In this guide, you will learn how centralized logging architectures work, how to set up a pipeline using open-source tools, and how to harden the platform against tampering.

Why Centralized Logging Matters

Modern environments rely on distributed infrastructure: virtual machines, container clusters, load balancers, and external databases. Checking each system individually during an active security incident wastes critical time.

Centralizing your telemetry solves three major operational challenges:

  • Tamper resistance: If an intruder gains root access on a web server, they can modify or delete /var/log/auth.log. If those events were shipped immediately to an external write-once log cluster, the evidence remains intact for forensic review.
  • Correlation: Tracing a single user transaction or attack path requires lining up events from reverse proxies, application backends, and database engines chronologically.
  • Regulatory compliance: Standards such as NIST SP 800-92 and CIS Benchmarks explicitly mandate collecting and securely storing audit logs off the originating host.

Core Components of a Logging Pipeline

A resilient logging pipeline breaks down into four primary layers, regardless of the specific software vendor used:

  1. The Shipper (Agent): A lightweight service running on every client system. It tails local files or listens to kernel logging sockets and forwards entries forward. Common tools include Fluent Bit, Promtail, and native rsyslog.
  2. The Ingestion and Transformation Layer: An optional buffer or stream processor that filters noise, masks sensitive fields like passwords or credit card numbers, and normalizes log formats into structured JSON. Logstash and Vector frequently serve this purpose.
  3. The Storage and Indexing Engine: A searchable database designed for fast time-series text retrieval. OpenSearch (the community-driven open-source fork of Elasticsearch) is the industry standard for full-text search, while Grafana Loki offers a lightweight alternative tailored for label-based indexing.
  4. The Visualization Dashboard: A web interface used to query events, create charts, and configure alerting thresholds. OpenSearch Dashboards and Grafana are the primary open-source choices.

Step-by-Step Implementation

The following workflow outlines building a baseline pipeline using OpenSearch as the indexing engine, OpenSearch Dashboards for querying, and Fluent Bit as the lightweight shipper on remote endpoints.

1. Prepare the Central Storage Node

Deploy OpenSearch on a dedicated Linux host. Ensure the node has sufficient memory allocated to its JVM heap (typically half of system RAM, not exceeding 31 GB) and that its storage volume uses an SSD array.

By default, secure your OpenSearch installation by enabling TLS for both the REST API layer (port 9200) and the internal transport layer (port 9300). Generate internal certificates using OpenSSL or your internal Public Key Infrastructure (PKI).

# Test secure connectivity to your local OpenSearch node
curl -k -u admin:SecurePassword123! https://10.0.0.50:9200

If configured correctly, the node returns a JSON response containing its cluster name, version, and health status.

2. Deploy and Configure Fluent Bit on Endpoints

Avoid installing heavy runtimes on production application servers. Fluent Bit is written in C and consumes very little memory. Install Fluent Bit using your distribution package manager.

Create a configuration file at /etc/fluent-bit/fluent-bit.conf. This setup captures both the systemd journal and local authorization logs, transforms them to JSON, and forwards them over TLS:

[SERVICE]
    Flush        1
    Daemon       Off
    Log_Level    info
    Parsers_File parsers.conf

[INPUT]
    Name         tail
    Path         /var/log/auth.log
    Tag          auth.log
    Parser       syslog

[INPUT]
    Name         systemd
    Tag          host.systemd
    Read_From_Tail On

[OUTPUT]
    Name         opensearch
    Match        *
    Host         10.0.0.50
    Port         9200
    Index        endpoint-logs
    HTTP_User    fluentbit_shipper
    HTTP_Passwd  ShipperPassword456!
    tls          On
    tls.verify   On
    tls.ca_file  /etc/fluent-bit/certs/ca.pem

Restart the service to begin shipping records:

sudo systemctl enable --now fluent-bit
sudo systemctl status fluent-bit

3. Handle Legacy Network Devices with rsyslog

Appliances such as hardware firewalls, switches, and VPN concentrators rarely support modern software agents. Instead, they export raw syslog messages over UDP or TCP port 514.

Configure a dedicated log relay machine to receive legacy syslog traffic and store it safely without exposing your database directly to untrusted networks. In /etc/rsyslog.conf, enable network reception:

module(load="imtcp")
input(type="imtcp" port="514")

# Store remote device logs in isolated directories per host
$template RemoteLogs,"/var/log/remote/%HOSTNAME%/%PROGRAMNAME%.log"
*.* ?RemoteLogs

Fluent Bit can then tail the /var/log/remote/ directory and securely ship those entries to OpenSearch.

4. Visualize and Query Events

Log in to OpenSearch Dashboards (port 5601). Navigate to Management > Index Patterns and create a pattern matching endpoint-logs-*.

Navigate to the Discover tab to view streaming messages in real time. You can run structured queries using Lucene syntax or OpenSearch Query DSL, such as isolating failed authentication attempts across the fleet:

log: "Failed password" AND host.systemd: "sshd"

Common Implementation Mistakes

Designing a centralized logging pipeline involves managing high data throughput and sensitive information. Watch out for these operational traps:

  • Transmitting logs in plaintext: Sending unencrypted logs over an internal network is a major security risk. Logs routinely contain internal hostnames, IP addresses, environment variables, and occasionally leaked session tokens. Always enforce TLS.
  • Neglecting disk retention policies: Without automated lifecycle management, your database will fill its disk and crash. Configure OpenSearch Index State Management (ISM) to transition old indexes to read-only status and delete them after your required retention window (e.g., 90 days).
  • Ignoring log ingestion spikes: Network scans or application bugs can trigger sudden bursts of thousands of events per second. If the indexing engine cannot keep up, endpoints may drop messages. Use a message broker like Apache Kafka or Redis as a buffer in high-volume environments.
  • Over-indexing raw strings: Indexing entire large text payloads as analyzed fields uses substantial RAM and storage. Set up explicit index mappings that index operational fields (status codes, usernames, source IPs) as exact keywords rather than free-form text.

Logging Architecture Checklist

Before moving your logging infrastructure to production, verify that your pipeline meets these baseline standards:

  • NTP Synchronization: All servers and network devices run Chrony or NTP. Correlating logs across systems is impossible if server clocks drift by even a few seconds.
  • Principle of Least Privilege: The credentials used by your log shipper only have write permissions for specific index patterns and cannot read or delete existing indexes.
  • Data Redaction: Ingestion filters actively scrub sensitive patterns, including API tokens, session secrets, and payment data, before records reach disk.
  • Off-Site Backups: Compressed snapshots of indexed logs are exported to encrypted, write-once object storage to meet disaster recovery and forensic preservation standards.