Welcome! Log In Create A New Profile

Advanced

Re: Is there any other way to trigger log reopen beside kill -USR1?

Jan-Philip Gehrcke
January 24, 2013 09:58AM
Maybe I did not read carefully enough, but instead of relying on the
$(date "+%Y%m%d") in the exact moment of renaming the file, you could
use the last modification time of the file via. e.g.

$ stat -c %y ~/.bashrc | awk '{print $1}'
2012-12-18

On a busy web server this should almost always correspond to the day
when -- in your words -- the trigger was triggered :)

HTH,

Jan-Philip

On 01/24/2013 03:42 PM, Liu Haifeng wrote:
> Sorry I note that I didn't describe it clearly. I am not looking for another way of log rotating, but afraid of any other 'trigger' make nginx reopen log file unexpectedly, which can break my logic. If its sure that no any hidden trigger other than my script, then my design is ok. I think there won't be such kind of trigger, and I have to make it sure.
>
> Regards.
>
> On 2013-1-24, at 21:00, Andre Jaenisch <andrejaenisch@googlemail.com> wrote:
>
>> 2013/1/24 Liu Haifeng <haifeng.813@gmail.com>:
>>> My goal is make the "current" log file renamed with the date pattern immediately, not after one day or other period.
>>
>> My first thought would be creating a symbolic (see "man ln") from the
>> current log to the log-with-date-within-filename.
>> You would just have to change the symlink then … For example like
>> this: http://www.unix.com/302239409-post5.html
>> So let access.log point to access.$(date "+%Y%m%d").log (see
>> https://en.wikipedia.org/wiki/Date_%28Unix%29 ).
>>
>> But I have no nginx running here at the moment.
>>
>> _______________________________________________
>> nginx mailing list
>> nginx@nginx.org
>> http://mailman.nginx.org/mailman/listinfo/nginx
>
> _______________________________________________
> nginx mailing list
> nginx@nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx
>

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

Is there any other way to trigger log reopen beside kill -USR1?

Liu Haifeng January 24, 2013 07:30AM

Re: Is there any other way to trigger log reopen beside kill -USR1?

Andre Jaenisch January 24, 2013 08:02AM

Re: Is there any other way to trigger log reopen beside kill -USR1?

Liu Haifeng January 24, 2013 09:44AM

Re: Is there any other way to trigger log reopen beside kill -USR1?

Scott Ribe January 24, 2013 09:56AM

Re: Is there any other way to trigger log reopen beside kill -USR1?

Andre Jaenisch January 24, 2013 12:50PM

Re: Is there any other way to trigger log reopen beside kill -USR1?

Liu Haifeng January 25, 2013 05:26AM

Re: Is there any other way to trigger log reopen beside kill -USR1?

Jan-Philip Gehrcke January 24, 2013 09:58AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

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