You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Jonny Rimkus <jo...@rimkus.it> on 2015/03/28 20:43:39 UTC
[users@httpd] question about roatelogs -n
Hello,
I've a question to the rotatelogs command.
I'm using following Apache Version:
Server version: Apache/2.4.7 (Ubuntu)
Server built: Mar 10 2015 13:05:59
I'm using the rotatelogs command in my Vhost as follows:
"|/usr/bin/rotatelogs -p /opt/bin/apacheloguser -n 3 /path/to/logfile
10M" combined
according to the man page it works as expected,
when logfile size reaches 10MB it:
1. creates a new File: logfile.1 and starts logging to this file
--> when logfile.1 reaches 10MB:
creates a new file: logfile.2 and start logging to this file
I would like to know if it is possible to make this behaviour possible:
1. rename logfile.1 to logfile.2
2. rename logfile to logfile.1
3. create new file logfile and start logging to this file
Thanks in advance and
Kind regards
Jonny Rimkus
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: [users@httpd] question about roatelogs -n
Posted by 5k Kate <5k...@gmail.com>.
Hi Jonny,
I'm not sure whther rotatelogs can do this. However, I usually use
logrotate http://linux.die.net/man/8/logrotate and it has the ability to do
this. Here's how it's setup for apache:
ubuntu@ip-172-31-11-241:~$ cat /etc/logrotate.d/apache2
/var/log/apache2/*.log {
weekly
missingok
rotate 52
compress
delaycompress
notifempty
create 640 root adm
sharedscripts
postrotate
/etc/init.d/apache2 reload > /dev/null
endscript
prerotate
if [ -d /etc/logrotate.d/httpd-prerotate ]; then \
run-parts /etc/logrotate.d/httpd-prerotate; \
fi; \
endscript
}
You can also see it's keeps access.log current and appends the number to
each new one. It also separately compresses the files after a time.
ubuntu@ip-172-31-11-241:~$ ls -l /var/log/apache2/
total 75788
-rw-r----- 1 root adm 6356 Mar 31 18:29 access.log
-rw-r----- 1 root adm 60851094 Mar 29 06:32 access.log.1
-rw-r----- 1 root adm 2013 Jan 4 06:51 access.log.10.gz
-rw-r----- 1 root adm 2442 Dec 28 06:29 access.log.11.gz
Hope that helps!
Kate
On Sat, Mar 28, 2015 at 7:42 PM, Daniel <df...@gmail.com> wrote:
>
>
> 2015-03-28 20:43 GMT+01:00 Jonny Rimkus <jo...@rimkus.it>:
>
>>
>> Hello,
>> I've a question to the rotatelogs command.
>> I'm using following Apache Version:
>>
>> Server version: Apache/2.4.7 (Ubuntu)
>> Server built: Mar 10 2015 13:05:59
>>
>> I'm using the rotatelogs command in my Vhost as follows:
>> "|/usr/bin/rotatelogs -p /opt/bin/apacheloguser -n 3 /path/to/logfile
>> 10M" combined
>>
>> according to the man page it works as expected,
>> when logfile size reaches 10MB it:
>> 1. creates a new File: logfile.1 and starts logging to this file
>> --> when logfile.1 reaches 10MB:
>> creates a new file: logfile.2 and start logging to this file
>>
>> I would like to know if it is possible to make this behaviour possible:
>>
>> 1. rename logfile.1 to logfile.2
>> 2. rename logfile to logfile.1
>> 3. create new file logfile and start logging to this file
>>
>> Thanks in advance and
>> Kind regards
>> Jonny Rimkus
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>> For additional commands, e-mail: users-help@httpd.apache.org
>>
>>
>
> Logrotate from your linux distrubution will do exactly just that. Maybe
> that's what you want to use instead of rotatelogs.
>
>
> --
> *Daniel Ferradal*
> IT Specialist
>
> email dferradal@gmail.com
> linkedin es.linkedin.com/in/danielferradal
>
Re: [users@httpd] question about roatelogs -n
Posted by Daniel <df...@gmail.com>.
2015-03-28 20:43 GMT+01:00 Jonny Rimkus <jo...@rimkus.it>:
>
> Hello,
> I've a question to the rotatelogs command.
> I'm using following Apache Version:
>
> Server version: Apache/2.4.7 (Ubuntu)
> Server built: Mar 10 2015 13:05:59
>
> I'm using the rotatelogs command in my Vhost as follows:
> "|/usr/bin/rotatelogs -p /opt/bin/apacheloguser -n 3 /path/to/logfile
> 10M" combined
>
> according to the man page it works as expected,
> when logfile size reaches 10MB it:
> 1. creates a new File: logfile.1 and starts logging to this file
> --> when logfile.1 reaches 10MB:
> creates a new file: logfile.2 and start logging to this file
>
> I would like to know if it is possible to make this behaviour possible:
>
> 1. rename logfile.1 to logfile.2
> 2. rename logfile to logfile.1
> 3. create new file logfile and start logging to this file
>
> Thanks in advance and
> Kind regards
> Jonny Rimkus
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>
Logrotate from your linux distrubution will do exactly just that. Maybe
that's what you want to use instead of rotatelogs.
--
*Daniel Ferradal*
IT Specialist
email dferradal@gmail.com
linkedin es.linkedin.com/in/danielferradal