Open MosheElisha opened 4 years ago
I saw that if I use SIGPIPE (kill -13) on the "tail" command, the goaccess exists softly and the output file is written.
Is that the expected behavior?
Can I ask you to try adding the additional single dash to the pipe? e.g.,
tail -F /var/log/nginx/access.log | /usr/local/bin/goaccess - --output=/tmp/report.html --time-format='%T' --date-format='%d/%b/%Y' --log-format='%h - %^ [%d:%t %^] "%r" %s %b "%R" "%u" "%^" %T %^ %^ %^'
Hi,
Thanks for replying. The dash did not help. I also tried tail -f
instead of tail -F
but same result (I did Ctrl+C after few some time)
$ tail -f /var/log/nginx/access.log | /usr/local/bin/goaccess - --output=/tmp/report.html --time-format='%T' --date-format='%d/%b/%Y' --log-format='%h - %^ [%d:%t %^] "%r" %s %b "%R" "%u" "%^" %T %^ %^ %^'
^Crsing... [10] [0/s]]
SIGINT caught!
Closing GoAccess...
$ ls /tmp/report.html
ls: cannot access /tmp/report.html: No such file or directory
I am OK with closing the stream into goaccess in order to gracefully shut it down and have the output file but if you want to pursue this, I will be happy to help if I can.
Try timeout
command preceding tail
:
timeout 1m tail -F ....
and it will end gracefully.
See the manual. You can also specify the signal sent to the command ahead.
By the way, are you running this as root? it seems centos has some sort of issue when reading a log as a user. Maybe related to #868?
Hi,
When I use "tail", pipe and "--output" the output file is not created. Not while goaccess is running and not after I signal it to stop (Ctrl+C).
tail -F /var/log/nginx/access.log | /usr/local/bin/goaccess --output=/tmp/report.html --time-format='%T' --date-format='%d/%b/%Y' --log-format='%h - %^ [%d:%t %^] "%r" %s %b "%R" "%u" "%^" %T %^ %^ %^'
Output isParsing... [10] [0/s]
I tried with "--output=/tmp/report.json" but same result. The output file wasn't created.
I saw that you have an example with tail and an output file so from that I understand it is a supported option (https://github.com/allinurl/goaccess/blame/master/README.md#L390)
Without an output file (interactive) it works properly:
tail -F /var/log/nginx/access.log | /usr/local/bin/goaccess --time-format='%T' --date-format='%d/%b/%Y' --log-format='%h - %^ [%d:%t %^] "%r" %s %b "%R" "%u" "%^" %T %^ %^ %^'
With an input file (without tail) it works properly:
/usr/local/bin/goaccess /var/log/nginx/access.log --output=/var/www/html/report.html --time-format='%T' --date-format='%d/%b/%Y' --log-format='%h - %^ [%d:%t %^] "%r" %s %b "%R" "%u" "%^" %T %^ %^ %^'
With tail and --real-time-html it works properly:
tail -F /var/log/nginx/access.log | /usr/local/bin/goaccess --output=/var/www/html/report.html --time-format='%T' --date-format='%d/%b/%Y' --log-format='%h - %^ [%d:%t %^] "%r" %s %b "%R" "%u" "%^" %T %^ %^ %^' --fifo-in=/tmp/goaccess.in --fifo-out=/tmp/goaccess.out --real-time-html
My setup
Thanks.