From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by yocto-www.yoctoproject.org (Postfix, from userid 118) id BF06DE007D2; Tue, 5 Aug 2014 07:40:24 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on yocto-www.yoctoproject.org X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, HTML_MESSAGE, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 X-Spam-HAM-Report: * 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider * (ismael.faye[at]yahoo.fr) * -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no * trust * [212.82.96.123 listed in list.dnswl.org] * -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% * [score: 0.0000] * 0.0 HTML_MESSAGE BODY: HTML included in message * -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's * domain * 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily * valid * -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature Received: from nm6-vm7.bullet.mail.ir2.yahoo.com (nm6-vm7.bullet.mail.ir2.yahoo.com [212.82.96.123]) by yocto-www.yoctoproject.org (Postfix) with ESMTP id 05050E00790 for ; Tue, 5 Aug 2014 07:40:19 -0700 (PDT) Received: from [212.82.98.126] by nm6.bullet.mail.ir2.yahoo.com with NNFMP; 05 Aug 2014 14:40:17 -0000 Received: from [212.82.98.99] by tm19.bullet.mail.ir2.yahoo.com with NNFMP; 05 Aug 2014 14:40:17 -0000 Received: from [127.0.0.1] by omp1036.mail.ir2.yahoo.com with NNFMP; 05 Aug 2014 14:40:17 -0000 X-Yahoo-Newman-Property: ymail-3 X-Yahoo-Newman-Id: 648242.32664.bm@omp1036.mail.ir2.yahoo.com Received: (qmail 48783 invoked by uid 60001); 5 Aug 2014 14:40:17 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.fr; s=s1024; t=1407249617; bh=CGs8a2W/cj/trwsYRS4W5QNbA/zqXq4W2fPTxPIuXzI=; h=Message-ID:Date:From:Reply-To:Subject:To:MIME-Version:Content-Type; b=xqC/MHyrXq3zk57vnadM2BmfkQKsUwxR+Dfe2k1lPbtJ0d927D6aHey+Ag3gCaHpmrMhTHjU7SnPP6l8QOZIVH9F+KKxVSZwp/7rOJZOCR+Zqb2P4tsMCihHbLDf5wEoCn7mNSxp3tWSC+e5WlIo9pGl40D25kAkRf+0B+rPz/4= X-YMail-OSG: vAMWJJgVM1n0UUcLi5d7whpHvmQadBazPq7B0OdUQBXYkYe ejz4CSuXXx3qfJ.V_2oeQJnDwk6uR6wuDAsqU0WZXEiC2cShDw0lw4t74YnD 0H6izEwqFxeOiEnUkCF7ET.riBc5t2xHJC0Y.v5VB0dxmRLs7lQ_PQeYSy3k _nE0jmPZkwCj73vlsSrYLHZAo9ZtP9OSNF9OLDy.d.gxBFlGQvFTXkWgCWnO AWQgduOLmA4zbI_noYr5LxmncD4F2Edwd40YRJhovo8og21FSXeseeHTzGSG nEu0CDYGOn9wPSLEAisEzEaGNkdzh025v.M4J8HsY2MaPWpFiRSckmVqIz3D 892kDrNNEUf1Q2v.pWlcgHaxVNuhXz6ilxyBqCe_U33OLZYUo_VGTxwym2W2 Ef6bAky33V4xJTJvnuu9kVEoNoIDR8sWbhXyMkEyQydMe6tN2l0u60OtulVu Mx1Lx931mtezxQbAR165pcYywGLSIOr2bw_biZFwdBAr_zwMvwwvT1QYz6Pv Z1dAnY14SuGyJbL7P.dmYocj929WUTbN8JRv_t9zENQ-- Received: from [217.108.83.254] by web171302.mail.ir2.yahoo.com via HTTP; Tue, 05 Aug 2014 15:40:17 BST X-Rocket-MIMEInfo: 002.001, SGkgYWxsLApJIHdhbnQgdG8gdXNlIHN5c2xvZy1uZyB0byBsb2cgdGhlIG1lc3NhZ2VzIGdlbmVyYXRlZCBieSBteSBhcHBsaWNhdGlvbiBpbXBsZW1lbnRlZCBpbiBDIGxhbmd1YWdlLiBJIGFkZGVkIHRoaXMgaW4gdGhlIGNvZGU6CgrCoMKgwqAgY2hhcsKgwqDCoCAqbG9nPSJydGNkIjsKwqDCoMKgIHByaW50ZigiWyVzXSBSVEMgYWRqdXN0ZW1lbnRcbiIsX19mdW5jX18pOwrCoMKgwqAgb3BlbmxvZyhsb2csIExPR19QSUQsIExPR19MT0NBTDApOwrCoMKgwqAgc3lzbG9nKExPR19ERUJVRywgIltGSUpdIFIBMAEBAQE- X-Mailer: YahooMailWebService/0.8.198.689 Message-ID: <1407249617.80963.YahooMailNeo@web171302.mail.ir2.yahoo.com> Date: Tue, 5 Aug 2014 15:40:17 +0100 From: Jean Faye To: "yocto@yoctoproject.org" MIME-Version: 1.0 Subject: How to log the messages generated by c program using syslog-ng and how to manage log file rotation X-BeenThere: yocto@yoctoproject.org X-Mailman-Version: 2.1.13 Precedence: list Reply-To: Jean Faye List-Id: Discussion of all things Yocto Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Aug 2014 14:40:24 -0000 Content-Type: multipart/alternative; boundary="1670751155-1865227008-1407249617=:80963" --1670751155-1865227008-1407249617=:80963 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Hi all,=0AI want to use syslog-ng to log the messages generated by my appli= cation implemented in C language. I added this in the code:=0A=0A=A0=A0=A0 = char=A0=A0=A0 *log=3D"rtcd";=0A=A0=A0=A0 printf("[%s] RTC adjustement\n",__= func__);=0A=A0=A0=A0 openlog(log, LOG_PID, LOG_LOCAL0);=0A=A0=A0=A0 syslog(= LOG_DEBUG, "[FIJ] RTC adjustement");=0A=A0=A0=A0 closelog();=0A=0A=0AFor me= , according to the syslog-ng file, the files /var/log/ldb/GENTrace.log, /va= r/log/ldb/SUTrace.log, /var/log/ldb/WANTrace.log and /var/log/ldb/CPLTrace.= log must be created and must contain the syslog message.=0ABut I got no mes= sages in my destination files. You can see the content of my syslog-ng.conf= file bellow.=0A=0AIs it the right way to log the messages sent by C progra= m? What can explain that I got no messages in the destinations files?=0A=0A= 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:=0A=0A. /etc/init.d/f= unctions=0A=0AWhy are you using the line? Is it necessary to use it?=0A=0AC= oncerning log file rotation, How can we manage it using syslog-ng? For exam= ple I want to have a destination file with a size maximum =3D 2Mo and if th= e size is greater than the max size, I have to save the current one and cre= ate a new one. On my system I can have max 4 files (4 x 2Mo). How can I man= age this kind of rotation?=0A=0AThanks in advance.=0ABest regards,=0AIsmael= Jean FAYE =0A=0A@version: 3.5=0A#=0A# Syslog-ng configuration file, compat= ible with default Debian syslogd=0A# installation. Originally written by an= onymous (I can't find his name)=0A# Revised, and rewrited by me (SZALAY Att= ila )=0A=0A# First, set some global options.=0Aoptions { c= hain_hostnames(off); flush_lines(0); use_dns(no); use_fqdn(no);=0A=A0=A0=A0= =A0 owner("root"); group("adm"); perm(0640); stats_freq(0);=0A=A0=A0=A0 = =A0 bad_hostname("^gconfd$");create_dirs(yes);=0A};=0A=0A##################= ######=0A# Sources=0A########################=0A=0Asource s_mysource { =0A= =A0=A0=A0 pipe("/tmp/pipe" pad_size(2048));=0A};=0A=0A#####################= ###=0A# Destinations=0A########################=0A=0Adestination d_GEN { = =0A=A0=A0=A0=A0=A0=A0 =A0=A0=A0 =A0=A0=A0=A0 file("/var/log/ldb/GENTrace.lo= g");=0A};=0A=0Adestination d_SU { =0A=A0=A0=A0=A0=A0=A0 =A0=A0=A0 =A0=A0=A0= =A0 file("/var/log/ldb/SUTrace.log");=0A};=0A=0Adestination d_WAN { =0A=A0= =A0=A0=A0=A0=A0 =A0=A0=A0 =A0=A0=A0=A0 file("/var/log/ldb/WANTrace.log");= =0A};=0A=0Adestination d_CPL { =0A=A0=A0=A0=A0=A0=A0 =A0=A0=A0 =A0=A0=A0=A0= file("/var/log/ldb/CPLTrace.log");=0A};=0A=0A########################=0A# = Filters=0A########################=0A=0A#filter f_GEN { =0A=A0=A0=A0=A0=A0= =A0 =A0=A0=A0 =A0=A0=A0=A0 #facility(local0) and filter(nom_du_composant_ap= plicatif);=0A=A0=A0=A0=A0=A0=A0 =A0=A0=A0 =A0=A0=A0=A0 #facility(local0) an= d filter(f_debug);=0A=A0=A0=A0=A0=A0=A0 =A0=A0=A0 =A0=A0=A0=A0 #facility(lo= cal0);=0A#};=0A=0Afilter f_SU { =0A=A0=A0=A0=A0=A0=A0 =A0=A0=A0 =A0=A0=A0= =A0 #facility(local0) and filter(nom_du_composant_applicatif);=0A=A0=A0=A0= =A0=A0=A0 =A0=A0=A0 =A0=A0=A0=A0 #facility(local0) and filter(f_debug);=0A= =A0=A0=A0=A0=A0=A0 =A0=A0=A0 =A0=A0=A0=A0 facility(local0);=0A};=0A=0Afilte= r f_WAN { =0A=A0=A0=A0=A0=A0=A0 =A0=A0=A0 =A0=A0=A0=A0 #facility(local0) an= d filter(nom_du_composant_applicatif);=0A=A0=A0=A0=A0=A0=A0 =A0=A0=A0 =A0= =A0=A0=A0 #facility(local0) and filter(f_debug);=0A=A0=A0=A0=A0=A0=A0 =A0= =A0=A0 =A0=A0=A0=A0 facility(local0);=0A};=0A=0Afilter f_CPL { =0A=A0=A0=A0= =A0=A0=A0 =A0=A0=A0 =A0=A0=A0=A0 #facility(local0) and filter(nom_du_compos= ant_applicatif);=0A=A0=A0=A0=A0=A0=A0 =A0=A0=A0 =A0=A0=A0=A0 #facility(loca= l0) and filter(f_debug);=0A=A0=A0=A0=A0=A0=A0 =A0=A0=A0 =A0=A0=A0=A0 facili= ty(local0);=0A};=0A=0A########################=0A# Log paths=0A############= ############=0A=0A#log { source(s_mysource); filter(f_GEN); destination(d_G= EN); };=0Alog { source(s_mysource); filter(f_SU); destination(d_SU); };=0Al= og { source(s_mysource); filter(f_WAN); destination(d_WAN); };=0Alog { sour= ce(s_mysource); filter(f_CPL); destination(d_CPL); }; --1670751155-1865227008-1407249617=:80963 Content-Type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable
Hi all,
I= want to use syslog-ng to log the messages generated by my application impl= emented in C language. I added this in the code:
<= br style=3D"" class=3D"">    char    *log=3D"= rtcd";
    printf("[%s] RTC adjuste= ment\n",__func__);
    openlog(log,= LOG_PID, LOG_LOCAL0);
    syslog(L= OG_DEBUG, "[FIJ] RTC adjustement");
  &n= bsp; closelog();


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 a= nd /var/log/ldb/CPLTrace.log must be created and must contain the syslog message.
But = I got no messages in my destination files. You can see the content of my sy= slog-ng.conf file bellow.

