[squid-users] Logrotate question

robert k Wild robertkwild at gmail.com
Fri Jun 17 19:06:16 UTC 2022


 i understand it now

cat /etc/logrotate.d/squid
/usr/local/squid/var/logs/*.log {
monthly
rotate 4
compress
delaycompress
missingok
sharedscripts
dateext
dateformat -%d%m%Y
su root root
postrotate
/usr/local/squid/sbin/squid -k reconfigure
endscript
}

needed the sharedscripts to run the postrotate just once for all logs

didnt need the squid -k rotate as already handled by logrotate

On Fri, 17 Jun 2022 at 19:27, robert k Wild <robertkwild at gmail.com> wrote:

> just a question, im just playing with logrotate
>
> /usr/local/squid/var/logs/*.log {
> monthly
> rotate 4
> compress
> delaycompress
> missingok
> dateext
> dateformat -%d%m%Y
> su root root
> postrotate
> /usr/local/squid/sbin/squid -k reconfigure
> endscript
> }
>
> why is the "squid -k rotate" listed under "postrotate" as logrotate is
> handling it
>
> On Thu, 16 Jun 2022 at 14:06, robert k Wild <robertkwild at gmail.com> wrote:
>
>> Thanks Eliezer, really appreciate it :)
>>
>> On Thu, 16 Jun 2022, 14:03 , <ngtech1ltd at gmail.com> wrote:
>>
>>> So just create the file I sent you before or extract the file from the
>>> squid RPM using “rpm2cpio squid…rpm |cpio -dimv” in some tmp dir.
>>>
>>> You will just need to copy the file into the proper location, disable
>>> the cron you have created and if the squid binary is in a specific
>>> different folder change the path of the squid binary in the squid
>>> logrotate file accordingly.
>>>
>>>
>>>
>>> All The Bests,
>>>
>>> Eliezer
>>>
>>>
>>>
>>> *From:* robert k Wild <robertkwild at gmail.com>
>>> *Sent:* Thursday, 16 June 2022 15:24
>>> *To:* Eliezer Croitoru <ngtech1ltd at gmail.com>
>>> *Cc:* Squid Users <squid-users at lists.squid-cache.org>
>>> *Subject:* Re: [squid-users] Logrotate question
>>>
>>>
>>>
>>> No squid isn't sorry it is compiled from source, I forgot to add it
>>> sorry about that
>>>
>>>
>>>
>>> On Thu, 16 Jun 2022, 13:19 , <ngtech1ltd at gmail.com> wrote:
>>>
>>> Since this one is from yum install it’s very simple to just change the
>>> config files of squid and logrotate.
>>>
>>>
>>>
>>> If you need more assistance let me know.
>>>
>>>
>>>
>>> Eliezer
>>>
>>>
>>>
>>> *From:* robert k Wild <robertkwild at gmail.com>
>>> *Sent:* Thursday, 16 June 2022 14:52
>>> *To:* Eliezer Croitoru <ngtech1ltd at gmail.com>
>>> *Cc:* Squid Users <squid-users at lists.squid-cache.org>
>>> *Subject:* Re: [squid-users] Logrotate question
>>>
>>>
>>>
>>> Self compiled from source with others ie
>>>
>>>
>>>
>>> Squidclamav
>>>
>>> Cicap
>>>
>>> Cicap modules
>>>
>>>
>>>
>>> And clamav but did this one via yum install
>>>
>>>
>>>
>>>
>>>
>>> On Thu, 16 Jun 2022, 12:27 , <ngtech1ltd at gmail.com> wrote:
>>>
>>> How did you installed squid on CentOS 7?
>>>
>>> From my packages or the OS default or self compiled or another source?
>>>
>>>
>>>
>>> Eliezer
>>>
>>>
>>>
>>> *From:* robert k Wild <robertkwild at gmail.com>
>>> *Sent:* Thursday, 16 June 2022 14:05
>>> *To:* Eliezer Croitoru <ngtech1ltd at gmail.com>
>>> *Cc:* Squid Users <squid-users at lists.squid-cache.org>
>>> *Subject:* Re: [squid-users] Logrotate question
>>>
>>>
>>>
>>> Oops sorry you did say that, sorry I didn't see that at first
>>>
>>>
>>>
>>> On Thu, 16 Jun 2022, 12:04 robert k Wild, <robertkwild at gmail.com> wrote:
>>>
>>> I imagine Eliezer that's what I need to put in logrotate.conf file
>>>
>>>
>>>
>>> On Thu, 16 Jun 2022, 12:01 , <ngtech1ltd at gmail.com> wrote:
>>>
>>> Oops,
>>>
>>>
>>>
>>> The next is the file: /etc/logrotate.d/squid
>>>
>>> ##START
>>>
>>> /var/log/squid/*.log {
>>>
>>>     weekly
>>>
>>>     rotate 5
>>>
>>>     compress
>>>
>>>     notifempty
>>>
>>>     missingok
>>>
>>>     nocreate
>>>
>>>     sharedscripts
>>>
>>>     postrotate
>>>
>>>       # Asks squid to reopen its logs. (logfile_rotate 0 is set in
>>> squid.conf)
>>>
>>>       # errors redirected to make it silent if squid is not running
>>>
>>>       /usr/sbin/squid -k rotate 2>/dev/null
>>>
>>>       # Wait a little to allow Squid to catch up before the logs is
>>> compressed
>>>
>>>       sleep 1
>>>
>>>     endscript
>>>
>>> }
>>>
>>> ##END
>>>
>>>
>>>
>>> So you need to change the rotate to 92+ and also change the squid number
>>> of logs to the same number.
>>>
>>>
>>>
>>> Let me know if you it’s helpful.
>>>
>>>
>>>
>>> Eliezer
>>>
>>>
>>>
>>> *From:* ngtech1ltd at gmail.com <ngtech1ltd at gmail.com>
>>> *Sent:* Thursday, 16 June 2022 14:00
>>> *To:* 'robert k Wild' <robertkwild at gmail.com>; 'Squid Users' <
>>> squid-users at lists.squid-cache.org>
>>> *Subject:* RE: [squid-users] Logrotate question
>>>
>>>
>>>
>>> Hey Rob,
>>>
>>>
>>>
>>> The next is the file:
>>>
>>>
>>>
>>>
>>>
>>> *From:* squid-users <squid-users-bounces at lists.squid-cache.org> *On
>>> Behalf Of *robert k Wild
>>> *Sent:* Thursday, 16 June 2022 13:27
>>> *To:* Squid Users <squid-users at lists.squid-cache.org>
>>> *Subject:* Re: [squid-users] Logrotate question
>>>
>>>
>>>
>>> Cool, so I will rotate daily and delete after 91 days, thanks guys
>>>
>>>
>>>
>>> On Thu, 16 Jun 2022, 11:14 Matus UHLAR - fantomas, <uhlar at fantomas.sk>
>>> wrote:
>>>
>>> On 16.06.22 10:54, robert k Wild wrote:
>>> >Basically I want to keep logs for 3 months then rotate so it overwrites
>>> >them with another 3 months, if that makes sense
>>>
>>> in fact, it does not.
>>>
>>> I guess you are supposed to keep 3 months of logs, which mean, you
>>> always
>>> need to have 3 months of logs available.
>>>
>>> Each day, you can delete log files over 3 months old.
>>>
>>> If you rotated lof once in 3 months, you would have single file with 3
>>> months of logs in it, and could remove it 3 months after rotating, when
>>> first logs would be 6 months old.
>>>
>>> As we already told you, rotate daily and remove old logs after 92 days.
>>> and use logrotate config.
>>>
>>> --
>>> Matus UHLAR - fantomas, uhlar at fantomas.sk ; 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
>>> squid-users at lists.squid-cache.org
>>> http://lists.squid-cache.org/listinfo/squid-users
>>>
>>>
>
> --
> Regards,
>
> Robert K Wild.
>


-- 
Regards,

Robert K Wild.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squid-cache.org/pipermail/squid-users/attachments/20220617/2c975f2d/attachment-0001.htm>


More information about the squid-users mailing list