Skip to content

cloud-init analyze fails to produce useful output on Amazon Linux 2 due to log format configuration #3668

@ubuntu-server-builder

Description

@ubuntu-server-builder

This bug was originally filed in Launchpad as LP: #1876323

Launchpad details
affected_projects = []
assignee = oddbloke
assignee_name = Dan Watkins
date_closed = 2020-08-25T19:31:21.919428+00:00
date_created = 2020-05-01T14:59:47.385669+00:00
date_fix_committed = 2020-05-06T17:18:11.451975+00:00
date_fix_released = 2020-08-25T19:31:21.919428+00:00
id = 1876323
importance = high
is_complete = True
lp_url = https://bugs.launchpad.net/cloud-init/+bug/1876323
milestone = None
owner = oddbloke
owner_name = Dan Watkins
private = False
status = fix_released
submitter = oddbloke
submitter_name = Dan Watkins
tags = []
duplicates = []

Launchpad user Dan Watkins(oddbloke) wrote on 2020-05-01T14:59:47.385669+00:00

When running cloud-init analyze show against a log file from an Amazon Linux 2 instance (e.g. https://pastebin.com/uhJNysgm), no useful output is produced:

$ cloud-init analyze show -i ~/Downloads/uhJNysgm.txt
-- Boot Record 01 --
The total time elapsed since completing an event is printed after the "@" character.
The time the event takes is printed after the "+" character.

Total Time: 0.00000 seconds

1 boot records analyzed

This is because the log configuration on Amazon Linux 2 (https://pastebin.com/x6NZ4NFJ) configures this for arg0Formatter:

format=%(asctime)s cloud-init[%(process)d]: %(filename)s[%(levelname)s]: %(message)s

which differs from the upstream definition:

format=%(asctime)s - %(filename)s[%(levelname)s]: %(message)s

This is a problem, because the cloud-init analyze commands depend on the " - " part of the line's presence as a separator (see https://github.com/canonical/cloud-init/blob/master/cloudinit/analyze/dump.py#L78), so when we run analyze against an Amazon Linux 2 log file, we incorrectly fail to identify any of the lines in it as being cloud-init log lines.

(As an aside, this is the only non-whitespace difference between the two configuration files.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions