[Lxc-users] Piping output of lxc-monitor to a file without buffering

Ken Elkabany Ken at Elkabany.com
Sat Sep 8 00:25:21 UTC 2012


On Thu, Sep 6, 2012 at 11:13 PM, Fajar A. Nugraha <list at fajar.net> wrote:

> On Fri, Sep 7, 2012 at 7:46 AM, Ken Elkabany <Ken at elkabany.com> wrote:
> > Hi,
> >
> > The following outputs container state changes to the terminal as
> expected:
> >
> > $ lxc-monitor -n container-1
> >
> > However, the following outputs the same state changes to a file only
> after a
> > certain buffer size has been reached:
> >
> > $ lxc-monitor -n container-1 &> output
> >
> > This is problematic because it means that live monitoring cannot be done
> by
> > a separate program. The buffering delays messages, potentially
> indefinitely.
> >
> > Is there a way around this?
>
> (optional: start a screen session)
> $ script -f /path/to/your-logfile.txt
> $ lxc-monitor -n container-1
>
> ... and on other terminal
> $ tail -f /path/to/your-logfile.txt
>
> --
> Fajar
>

Unfortunately, in my application there won't be any open terminals. I
simply used that as an example to illustrate my point.

Ken
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linuxcontainers.org/pipermail/lxc-users/attachments/20120907/89fd0aa1/attachment.html>


More information about the lxc-users mailing list