Lesson 2 of 4 Security Monitoring and Analysis

Log Management

Logs are evidence, so they must be complete, accurate, protected and kept for the right time. This lesson explains logging policy, integrity and preservation, logging architectures, configuration, aggregation and tuning.

Learning outcomes

After completing this lesson, you will be able to:

  • Describe the contents of a logging policy.
  • Explain how log integrity and preservation are protected.
  • Describe logging architectures, configuration and aggregation.
  • Explain the purpose of tuning.

Logging policy

A logging policy defines which systems must log, which events they must record, the minimum detail of each entry, where logs are sent, how long they are retained, who may access them and how they are protected. It is driven by security needs (detection and investigation), accountability, legal and regulatory requirements (for example PCI DSS requires audit trails and their review) and privacy, because logs contain personal data.

A useful log entry answers who, what, when, where and with what result: the user or process, the action, a precise timestamp with time zone, the source and destination systems, and success or failure. Logs must not contain secrets such as passwords or full card numbers.

Integrity and preservation

Attackers try to delete or alter logs to hide their activity, and administrators of a system can usually change its local logs. Log integrity is protected by forwarding logs promptly to a central store that the administrators of the source systems cannot modify; using append-only or write-once (WORM) storage; hashing or digitally signing log files or batches; restricting and monitoring access to the log platform; and alerting on log deletion or logging being disabled.

Preservation keeps logs for the retention period set by policy and regulation, often one year or more, with recent logs searchable quickly and older ones archived. When an incident or litigation occurs, relevant logs are placed on legal hold so they are not deleted, and copies used as evidence are hashed and handled under chain of custody.

Select all that apply

Protecting logs

Exam skills 3.4.3

Identify controls that protect log integrity.

Log in to try this activity Interactive activities are free with an account.

Architectures, configuration and aggregation

Logging architectures range from local logs on each system, which are easy to lose and hard to search, to centralised collection. In a typical design, sources send logs with syslog (UDP or TCP 514, or TLS on 6514), Windows event forwarding or agents to collectors, which forward them to a central log platform or SIEM. Collectors may buffer logs so that nothing is lost during outages. Cloud services provide their own logging that is exported to the central platform.

Configuration on each source sets which events are logged (for example enabling Windows process creation auditing or database audit logging), the level of detail, the format and the destination. Standard formats such as JSON or CEF and consistent field names make logs easier to parse. Aggregation brings logs together so that events from different systems can be searched and correlated in one place, and normalisation maps different formats to common fields.

The following diagram labels each part of one Linux authentication log entry.

Reading one Linux authentication log entry. At 03:14:07 on 28 October, the SSH service on web01 rejected a password login for oracle, a username that does not exist there, from the internet address 203.0.113.45. Attempts against common non-existent usernames from an internet address are typical of automated password guessing.
The scenario is illustrative.

Tuning

Logging everything at maximum detail creates huge volumes, cost and noise that hide important events; logging too little leaves blind spots. Tuning adjusts both collection and alerting: filtering routine, low-value events at the source or collector, raising detail where investigations need it, and adjusting alert thresholds and rules so that alerts are meaningful. Tuning is continuous and documented, because a filter that drops events may hide an attack later. The following table summarises common log management problems and remedies.

ProblemRemedy
Logs deleted by an attacker on the hostForward promptly to a central, write-restricted store
Events cannot be ordered across systemsSynchronise time with NTP; record time zones
Too much noise to find attacksFilter low-value events; tune rules and thresholds
Key events missingEnable the required audit settings on sources
Logs gone before an investigationSet retention by policy; apply legal holds
Scenario questions

Tuning log collection

Exam skills 3.4.3

Tune logging to keep what matters.

Log in to try this activity Interactive activities are free with an account.
Worked example

Protecting audit logs

A database administrator was found to have altered salary records and then deleted the database's local audit log. How should logging be designed so that this can be detected and proven in future?

Database audit events should be forwarded in near real time to a central log platform administered by a different team (separation of duties), stored in append-only or write-once storage with integrity hashing, and alerts should fire when auditing is disabled or local logs are cleared. The administrator could then not erase the record of their actions.

Worked example

Reading a syslog entry

An analyst reviews the following entry from a Linux server's authentication log. What does it show?

Oct 28 03:14:07 web01 sshd[2241]: Failed password for invalid user oracle from 203.0.113.45 port 51122 ssh2

At 03:14:07 on 28 October, the SSH service on web01 rejected a password login for the username oracle, which does not exist on the system, from 203.0.113.45. Attempts against non-existent common usernames from an internet address are typical of automated password-guessing. Many such entries would justify blocking the source and confirming that SSH password authentication is disabled in favour of keys.

Check yourself

Why should logs be forwarded promptly to a central store administered by a different team?

Show answer

Administrators of a system can alter its local logs, as can attackers who gain admin rights; prompt forwarding to a separately controlled store preserves integrity.

Exam Tips

Remember for the exam

  • Centralise logs where source administrators cannot alter them.
  • Retention is set by policy and regulation; legal holds suspend deletion.
  • Tune collection and alerts to reduce noise without creating blind spots.