Bug 1361378

Summary: [RFE] improve risk/message logging format
Product: Red Hat Enterprise Linux 6 Reporter: Alois Mahdal <amahdal>
Component: preupgrade-assistantAssignee: Petr Hracek <phracek>
Status: CLOSED ERRATA QA Contact: Alois Mahdal <amahdal>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.8CC: amahdal, fkluknav, jmazanek, phracek, pstodulk
Target Milestone: rcKeywords: Extras, FutureFeature, Patch
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: preupgrade-assistant-2.1.9-1.el6 Doc Type: Enhancement
Doc Text:
The text is taken from description which describe it. Proposal ======== For logging risks, use format: preupg.risk.MEDIUM: some risky risk For other properly logged messages, use: preupg.log.INFO: some_component: I just want to let you know This way, all properly logged messages and risks can be easily separated from leaks or errors thrown for various reasons.
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-11-04 08:57:54 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1335121    

Description Alois Mahdal 2016-07-29 01:23:39 UTC
Description of problem
======================

Currently there are two issues with logging from modules:

 *  Risks use prefix "INPLACERISK:" that is not suitable for migration
    scenarios.

 *  Other log messages use format that is hard to filter out.

Together with bug 1309491 (openscap merges stderr to stdout), this makes
it hard to catch situations when scripts leak some info outside intended.

For example, "leaking" grep as in bug 1356811, sntax errors or errors
thrown by external utilities called by modules are all problems
that could be easily checked by tests *if* the formatting was more
filtering-friendly.


Proposal
========

For logging risks, use format:

    preupg.risk.MEDIUM: some risky risk

For other properly logged messages, use:

    preupg.log.INFO: some_component: I just want to let you know

This way, all properly logged messages and risks can be easily separated
from leaks or errors thrown for various reasons.

(I'm planning to add this to preupg wrapper in our Beakerlib testing library
so these problems will be much more easy to spot.)

Comment 1 Alois Mahdal 2016-07-29 01:31:54 UTC
aaand... pull request (not tested!):

https://github.com/upgrades-migrations/preupgrade-assistant/pull/122

Comment 3 Petr Hracek 2016-08-15 10:03:36 UTC
Yeah, it can be added into this release path. 

Can we remove 'preupg.' before logs. I don't thing it is really needed.

Comment 4 Alois Mahdal 2016-08-15 10:33:51 UTC
(In reply to Petr Hracek from comment #3)
> Yeah, it can be added into this release path. 
> 
> Can we remove 'preupg.' before logs. I don't thing it is really needed.

The reason why there's ^preupg. is that it reliably distinguishes messages from modules from amy other possible messages dropped by any tools/scripts called from that.

Which was kinda the main point of this RFE (second bulltet point in comment 0).

Comment 5 Alois Mahdal 2016-08-15 10:33:52 UTC
(In reply to Petr Hracek from comment #3)
> Yeah, it can be added into this release path. 
> 
> Can we remove 'preupg.' before logs. I don't thing it is really needed.

The reason why there's ^preupg. is that it reliably distinguishes messages from modules from amy other possible messages dropped by any tools/scripts called from that.

Which was kinda the main point of this RFE (second bulltet point in comment 0).

Comment 6 Petr Hracek 2016-08-15 12:25:29 UTC
Well, after a discussion I will implemented in the next release cycle.
I have a lot of other issues which are urgent from preupgrade-assistant point of view.

Comment 7 Alois Mahdal 2016-08-30 19:39:23 UTC
(In reply to Petr Hracek from comment #6)
> Well, after a discussion I will implemented in the next release cycle.
> I have a lot of other issues which are urgent from preupgrade-assistant
> point of view.

Finally this has been included in last build (2.1.9-1.el6) anyway.  We have coverage for it.  It works fine.

I think universe is trying to tell us something.

(Granting qa_ack).

Comment 10 Alois Mahdal 2016-09-12 13:30:58 UTC
Test library has been updated to parse errors and risks based on the new format.  That code is used extensively, and we also have tests for Bash logging API.

IOW, the fact that almost all tests are not failing right now is proof that this has been implemented correctly.

Comment 12 errata-xmlrpc 2016-11-04 08:57:54 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2016-2616.html