Skip to contentSkip to conversation

logrotate scripts policy

RFC Roman I Khimov 4 participants 7 messages May 11, 2010 – May 12, 2010

lore
Share & tools
lore
#0 lore raw

Hello all.

Seems like most OE users are fine with /var/log being on tmpfs and thus not care about logs and their rotation. We actually care about logs and thus need to rotate them. I have several patches adding logrotate scripts to recipes but I'd like to discuss the way they should be packaged in order to satisfy both camps (caring about logs and don't) and hopefully develop some policy for that.

As of now, my patches package logrotate scripts like this:

+PACKAGES =+ "${PN}-logrotate" +FILES_${PN}-logrotate = "${sysconfdir}/logrotate.d/squid" +RRECOMMENDS_${PN} += "${PN}-logrotate" +RDEPENDS_${PN}-logrotate += "logrotate"

It works fine here, but I guess that people not caring about logs don't want to have logrotate installed and probably don't want /etc/logrotate.d cruft either. So, an opposite approach could be:

+RSUGGESTS_${PN} += "${PN}-logrotate"
+RSUGGESTS_${PN}-logrotate += "logrotate"

But then if you need logrotate scripts, you have to add all those *-logrotate packages to the respective image along with logrotate program itself. As the number of *-logrotate packages can be quite big it might be easier to add some IMAGE_LINGUAS-alike hook to image class with "IMAGE_LOGROTATE=y" parameter activating it.

So, probably a better approach and what I'm proposing is:

+RRECOMMENDS_${PN} += "${PN}-logrotate"
+RSUGGESTS_${PN}-logrotate += "logrotate"

This way all *-logrotate packages will get installed by default, but not the logrotate program. So, it will eat some little space in /etc/logrotate.d for everyone by default (but you can get rid of those packages if you really don't want them), but would allow to switch rotation on/off easily with just one package included or not in the image.

Also, in org.oe.dev there is already callweaver, asterisk and cluster- resource-agents that have logrotate scripts installed in /etc/logrotate.d (that legitimizes RRECOMMENDS for *-logrotate a bit) and callweaver RRECOMMENDS logrotate (asterisk has that commented out, so it supports RSUGGESTS approach to logrotate itself a bit).

Suggestions, recommendations, comments?

#1 lore raw

В сообщении от Вторник 11 мая 2010 19:04:05 автор Roman I Khimov написал:

Quoted 5 lines

Also, in org.oe.dev there is already callweaver, asterisk and cluster- resource-agents that have logrotate scripts installed in /etc/logrotate.d (that legitimizes RRECOMMENDS for *-logrotate a bit) and callweaver RRECOMMENDS logrotate (asterisk has that commented out, so it supports RSUGGESTS approach to logrotate itself a bit).

P.S. There are probably more that have /etc/logrotate.d installed and packaged in ${PN} without specifically mentioning it anywhere.

#2 lore raw

В сообщении от Вторник 11 мая 2010 19:10:21 автор Roman I Khimov написал:

Quoted 9 lines

В сообщении от Вторник 11 мая 2010 19:04:05 автор Roman I Khimov написал:

Quoted 5 lines

Also, in org.oe.dev there is already callweaver, asterisk and cluster- resource-agents that have logrotate scripts installed in /etc/logrotate.d (that legitimizes RRECOMMENDS for *-logrotate a bit) and callweaver RRECOMMENDS logrotate (asterisk has that commented out, so it supports RSUGGESTS approach to logrotate itself a bit).

P.S. There are probably more that have /etc/logrotate.d installed and
packaged in ${PN} without specifically mentioning it anywhere.

P.P.S. And because of that (and to simplify things in general) if might be easier to handle logrotate script packaging with respectful rsuggests/rrecommends/whatever in bitbake.conf. By default.

Signature · 3 lines
 http://roman.khimov.ru
mailto: [email protected]
gpg --keyserver hkp://subkeys.pgp.net --recv-keys 0xE5E055C3
#3 lore raw
In reply to Roman I Khimov
Quoted 40 lines · Roman I Khimov

Hello all.

Seems like most OE users are fine with /var/log being on tmpfs and thus not care about logs and their rotation. We actually care about logs and thus need to rotate them. I have several patches adding logrotate scripts to recipes but I'd like to discuss the way they should be packaged in order to satisfy both camps (caring about logs and don't) and hopefully develop some policy for that.

As of now, my patches package logrotate scripts like this:

(quoted diff) +4 -0
+PACKAGES =+ "${PN}-logrotate"
+FILES_${PN}-logrotate = "${sysconfdir}/logrotate.d/squid"
+RRECOMMENDS_${PN} += "${PN}-logrotate"
+RDEPENDS_${PN}-logrotate += "logrotate"

It works fine here, but I guess that people not caring about logs don't want to have logrotate installed and probably don't want /etc/logrotate.d cruft either. So, an opposite approach could be:

