allinurl / goaccess

GoAccess is a real-time web log analyzer and interactive viewer that runs in a terminal in *nix systems or through your browser.
https://goaccess.io
MIT License
18.12k stars 1.1k forks source link

Configuration directory and "include" directive #465

Open MelkorLord opened 8 years ago

MelkorLord commented 8 years ago

Hi,

I mainly use GoAccess to generate static HTML reports and I'll like to replace the old AWStats installation.

AWStats featured some really nice options I'd like to have in GoAccess :-) Here are the suggestions:

For example : /etc/goaccess/www.domain.tld.conf

include "goaccess"
# translates to /etc/goaccess/goaccess.conf
# -or- include "/path/to/somefile.conf" => absolute path so no "translation"

... put here specific options such as 
    time-format, date-format, log-format, exclude-ip,
    whatever makes sense

What do you think ?

allinurl commented 8 years ago

Hi,

Thanks for the suggestions.

     goaccess -p ~/.goaccessrc --log-format=COMBINED

Let me know if that helps.

MelkorLord commented 8 years ago

Hi,

goaccess -p foobar
  1. If "foobar" exists in the current directory, use it.
  2. Else try to open "/etc/goaccess/foobar.conf".

but inside the "foobar.conf" file, the "include" directive would work like this :

  1. A "relative" path (without slashes) is always searched in "/etc/goaccess"
  2. Any non relative path (starting or containing any slash) would be used "as-is".

This way, this does not break the way GA currently works.

Of course, this is manageable with the way you mentioned in your third point but I see some drawbacks.

  1. On my specific case, I use a quite "long" exclude-ip directives which would be a bit painful to use in the command line each time.
  2. It's way easier to modify a config file instead of a script to add/change some overridden option. The script could be more complex than just calling GA.

All the rationale behind the "include" directive is to reduce the errors by eliminating directives duplication in multiple files.

Again, in my particular case : "/etc/goaccess/goaccess.conf" would contain all the common directives to all the sites I manage. Then, "/etc/goaccess/foobar.conf" would only contain a "include goaccess" and all the needed "exclude-ip xxxx" and other specific directives for that particular configuration.

All in all, this a suggestion for improvement, not a requirement :-) I currently use multiple configurations for the sites I manage. It's just that I find it "ugly" to have 4 configuration files sharing "99%" of duplicate content :-)

allinurl commented 8 years ago

Thanks for posting this. I understand now the rationale behind the "include" directive and I do agree that it should help avoid config options duplication.

Please keep this open, I can look into it.

Synchro commented 7 years ago

It didn't occur to me that it wouldn't work this way, and I spent ages trying to figure out how to do it! Putting overrides in a folder is also absolutely vital for config management - as far as possible you always want to leave default configs untouched so that they can be updated by upstream changes without causing clashes or losing changes.

I would vote for /etc/goaccess/goaccess.conf as the master config file, then stick multiple override files in /etc/goaccess/conf.d/. The files should be processed in alphanumeric order so they they may override each other too, and you can change the order by renaming them. This is exactly how nginx (and many other apps) do it.

ottok commented 4 years ago

I think this was addressed in https://github.com/allinurl/goaccess/pull/1395