Log rotate

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Log rotate

sampei02@tiscali.it
I want to rotate access.log by logrotate system process so I disabled rotation in squid.conf, logfile_rotate has been set to zero; by logrotate I can compress log files and to name them with date suffix.
But what I have to write among postrotate and endscript ? What command to send to squid to start rotation?
It’s right to write "squid -k rotate" in postrotate section if I wanted to manage rotation only by logrotate?


This is my /etc/logorotate.d/ file

var/log/squid/access.log {
        daily
        compress
        rotate 365
        missingok
        nocreate
        sharedscripts
        postrotate
                 test ! -e /var/run/squid.pid || test ! -x /usr/sbin/squid || /usr/sbin/squid -k rotate 2>/dev/null
        endscript
}



_______________________________________________
squid-users mailing list
[hidden email]
http://lists.squid-cache.org/listinfo/squid-users
Reply | Threaded
Open this post in threaded view
|

Re: Log rotate

Matus UHLAR - fantomas
On 07.12.20 09:12, [hidden email] wrote:
>I want to rotate access.log by logrotate system process so I disabled
> rotation in squid.conf, logfile_rotate has been set to zero; by logrotate
> I can compress log files and to name them with date suffix.

>But what I have to write among postrotate and endscript ?  What command to
> send to squid to start rotation?

>It’s right to write "squid -k rotate" in postrotate section if I wanted to
> manage rotation only by logrotate?


this is very common on debian-based systems.

>This is my /etc/logorotate.d/ file
>
>var/log/squid/access.log {
>        daily
>        compress
>        rotate 365
>        missingok
>        nocreate
>        sharedscripts
>        postrotate
> test ! -e /var/run/squid.pid || test ! -x /usr/sbin/squid || /usr/sbin/squid -k rotate 2>/dev/null
>        endscript
>}

are you sure you don't run debian? ;-)
I would just like to avoit redirecting stderr to /dev/null
- if something bad happens, you should know it and not flush the info


