LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Kernel (https://www.linuxquestions.org/questions/linux-kernel-70/)
-   -   Redirecting user space console messages (https://www.linuxquestions.org/questions/linux-kernel-70/redirecting-user-space-console-messages-4175451813/)

vinodkd 02-26-2013 03:57 PM

Redirecting user space console messages
 
Hi,

I'm working on a third party provided embedded hardware(mips). It has a preloaded linux kernel and CFE boot loader.
My program needs to collect the console/stdout messages from all the running programs and send to a server. (Somewhat similar to netconsole - but netconsole collects only kernel messages.)
Linux bootup options "console=<device>" will help us to add one more console device. But I don't have flexibility to change CFE or rebuild kernel with my own driver.
Fortunately, this linux build supports loadable modules. Can I redirect the console output to a loadable module? If so, what are the steps to do it?
(My idea is to create a tty-console like device, which loops back the messages to userspace.)

PS: Pls let me know, if the system-wide "stdout" redirection is possible by a user land process - that is my first preference.

Thanks in advance.
Vinod

aaazen 03-04-2013 11:29 PM

If your system has the syslogd daemon running then you might look at that:

$man 8 syslogd

User programs can write to the system log files by using the logger command from a script:

$man 1 logger

or from calling the syslog function from a program:

$man 3 syslog


All times are GMT -5. The time now is 04:52 PM.