[squid-users] script /usr/lib/squid3/log_db_daemon

Amos Jeffries squid3 at treenet.co.nz
Wed Feb 10 08:45:31 UTC 2016


On 9/02/2016 11:23 p.m., Tony Peña wrote:
> Hi
> 
> I want to modify the /usr/lib/squid3/log_db_daemon script, but I'm not know
> very knowledge about PERL, so if i want to modify to get on the mysql
> table, not epoch_time, and date_time in human readable i guess first change
> the scheme...

Hi Tony,


If you change the stored format to be human-text then you have to change
*everything* touching or using that data. the logger, the database
functions procedures, the display logics. Right down to sorting and
comparisions between any two records by the DB software itself. Just
listing the records in the right order now needs to account for
leap-things (from years to nanoseconds), local machine clock skew,
governments changing your local TZ offsets (daylight savings) schedule,
etc, etc.
 It is a huge amount of avoidable complexity and performance drag all
the way through the code.

So, leave it all as the efficient epoch internally and do the time
conversion exactly once: at the point where its actually being displayed
to a human.

MySQL provides a built-in function for reformatting timestamps if it is
the point doing the display.
<https://dev.mysql.com/doc/refman/5.6/en/date-and-time-functions.html#function_from-unixtime>

Amos



More information about the squid-users mailing list