goaccess log analyzer zipped log files systemd

Alle weiteren Dienste, die nicht in die drei oberen Foren gehören.
Antworten
carrer
Beiträge: 2
Registriert: 13.06.2024 04:09:53

goaccess log analyzer zipped log files systemd

Beitrag von carrer » 13.06.2024 04:18:03

i got the following bash file "/root/goaccess.sh":

Code: Alles auswählen

/bin/zcat /var/log/nginx/access.log.*gz | /usr/bin/goaccess -p /etc/goaccess/goaccess.conf /var/log/nginx/access.log /var/log/nginx/access.log.1
if i launch it manually everything works yust fine. - i get all the access.log files into goaccess. with the following output:

Code: Alles auswählen

[PARSING -] {67,584} @ {67,584/s}
WebSocket server ready to accept new client connections
i tried to make it a systemd service like this "/etc/systemd/system/goaccess.service":

Code: Alles auswählen

[Unit]
Description=GoAccess Live Log Analyzer

[Service]
#Type=forking
Type=oneshot
RemainAfterExit=yes
ExecStart=/bin/bash -c '/root/goaccess.sh'
ExecStop=/bin/kill -9 ${MAINPID}
User=root
Group=root
Restart=always

[Install]
WantedBy=multi-user.target
the following command works but it wont feed the zipped access logs to goaccess

Code: Alles auswählen

systemctl start goaccess
any suggestions?

carrer
Beiträge: 2
Registriert: 13.06.2024 04:09:53

Re: goaccess log analyzer zipped log files systemd

Beitrag von carrer » 14.06.2024 12:16:08

The solution was to add a "-" at the end of the systemd ExecStart bash command, like:

Code: Alles auswählen

/bin/zcat /var/log/nginx/access.log.*gz | /usr/bin/goaccess -p /etc/goaccess/goaccess.conf /var/log/nginx/access.log /var/log/nginx/access.log.1 -

Antworten