Azure / Azure/azure-linux-extensions

Log rotate on rhel failing due to 777 permissions on parent directory

Open
#1,633 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
333
Forks
278
Avg merge
2d 9h
Merged PRs (30d)
4

Description

When setting up logrotation on RHEL version 7.9, we are receiving an error on the rotation of the /etc/opt/microsoft/azuremonitoragent/config-cache/fluentbit/Logs/fluentbit.log.
A debug of the logrotation by running
```sh
sudo logrotate -f /etc/logrotate.conf
```
produces the following error.
error: skipping "/etc/opt/microsoft/azuremonitoragent/config-cache/fluentbit/Logs/fluentbit.log" because parent directory has insecure permissions (It's world writable or writable by group which is not "root") Set "su" directive in config file to tell logrotate which user/group should be used for rotation.
The following permissions are showing for the parent directory of the fluentbit.
```sh
[someuser@rhelbox fluentbit]$ pwd
/etc/opt/microsoft/azuremonitoragent/config-cache/fluentbit
[someuser@rhelbox fluentbit]$ ls -la
total 0
drwxrwxrwx. 3 syslog syslog 18 Nov 15 21:25 .
drwxr-xr-x. 4 syslog syslog 196 Nov 15 21:30 ..
drwxrwxrwx. 2 syslog syslog 6 Nov 15 21:25 Logs
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the reported command, `sudo logrotate -f /etc/logrotate.conf`, against `/etc/opt/microsoft/azuremonitoragent/config-cache/fluentbit/Logs/fluentbit.log` and inspect the parent-directory permissions shown in the report. The issue names no repository file or test, so completion would first require identifying the extension configuration responsible and confirming that log rotation no longer skips this file.

Written by the indexing model from the issue text.

Assessment

Tech stack
linux
Domain
observability
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.