AKP-Hub | Digital Marketing

How Linux Logs Power Security: What /var/log Contains, How Wazuh Monitors It, and Practical Steps for Detection

Introduction — Why logs/Linux Logs matter:

When a system is compromised, the first useful information almost always comes from logs. Logs record events that already happened — user logins, service starts, file changes, authentication failures, kernel messages. Because logs are generated by the system itself, they are the closest thing we have to a factual trail of activity.

But logs are noisy and voluminous. To detect attacks reliably at scale you need three things:

  1. Robust log collection and retention

  2. Good parsing and normalization (so diverse log formats become comparable)

  3. Intelligent rules, correlation and alerting (to turn noise into prioritized signals)

That’s where SIEMs like Wazuh come in.

1. What is a log?

A log is a text (or binary) record describing an event that occurred on a system. Examples of events:

  • Successful/failed login attempts

  • sudo usage and privilege elevation

  • Service start/stop and crashes

  • File creation/modification (integrity checks)

  • Network connections and rejections

Logs are records, not prevention. They tell you what happened and when — the forensic evidence used to investigate incidents and tune detection.

2. Where Linux stores logs (canonical locations)

Most classic Linux distributions store logs in:

/var/log/


Important files and their typical contents:

  • /var/log/auth.log — authentication events (SSH logins, sudo usage)
  • /var/log/syslog — general system messages and service logs (Debian/Ubuntu)
  • /var/log/kern.log — kernel messages and hardware/system errors
  • /var/log/messages — general message file on some distros (RHEL-family)
  • /var/log/secure — authentication/security events on RHEL/CentOS
  • journald (systemd): binary logs read with journalctl on modern systems

Note: systemd journald stores logs in a binary journal by default. Use journalctl to query them. Some setups forward journald output into plain text files under /var/log/ as well.

3. Quick practical commands (how to view logs)

Use these on your Linux box (replace filenames as appropriate):

View latest entries (tail):

sudo tail -n 200 /var/log/auth.log

Follow new entries in real time:

sudo tail -f /var/log/syslog

# or with journalctl

sudo journalctl -f

Search within a log:

sudo grep -i "failed password" /var/log/auth.log

Filter journalctl by unit or time:

sudo journalctl -u ssh.service --since "2 hours ago"

These commands help you spot suspicious lines fast — but doing this manually on many hosts does not scale.

deterministic-document-automation-with-python

4. How logs are generated and why format/normalization matters

Different components write logs in different formats. A web server, kernel, and application may each have different timestamp formats, field separators, or message structure. Before you can detect patterns reliably across many hosts you must normalize logs:

  • Parse timestamps into a common format (UTC recommended)
  • Extract fields (IP, user, process, PID, message)
  • Tag log type (auth, kernel, application)
  • Enrich logs with context (hostname, application name, geoIP)

Normalization is the step that turns “messy files” into searchable, comparable records.

5. What is Wazuh and how it fits (overview)

Wazuh is an open-source security platform that provides log collection, threat detection, integrity monitoring, configuration assessment, and centralized alerting. Basic components:

  • Agent: runs on endpoints, collects logs, and forwards them securely. Can collect syslog, journal, system events, file integrity events, and more.
  • Manager / Server: receives logs and events from agents, processes them using decoders and rules, and stores/forwards alerts.
  • Dashboard (Kibana/Opensearch): visualizes alerts, provides querying, dashboards, and reporting.

Wazuh is often used with ELK/Opensearch for indexing and visualizing logs.

6. From logs to alerts: rules, decoders and alerts (step-by-step)

Wazuh converts raw log lines into detections through a few steps:

  1. Collection: Agent reads logs (files, journald, syslog).
  2. Decoding / Parsing: Decoders parse the log message and extract fields.
  3. Rule Matching: Decoded events are matched against rules (e.g., SSH brute force patterns).
  4. Correlation / Aggregation: Multiple events can be grouped to reduce noise (e.g., many failed logins followed by a success).
  5. Alerting & Severity: When a rule triggers, an alert is generated with severity (info/warning/critical).
  6. Visualization & Reporting: Alerts appear on the dashboard and can create notable events for analysts.

Good rule design and correlation are what separate noisy alerts from actionable signals.

NotesForge deterministic document automation interface built with Streamlit showing live preview and theme customization options

7. Real detection examples (common security scenarios)

Below are common incidents and how logs + rules spot them:

SSH brute-force:

  • Log evidence: repeated Failed password for entries from a single IP followed by many attempts within minutes.
  • Rule idea: if > N failed attempts from same IP in T minutes → high-severity alert.

Privilege escalation (sudo abuse)

  • Log evidence: sudo: username : TTY=… ; PWD=… ; USER=root ; COMMAND=… entries; or unexpected su or sudo from service accounts.
  • Rule idea: unusual sudo activity outside business hours or from unfamiliar hosts → alert.

File integrity change (possible tampering)

  • Log evidence: filesystem events showing modifications to critical files (e.g., /etc/passwd, /usr/bin), often accompanied by process info.
  • Rule idea: file integrity monitor flags unexpected binary replacement or permission changes → alert.

Suspicious process execution

  • Log evidence: new unexpected process started; failed attempts to run binaries in /tmp or user home folders.
  • Rule idea: detect execution of binaries from user-writable directories.

8. Tuning rules and reducing false positives

A SIEM that cries wolf is ignored. Tune alerts:

  • Baseline normal behavior — understand your environment (quiet times, known processes).

  • Whitelist known benign sources — internal scanners, backup accounts.

  • Aggregate alerts — group related events so one incident makes one ticket.

  • Set severity thoughtfully — not all alerts are critical.

  • Use enrichment — add context (asset owner, role) to help prioritization.

  • Review and iterate — weekly or monthly tuning reduces noise over time.

9. Limitations: what logs cannot tell you

Logs are powerful but imperfect:

  • Logs can be missing (deleted, truncated, or never written).

  • Time sync errors (clock drift) can complicate correlation.

  • Verbose applications can drown signals in noise.

  • Logs show facts (what happened), not intent (why it happened) — human analysis or contextual systems are required.

Plan for these limitations: centralize logs, enforce retention, and keep clocks synchronized (NTP).

10. Where AI fits

After you have solid log collection, normalization, and tuned rules, AI/ML can assist with:

  • clustering similar alerts,

  • anomaly detection on metrics/time-series,

  • automated triage and suggested remediation text.

But AI should augment — not replace — correlation rules and human validation. Always keep the detection pipeline (collection → decoding → rules → correlation) sound before adding ML.

Conclusion

Logs are the foundation of monitoring. If you build a strong log pipeline and well-tuned rule set, adding ML and automation later will be valuable — otherwise it amplifies noise. Start small, validate each step, and move to automation only when the basics are solid.

References

Now that you have an overview about logs, SIEM, Wazuh take a look on official documents for more information,

For discussions: ashish@akpghub.live or LinkedIn: Ashish Krishna Pavan Gade

Leave a Comment