Howdy y’all, new to the channel, and I have a quick question. Is there a way to send the error.log and requests.log to a specific folder?
I assume this is something that happened in an earlier version since I’ve been upgrading for many versions now. If I dont have a /log folder under /nextcloud, nextcloud wont start. But when I upgrade it complains that that folder should not be there:
The only log files that show u pin that folder is error.log and requests.log. Nextcloud.log is currently in data. Rotates without issue. How do I tell nextcloud to put those log files in data, or even /var/log/nextcloud? CentOS 8 (core) soon to be switching to stream.
error.log and request.log are usually web server log files and have nothing to do with Nextcloud itself. They reside outside the Nexcloud root and therefore cannot be accessed from within Nextcloud.
I can explain how the log dir is defined on Ubuntu/Debian, there APACHE_LOG_DIR is defined in the file /etc/apache2/envvars
As far as I know, the location of the logfiles for apache2 on CentOS 8 (core) is defined in the /etc/httpd/conf/httpd.conf configuration file. Search for this part:
# Load config files from the config directory "/etc/httpd/conf.d".
IncludeOptional conf.d/*.conf
# Set environment variables for Apache
# The variable `APACHE_LOG_DIR` is used by some modules to find writable
# directories for logs and other runtime data.
#
# You can set this variable to a different value before starting Apache.
# export APACHE_LOG_DIR=/var/log/httpd
export APACHE_RUN_USER=apache
export APACHE_RUN_GROUP=apache
As you can see, the APACHE_LOG_DIR variable is defined using the export command, which sets the value of the variable to /var/log/httpd by default.
If it is commented like in this example, it is not defined.
However, the $APACHE_LOG_DIR variable is not used to define the location of log files in the Apache configuration file by default on CentOS 8 (core). Instead, the location of log files is defined directly in the httpd.conf file using the ErrorLog and CustomLog directives.
If you want to use the $APACHE_LOG_DIR variable to define the location of log files in the Apache configuration file, you can modify the httpd.conf file and replace the explicit paths with the $APACHE_LOG_DIR variable. For example:
It is possible the error log one is configured for php, but that would be an unusual location (and it’s often set up to simply fall back to the Apache/web server error log).
Are you sure those extra logs are currently being used at all still? Do they have recent entries or file modification dates?
I’m a little curious about you statement that NC won’t start without this log/ folder. What version of NC is currently installed? And what version are you trying to upgrade directly to?
Just a heads up that you may want to pick different filenames for your NC log (nextcloud.log), your Apache ErrorLog, and your access/request log. This will keep them from colliding/stomping on each other and avoid triggering new problems (interactions/collisions) down the road since they’re all logged to from different apps and code paths.