Is it the right way to log the messages sent by C program? What can expla= in that I got no messages in the destinations files?

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 lin= e below:

. /etc/init.d/f= unctions

Why are you usi= ng the line? Is it necessary to use it?

Concerning log file rotation, How can we manage it using s= yslog-ng? For example I want to have a destination file with a size maximum= =3D 2Mo and if the size is greater than the max size, I have to save the c= urrent 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 rot= ation?

Thanks in advance= .
Best regards,
Ismael Je= an FAYE

@version: 3.5#
# Syslog-ng configuratio= n file, compatible with default Debian syslogd
# i= nstallation. Originally written by anonymous (I can't find his name)
# Revised, and rewrited by me (SZALAY Attila <sasa@de= bian.org>)

# First, s= et some global options.
options { chain_hostnames(= off); flush_lines(0); use_dns(no); use_fqdn(no);
&= nbsp;     owner("root"); group("adm"); perm(0640); stats_fre= q(0);
      bad_hostname("^gco= nfd$");create_dirs(yes);
};

######################### Sources
################= ########

source s_mysour= ce {
    pipe("/tmp/pipe" pad_size= (2048));
};

########################
# Destinatio= ns
########################

destination d_GEN {
=               &= nbsp; file("/var/log/ldb/GENTrace.log");
};

