Systemd Logging Issue
By default systemd creates systemd-private- folders in the tmp directory to protect apache2. You can disable this behavior and use actual log file by following these steps (not recommended, see recommended approach below):
- Edit this file as root:
sudo vi /etc/systemd/system/multi-user.target.wants/apache2.service. - And comment this line:
PrivateTmp=true. - Reload systemd daemon using
sudo systemctl daemon-reload. - Restart apache server using
sudo systemctl restart apache2.
Your logs should now go to the expected file.
Use Override File (recommended)
It is recommended not to touch the distro service files as shown above. Instead, you can use an override file for the corresponding service.
- To create/edit an override file for
apache2, use:
shell
sudo systemctl edit apache2The override file will be created at /etc/systemd/system/apache2.service.d/override.conf
- Add the following lines inside the newly created override file:
shell
[Service]
PrivateTmp=false- Reload systemd daemon and restart apache server using:
shell
sudo systemctl daemon-reload && sudo systemctl restart apache2