Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #31442

Re: Is there a way to create kernel log messages via Python?

From Andrew Cooper <andrew@nospam.example.com>
Newsgroups comp.lang.python
Subject Re: Is there a way to create kernel log messages via Python?
References <mailman.2248.1350359007.27098.python-list@python.org>
Message-ID <SNnfs.353989$512.310988@fx28.am4> (permalink)
Organization virginmedia.com
Date 2012-10-17 02:25 +0100

Show all headers | View raw


On 16/10/2012 04:43, J wrote:
> Hi...
> 
<snip>
> 
> So, what I REALLY want is to inject my start/stop markers into klogd
> rather than syslogd.  This will, I hope, give my markers kernel
> timestamps rather than syslog timestamps which are not as accurate.
> 
> So does anyone know of a way to do this?  Unfortunately, I've tried
> some searching but google doesn't like the term klog, and most of the
> hits involved injecting code or other things that are not related at
> all.
> 
> Or, if there's a better way to get accurate timestamps, what would that be?
> 

It is very easy (about 40 lines of C) to write a kernel module which
opens up an easy interface to use.

I wrote a kernel module (unimaginatively called uklog, for user-klog)
which exports /proc/printk/{alert thru debug}.  With this in place, any
(root, although this can be changed) userspace process can issue
messages into the kernel by opening the relevant file and writing to it.

Sadly, this is not useful on any system which is not your own, and is
also unlikely to be accepted upstream (although it is fantastically
useful for micro-vms with no root filesystems, where the kernel log is
the only form of logging, and the serial console is the only useful
method of communication.)

~Andrew

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Is there a way to create kernel log messages via Python? J <dreadpiratejeff@gmail.com> - 2012-10-15 23:43 -0400
  Re: Is there a way to create kernel log messages via Python? Marco Nawijn <nawijn@gmail.com> - 2012-10-16 03:26 -0700
  Re: Is there a way to create kernel log messages via Python? Marco Nawijn <nawijn@gmail.com> - 2012-10-16 03:26 -0700
  Re: Is there a way to create kernel log messages via Python? Jerry Peters <jerry@example.invalid> - 2012-10-16 20:19 +0000
  Re: Is there a way to create kernel log messages via Python? Andrew Cooper <andrew@nospam.example.com> - 2012-10-17 02:25 +0100

csiph-web