destination d_SU {
           &n= bsp;    file("/var/log/ldb/SUTrace.log");
};

destination d_= WAN {
         = ;       file("/var/log/ldb/WANTrace.log");
};

des= tination d_CPL {
     &n= bsp;          file("/var/log/ldb/CPLTrac= e.log");
};

########################
# Filters########################
#filter f_GEN {
 &nb= sp;              #fa= cility(local0) and filter(nom_du_composant_applicatif);
             &= nbsp;  #facility(local0) and filter(f_debug);
                #facility(local0);
#};

filter= f_SU {
       &nbs= p;        #facility(local0) and filter(nom_du= _composant_applicatif);
    &n= bsp;           #facility(local0) an= d filter(f_debug);
     &= nbsp;          facility(local0);
};

fil= ter f_WAN {
       =          #facility(local0) and filter(no= m_du_composant_applicatif);
   &nbs= p;            #facility(local0= ) and filter(f_debug);
            &= nbsp;   facility(local0);
};

filter f_CPL {
             &= nbsp;  #facility(local0) and filter(nom_du_composant_applicatif);
          = ;      #facility(local0) and filter(f_debug);
           &n= bsp;    facility(local0);
};

########################
# Log paths
##################= ######

#log { source(s_m= ysource); filter(f_GEN); destination(d_GEN); };
lo= g { source(s_mysource); filter(f_SU); destination(d_SU); };
log { source(s_mysource); f= ilter(f_WAN); destination(d_WAN); };
log { source(= s_mysource); filter(f_CPL); destination(d_CPL); };

--1670751155-1865227008-1407249617=:80963--