> Source: https://docs.cyberelements.io/bastion/4.6/Installation/Dependencies/PostgreSQLCluster/Operation/PsqlLogs/

# Obtaining PostgreSQL cluster logs

The PostgreSQL cluster's operating logs are all located in `/var/log/syslog` on the various nodes. Particular attention should be paid to logs from `patroni` and `etcd`. These logs can be displayed continuously using the following command (to be executed as `root`):

```
1
```

You can also display the current logs for these two services in more detail using the commands:

```
1
2
```

The `patroni` service will regularly indicate the current status of the node and specify whether it is `LEADER` or who is the `LEADER`.
As for `etcd`, it will be able to provide information on the status of the cluster.

> **Example**
>
> Here is an example of a log from a leader node:
>
> ```
> 1
> ```
>
> Here is an example of a secondary node log:
>
> ```
> 1
> ```
>
> When a node fails, we obtain the following information from `etcd`:
>
> ```
>  1
>  2
>  3
>  4
>  5
>  6
>  7
>  8
>  9
> 10
> ```
>
> The latest logs, those highlighted, loop until the failed node is restored.
>
> The `patroni` service will also log other information:
>
> ```
>  1
>  2
>  3
>  4
>  5
>  6
>  7
>  8
>  9
> 10
> 11
> 12
> 13
> 14
> 15
> 16
> 17
> 18
> 19
> ```
>
> In this example, line 1 indicates that `PSQL_2` is a `REPLICA` of the `LEADER` `PSQL_1`. Line 2 is an error message due to the loss of connectivity with the `LEADER` node, and the last line specifies that `PSQL_2` is still a `REPLICA`, but this time of the `LEADER` server `PSQL_3`.
