8

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 3

6

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.

3

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
  • But does this answer the question? I need the output of the commands after they are executed. Nov 21, 2011 at 23:24
  • That is exactly what the debug-log provides.. output of all commands executed by all agents (hooks, API calls, everything). Charms can also control what log level their output is produced at by using 'juju-log'.
    – SpamapS
    Nov 22, 2011 at 0:01
  • But does this return the output of commands that have run before I call juju debug-log? Nov 22, 2011 at 0:09
  • No, debug-log informs the agents that they need to start sending their logs. If you want to see the logs of agent activities past you must login to each unit and inspect the logs in /var/log/juju and /var/lib/juju
    – SpamapS
    Nov 22, 2011 at 0:49
  • Yes, that was the question I asked and the answer below contains that information. Nov 22, 2011 at 0:54
1

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .