I want to use one of Drupal's syslog modules but place the log in a the user's home directory so there are not permissions issues when the user wants to view or analyze the file.
Is there a way a syslog configuration can be set in that way?
You can add a file to route wanted messages to a given user directory. Eg create /etc/rsyslog.d/00-meuh.conf
with
if ($msg contains "testing") then {
action(type="omfile" file="/home/meuh/logs/meuh-rsyslog" sync="on" fileCreateMode="0644" fileOwner="meuh")
stop
}
then restart rsyslog and send a suitable message with
$ sudo systemctl restart rsyslog
$ logger 'meuh testing new logfile'
The file is created:
$ ls -l /home/meuh/logs/meuh-rsyslog
-rw------- 1 meuh root 50 Sep 23 17:10 /home/meuh/logs/meuh-rsyslog
$ cat /home/meuh/logs/meuh-rsyslog
Sep 23 17:10:22 home meuh: meuh testing new logfile
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다