I'd like the OPNsense GUI of vnstat to show dates in dd/mm/yy format, Locale "en_GB.UTF-8" would suit me nicely. Unfortunately, my setup provides mm/dd/yy.
/usr/local/etc/vnstat.conf says:
Quote# locale (LC_ALL) ("-" = use system locale)
Locale "-"
The terminal output of % locale is:
QuoteLANG=en_GB.UTF-8
LC_CTYPE="en_GB.UTF-8"
LC_COLLATE="en_GB.UTF-8"
LC_TIME="en_GB.UTF-8"
LC_NUMERIC="en_GB.UTF-8"
LC_MONETARY="en_GB.UTF-8"
LC_MESSAGES="en_GB.UTF-8"
LC_ALL=
The terminal output of: vnstat -d
does provide dates in dd/mm/yy format, as expected.
So... it appears that OPNsense GUI has its own opinion of Locale but where is this stored ?
For good measure, I edit'd /usr/local/etc/vnstat.conf such that:
Quote# locale (LC_ALL) ("-" = use system locale)
Locale "en_GB.UTF-8"
... and the GUI output of vnstat changes to dd/mm/yy format. Of course, that doesn't work for long, getting re-written with reboots, updates and so on.
What am I missing ? How can I get the GUI display of vnstat to use dd/mm/yy ?
For changes that will persist after reboot, you need to edit:
/usr/local/opnsense/service/templates/OPNsense/Vnstat/vnstat.conf
I have the following setting to get dd/mm/yyyy:
# locale (LC_ALL) ("-" = use system locale)
Locale "-"
# date output formats for -d, -m, -t and -w
# see 'man date' for control codes
DayFormat "%d/%m/%Y"
MonthFormat "%m/%Y"
TopFormat "%d/%m/%Y"
Hope this helps?
Yes, that works, thanks. The dd/mm/yyyy survived a minor point update and reboot, which is what I wanted to achieve.
Curiously though, despite the...
# locale (LC_ALL) ("-" = use system locale)
Locale "-"
...in the templates file, OPNsense still resolutely ignores locale, giving the same problem as my first post. It does require the Day/Month/Top format changes to get dd/mm/yyyy, which feels a bit of a kludge.
But it does work, so my problem is solved. Thanks again for the tip re templates.