Search code examples
linuxloggingcontainerslxclxd

Dump file outside the lxc container


I am able to view syslog of my lxc container, from outside the container... by;

sudo lxc exec my-abc-container -- /root/tail  /usr/local/var/syslog

or either by tailing it

sudo lxc exec my-abc-container -- /root/tail --follow=name /usr/local/var/syslog

But I have no clue on how to dump this log in a file. Tired of finding similar question but nothing helped.


Solution

  • By using file pull

    lxc file pull my-abc-container/usr/local/var/syslog ./my-abc-container-syslog
    

    Or by exec

    lxc exec my-abc-container -- /bin/sh -c "cat /usr/local/var/syslog" > ./my-abc-container-syslog