/var/log/squid/*.log {
        daily
        compress
        delaycompress
        rotate 31
        missingok
        nocreate
        sharedscripts
        prerotate
                test ! -x /usr/sbin/sarg-reports || /usr/sbin/sarg-reports daily
        endscript
        postrotate
                test ! -e /var/run/squid.pid || test ! -x /usr/sbin/squid || /usr/sbin/squid -k rotate
        endscript
}


--
Matus UHLAR - fantomas, [hidden email] ; http://www.fantomas.sk/
Warning: I wish NOT to receive e-mail advertising to this address.
Varovanie: na tuto adresu chcem NEDOSTAVAT akukolvek reklamnu postu.
Linux - It's now safe to turn on your computer.
Linux - Teraz mozete pocitac bez obav zapnut.
_______________________________________________
squid-users mailing list
[hidden email]
http://lists.squid-cache.org/listinfo/squid-users
Reply | Threaded
Open this post in threaded view
|

Re: Log rotate

sampei02@tiscali.it
My OS is Centos 7.
But I manage rotation by logrotate, according to your suggestions in /etc/logrotate.d/squid, among postscript and endscript, there is written 'squid -k rotate’ so you don’t invoke squid rotation too ?!? We have 2 rotations?



On 7 Dec 2020, at 10:08, Matus UHLAR - fantomas <[hidden email]> wrote:

On 07.12.20 09:12, [hidden email] wrote:
I want to rotate access.log by logrotate system process so I disabled
rotation in squid.conf, logfile_rotate has been set to zero; by logrotate
I can compress log files and to name them with date suffix.

But what I have to write among postrotate and endscript ?  What command to
send to squid to start rotation?

It’s right to write "squid -k rotate" in postrotate section if I wanted to
manage rotation only by logrotate?


this is very common on debian-based systems.

This is my /etc/logorotate.d/ file

var/log/squid/access.log {
      daily
      compress
      rotate 365
      missingok
      nocreate
      sharedscripts
      postrotate
 test ! -e /var/run/squid.pid || test ! -x /usr/sbin/squid || /usr/sbin/squid -k rotate 2>/dev/null
      endscript
}

are you sure you don't run debian? ;-)
I would just like to avoit redirecting stderr to /dev/null
- if something bad happens, you should know it and not flush the info


/var/log/squid/*.log {
      daily
      compress
      delaycompress
      rotate 31
      missingok
      nocreate
      sharedscripts
      prerotate
              test ! -x /usr/sbin/sarg-reports || /usr/sbin/sarg-reports daily
      endscript
      postrotate
              test ! -e /var/run/squid.pid || test ! -x /usr/sbin/squid || /usr/sbin/squid -k rotate
      endscript
}


-- 
Matus UHLAR - fantomas, [hidden email] ; http://www.fantomas.sk/
Warning: I wish NOT to receive e-mail advertising to this address.
Varovanie: na tuto adresu chcem NEDOSTAVAT akukolvek reklamnu postu.
Linux - It's now safe to turn on your computer.
Linux - Teraz mozete pocitac bez obav zapnut.
_______________________________________________
squid-users mailing list
[hidden email]
http://lists.squid-cache.org/listinfo/squid-users


_______________________________________________
squid-users mailing list
[hidden email]
http://lists.squid-cache.org/listinfo/squid-users
Reply | Threaded
Open this post in threaded view
|

Re: Log rotate

Matus UHLAR - fantomas
On 07.12.20 10:35, [hidden email] wrote:
>My OS is Centos 7.

doesn't centos come with squid package, including logrotate config?

>But I manage rotation by logrotate, according to your suggestions in
> /etc/logrotate.d/squid, among postscript and endscript, there is written
> 'squid -k rotate’ so you don’t invoke squid rotation too ?!?  We have 2
> rotations?

you are running squid -k rotate in postrotate too, so what is your question?

according to squid docs, squid only reopens log files in "rotate" request,
so logrotate takes care about renaming and compressing files, while squid
only has to reopen them.

>> On 07.12.20 09:12, [hidden email] <mailto:[hidden email]> wrote:
>>> I want to rotate access.log by logrotate system process so I disabled
>>> rotation in squid.conf, logfile_rotate has been set to zero; by logrotate
>>> I can compress log files and to name them with date suffix.
>>
>>> But what I have to write among postrotate and endscript ?  What command to
>>> send to squid to start rotation?
>>
>>> It’s right to write "squid -k rotate" in postrotate section if I wanted to
>>> manage rotation only by logrotate?
>>
>>
>> this is very common on debian-based systems.
>>
>>> This is my /etc/logorotate.d/ file
>>>
>>> var/log/squid/access.log {
>>>       daily
>>>       compress
>>>       rotate 365
>>>       missingok
>>>       nocreate
>>>       sharedscripts
>>>       postrotate
>>> test ! -e /var/run/squid.pid || test ! -x /usr/sbin/squid || /usr/sbin/squid -k rotate 2>/dev/null
>>>       endscript
>>> }

>> On 7 Dec 2020, at 10:08, Matus UHLAR - fantomas <[hidden email]> wrote:
>> are you sure you don't run debian? ;-)
>> I would just like to avoit redirecting stderr to /dev/null
>> - if something bad happens, you should know it and not flush the info
>>
>>
>> /var/log/squid/*.log {
>>       daily
>>       compress
>>       delaycompress
>>       rotate 31
>>       missingok
>>       nocreate
>>       sharedscripts
>>       prerotate
>>               test ! -x /usr/sbin/sarg-reports || /usr/sbin/sarg-reports daily
>>       endscript
>>       postrotate
>>               test ! -e /var/run/squid.pid || test ! -x /usr/sbin/squid || /usr/sbin/squid -k rotate
>>       endscript
>> }

--
Matus UHLAR - fantomas, [hidden email] ; http://www.fantomas.sk/
Warning: I wish NOT to receive e-mail advertising to this address.
Varovanie: na tuto adresu chcem NEDOSTAVAT akukolvek reklamnu postu.
Silvester Stallone: Father of the RISC concept.
_______________________________________________
squid-users mailing list
[hidden email]
http://lists.squid-cache.org/listinfo/squid-users
Reply | Threaded
Open this post in threaded view
|

Re: Log rotate

sampei02@tiscali.it
> doesn't centos come with squid package, including logrotate config?

I manually installed Squid package 4.8-1 by yum utility while logrotate 3.8.6-19 was already installed.

> you are running squid -k rotate in postrotate too, so what is your question?
When I installed Squid package, It’s has been created automatically /etc/logrotate.d/squid as I showed in previous mails and where there is written 'squid -k rotate’.
My question is: if I use logrotate process why in /etc/logrotate.d/squid is recalled ''squid -k rotate’ ?
I thought 'squid -k rotate’ started another file rotation in addition to logrotate.


> On 7 Dec 2020, at 12:07, Matus UHLAR - fantomas <[hidden email]> wrote:
>
> On 07.12.20 10:35, [hidden email] wrote:
>> My OS is Centos 7.
>
> doesn't centos come with squid package, including logrotate config?
>
>> But I manage rotation by logrotate, according to your suggestions in
>> /etc/logrotate.d/squid, among postscript and endscript, there is written
>> 'squid -k rotate’ so you don’t invoke squid rotation too ?!?  We have 2
>> rotations?
>
> you are running squid -k rotate in postrotate too, so what is your question?
>
> according to squid docs, squid only reopens log files in "rotate" request,
> so logrotate takes care about renaming and compressing files, while squid
> only has to reopen them.
>
>>> On 07.12.20 09:12, [hidden email] <mailto:[hidden email]> wrote:
>>>> I want to rotate access.log by logrotate system process so I disabled
>>>> rotation in squid.conf, logfile_rotate has been set to zero; by logrotate
>>>> I can compress log files and to name them with date suffix.
>>>
>>>> But what I have to write among postrotate and endscript ?  What command to
>>>> send to squid to start rotation?
>>>
>>>> It’s right to write "squid -k rotate" in postrotate section if I wanted to
>>>> manage rotation only by logrotate?
>>>
>>>
>>> this is very common on debian-based systems.
>>>
>>>> This is my /etc/logorotate.d/ file
>>>>
>>>> var/log/squid/access.log {
>>>>      daily
>>>>      compress
>>>>      rotate 365
>>>>      missingok
>>>>      nocreate
>>>>      sharedscripts
>>>>      postrotate
>>>> test ! -e /var/run/squid.pid || test ! -x /usr/sbin/squid || /usr/sbin/squid -k rotate 2>/dev/null
>>>>      endscript
>>>> }
>
>>> On 7 Dec 2020, at 10:08, Matus UHLAR - fantomas <[hidden email]> wrote:
>>> are you sure you don't run debian? ;-)
>>> I would just like to avoit redirecting stderr to /dev/null
>>> - if something bad happens, you should know it and not flush the info
>>>
>>>
>>> /var/log/squid/*.log {
>>>      daily
>>>      compress
>>>      delaycompress
>>>      rotate 31
>>>      missingok
>>>      nocreate
>>>      sharedscripts
>>>      prerotate
>>>              test ! -x /usr/sbin/sarg-reports || /usr/sbin/sarg-reports daily
>>>      endscript
>>>      postrotate
>>>              test ! -e /var/run/squid.pid || test ! -x /usr/sbin/squid || /usr/sbin/squid -k rotate
>>>      endscript
>>> }
>
> --
> Matus UHLAR - fantomas, [hidden email] ; http://www.fantomas.sk/
> Warning: I wish NOT to receive e-mail advertising to this address.
> Varovanie: na tuto adresu chcem NEDOSTAVAT akukolvek reklamnu postu.
> Silvester Stallone: Father of the RISC concept.
> _______________________________________________
> squid-users mailing list
> [hidden email]
> http://lists.squid-cache.org/listinfo/squid-users

_______________________________________________
squid-users mailing list
[hidden email]
http://lists.squid-cache.org/listinfo/squid-users
Reply | Threaded
Open this post in threaded view
|

Re: Log rotate

Matus UHLAR - fantomas
On 07.12.20 12:52, [hidden email] wrote:
>I manually installed Squid package 4.8-1 by yum utility while logrotate 3.8.6-19 was already installed.
>
>> you are running squid -k rotate in postrotate too, so what is your question?

>When I installed Squid package, It’s has been created automatically /etc/logrotate.d/squid as I showed in previous mails and where there is written 'squid -k rotate’.
>My question is: if I use logrotate process why in /etc/logrotate.d/squid is recalled ''squid -k rotate’ ?
>I thought 'squid -k rotate’ started another file rotation in addition to logrotate.

in such case I answered in my former mail:

>> On 7 Dec 2020, at 12:07, Matus UHLAR - fantomas <[hidden email]> wrote:
>> according to squid docs, squid only reopens log files in "rotate" request,
>> so logrotate takes care about renaming and compressing files, while squid
>> only has to reopen them.

if squid would not reopen log files, it would continue writing to old log
files, no matter if they were renamed, removed, compressed (due to how unix
systems handle files).

reopening log files makes squid to start writing to new files, so the old
logs aren't touched.

--
Matus UHLAR - fantomas, [hidden email] ; http://www.fantomas.sk/
Warning: I wish NOT to receive e-mail advertising to this address.
Varovanie: na tuto adresu chcem NEDOSTAVAT akukolvek reklamnu postu.
It's now safe to throw off your computer.
_______________________________________________
squid-users mailing list
[hidden email]
http://lists.squid-cache.org/listinfo/squid-users