mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
Using /var/log/daemon.log or /var/log/syslog is pointless, these files logs many different things. Instead, we shall always return the logs from journalctl
This commit is contained in:
parent
69b611bd28
commit
bb8b1b052d
4 changed files with 14 additions and 13 deletions
|
@ -101,6 +101,12 @@ for service, conf in new_services.items():
|
|||
if conffiles:
|
||||
services[service]['conffiles'] = conffiles
|
||||
|
||||
# Remove legacy /var/log/daemon.log and /var/log/syslog from log entries
|
||||
# because they are too general. Instead, now the journalctl log is
|
||||
# returned by default which is more relevant.
|
||||
if "log" in services[service]:
|
||||
if services[service]["log"] in ["/var/log/syslog", "/var/log/daemon.log"]:
|
||||
del services[service]["log"]
|
||||
|
||||
if updated:
|
||||
with open('/etc/yunohost/services.yml-new', 'w') as f:
|
||||
|
|
|
@ -2,10 +2,8 @@ nginx:
|
|||
log: /var/log/nginx
|
||||
test_conf: nginx -t
|
||||
needs_exposed_ports: [80, 443]
|
||||
avahi-daemon:
|
||||
log: /var/log/daemon.log
|
||||
dnsmasq:
|
||||
log: /var/log/daemon.log
|
||||
avahi-daemon: {}
|
||||
dnsmasq: {}
|
||||
fail2ban:
|
||||
log: /var/log/fail2ban.log
|
||||
dovecot:
|
||||
|
@ -29,8 +27,7 @@ ssh:
|
|||
metronome:
|
||||
log: [/var/log/metronome/metronome.log,/var/log/metronome/metronome.err]
|
||||
needs_exposed_ports: [5222, 5269]
|
||||
slapd:
|
||||
log: /var/log/syslog
|
||||
slapd: {}
|
||||
php7.0-fpm:
|
||||
log: /var/log/php7.0-fpm.log
|
||||
test_conf: php-fpm7.0 --test
|
||||
|
@ -39,8 +36,7 @@ yunohost-api:
|
|||
yunohost-firewall:
|
||||
need_lock: true
|
||||
test_status: iptables -S | grep "^-A INPUT" | grep " --dport" | grep -q ACCEPT
|
||||
nslcd:
|
||||
log: /var/log/syslog
|
||||
nslcd: {}
|
||||
glances: null
|
||||
nsswitch: null
|
||||
ssl: null
|
||||
|
|
|
@ -544,7 +544,6 @@
|
|||
"service_disabled": "The '{service:s}' service was turned off",
|
||||
"service_enable_failed": "Could not turn on the service '{service:s}'\n\nRecent service logs:{logs:s}",
|
||||
"service_enabled": "The '{service:s}' service was turned off",
|
||||
"service_no_log": "No logs to display for the service '{service:s}'",
|
||||
"service_regen_conf_is_deprecated": "'yunohost service regen-conf' is deprecated! Please use 'yunohost tools regen-conf' instead.",
|
||||
"service_remove_failed": "Could not remove the service '{service:s}'",
|
||||
"service_removed": "'{service:s}' service removed",
|
||||
|
|
|
@ -395,10 +395,7 @@ def service_log(name, number=50):
|
|||
if name not in services.keys():
|
||||
raise YunohostError('service_unknown', service=name)
|
||||
|
||||
if 'log' not in services[name]:
|
||||
raise YunohostError('service_no_log', service=name)
|
||||
|
||||
log_list = services[name]['log']
|
||||
log_list = services[name].get('log', [])
|
||||
log_type_list = services[name].get('log_type', [])
|
||||
|
||||
if not isinstance(log_list, list):
|
||||
|
@ -408,6 +405,9 @@ def service_log(name, number=50):
|
|||
|
||||
result = {}
|
||||
|
||||
# First we always add the logs from journalctl / systemd
|
||||
result["journalctl"] = _get_journalctl_logs(name, int(number)).splitlines()
|
||||
|
||||
for index, log_path in enumerate(log_list):
|
||||
log_type = log_type_list[index]
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue