how can I redirect the messages sent from kernel to a user app's stdin?
Hi,
I have an application that prints to a log what it gets from its stdin. I would like this application to also print to log messages the kernel creates(I.e. the same messages displayed by dmesg app). How can I do it? In other words, can I redirect the kernel messages (I.e. sent using printk) to an application's stdin pipe? Thanks! Hadar |
rsyslog supports "named pipes" and "shell execute" actions, may one of these would suit. See 'man rsyslog.conf'
|
Thanks. I already found a different solution. I sent /proc/kmsg and other applications' stdout to a fifo, and use this fifo as an input file to my application.
Something like this: mkfifo /tmp/misfifo; cat /proc/kmsg > /tmp/misfifo & ... # Send other appluications logs to myfifo. E.g. ./CoolApp > /tmp/misfifo & ./MyApp < /tmp/misfifo # Use misfifo as an input file to my application It works. Thanks again! Hadar |
Cool, but doing "cat /proc/kmsg > /tmp/misfifo" is a manual process as opposed to redirecting automatically via rsyslog
kernel -> rsyslog -> named pipe/fifo -> your app |
All times are GMT -5. The time now is 02:10 PM. |