Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Output file not created when using tail #1636

Open
MosheElisha opened this issue Dec 25, 2019 · 3 comments
Open

Output file not created when using tail #1636

MosheElisha opened this issue Dec 25, 2019 · 3 comments

Comments

@MosheElisha
Copy link

@MosheElisha MosheElisha commented Dec 25, 2019

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 is Parsing... [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

$ goaccess --version
GoAccess - 1.3.
For more details visit: http://goaccess.io
Copyright (C) 2009-2016 by Gerardo Orellana

Build configure arguments:
  --enable-debug
  --enable-utf8
  --with-openssl
$ cat /etc/centos-release
CentOS Linux release 7.7.1908 (Core)

Thanks.

@MosheElisha

This comment has been minimized.

Copy link
Author

@MosheElisha MosheElisha commented Dec 25, 2019

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?

@allinurl

This comment has been minimized.

Copy link
Owner

@allinurl allinurl commented Dec 26, 2019

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 %^ %^ %^'
@MosheElisha

This comment has been minimized.

Copy link
Author

@MosheElisha MosheElisha commented Dec 26, 2019

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.