juju debug-log

See also: status, ssh

Summary

Displays log messages for a model.

Options

Flag

Default

Usage

-B, --no-browser-login

false

Do not use web browser for authentication

--color

false

Force use of ANSI color codes

--controller

A specific controller from which to display logs, or ‘all’ for interleaved logs from all controllers.

--date

false

Show dates as well as times

--exclude-labels

Do not show log messages for these logging label key values

--exclude-module

Do not show log messages for these logging modules

--firehose

false

Show logs from all models

--format

text

Specify output format (json|text)

-i, --include

Only show log messages for these entities

--include-labels

Only show log messages for these logging label key values

--include-module

Only show log messages for these logging modules

-l, --level

Log level to show, one of [TRACE, DEBUG, INFO, WARNING, ERROR]

--limit

0

Exit once this many of the most recent (possibly filtered) lines are shown

--location

false

Show filename and line numbers

-m, --model

Model to operate in. Accepts [<controller name>:]<model name>|<model UUID>

--ms

false

Show times to millisecond precision

-n, --lines

10

Show this many of the most recent (possibly filtered) lines, and continue to append

--no-tail

false

Stop after returning existing log messages

-o, --output

Specify an output file

--replay

false

Show the entire (possibly filtered) log and continue to append

--retry

false

Retry connection on failure

--retry-delay

1s

Retry delay between connection failure retries

--tail

false

Wait for new logs

--utc

false

Show times in UTC

-x, --exclude

Do not show log messages for these entities

Examples

Exclude all machine 0 messages; show a maximum of 100 lines; and continue to append filtered messages:

juju debug-log --exclude machine-0 --lines 100

Include only messages from the mysql/0 unit; show a maximum of 50 lines; and then exit:

juju debug-log --include mysql/0 --limit 50

Show all messages from the apache/2 unit or machine 1 and then exit:

juju debug-log --replay --include apache/2 --include machine-1 --no-tail

Show all juju.worker.uniter logging module messages that are also unit wordpress/0 messages, and then show any new log messages which match the filter and append:

juju debug-log --replay
    --include-module juju.worker.uniter \
    --include wordpress/0

Show all messages from the juju.worker.uniter module, except those sent from machine-3 or machine-4, and then stop:

juju debug-log --replay --no-tail
    --include-module juju.worker.uniter \
    --exclude machine-3 \
    --exclude machine-4

To see all WARNING and ERROR messages and then continue showing any new WARNING and ERROR messages as they are logged:

juju debug-log --replay --level WARNING

To see logs from all models hosted on the controller, use the –firehose option.

juju debug-log --firehose

In the HA case, debug-log can be configured to stream messages from a selected controller. Use juju show-controller to see the available controller numbers.

juju debug-log --controller 2

You can also stream messages from all controllers - a best effort will be made to correctly interleave them so they are ordered by timestamp.

juju debug-log --controller all

Details

This command provides access to all logged Juju activity on a per-model basis. By default, the logs for the currently select model are shown.

Each log line is emitted in this format:

<entity> <timestamp> <log-level> <module>:<line-no> <message>

The “entity” is the source of the message: a machine or unit. The names for machines and units can be seen in the output of juju status.

The ‘–include’ and ‘–exclude’ options filter by entity. The entity can be a machine, unit, or application for vm models, but can be application only for k8s models. These filters support wildcards * if filtering on the entity full name (prefixed by <entity type>-)

The ‘–include-module’ and ‘–exclude-module’ options filter by (dotted) logging module name. The module name can be truncated such that all loggers with the prefix will match.

The ‘–include-labels’ and ‘–exclude-labels’ options filter by logging labels.

The filtering options combine as follows:

  • All –include options are logically ORed together.

  • All –exclude options are logically ORed together.

  • All –include-module options are logically ORed together.

  • All –exclude-module options are logically ORed together.

  • All –include-labels options are logically ORed together.

  • All –exclude-labels options are logically ORed together.

  • The combined –include, –exclude, –include-module, –exclude-module, –include-labels and –exclude-labels selections are logically ANDed to form the complete filter.