# Enable user activity logging

User activity logging is an On-Premises-only feature that allows you to log user activities. Below is an example of logged user actions:

```CONSOLE
$ tail -f /tmp/datalore/datalore.log
```

```JSON
{"@timestamp":"2022-10-11T14:46:14.594+02:00","@version":"1","message":"Audit logging event","logger_name":"audit","thread_name":"Computation edt_0_0","level":"TRACE","level_value":5000,"id":"B9otorSZuP2n2vyTHCkhLe","timestamp":"1665492374594","event_type":"run_cell","user_id":"pEoHIeNPj4DE43XInXC5OV","cell_content":"print(123)","file_id":"pEoHIeNPj4DE43XInXC5OV\/cEFzZVm3xAYFg3nvWeZqnT"}
```

Procedure: Enable user activity logging

1. Open the `datalore.values.yaml` file and navigate to the `logbackConfig` key.

2. Choose a logback [appender](https://logback.qos.ch/manual/appenders.html), add the `net.logstash.logback.encoder.LogstashEncoder` encoder for it and specify your logger configuration in place of `<logger name="audit" level="OFF"/>` as shown in the example below.

```XML
<configuration>
    ...
    <appender name="AUDIT" class="ch.qos.logback.core.rolling.RollingFileAppender">
        <file>/tmp/datalore/datalore.log</file>
        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
            <fileNamePattern>datalore.%d{yyyy-MM-dd}.log</fileNamePattern>
            <maxHistory>30</maxHistory>
            <totalSizeCap>300GB</totalSizeCap>
        </rollingPolicy>
        <encoder class="net.logstash.logback.encoder.LogstashEncoder"/>
    </appender>
    <logger name="audit" level="ALL" additivity="false">
        <appender-ref ref="AUDIT"/>
    </logger>
    ...
</configuration>
```

> **Note:**
> All logs are saved to `/tmp/datalore/datalore.log`. This file will be created inside the container. Make sure the folder with your logs is in a persistent volume so they are saved after the pod is restarted.

