> Source: https://docs.cyberelements.io/saas/da/Security/CentralizedLogging/

# Centralised logging

This chapter covers the **centralisation of logs towards a logging infrastructure** (syslog server or SIEM).

The CyberElements architecture has **no dedicated logging server**. Centralisation is nonetheless recommended and relies on the standard `rsyslog` mechanisms.

The general principles of **local** logging (`rsyslog` configuration, rotation, permissions, command histories) are covered in [System logging and time](https://docs.cyberelements.io/saas/da/Security/SystemHardening/SystemLogsAndTime/) and are not repeated here.

> **Information**
>
> The ANSSI reference for logging architecture is the guide **ANSSI-PA-012** (28/01/2022, "Recommandations de sécurité pour l'architecture d'un système de journalisation"), which replaced the 2013 technical note on the same subject. The points below refer to its content.

## Summary

| # | Recommendation | Edge Gateway |
|---|---|---|
| [**R63**](#r63) | Principle of centralisation towards the logging infrastructure | ✅ |
| [**R66**](#r66) | Reliable forwarding to the logging server | ✅ |
| [**R67**](#r67) | Good practices on the destination logging server | ❌ |

## R63. Principle of centralisation towards the logging infrastructure

**Applies to**: Edge Gateway ✅

With no logging server supplied by the product, the logs of the Edge Gateway must be forwarded by `rsyslog` to the logging server: transport is covered in [R66](#r66).

That forwarding **natively** covers the operating system logs.

> **Warning!**
>
> The ANSSI (PA-012, R11) points out that an intermediate logging server **should not be sought at any cost**: it adds complexity and can itself become a point of failure if its availability is not under control. **Local retention** of logs on each server is the first level of protection; centralisation towards a logging infrastructure complements it **without replacing it**.

## R66. Reliable forwarding to the logging server

**Applies to**: Edge Gateway ✅

The ANSSI (PA-012) recommends using a transport protocol based on **TCP rather than UDP** for sending logs between an emitting device and a centralisation server, so as to make the transfer reliable: unlike UDP, TCP makes it possible to **detect log loss** caused by a network outage rather than letting it pass silently.

> **Warning!**
>
> This point concerns the **network transport** between each server and the logging server. The forwarding is the integrator's responsibility: it means adding on each server an `rsyslog` rule such as the one below, and **allowing the corresponding flow through the firewall** (see [Local firewall](https://docs.cyberelements.io/saas/da/Security/LocalFirewall/)).

Where the configuration is accessible, a TCP-based `rsyslog` forwarding rule takes the following form (to be adapted to the mechanism actually in place):

```
1
```

The **double `@`** (`@@`) indicates TCP transport, as opposed to a single `@` for UDP.

If the flow crosses an uncontrolled network, **transport encryption** must be put in place (TLS for `rsyslog`, or RELP with TLS), in line with the principles of PA-012.

## R67. Good practices on the destination logging server

**Applies to**: Edge Gateway ❌

The logging server is **outside the scope of this guide**; the principles of PA-012 are recalled here for the record.

Aggregated logs may contain **confidentiality-sensitive** information and should be accessible to as few users as possible. As the overall volume aggregated from several servers is generally larger than on any single server, particular attention must be paid to available disk space and to monitoring it.

- **Write the logs to a dedicated partition**, separate from the system one, so that filling it up does not compromise the operation of the server itself;
- **structure the storage as a thematic tree** (authentication, resource access, web logs…), which `rsyslog` supports natively: this makes it easier to transfer a subset of logs in bulk, for instance for a targeted investigation;
- **put in place a rotation policy** (`logrotate`) suited to the aggregated volume, distinct from the one applied to each server's local logs, which deal with far smaller volumes.

> **Information**
>
> The ANSSI (PA-012) also points out that the accounts with access to the centralised log consultation tool should be tied to **roles defined in advance**, and that the collection processes themselves should run with the **minimum privileges** required, a principle already applied by design to the dedicated service accounts of CyberElements.
