Skip to content

Logs

Helper methods for container logs.

List

Returns a list of the log files available for this container.

Note: This works on containers that have been deleted (or were never created) to enable you to get logs for failed creations.

Parameters & Call

Parameter Type Description Default
remote string LXD remote local
container string Container name
mutator function Mutation function
$client->lxd->containers->logs->list('local', 'my-container');

Response

[
    "/1.0/containers/my-container/logs/forkstart.log",
    "/1.0/containers/my-container/logs/lxc.conf",
    "/1.0/containers/my-container/logs/lxc.log"
]

Get

Returns the contents of a particular log file.

Note: This method ONLY works with LXD > 3.0.0

Parameters & Call

Parameter Type Description Default
remote string LXD remote local
container string Container name
logfile string Container logfile
mutator function Mutation function
$client->lxd->containers->logs->get('local', 'my-container', 'lxc.conf');

Response

The log file contents

Delete

Delete a particular log file.

Parameters & Call

Parameter Type Description Default
remote string LXD remote local
container string Container name
logfile string Container logfile
mutator function Mutation function
$client->lxd->containers->logs->remove('local', 'my-container', 'lxc.conf');

Response

""

Comments