Sometimes when deploying a service (and more specifically a new unit) for a Juju charm, an error occurs and there seems to be no way of finding out exactly what it was.

Is there some sort of output log of all commands the unit ran?

3 Answers

It appears that each unit stores a log of the commands run in /var/log/juju/unit/unit-service_name-service_number.log. You can access it by taking advantage of Juju's ssh command like so:

juju ssh service_name/service_number

This will drop you into a shell for that unit. You can then use a text editor or even just cat | less to read the log.

you can use juju debug-log to get a distributed log of all operations by all agents. It allows suppressing things by log level, so give juju debug-log -h a read. It does miss a few things, but for the most part it should give you what you are looking for.

The following command shows all the logs from the beginning of time. So it will also show the logs from before you started juju debug-log

juju debug-log --replay 
7

You can find the complete log inside the data-dir set in your environments.yaml file.

Open it with gksudo <path_to_data-dir>, navigate thru the folders to your units folder, open the service folder you want to have a look at and look at the unit.log file.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy