Please clean up log files on lxc delete

Bug #1576063 reported by Martin Pitt
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
lxd (Ubuntu)
Fix Released
Medium
Unassigned

Bug Description

It seems "lxc delete" does not remove log files in /var/log/lxd, so there's nothing that cleans them up and they pile up over time. I have no lxd containers defined on my laptop at the moment, but

$ ls /var/log/lxd/|wc -l
286

ProblemType: Bug
DistroRelease: Ubuntu 16.04
Package: lxd 2.0.0-0ubuntu4
ProcVersionSignature: Ubuntu 4.4.0-22.38-generic 4.4.8
Uname: Linux 4.4.0-22-generic x86_64
ApportVersion: 2.20.1-0ubuntu2
Architecture: amd64
CurrentDesktop: i3
Date: Thu Apr 28 09:20:17 2016
EcryptfsInUse: Yes
SourcePackage: lxd
UpgradeStatus: No upgrade log present (probably fresh install)

Revision history for this message
Martin Pitt (pitti) wrote :
Revision history for this message
Tycho Andersen (tycho-s) wrote : Re: [Bug 1576063] [NEW] Please clean up log files on lxc delete

On Thu, Apr 28, 2016 at 07:24:23AM -0000, Martin Pitt wrote:
> Public bug reported:
>
> It seems "lxc delete" does not remove log files in /var/log/lxd, so
> there's nothing that cleans them up and they pile up over time. I have
> no lxd containers defined on my laptop at the moment, but

In some cases it is useful to keep these around for debugging. I
wouldn't mind something that deleted day old logs for containers that
don't exist, though.

> $ ls /var/log/lxd/|wc -l
> 286
>
> ProblemType: Bug
> DistroRelease: Ubuntu 16.04
> Package: lxd 2.0.0-0ubuntu4
> ProcVersionSignature: Ubuntu 4.4.0-22.38-generic 4.4.8
> Uname: Linux 4.4.0-22-generic x86_64
> ApportVersion: 2.20.1-0ubuntu2
> Architecture: amd64
> CurrentDesktop: i3
> Date: Thu Apr 28 09:20:17 2016
> EcryptfsInUse: Yes
> SourcePackage: lxd
> UpgradeStatus: No upgrade log present (probably fresh install)
>
> ** Affects: lxd (Ubuntu)
> Importance: Undecided
> Status: New
>
>
> ** Tags: amd64 apport-bug xenial
>
> --
> You received this bug notification because you are a member of Ubuntu
> containers team, which is subscribed to lxd in Ubuntu.
> Matching subscriptions: lxd
> https://bugs.launchpad.net/bugs/1576063
>
> Title:
> Please clean up log files on lxc delete
>
> Status in lxd package in Ubuntu:
> New
>
> Bug description:
> It seems "lxc delete" does not remove log files in /var/log/lxd, so
> there's nothing that cleans them up and they pile up over time. I have
> no lxd containers defined on my laptop at the moment, but
>
> $ ls /var/log/lxd/|wc -l
> 286
>
> ProblemType: Bug
> DistroRelease: Ubuntu 16.04
> Package: lxd 2.0.0-0ubuntu4
> ProcVersionSignature: Ubuntu 4.4.0-22.38-generic 4.4.8
> Uname: Linux 4.4.0-22-generic x86_64
> ApportVersion: 2.20.1-0ubuntu2
> Architecture: amd64
> CurrentDesktop: i3
> Date: Thu Apr 28 09:20:17 2016
> EcryptfsInUse: Yes
> SourcePackage: lxd
> UpgradeStatus: No upgrade log present (probably fresh install)
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/ubuntu/+source/lxd/+bug/1576063/+subscriptions

Revision history for this message
Martin Pitt (pitti) wrote :

So maybe lxd could clean up logs for nonexisting containers that are older than a few days at startup then?

Revision history for this message
Martin Pitt (pitti) wrote :

Alternatively lxd could also just log to syslog (i. e. the journal), then you'd have builtin rotation (using the container name as syslog identifier, so that it's easy to filter for it).

Revision history for this message
Stéphane Graber (stgraber) wrote :

Yeah, I think we should:
 - Wipe the log dir of containers that are more than a day old at startup and once a day (for when the daemon is long running)
 - Rotate lxc.log at every container start (startCommon)
 - Expire all log files (so everything but lxc.conf) after 2 days (same at startup + background job)

That should keep our log file situation under control.

Revision history for this message
Stéphane Graber (stgraber) wrote :

LXD itself doesn't log in /var/log/lxd, it's all the stuff we call which does, so patching everything to log to syslog isn't really an option.

Revision history for this message
Stéphane Graber (stgraber) wrote :
Changed in lxd (Ubuntu):
status: New → Triaged
Changed in lxd (Ubuntu):
importance: Undecided → Medium
Changed in lxd (Ubuntu):
status: Triaged → Fix Committed
Changed in lxd (Ubuntu):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.