Welcome! Log In Create A New Profile

Advanced

Re: How to log the time in the UTC time format?

Maxim Dounin
November 30, 2009 06:34PM
Hello!

On Mon, Nov 30, 2009 at 05:06:57PM -0500, naltimari wrote:

> Well, maybe you're right, but what I need is the same time that would come from 'date -u' command.
>
> Right now, my log time format is like this: 30/Nov/2009:16:14:39 -0200

It's date and time in common log format
(http://en.wikipedia.org/wiki/Common_Log_Format).

> When I need this: Mon Nov 30 18:14:39 UTC 2009
>
> Can I change the syntax/format in which the date is written to the log?

No, the is no way to specify arbitrary format for time. The only
available options out-of-the box is $time_local (time in common log
format) and $msec (seconds since the Epoch with milliseconds
resolution).

The only option for now is to use something like embedded perl to
construct time in arbitrary format, something like

perl_set $tt 'sub { scalar localtime }';

and then use it in logs via appropriate log_format. But I don't
really think it's a good way to go.

BTW, could you please explain why do you need time in this particular
format?

Maxim Dounin

_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx
Subject Author Posted

How to log the time in the UTC time format?

naltimari November 30, 2009 04:31PM

Re: How to log the time in the UTC time format?

Maxim Dounin November 30, 2009 04:56PM

Re: How to log the time in the UTC time format?

naltimari November 30, 2009 05:06PM

Re: How to log the time in the UTC time format?

Maxim Dounin November 30, 2009 06:34PM

Re: How to log the time in the UTC time format?

naltimari November 30, 2009 06:52PM

Re: How to log the time in the UTC time format?

rmalayter December 04, 2009 10:11AM

Re: How to log the time in the UTC time format?

Igor Sysoev December 01, 2009 02:24AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 111
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready