writing to syslog file - Linux

This is a discussion on writing to syslog file - Linux ; Hi all, I'm using Linux Kernel 2.6.17.6 and I need to write some specific messages into syslog file. I'm using the syslog command: syslog(LOG_INFO, "message"); After recompiling the kernel, I can not get any message in the syslog file. Am ...

+ Reply to Thread
Results 1 to 5 of 5

Thread: writing to syslog file

  1. writing to syslog file

    Hi all,

    I'm using Linux Kernel 2.6.17.6 and I need to write some specific
    messages into syslog file. I'm using the syslog command:
    syslog(LOG_INFO, "message");

    After recompiling the kernel, I can not get any message in the syslog
    file. Am I missing anything ? also, do I need to define the LOG_INFO
    within the code and how?

    Actually, I need to repeat this message several times within the same
    kernel file (tcp_input.c).
    Please advice, I really need help as soon as possible.

    Thanks for your help,
    Alaa


  2. Re: writing to syslog file


    Alaa wrote:
    > Hi all,
    >
    > I'm using Linux Kernel 2.6.17.6 and I need to write some specific
    > messages into syslog file. I'm using the syslog command:
    > syslog(LOG_INFO, "message");
    >
    > After recompiling the kernel, I can not get any message in the syslog
    > file. Am I missing anything ? also, do I need to define the LOG_INFO
    > within the code and how?

    why don't u use "printk"?
    Have you seen the level of kernel log messages in in /etc/sylog.conf
    file.
    google to know more about that file.
    >
    > Actually, I need to repeat this message several times within the same
    > kernel file (tcp_input.c).
    > Please advice, I really need help as soon as possible.
    >
    > Thanks for your help,
    > Alaa



  3. Re: writing to syslog file

    I'm trying to use "printk".........
    wish me luck, and thanks for the advice.

    Alaa


    Milind Dumbare a écrit :

    > Alaa wrote:
    > > Hi all,
    > >
    > > I'm using Linux Kernel 2.6.17.6 and I need to write some specific
    > > messages into syslog file. I'm using the syslog command:
    > > syslog(LOG_INFO, "message");
    > >
    > > After recompiling the kernel, I can not get any message in the syslog
    > > file. Am I missing anything ? also, do I need to define the LOG_INFO
    > > within the code and how?

    > why don't u use "printk"?
    > Have you seen the level of kernel log messages in in /etc/sylog.conf
    > file.
    > google to know more about that file.
    > >
    > > Actually, I need to repeat this message several times within the same
    > > kernel file (tcp_input.c).
    > > Please advice, I really need help as soon as possible.
    > >
    > > Thanks for your help,
    > > Alaa



  4. Re: writing to syslog file

    I used :
    "printk(KERN_INFO "message"\n);
    within tcp_input.c file, and did recompile using "make bzImage". The
    system recompiled without any errors. But I can not see any message
    (those I inserted in the file).

    Any advise please,
    Thanks a lot,

    Alaa


    Milind Dumbare a écrit :

    > Alaa wrote:
    > > Hi all,
    > >
    > > I'm using Linux Kernel 2.6.17.6 and I need to write some specific
    > > messages into syslog file. I'm using the syslog command:
    > > syslog(LOG_INFO, "message");
    > >
    > > After recompiling the kernel, I can not get any message in the syslog
    > > file. Am I missing anything ? also, do I need to define the LOG_INFO
    > > within the code and how?

    > why don't u use "printk"?
    > Have you seen the level of kernel log messages in in /etc/sylog.conf
    > file.
    > google to know more about that file.
    > >
    > > Actually, I need to repeat this message several times within the same
    > > kernel file (tcp_input.c).
    > > Please advice, I really need help as soon as possible.
    > >
    > > Thanks for your help,
    > > Alaa



  5. Re: writing to syslog file

    Alaa wrote:
    > I used :
    > "printk(KERN_INFO "message"\n);
    > within tcp_input.c file, and did recompile using "make bzImage". The
    > system recompiled without any errors. But I can not see any message
    > (those I inserted in the file).


    Couple things to try:

    First, this command: "echo 8 >/proc/sys/kernel/printk" should make
    *all* subsequent printk output show up on the console whether it goes
    to syslog or not.

    Second, check /etc/syslog.conf to see how the syslog subsystem is
    configured. Read the syslog.conf manual page to find out how to
    interpret/modify the file contents. Also make sure that the syslogd
    and klogd daemons are actually running (klogd actually collect the
    printk output from the kernel). Read their manual pages as needed too.

    GH


+ Reply to Thread