Welcome! Log In Create A New Profile

Advanced

Re: Rotating Access Logs with $date_local

Maxim Dounin
October 28, 2014 11:56AM
Hello!

On Tue, Oct 28, 2014 at 08:39:04AM -0700, Igal @ getRailo.org wrote:

> How can I format the $date_local string? I want it to be date only,
> like 20141028, and then use it in the filename for access log.
>
> Is that possible? and if not, why? seems like a simple solution to a
> problem that many users face and resort to external tools etc.

It is possible - you can use construct appropriate variable, e.g.,
by using map{} and $time_local. (The $date_local won't work for
you as you won't be able to set format without SSI.)

On the other hand, it's not recommended as it implies unneeded
work on each request. It's better to configure proper log
rotation instead, see:

http://en.wikipedia.org/wiki/Log_rotation
http://nginx.org/en/docs/control.html#logs

On UNIX systems there are system tools to rotate logs, like
newsyslog or logrotate, and configuring log rotation is as easy as
adding a line to appropriate configuration file. There are likely
something available for Windows, too.

--
Maxim Dounin
http://nginx.org/

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

Rotating Access Logs with $date_local

Igal @ getRailo.org October 28, 2014 11:40AM

Re: Rotating Access Logs with $date_local

Maxim Dounin October 28, 2014 11:56AM

Re: Rotating Access Logs with $date_local

Igal @ getRailo.org October 28, 2014 12:50PM

Re: Rotating Access Logs with $date_local

Francis Daly October 28, 2014 01:14PM

Re: Rotating Access Logs with $date_local

Igal @ getRailo.org October 28, 2014 01:20PM

Re: Rotating Access Logs with $date_local

Igal @ getRailo.org October 28, 2014 02:08PM

Re: Rotating Access Logs with $date_local

itpp2012 October 28, 2014 03:06PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 314
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