Bug 47327

Summary: Use a standard JSON format for structured logging
Product: UCS Reporter: Arvid Requate <requate>
Component: univention-libAssignee: UCS maintainers <ucs-maintainers>
Status: RESOLVED WONTFIX QA Contact: UCS maintainers <ucs-maintainers>
Severity: normal    
Priority: P5 CC: ahlers, best, damrose
Version: UCS 4.3   
Target Milestone: ---   
Hardware: Other   
OS: Linux   
See Also: http://forge.univention.org/bugzilla/show_bug.cgi?id=42366
What kind of report is it?: Feature Request What type of bug is this?: ---
Who will be affected by this bug?: --- How will those affected feel about the bug?: ---
User Pain: Enterprise Customer affected?:
School Customer affected?: ISV affected?:
Waiting Support: Flags outvoted (downgraded) after PO Review:
Ticket number: Bug group (optional):
Max CVSS v3 score:

Description Arvid Requate univentionstaff 2018-07-09 17:41:27 CEST
We use several free style formats for logging internally, for example univention-join outputs a single line prefixed with "* Message", but the joinscripts output messages with a "__JOINERR__:" prefix. It would be good to define and use a standard format for structured logging. I would suggest a JSON format because it lends itself to serialization to/from text format. Something like this:


{ "Message-Type": "Setup Error", "Source": $joinscript, "Headline": "Join failed", "Details": "Long\nStuff", "Returncode": 1, "Timestap": $timestamp}


Maybe it would be useful to use (or allow) a modified form of JSON here, using single quotes, to make life simpler for sending this from Shell:

echo "{'Message-Type': 'Setup Error', 'Source': '$0', 'Timestamp': '$(date)'}"

This can easily be transformed into standard JSON in Python for post processing.
Comment 1 Erik Damrose univentionstaff 2018-07-09 17:48:25 CEST
I would like to read log messages that i can parse easily, if i have to access logfiles. The proposed format is not easily readable in my opinion.

Maybe we could adapt the logging to write additional log entries, into different logfiles, that are easily parseable by programs.
Comment 2 Florian Best univentionstaff 2019-03-15 22:28:18 CET
The __JOINERR__/etc. exists for filling the progressbar content.
So yes, I would also like to have additional log files for the progress bars.
Comment 3 Ingo Steuwer univentionstaff 2021-05-14 15:42:30 CEST
This issue has been filed against UCS 4.3.

UCS 4.3 is out of maintenance and many UCS components have changed in later releases. Thus, this issue is now being closed.

If this issue still occurs in newer UCS versions, please use "Clone this bug" or reopen it and update the UCS version. In this case please provide detailed information on how this issue is affecting you.