Return-Path: Received: by yocto-www.yoctoproject.org (Postfix, from userid 118) id ABEAFE007C1; Tue, 5 Aug 2014 07:33:28 -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.97.76 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 nm29-vm7.bullet.mail.ir2.yahoo.com (nm29-vm7.bullet.mail.ir2.yahoo.com [212.82.97.76]) by yocto-www.yoctoproject.org (Postfix) with ESMTP id 799BDE00790 for ; Tue, 5 Aug 2014 07:33:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.fr; s=s1024; t=1407249202; bh=yxYsDmwUc0Jqep7vP1e11lxWNSpzSkxissQ2gP5hCr0=; h=Received:Received:Received:X-Yahoo-Newman-Property:X-Yahoo-Newman-Id:Received:DKIM-Signature:X-YMail-OSG:Received:X-Rocket-MIMEInfo:X-Mailer:Message-ID:Date:From:Reply-To:Subject:To:MIME-Version:Content-Type; b=xzCx/Y106WM9vYZ46gi/ZIz7bJOy9w0sAH7GpWF1XE8p96d00YddjXMk3DAk1G8QzVhl4kLaqc+WqC/UBIjQ8O9X16u6oCf0qigSi0PTGk9vdMc7TpKpJvWH/h0SzUogsoBmqXIDORWkAIeB/4vS7gEO19LUx3QTWCo3Yaw6Nmo= DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.fr; b=SM8GIts8aFqst2CmtE8OyMGu2957nMTT8ahhjRh0ImLUPMqNco6Dy9yBo/aXbLHyEvuHSvtxpbW16FacnVU++d7hGOkEXfkpQyuxs+vwneorWpcl2RCJa1pkE3e4hK03EjeMGWN6J7D8YUZwDd6HlUHE3L0CPlE8u0kjt0n4BmA=; Received: from [212.82.98.59] by nm29.bullet.mail.ir2.yahoo.com with NNFMP; 05 Aug 2014 14:33:22 -0000 Received: from [212.82.98.105] by tm12.bullet.mail.ir2.yahoo.com with NNFMP; 05 Aug 2014 14:33:22 -0000 Received: from [127.0.0.1] by omp1042.mail.ir2.yahoo.com with NNFMP; 05 Aug 2014 14:33:22 -0000 X-Yahoo-Newman-Property: ymail-3 X-Yahoo-Newman-Id: 3032.13127.bm@omp1042.mail.ir2.yahoo.com Received: (qmail 45037 invoked by uid 60001); 5 Aug 2014 14:33:21 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.fr; s=s1024; t=1407249201; bh=yxYsDmwUc0Jqep7vP1e11lxWNSpzSkxissQ2gP5hCr0=; h=Message-ID:Date:From:Reply-To:Subject:To:MIME-Version:Content-Type; b=D0g9X4F4glD4aaoCNzGhS5ZPK7G1mahYJL0ipPFQknBma17TJt8jO7m4Tiq1uvIPbM64Tm12eZ2RhwjWjvYgrXl0Y/UQab33iiCoAlh31seVSbNg0cWmBYDV//tL9xrDZnXFVfO6jPvot1+n9hPe5svlHq85QSAXo6GU1ejDElg= X-YMail-OSG: YJSiZXgVM1nP.Cc10GMEpc73aHUx62IdZLz4L0vETJW4u.2 fxMBVkifRVFwQHRdygH6vL0KClZihxHkpZ_uB4oDeJes7O0_ztMNhzk1F5_b YLfjaswkRipDe4Q3NLxOEWss9PuKNDRZuFuzN_PyhiSmm02B_1RI_2HsflrC sJalHn1x.zDr3fTN0uhDvVR08hdFGYj.lJRlmgdQDV8CuDU9joMmRqiYjsA4 glNvGzLcBWukOanXkysscM3foBplgK6cIVL1lASzRMRI7LebYU_9Iu8LZU6d 6SULNtooXZ8HC5wmQVTpHxLfcU3Sf54LY_uh7nbgm3JaOP09vZXL_kESsuuj Sk.yNii3HY4iv5zQ6ygf_1S59MbhnPgnB0ejo._t9_HfK5ri1n7CdApAOqF6 1YjyjE6tOyc8xW0vU_1kC5JvWt0oIlsLbAoZbHGEZWsAyfFNgj1PNig4IdQf dLBp5YUHXYCchkeQ5APl9ozFP367Abpe1B5GM6XIuNwoA_DBI57GyCnRQaNb odoHBMH5M_lw_bMlAD85qx0p2CPA0B4RYrJalpNMmlZUy Received: from [217.108.83.254] by web171301.mail.ir2.yahoo.com via HTTP; Tue, 05 Aug 2014 15:33:21 BST X-Rocket-MIMEInfo: 002.001, SGkgYWxsLApJIHdhbnQgdG8gdXNlIHN5c2xvZy1uZyB0byBsb2cgdGhlIG1lc3NhZ2VzIGdlbmVyYXRlZCBieSBteSBhcHBsaWNhdGlvbiBpbXBsZW1lbnRlZCBpbiBDIGxhbmd1YWdlLiBJIGFkZGVkIHRoaXMgaW4gdGhlIGNvZGU6CgrCoMKgwqAgY2hhcsKgwqDCoCAqbG9nPSJydGNkIjsKwqDCoMKgIHByaW50ZigiWyVzXSBSVEMgYWRqdXN0ZW1lbnRcbiIsX19mdW5jX18pOwrCoMKgwqAgb3BlbmxvZyhsb2csIExPR19QSUQsIExPR19MT0NBTDApOwrCoMKgwqAgc3lzbG9nKExPR19ERUJVRywgIltGSUpdIFIBMAEBAQE- X-Mailer: YahooMailWebService/0.8.198.689 Message-ID: <1407249201.20340.YahooMailNeo@web171301.mail.ir2.yahoo.com> Date: Tue, 5 Aug 2014 15:33:21 +0100 From: Jean Faye To: "yocto@yoctoproject.org" MIME-Version: 1.0 Subject: How to log 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:33:28 -0000 Content-Type: multipart/alternative; boundary="862858767-245626660-1407249201=:20340" --862858767-245626660-1407249201=:20340 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 I remove the line below:=0A=0AWhy are you using the line? Is it= necessary to use it?=0A=0AConcerning log file rotation, How can we manage = it using syslog-ng? For example I want to have a destination file with a si= ze maximum =3D 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 fi= les (4 x 2Mo). How can I manage this kind of rotation?=0A=0AThanks in advan= ce.=0ABest regards,=0AIsmael Jean FAYE =0A=0A@version: 3.5=0A#=0A# Syslog-n= g configuration file, compatible with default Debian syslogd=0A# installati= on. Originally written by anonymous (I can't find his name)=0A# Revised, an= d rewrited by me (SZALAY Attila )=0A=0A# First, set some g= lobal options.=0Aoptions { chain_hostnames(off); flush_lines(0); use_dns(no= ); use_fqdn(no);=0A=A0=A0=A0 =A0 owner("root"); group("adm"); perm(0640); s= tats_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.log");=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=0Ad= estination 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_GE= N { =0A=A0=A0=A0=A0=A0=A0 =A0=A0=A0 =A0=A0=A0=A0 #facility(local0) and filt= er(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_SU { =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(loc= al0);=0A};=0A=0Afilter f_WAN { =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=0Afilter f= _CPL { =0A=A0=A0=A0=A0=A0=A0 =A0=A0=A0 =A0=A0=A0=A0 #facility(local0) and f= ilter(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=0A########################=0A# L= og paths=0A########################=0A=0A#log { source(s_mysource); filter(= f_GEN); destination(d_GEN); };=0Alog { source(s_mysource); filter(f_SU); de= stination(d_SU); };=0Alog { source(s_mysource); filter(f_WAN); destination(= d_WAN); };=0Alog { source(s_mysource); filter(f_CPL); destination(d_CPL); }= ; --862858767-245626660-1407249201=:20340 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 I remove the line below:

