[Logwatch-Devel] running too much instances of perl in parallel

Mike Tremaine mgt at stellarcore.net
Thu Jun 11 06:46:14 MST 2009


Mike Tremaine wrote:
> Ivana Varekova wrote:
>> Hello,
>> I just get a bug-report - which complains about the multiple 
>> instances of perl running at one time:
>>
>> "I noticed on F10 x86_64 machine that logwatch runs 10 perl instances 
>> and moves my AMD CPU temp to 90 C.
>>
>>
>> I agree with the bug reporter. The number of perl instances 
>> especially for /var/log/messages logfile is huge. So could the number 
>> of perl calls be  reduce?
>> I have two ideas what could be done:
>> 1/ add the possibility to call shared scripts with several parameters 
>> (logwatch does not need to go through the log file multiple times)and 
>> the number of perl script decrease.
>> 2/ shared perl scipt transfer to perl procedures - so there will be 
>> no need to call another perl instance.
>> What is your opinion? Is any of these solutions acceptable for? Or do 
>> you have any other idea how to solve this problem?
>> Thanks.
>> Ivana Varekova
>> _
>
> This comes from these config lines is conf/shared/messages.conf
>
> messages.conf:*RemoveService = talkd
> messages.conf:*RemoveService = telnetd
> messages.conf:*RemoveService = inetd
> messages.conf:*RemoveService = nfsd
> messages.conf:*RemoveService = /sbin/mingetty
> messages.conf:*RemoveService = netscreen
> messages.conf:*RemoveService = NetScreen
>
> If you re-write this as
>
> *RemoveService = 
> (talkd|telnetd|inetd|nfsd|/sbin/mingetty|netscreen|NetScreen)
>
> It should work without changes....
>
> However it would be nice if the shared scripts would build that regex 
> for you from a CSV list
>
> *RemoveService = talkd,telnetd,etc....
>
> I don't think it would be hard let me take a look.
>
> -Mike
> _______________________________________________
> Logwatch-Devel mailing list
> Logwatch-Devel at logwatch.org
> http://www2.list.logwatch.org:81/mailman/listinfo/logwatch-devel

How about a patch like this

[mgt at vega shared]$ cvs diff removeservice
Index: removeservice
===================================================================
RCS file: /var/cvs/logwatch/scripts/shared/removeservice,v
retrieving revision 1.9
diff -r1.9 removeservice
34a35,37
 > #Change commas to pipes -mgt
 > $ServiceName =~ s/,/|/g;
 >
37,38c40,41
<    unless ( ($ThisLine =~ m/^... .. ..:..:.. [^ ]* 
$ServiceName\[[0123456789]*\]: /oi) or
<          ($ThisLine =~ m/^... .. ..:..:.. [^ ]* 
(:\s*)?$ServiceName\s*: /oi) ) {
---
 >    unless ( ($ThisLine =~ m/^... .. ..:..:.. [^ ]* 
($ServiceName)\[[0123456789]*\]: /oi) or
 >          ($ThisLine =~ m/^... .. ..:..:.. [^ ]* 
(:\s*)?($ServiceName)\s*: /oi) ) {

It should allow comma separated list to be used, but still remain 
backwards compatible. If you can give it a try and I'll commit it.

-Mike


More information about the Logwatch-Devel mailing list