I am using apache.
If we keep it in var/www/
folder permission issues is raised.
I am thinking to keep log files in /tmp/
folder.Is it right place to keep log files?
-
possible duplicate of [How should I log from a non-root Debian Linux daemon?](http://stackoverflow.com/questions/483781/how-should-i-log-from-a-non-root-debian-linux-daemon) – Josh Kupershmidt May 04 '15 at 13:04
1 Answers
No, /tmp
would not be the right place to save log files.
According to the Filesystem Hierarchy Standard (FHS), the /tmp
directory serves a different purpose:
3.17.1. Purpose
The/tmp
directory must be made available for programs that require temporary files. Programs must not assume that any files or directories in/tmp
are preserved between invocations of the program.
The intent of writing log files is the ability to debug errors and keep track of program activity. Therefore, non-persistent logs would be of very little use.
For Logging there is the /var/log
directory, as being recommended by the FHS:
5.10.1. Purpose
This directory contains miscellaneous log files. Most logs must be written to this directory or an appropriate subdirectory.
For the rights question I can only refer to WiseTechi, a /var/log/mydaemon
directory is your way to go.