[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [Libguestfs] Script to read systemd journal of a guest to find its IP address



On Sat, Jun 14, 2014 at 02:25:59PM +0100, Richard W.M. Jones wrote:
> 
> I've pushed a new tool called "virt-log" upstream, so you can now
> just do:
> 
>   virt-log -d Guest
> 
> or:
> 
>   virt-log -a disk.img

Sweet!

Just tested it (after building from git) on a Fedora 20 disk image which
has systemd journal:

    $ git log | head -1
    fb546eaee064b14ad192a4f0390325ba1b4c766a

    $ sudo ./run ./cat/virt-log -a \
      /var/lib/libvirt/images/ostack-controller.qcow2 \
      | grep "dhclient.*bound"
     Jun 10 17:08:30 dhclient[971] info: bound to 192.162.122.118 --
     renewal in 1722 seconds.
     .
     .

> It will automatically fetch the journal or traditional syslog file as
> appropriate, and we can add Windows support in future.
> 
> Unfortunately the journal_* API calls are rather slow because they
> have to fetch each single line from the journal.  So there's some work
> to be done to make that fast.
 
Out of curiosity, I just ran the same above invocation w/ `time`. For 5
occurances, it took about 1m13sec. But this was already 2nd invocation
(so applinace caching may have kicked in?):

    $ time sudo ./run ./cat/virt-log -a \
      /var/lib/libvirt/images/ostack-controller.qcow2 \
      | grep "dhclient.*bound"
    Jun 10 17:08:30 dhclient[971] info: bound to 192.162.122.118 -- renewal in 1722 seconds.
    Jun 10 18:00:48 dhclient[968] info: bound to 192.162.122.118 -- renewal in 1429 seconds.
    Jun 10 18:18:32 dhclient[970] info: bound to 192.169.142.118 -- renewal in 1391 seconds.
    Jun 10 18:41:43 dhclient[970] info: bound to 192.169.142.118 -- renewal in 1262 seconds.
    Jun 10 19:02:46 dhclient[970] info: bound to 192.169.142.118 -- renewal in 1567 seconds.
    ^C
    
    real    1m13.594s
    user    0m8.272s
    sys 0m42.631s

-- 
/kashyap


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]