4est
(Dan Padure)
4 October 2019 08:39
1
hello
I get The log file has no write permissions or does not exists. To fix, log-on on shell and do:
touch /var/log/emoncms/emoncms.log
chmod 666 /var/log/emoncms/emoncms.log
But in /var/www/emoncms/settings.php:
$log_filename = ‘/var/log/emoncms.log’;
The log file is indeed in /var/log
but why does the admin page insists the log file should be in /var/log/emoncms?
I grepped all the files but I could not find the hard reference to that
borpin
(Brian Orpin)
4 October 2019 08:55
2
If it is there, can you please post the Server Information from the admin page (Copy as Markdown button).
borpin
(Brian Orpin)
4 October 2019 14:05
4
My suspicion is that this is because the variable $log_filename
became $log_location
Is there a folder /var/log/emoncms/
? It should be created by one of the services at startup.
I think if you change the line
$log_filename = '/var/log/emoncms.log';
to
$log_location = "/var/log/emoncms";
it should be happy.
Merge latest master to stable by TrystanLea · Pull Request #1308 · emoncms/emoncms · GitHub refers
These sort of issues should be overcome by the hierarchical settings that have been introduced.
If this doesn’t fix it, try
sudo systemctl restart emoncms_mqtt.service
and post output from
sudo systemctl status emoncms_mqtt.service
4est
(Dan Padure)
4 October 2019 16:36
5
no, your line did not work
but this one inspired by yours worked:
$log_location = ‘/var/log’;
$log_filename = ‘emoncms.log’;
4est
(Dan Padure)
4 October 2019 16:39
6
the problem is now it does not find emonpiupdate.log
/var/log/emonpiupdate.log does not exist
it’s actually in /home/pi/data
That’s because in modules/admin/admin_controller.php:
$emoncms_logfile = $settings[‘log’][‘location’]."/emoncms.log";
$update_logfile = $settings[‘log’][‘location’]."/emonpiupdate.log";
$backup_logfile = $settings[‘log’][‘location’]."/emonpibackup.log";
from what I see, you can’t have logs in different locations
I could hard edit $emoncms_logfile in the php file, but that would be an ugly fix
4est
(Dan Padure)
4 October 2019 16:46
7
I don’t have emoncms_mqtt.service
root@emonpi:/var/www/emoncms# systemctl | grep mqtt
mqtt_input.service loaded active running Emoncms MQTT Input Script
root@emonpi:/var/www/emoncms# systemctl | grep emoncms
root@emonpi:/var/www/emoncms#
LATER EDIT:
I did a full update and now I do have that script
● emoncms_mqtt.service - Emoncms emoncms_mqtt script
Loaded: loaded (/var/www/emoncms/scripts/services/emoncms_mqtt/emoncms_mqtt.service; enabled; vendor preset: enabled)
Active: active (running) since Fri 2019-10-04 20:09:42 EEST; 4s ago
Docs: emoncms/MQTT.md at master · emoncms/emoncms · GitHub
Process: 16231 ExecStartPre=/bin/chmod 666 ${LOG_PATH}/emoncms.log (code=exited, status=0/SUCCESS)
Process: 16227 ExecStartPre=/bin/touch ${LOG_PATH}/emoncms.log (code=exited, status=0/SUCCESS)
Process: 16224 ExecStartPre=/bin/chown ${USER} ${LOG_PATH} (code=exited, status=0/SUCCESS)
Process: 16218 ExecStartPre=/bin/mkdir -p ${LOG_PATH} (code=exited, status=0/SUCCESS)
Main PID: 16234 (php)
Tasks: 1 (limit: 4915)
CGroup: /system.slice/emoncms_mqtt.service
└─16234 /usr/bin/php /var/www/emoncms/scripts/services/emoncms_mqtt/emoncms_mqtt.php
4est
(Dan Padure)
4 October 2019 17:03
8
I changed the log location to /home/pi/data, where the other log files are and it seems to work as all files are in the same place now
$log_location = '/home/pi/data';
$log_filename = 'emoncms.log';
borpin
(Brian Orpin)
4 October 2019 17:24
9
Because
Now you have the emoncms_mqtt.service
the correct folder, /var/log/emoncms
should be created and the permissions set correctly (on startup).
You would now be better with
$log_location = "/var/log/emoncms";
As:
That is where emoncms expects to be.
If the logs are on /home/pi/data
, it is increasing the wear on the SD card so making this more prone to early failure. /var/log
is mounted on tempfs
for this reason.
Additionally, the logfiles will grow uncontrolled as logrotate
will not find them there.
YMMV
Cheers
4est
(Dan Padure)
4 October 2019 17:44
10
indeed now everything works as expected
thanks
borpin
(Brian Orpin)
4 October 2019 17:50
11
Did you change the log_location to /var/log/emoncms
?