No sooner did I write this that ElectricFence reported back (after 2 hours of uptime):

"ElectricFence: Exiting: mprotect() failed: Cannot allocate memory"


The machine is a dual Proc P2 w/512 Mb RAM.   syslog-ng initilizes with 10mb, and slowly consumes about a 1 mb per minute.




henry@shoelacecity.com
Sent by: syslog-ng-admin@lists.balabit.hu

02/28/2005 11:27 AM
Please respond to
syslog-ng@lists.balabit.hu

To
syslog-ng@lists.balabit.hu
cc
Subject
Re: [syslog-ng]Syslog-NG 1.6.6 memory leak when sending UDP logs






The installation is a fresh 1.6.6 installation on a clean install of Redhat 3.0.    It's been running fine for about 2 weeks logging the same amount of traffic to local files only.

When I turned on the UDP destinations, it started chewing up memory.  The destinations are receiving logs entries properly, and the source address is properly spoofed.


Versions of libs:


libnet 1.1.2

libol 0.3.14


Here's the syslog-ng config file - the only thing that changed to cause this memory eating behavior is the 3 lines under "# Sets up local destination for Cisco logs". It makes no difference if I am sending to a single host, or multiple, the memory "leak" is still there.


I have it currently running under "ElectricFence"  looking for malloc problems - so far none, just memory consumption.


-------------------------------------------

options { long_hostnames(off); sync(0); };


source src { unix-stream("/dev/log"); internal(); };

source kernsrc { file("/proc/kmsg"); };

source net { udp(port(514)); };



# Sets up local desitation for Cisco logs

destination ciscolog { file("/var/log/cisco.log"); };


# Sets up forwarding to other hosts

destination loghostd { udp(loghostd spoof_source(yes)); };

destination loghosta { udp(loghosta spoof_source(yes)); };

destination scribe02 { udp(scribe02 spoof_source(yes)); };


# standard localhost logging stuff

destination authlog { file("/var/log/auth.log"); };

destination syslog { file("/var/log/syslog"); };

destination cron { file("/var/log/cron.log"); };

destination daemon { file("/var/log/daemon.log"); };

destination kern { file("/var/log/kern.log"); };

destination lpr { file("/var/log/lpr.log"); };

destination user { file("/var/log/user.log"); };

destination uucp { file("/var/log/uucp.log"); };

destination ppp { file("/var/log/ppp.log"); };

destination mail { file("/var/log/mail.log"); };


destination mailinfo { file("/var/log/mail.info"); };

destination mailwarn { file("/var/log/mail.warn"); };

destination mailerr { file("/var/log/mail.err"); };

destination local0 { file("/var/log/local0.log"); };

destination local1 { file("/var/log/local1.log"); };


destination all { file("/var/log/all.log"); };

destination allnet { file("/var/log/allnet.log"); };


destination newscrit { file("/var/log/news/news.crit"); };

destination newserr { file("/var/log/news/news.err"); };

destination newsnotice { file("/var/log/news/news.notice"); };


destination debug { file("/var/log/debug"); };

destination messages { file("/var/log/messages"); };

destination console { usertty("root"); };

destination console_all { file("/dev/tty12"); };





# Filters Cisco events - well, at least local7 and local4 events

filter f_cisco { facility(local7,local4);};

filter f_notcisco {not facility(local7, local4); };


filter f_auth { facility(auth); };

filter f_authpriv { facility(auth, authpriv); };

filter f_syslog { not facility(authpriv, mail) and not match(ppp.*LCP); };

filter f_cron { facility(cron); };

filter f_daemon { facility(daemon); };

filter f_kern { facility(kern); };

filter f_lpr { facility(lpr); };

filter f_mail { facility(mail) and not match (imapd); };

filter f_user { facility(user); };

filter f_uucp { facility(cron); };

filter f_ppp { program(ppp); };

filter f_news { facility(news); };

filter f_debug { not facility(auth, authpriv, news, mail) and not match(ppp.*LCP); };

filter f_messages { level(info..warn)
       and not facility(auth, authpriv, mail, news); };

filter f_emergency { level(emerg); };


filter f_info { level(info); };

filter f_notice { level(notice); };

filter f_warn { level(warn); };

filter f_crit { level(crit); };

filter f_err { level(err); };



# Reflects Cisco SYSLOG packets to remote hosts

log { source(net); filter(f_cisco); destination(loghostd); };

log { source(net); filter(f_cisco); destination(loghosta); };

log { source(net); filter(f_cisco); destination(scribe02); };


# Keeps a copy for ourself

log { source(net); filter(f_cisco); destination(ciscolog); };



log { source(src); filter(f_authpriv); destination(authlog); };

log { source(src); filter(f_syslog); destination(syslog); };

log { source(src); filter(f_cron); destination(cron); };

log { source(src); filter(f_daemon); destination(daemon); };

log { source(kernsrc); filter(f_kern); destination(kern); };

log { source(src); filter(f_lpr); destination(lpr); };

log { source(src); filter(f_mail); destination(mail); };

log { source(src); filter(f_user); destination(user); };

log { source(src); filter(f_uucp); destination(uucp); };

log { source(src); filter(f_mail); filter(f_info); destination(mailinfo); };

log { source(src); filter(f_mail); filter(f_warn); destination(mailwarn); };

log { source(src); filter(f_mail); filter(f_err); destination(mailerr); };

log { source(src); filter(f_news); filter(f_crit); destination(newscrit); };

log { source(src); filter(f_news); filter(f_err); destination(newserr); };

log { source(src); filter(f_news); filter(f_notice); destination(newsnotice); };

log { source(src); filter(f_debug); destination(debug); };

log { source(src); filter(f_messages); destination(messages); };

log { source(src); filter(f_emergency); destination(console); };

log { source(src); filter(f_ppp); destination(ppp); };

log { source(src); destination(console_all); };


log { source(src); destination(all); };


# Log all non cisco stuff to localfile for debugging

log { source(net); filter(f_notcisco); destination(allnet); };



Henry -



Balazs Scheidler <bazsi@balabit.hu>
Sent by: syslog-ng-admin@lists.balabit.hu

02/28/2005 11:11 AM
Please respond to
syslog-ng@lists.balabit.hu

To
syslog-ng@lists.balabit.hu
cc
Subject
Re: [syslog-ng]Syslog-NG 1.6.6 memory leak when sending UDP logs







On Mon, 2005-02-28 at 09:36 -0500, henry@shoelacecity.com wrote:
>
> I'm running 1.6.6 on Linux Redhat ES 3.0 logging Cisco router logs to
> local files and it's been running just fine for over a week.  
> I just enabled  forwarding for local4 and local7 (with spoof UDP)  to
> 2 additional hosts via UDP and noticed, within a day, that it
> syslog-NG has consumed all available memory.   It continues to log,
> however, the system starts killing processes off unless I restart
> syslog-ng.

If I understand you correctly you use syslog-ng to send logs to another
host via UDP. Is it a new installation or this installation has worked
so far and upgrading to 1.6.6 is what triggered the problem?

Are you using address spoofing (spoof-source(yes))? Can you post your
configuration file?

--
Bazsi


_______________________________________________
syslog-ng maillist  -  syslog-ng@lists.balabit.hu
https://lists.balabit.hu/mailman/listinfo/syslog-ng
Frequently asked questions at http://www.campin.net/syslog-ng/faq.html