Menu

#167 Displaying date in reports

v1.0_(example)
open
nobody
date (1)
5
2015-10-21
2015-10-19
No

Hello!
I have two proxy servers running on CentOS 6.5 x86_64. They have the latest revision of sarg from master branch. The first server has a locale set to LANG=ru_RU.UTF-8. When sarg makes reports on this server, it writes date in european format, no matter the value that parameter date_format is set to in sarg.conf.
The second one has a locale set to LANG=en_US.UTF-8. When sarg makes reports on this server, it writes date in american format, and the parameter date_format in sarg.conf also ignored.

And one more thing is improper output of date in redirector report. For exapmle, for yesterday it is 18.00.2015 instead of 18.10.2015.

Discussion

  • Frederic Marchal

    Concerning the 18.00.2015 date, there was a stupid typo in the source code. The month was computed modulo 10! The bug would only show up when running sarg on October, November or December… It is fixed in commit [358e16].

    As for the date format, the redirector report ignores the date_format option. The date is formated by the operating system to display it as "the preferred date representation for the current locale without the time" (see strftime man page for the %x format specifier).

    It is the result of an attempt to get rid of date_format. It struck me as cumbersome to require the user to tell sarg how to format dates when the system locale already knows how to do that. Beside, it would let sarg support any date format beside European and American.

    But I stopped short in my track after changing a few dates because the date looks ugly in the French locale (today is 20/10/15 which is hard to read). I wanted to test it for a while and collect successes or failures before applying it everywhere.

    What do you think of it? Should I keep using the preferred system date format? Should I revert to the date_format option? Is it better to configure it in sarg.conf using a strftime like syntax and default to %x?

     

    Related

    Commit: [358e16]

  • Evgeniy Yakushev

    Thanks, now it's okay with dates.

    As for me, I think that configuring format in strftime like syntax is great idea, of course, if it's not difficult to implement. But the system date format is also very good.

     
  • Evgeniy Yakushev

    By the way, is it possible to apply system date format to a title of index page or maybe customize it somehow? Notation "Period: 2015 Oct 12" looks like reverse for my locale, it should be "Period: 12 Oct 2015".

     

Log in to post a comment.