Why are you using the line? Is i= t necessary to use it?

C= 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?

Thanks in advance.
Best regards,
Ismael Jean FAYE <= br style=3D"" class=3D"">
@version: 3.5
#
# Syslog-ng configuration file,= compatible with default Debian syslogd
# installa= tion. Originally written by anonymous (I can't find his name)
# Revised, and rewrited by me (SZALAY Attila <sasa@debian.or= g>)

# First, set some= global options.
options { chain_hostnames(off); f= lush_lines(0); use_dns(no); use_fqdn(no);
 &n= bsp;    owner("root"); group("adm"); perm(0640); stats_freq(0);      bad_hostname("^gconfd$");= create_dirs(yes);
};

########################
# Sources
########################

source s_mysource {
    pipe("/tmp/pipe" pad_size(2048));
};

########################
# Destinations
########################

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

destination d_SU {
             &= nbsp;  file("/var/log/ldb/SUTrace.log");
};
destination d_WAN {
          = ;      file("/var/log/ldb/WANTrace.log");
};

destinatio= n d_CPL {
       &n= bsp;        file("/var/log/ldb/CPLTrace.log")= ;
};

########################
# Filters
########################

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

filter f_SU {
            = ;    #facility(local0) and filter(nom_du_composant_applicati= f);
        &nb= sp;       #facility(local0) and filter(f_debug);         &n= bsp;      facility(local0);
};=

filter f_WAN {
           &= nbsp;    #facility(local0) and filter(nom_du_composant_appli= catif);
        = ;        #facility(local0) and filter(f_debug= );
        &nbs= p;       facility(local0);
};
filter f_CPL {
  = ;              #faci= lity(local0) and filter(nom_du_composant_applicatif);
             &= nbsp;  #facility(local0) and filter(f_debug);
              =   facility(local0);
};

########################
# Log paths
########################

#log { source(s_mysource); filt= er(f_GEN); destination(d_GEN); };
log { source(s_m= ysource); filter(f_SU); destination(d_SU); };
log = { source(s_mysource); filter(f_WAN); destination(d_WAN); };
log { source(s_mysource); filter(f_CPL); desti= nation(d_CPL); };

=
--862858767-245626660-1407249201=:20340--