<p dir="ltr">Hi,</p>
<p dir="ltr">You seem to have defined the source as a named pipe whereas the libc usually uses a UNIX domain socket to send messages.</p>
<p dir="ltr">Why don't you simply use the system() source? Or at least define use unix-dgram("/dev/log")<br>
</p>
<div class="gmail_quote">On Aug 6, 2014 11:11 AM, "Jean Faye" <<a href="mailto:ismael.faye@yahoo.fr">ismael.faye@yahoo.fr</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div><div style="color:#000;background-color:#fff;font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif;font-size:12pt"><div><br><br> </div><div><div><div style="color:#000;background-color:#fff;font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif;font-size:12pt">
<div>Hi all,<br>I want to use syslog-ng to log the messages generated by my application implemented in C language. I added this in the code:<br><br> char *log="rtcd";<br> printf("[%s] RTC adjustement\n",__func__);<br>
openlog(log, LOG_PID, LOG_LOCAL0);<br> syslog(LOG_DEBUG, "[FIJ] RTC
adjustement");<br> closelog();<br><br><br>For
me, according to the syslog-ng file, the files
/var/log/ldb/GENTrace.log, /var/log/ldb/SUTrace.log,
/var/log/ldb/WANTrace.log and /var/log/ldb/CPLTrace.log must be
created and must contain the syslog message.<br>But I got no messages in my destination files. You can see the content of my syslog-ng.conf file bellow.<br><br>Is it the right way to log the messages sent by C program? What can explain that I got no messages in the destinations files?<br>
<br>I
am using syslog-ng 3.5.4.1 provided by yocto. And in the script which
run the binary (initscript file) I remove the line below:<br><br>. /etc/init.d/functions<br><br>Why are you using the line? Is it necessary to use it?<br><br>Concerning
log file rotation, How can we manage it using syslog-ng? For example I
want to have a destination file with a size maximum = 2Mo and if the
size is greater than the max size, I have to save the current one and
create a new one. On my
system I can have max 4 files (4 x 2Mo). How can I manage this kind of
rotation?<br><br>Thanks in advance.<br>Best regards,<br>Ismael Jean FAYE <br><br>@version: 3.5<br>#<br># Syslog-ng configuration file, compatible with default Debian syslogd<br># installation. Originally written by anonymous (I can't find his name)<br>
# Revised, and rewrited by me (SZALAY Attila <<a href="mailto:sasa@debian.org" target="_blank">sasa@debian.org</a>>)<br><br># First, set some global options.<br>options { chain_hostnames(off); flush_lines(0); use_dns(no); use_fqdn(no);<br>
owner("root"); group("adm"); perm(0640); stats_freq(0);<br> bad_hostname("^gconfd$");create_dirs(yes);<br>};<br><br>########################<br># Sources<br>########################<br>
<br>source s_mysource { <br> pipe("/tmp/pipe" pad_size(2048));<br>};<br><br>########################<br># Destinations<br>########################<br><br>destination d_GEN { <br> file("/var/log/ldb/GENTrace.log");<br>
};<br><br>destination d_SU { <br> file("/var/log/ldb/SUTrace.log");<br>};<br><br>destination d_WAN {
<br> file("/var/log/ldb/WANTrace.log");<br>};<br><br>destination d_CPL { <br> file("/var/log/ldb/CPLTrace.log");<br>};<br><br>########################<br># Filters<br>########################<br>
<br>filter f_GEN { <br> #facility(local0) and filter(nom_du_composant_applicatif);<br> #facility(local0) and filter(f_debug);<br>
facility(local0);<br>};<br><br>filter f_SU { <br> #facility(local0) and filter(nom_du_composant_applicatif);<br> #facility(local0) and filter(f_debug);<br> facility(local0);<br>
};<br><br>filter f_WAN { <br> #facility(local0) and filter(nom_du_composant_applicatif);<br> #facility(local0) and filter(f_debug);<br> facility(local0);<br>};<br><br>filter f_CPL { <br>
#facility(local0) and filter(nom_du_composant_applicatif);<br> #facility(local0) and filter(f_debug);<br> facility(local0);<br>};<br><br>########################<br># Log paths<br>
########################<br><br>log { source(s_mysource); filter(f_GEN); destination(d_GEN); };<br>log { source(s_mysource); filter(f_SU);
destination(d_SU); };<br>log { source(s_mysource); filter(f_WAN); destination(d_WAN); };<br>log { source(s_mysource); filter(f_CPL); destination(d_CPL); };<br><br></div></div></div></div><br> <div><br><br></div><div style="display:block">
<div style="font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif;font-size:12pt"> <div style="font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif;font-size:12pt">
<div dir="ltr"> <font face="Arial"> Le Mardi 5 août 2014 16h05, Jean Faye <<a href="mailto:ismael.faye@yahoo.fr" target="_blank">ismael.faye@yahoo.fr</a>> a écrit :<br> </font> </div> <br><br> <div><div><div><div style="color:#000;background-color:#fff;font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif;font-size:12pt">
<div>confirm a6d843f7ad7d1dbf1fefb6f12432e54941a680a9<br><br>Hi all,<br>I want to use syslog-ng to log the messages generated by my application implemented in C language. I added this in the code:<br><br> char *log="rtcd";<br>
printf("[%s] RTC adjustement\n",__func__);<br> openlog(log, LOG_PID, LOG_LOCAL0);<br> syslog(LOG_DEBUG, "[FIJ] RTC adjustement");<br> closelog();<br><br><br>For me, according to the syslog-ng file, the files /var/log/ldb/GENTrace.log,
/var/log/ldb/SUTrace.log, /var/log/ldb/WANTrace.log and /var/log/ldb/CPLTrace.log must be created and must contain the syslog message.<br>But I got no messages in my destination files. You can see the content of my syslog-ng.conf file bellow.<br>
<br>Is it the right way to log the messages sent by C program? What can explain that I got no messages in the destinations files?<br><br>Concerning log file rotation, How can we manage it using syslog-ng? For example I want to have a destination file with a size maximum = 2Mo and if the size is greater than the max size, I have to save the current one and create a new one. On my system I can have max 4 files (4 x 2Mo). How can I manage this kind of rotation?<br>
<br>Thanks in advance.<br>Best regards,<br>Ismael Jean FAYE <br><br>@version: 3.5<br>#<br># Syslog-ng configuration file, compatible with default Debian syslogd<br># installation. Originally written by anonymous (I can't find his name)<br>
# Revised, and rewrited by me (SZALAY Attila <<a href="mailto:sasa@debian.org" target="_blank">sasa@debian.org</a>>)<br><br># First, set some global options.<br>options { chain_hostnames(off); flush_lines(0); use_dns(no); use_fqdn(no);<br>
owner("root"); group("adm"); perm(0640); stats_freq(0);<br> bad_hostname("^gconfd$");create_dirs(yes);<br>};<br><br>########################<br># Sources<br>########################<br>
<br>source s_mysource { <br> pipe("/tmp/pipe" pad_size(2048));<br>};<br><br>########################<br># Destinations<br>########################<br><br>destination d_GEN { <br> file("/var/log/ldb/GENTrace.log");<br>
};<br><br>destination d_SU { <br> file("/var/log/ldb/SUTrace.log");<br>};<br><br>destination d_WAN { <br> file("/var/log/ldb/WANTrace.log");<br>};<br><br>destination
d_CPL { <br> file("/var/log/ldb/CPLTrace.log");<br>};<br><br>########################<br># Filters<br>########################<br><br>#filter f_GEN { <br> #facility(local0) and filter(nom_du_composant_applicatif);<br>
#facility(local0) and filter(f_debug);<br> #facility(local0);<br>#};<br><br>filter f_SU { <br>
#facility(local0) and filter(nom_du_composant_applicatif);<br> #facility(local0) and filter(f_debug);<br> facility(local0);<br>};<br><br>filter f_WAN { <br> #facility(local0) and filter(nom_du_composant_applicatif);<br>
#facility(local0) and filter(f_debug);<br> facility(local0);<br>};<br><br>filter f_CPL { <br> #facility(local0) and filter(nom_du_composant_applicatif);<br> #facility(local0) and filter(f_debug);<br>
facility(local0);<br>};<br><br>########################<br># Log paths<br>########################<br><br>#log { source(s_mysource); filter(f_GEN); destination(d_GEN); };<br>log { source(s_mysource); filter(f_SU); destination(d_SU); };<br>
log { source(s_mysource); filter(f_WAN); destination(d_WAN); };<br>log { source(s_mysource); filter(f_CPL); destination(d_CPL); };<br><br></div></div></div></div><br><br></div> </div> </div> </div> </div></div><br>______________________________________________________________________________<br>
Member info: <a href="https://lists.balabit.hu/mailman/listinfo/syslog-ng" target="_blank">https://lists.balabit.hu/mailman/listinfo/syslog-ng</a><br>
Documentation: <a href="http://www.balabit.com/support/documentation/?product=syslog-ng" target="_blank">http://www.balabit.com/support/documentation/?product=syslog-ng</a><br>
FAQ: <a href="http://www.balabit.com/wiki/syslog-ng-faq" target="_blank">http://www.balabit.com/wiki/syslog-ng-faq</a><br>
<br>
<br></blockquote></div>