Centralized logging collects logs from every server and application into one searchable system, so you can troubleshoot and detect threats without logging in to each host. This Mintopsblog.com guide explains the pipeline, log formats, retention and setup steps.
Key Takeaways
- A logging pipeline has four parts: sources, shippers, a central store and a search or alerting layer.
- Structured logs (key-value or JSON) are far easier to search than free text.
- Synchronized clocks, consistent hostnames and clear retention rules matter as much as the tool.
- Protect logs in transit with TLS and limit who can read them, because they often contain sensitive data.
Why Centralize Logs
On one server, reading files in /var/log or using journalctl works well. With ten or a hundred servers, it does not: an error that crosses a load balancer, an application and a database leaves traces on several machines, and an attacker may delete local logs. A central system keeps a copy elsewhere, lets you search all sources at once and makes alerts possible.
Security agencies treat logging as a core control. The CISA best practices for event logging and threat detection stress central collection, consistent timestamps and protecting log integrity, and NIST SP 800-92 gives a full framework for log management planning.
The Parts of a Logging Pipeline
| Stage | Role | Common examples |
|---|---|---|
| Sources | Produce events | systemd journal, syslog, web server access logs, application logs |
| Shippers | Read, buffer and forward events | rsyslog, Fluent Bit, Filebeat, NXLog |
| Central store | Receive, parse, index and keep events | Graylog with OpenSearch, Elasticsearch, Loki |
| Search and alerts | Query, visualize, notify | Dashboards, saved searches, alert rules |
Graylog is a popular choice in tutorial-driven teams because it bundles inputs, parsing (extractors and pipeline rules), search and alerting behind one web interface, while storing data in OpenSearch or Elasticsearch and settings in MongoDB. The same pipeline ideas apply whichever product you pick.
Log Formats That Make Search Easy
Traditional syslog sends a priority, timestamp, hostname, program name and free-text message; RFC 5424 defines the modern syslog format with structured data fields. Free text is hard to filter reliably, so wherever you control the application, log in a structured form such as JSON with stable field names.
- Use the same field names everywhere, such as
user_id,request_idandstatus. - Record times in UTC with an explicit offset, for example ISO 8601.
- Add a correlation or request ID that follows a request across services.
- Log levels (debug, info, warning, error) should mean the same thing in every application.
- Never write passwords, tokens or full card numbers into logs.
Setting Up a Basic Central Log Server
- Synchronize time on every host with NTP or chrony; mismatched clocks make timelines useless.
- Pick a central store and size its disk for your daily volume multiplied by your retention period, plus headroom.
- Create an input on the central server, such as syslog over TCP or a Beats or GELF input.
- Configure shippers on each host to forward the journal and application log files, with a local buffer for outages.
- Enable TLS between shippers and the server so logs cannot be read or altered on the network.
- Add parsing rules that turn raw lines into fields, starting with your most important sources.
- Build a few saved searches and alerts, for example repeated failed SSH logins or a spike in HTTP 500 errors.
If services on a host are failing, the local journal is still the fastest first look; the systemd service management guide shows the journalctl commands. Data platforms such as NiFi produce their own logs and provenance, covered in our Apache NiFi basics article.
Retention, Access and Cost
Logs grow fast, and storage is usually the largest cost. Decide how long each type must be kept: security and authentication logs often need months, while debug logs may need days. Many teams keep recent data on fast storage for search and move older data to cheaper archives. Restrict who can read logs, record who searched them, and back up the configuration of the logging system itself.
Learn more about tooling in DevOps and Data Tools, or harden the servers that send these logs with articles in the Linux section. Our home lab guide shows how to practice this setup on spare hardware. For every topic we cover, visit the Mintopsblog.com tutorial index.
Turning Logs Into Alerts
Collecting logs is only half the job; the value comes from noticing problems quickly. Start with a short list of alerts that are almost always worth a look and refine them over time:
- Many failed SSH or application logins from one address in a few minutes.
- A successful administrator login from a new country or at an unusual hour.
- A sudden rise in HTTP 5xx errors or in application exceptions.
- A host that stops sending logs entirely, which can mean an outage or tampering.
- Disk usage on the log server above a safe threshold.
Each alert should name an owner and a first response step. Alerts that nobody acts on train people to ignore the system, so remove or tune them quickly. The tutorials in the Mintopsblog.com archive on Graylog setup focus on installation; alert design is what turns that installation into a useful tool.
Review alert results every month. Count how many fired, how many led to real action and how long the first response took. Those three numbers show whether the logging system is helping the team or only producing noise, and they give you a simple way to report its value.
Frequently Asked Questions
What Is Centralized Logging?
Centralized logging is the practice of sending logs from many servers, network devices and applications to one system that stores, indexes and searches them. It lets teams troubleshoot across machines, keep a copy that local attackers cannot easily erase, and create alerts based on patterns across the whole environment.
Is Graylog Free to Use?
Graylog offers a free, open edition that includes log collection, search, dashboards and alerts, and paid editions add features such as archiving and advanced security tools. Check the current edition comparison on the official Graylog website before planning, because the features included in each edition change between releases.
How Long Should I Keep Logs?
It depends on legal, contract and security needs. Many organizations keep authentication and security logs for at least several months, and some regulations require a year or more. Debug and verbose application logs are often kept for days. Write a retention policy per log type and size storage to match.
Should Logs Be Sent Over TLS?
Yes, whenever they cross a network. Logs often contain usernames, IP addresses and internal hostnames, and plain syslog over UDP can be read or spoofed. Most shippers and log servers support TLS on TCP inputs, and some also support client certificates so only trusted hosts can send data.





