Unknown Option Flag when running with sudo

sudo

Following the examples for GoAccess, which is installed on Debian via apt-get:

sudo apt-get install goaccess

The log files are owned by www-data, the adm group:

$ admin@mycomputer:~# ls -l /var/log/nginx/
ls: cannot open directory /var/log/nginx/: Permission denied
$ sudo -i
root@mycomputer:~# ls -l /var/log/nginx/
-rw-r----- 1 www-data adm   9780 Aug  1 22:11 access.log
# etc...

As the admin user I can run the basic GoAccess command succesfully using sudo:

$ sudo goaccess -f /var/log/nginx/access.log

Cool!

General Dashboard - Overall Analyzed Requests                                                [Active Module 0]

  Total Requests  51 Unique Visitors 26 Referrers  0 Log Size  9.55 KiB
  Failed Requests 0  Unique Files    18 Unique 404 0 Bandwidth 0.0  B
  Generation Time 0  Static Files    0               Log File  /var/log/nginx/access.log

 Unique visitors per day - Including spiders                                                        Total: 1/1
 Hits having the same IP, date and agent are a unique visit

  26 100.00%      0.0  B 01/Aug/2016 |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||

 Requested files (Pages-URL)                                                                      Total: 18/18
 Top requested files - hits, percent, [bandwidth, time served]

  24 47.06%      0.0  B /
  4  7.84%       0.0  B http://www.baidu.com/s?wd=5118
  2  3.92%       0.0  B /contact/
 [F1]Help [O]pen detail view  0 - Mon Aug  1 23:38:47 2016                                 [Q]uit GoAccess 0.6

Without sudo (or if I run it as root, the log file is not found:

$ goaccess -f /var/log/nginx/access.log

GoAccess - version 0.6 - Oct 21 2013 23:06:19

An error has occurred
Error occured at: parser.c - parse_log - 798
Message: Error while opening the log file. Make sure it exists.

But when I run as sudo, the options/flags following the log file name are not recognized:

$ sudo goaccess -f /var/log/nginx/access.log -o report.html --real-time-html 
Unknown option `-o'.
$ sudo goaccess -f /var/log/nginx/access.log --no-csv-summary -o report.csv
Unknown option `--'.

I'm confident the bug is in my workflow. Can someone spin me in the right direction?

Best Answer

The --no-csv-summary flag was added in version 0.9, from March 2015. Your version is 0.6. The current version as of August 2016 is 1.0.2.

You may need to add the official GoAccess debian repository:

$ echo "deb http://deb.goaccess.io/ $(lsb_release -cs) main" | sudo tee -a /etc/apt/sources.list.d/goaccess.list 
$ wget -O - https://deb.goaccess.io/gnugpg.key | sudo apt-key add -
$ sudo apt-get update 
$ sudo apt-get install goaccess

Or build from source, for which you can find a guide here.

Related Question