---
title: Verify Permissions on /var/log/*.journal(~) Files
description: Datadog, the leading service for cloud-scale monitoring.
breadcrumbs: >-
  Docs > Datadog Security > OOTB Rules > Verify Permissions on
  /var/log/*.journal(~) Files
---

> For the complete documentation index, see [llms.txt](https://docs.datadoghq.com/llms.txt).

# Verify Permissions on /var/log/*.journal(~) Files
 
## Description{% #description %}

To properly set the permissions of the journal files under `/var/log`, `*.journal` and `*.journal~`, run the command:

```gdscript3
$ sudo find /var/log -type f \( -name '*.journal' -o -name '*.journal~' \) -exec chmod 0640 {} +
```

## Rationale{% #rationale %}

The `/var/log/*.journal(~)` files are system logs managed by the "systemd" service.

## Remediation{% #remediation %}

### Shell script{% #shell-script %}

The following script can be run on the host to remediate the issue.

```bash
#!/bin/bash

find -P /var/log/  -perm /u+xs,g+xws,o+xwrt  -type f -regextype posix-extended -regex '^.*\.journal~?$' -exec chmod u-xs,g-xws,o-xwrt {} \;
```

### Ansible playbook{% #ansible-playbook %}

The following playbook can be run with Ansible to remediate the issue.

```gdscript3
- name: Find /var/log/ file(s) recursively
  ansible.builtin.command: find -P /var/log/  -perm /u+xs,g+xws,o+xwrt  -type f -regextype
    posix-extended -regex "^.*\.journal~?$"
  register: files_found
  changed_when: false
  failed_when: false
  check_mode: false
  tags:
  - configure_strategy
  - file_permissions_var_log_journal
  - low_complexity
  - low_disruption
  - medium_severity
  - no_reboot_needed

- name: Set permissions for /var/log/ file(s)
  ansible.builtin.file:
    path: '{{ item }}'
    mode: u-xs,g-xws,o-xwrt
    state: file
  with_items:
  - '{{ files_found.stdout_lines }}'
  tags:
  - configure_strategy
  - file_permissions_var_log_journal
  - low_complexity
  - low_disruption
  - medium_severity
  - no_reboot_needed
```
