convert $msec to sec

Валентин Бартенев vbart at
Sun Apr 3 12:40:40 UTC 2016

On Sunday 03 April 2016 11:31:08 Anoop Alias wrote:
> I need to log the seconds since epoch (without the millisecond resolution)
> in the access_log file
> is there is a way to convert the $msec to seconds or drop the exponential
> part of the time . Probably using the map function?.

It's easy with the map directive:

    map $msec $sec {
        ~^(?P<_sec>.+)\. $_sec;

  wbr, Valentin V. Bartenev

More information about the nginx mailing list