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.63k stars 1.11k forks source link

thousands separator same as floating point #2147

Open minusf opened 3 years ago

minusf commented 3 years ago

goaccess 1.5.1 macos 11.4

When generating html reports, numbers in the columns look like this:

207.286 (8.80%)

the man page does not mention locales at all, but in any case i have:

$ echo $LANG
C

I think in this case the number should look like any of these:

207,286 (8.80%) 207 286 (8.80%) 207_286 (8.80%) (some programming languages accept these numbers nowadays)

minusf commented 3 years ago

btw it would be really nice to have the thousands separators in the terminal version as well...

allinurl commented 3 years ago

The formatting is done through LC_NUMERIC. You can try changing/setting the env variable for LC_NUMERIC.

# export LC_NUMERIC="en_US.UTF-8"

or

# LC_NUMERIC="en_US.UTF-8" bash -c 'goaccess access.log --log-format=COMBINED'
minusf commented 3 years ago

hm. i don't have LC_NUMERIC set. i thought LC_something is not set, LANG takes precedence, but i might be wrong... i give it a try, thank you.

minusf commented 3 years ago
$ LC_NUMERIC= goaccess -p .goaccessrc log.2021-05-01 -o log.2021-05-01.html
 [PARSING log.2021-05-01] {2401556} @ {66860/s}

$ LC_NUMERIC=en_US.UTF-8 goaccess -p .goaccessrc log.2021-05-01 -o log.2021-05-01.html
 [PARSING log.2021-05-01] {2,399,617} @ {66,656/s}

the terminal indeed printed correct thousand separators. however the generated html is the same in both cases:

4.506 (0.53%) 30 (0.04%)