(quoted diff) +2 -0
+RSUGGESTS_${PN} += "${PN}-logrotate"
+RSUGGESTS_${PN}-logrotate += "logrotate"

But then if you need logrotate scripts, you have to add all those *-logrotate packages to the respective image along with logrotate program itself. As the number of *-logrotate packages can be quite big it might be easier to add some IMAGE_LINGUAS-alike hook to image class with "IMAGE_LOGROTATE=y" parameter activating it.

So, probably a better approach and what I'm proposing is:

(quoted diff) +2 -0
+RRECOMMENDS_${PN} += "${PN}-logrotate"
+RSUGGESTS_${PN}-logrotate += "logrotate"

This way all *-logrotate packages will get installed by default, but not the logrotate program. So, it will eat some little space in /etc/logrotate.d for everyone by default (but you can get rid of those packages if you really don't want them), but would allow to switch rotation on/off easily with just one package included or not in the image.

Quoted 7 lines

Also, in org.oe.dev there is already callweaver, asterisk and cluster- resource-agents that have logrotate scripts installed in /etc/logrotate.d (that legitimizes RRECOMMENDS for *-logrotate a bit) and callweaver RRECOMMENDS logrotate (asterisk has that commented out, so it supports RSUGGESTS approach to logrotate itself a bit).

Suggestions, recommendations, comments?

Both proposed aproaches seem good to me. We have /var/log on tmpfs but I would still add logrotate to image because realy big log in tmpfs is much worse than few more kB in image (nobody wants a unusable phone after 3 days just because of ram full of logs).

But maybe there are different "optimal" logrotate rules for people with tmpfs and without, which is IMHO harder to implement. I don't care about logs enough to ask for this :).

Regards,

Signature · 3 lines
uin:136542059                jid:[email protected]
Jansa Martin                 sip:[email protected] 
JaMa                         
#4 lore raw

В сообщении от Вторник 11 мая 2010 19:15:49 автор Martin Jansa написал:

Quoted 3 lines

But maybe there are different "optimal" logrotate rules for people with tmpfs and without, which is IMHO harder to implement. I don't care about logs enough to ask for this :).

I think this cases should be handled at distro level, for most of packages logrotate scripts will be added as separate source files for the package and luckily that are very easy to override for distros (or even machines if there is a need to) in OE implementing any policy needed.

Signature · 3 lines
 http://roman.khimov.ru
mailto: [email protected]
gpg --keyserver hkp://subkeys.pgp.net --recv-keys 0xE5E055C3
#5 lore raw
In reply to Roman I Khimov

Roman I Khimov wrote:
...

Quoted 5 lines

This way all *-logrotate packages will get installed by default, but not the logrotate program. So, it will eat some little space in /etc/logrotate.d for everyone by default (but you can get rid of those packages if you really don't want them), but would allow to switch rotation on/off easily with just one package included or not in the image.

The NSLU2 has a grand total of 8MB of flash space for bootloader, kernel, and the filesystem. We don't have even a few KB left right now for those extra packages. Keep in mind that even a 20-byte script will have a large footprint in the opkg database that's on the filesystem, so that space is in addition.

It's really really difficult to build an image without a whole lot of extraneous stuff in it, and I suspect that extraneous stuff is all in there for the same reasoning, which goes along the lines of "It's only a little bit of space..." -- but it all adds up, and when your total rootfs can only be 5.5 MB or so...

I'm not going to NAK this, but I will ask that if you do this please spend some time with the SlugOS image recipes to remove all the packages that this adds by default, with whatever mechanism you meant when you say "but you can get rid of those packages if you really don't want them".

-Mike (mwester)

#6 lore raw

В сообщении от Среда 12 мая 2010 03:05:15 автор Mike Westerhof написал:

Quoted 14 lines
Quoted 6 lines · Roman I Khimov

This way all *-logrotate packages will get installed by default, but not the logrotate program. So, it will eat some little space in /etc/logrotate.d for everyone by default (but you can get rid of those packages if you really don't want them), but would allow to switch rotation on/off easily with just one package included or not in the image.

The NSLU2 has a grand total of 8MB of flash space for bootloader, kernel, and the filesystem. We don't have even a few KB left right now for those extra packages. Keep in mind that even a 20-byte script will have a large footprint in the opkg database that's on the filesystem, so that space is in addition.

Quoted 5 lines

It's really really difficult to build an image without a whole lot of extraneous stuff in it, and I suspect that extraneous stuff is all in there for the same reasoning, which goes along the lines of "It's only a little bit of space..." -- but it all adds up, and when your total rootfs can only be 5.5 MB or so...

OK, that's exactly the kind of feedback I've wanted to get. But as such constraints are not common (or they are?), I still think that this should be (and easier to) implemented in opt-out fashion. So, I'll try to cook up a patch today that does

RRECOMMENDS_${PN} += "${PN}-logrotate"
RSUGGESTS_${PN}-logrotate += "logrotate"

and then add some "PURGE_LOGROTATE" variable that will trigger *-logrotate packages removal from image if there is a need to.