blob: 1ec3df7816d16a19366a6767f35158ee38ac372e [file] [log] [blame]
liangke6cb3c152018-01-29 16:25:08 +08001..
2 This work is licensed under a Creative Commons Attribution 4.0
3 International License.
4
5=================
6Multi-Vim logging
7=================
8
Ethan Lynnb3e79cc2018-06-05 17:26:55 +08009The purpose of logging is to generate machine-readable, indexable output logs
10and support to trace
11requests through sub-component, it need to ship logs to logging enhancement
12project a centralized
liangke6cb3c152018-01-29 16:25:08 +080013logging analysis system capturing diagnostic information.
14
15
16
17Problem Description
18===================
19
Ethan Lynnb3e79cc2018-06-05 17:26:55 +080020So far the logging of multi-vim is not able to support customer configuration,
21handler context specific logging like
22MDC[MDC_Document]_, also it dose't propagate transaction-ID in REST headers
23which is critical to tracing request.
24There are 4 python containers in oom project need to configure filebeat
25container for shipping logs.
liangke6cb3c152018-01-29 16:25:08 +080026
27.. [MDC_Document] https://wiki.onap.org/display/DW/ONAP+Application+Logging+Guidelines+v1.1#ONAPApplicationLoggingGuidelinesv1.1-MDCs
28
Ethan Lynnb3e79cc2018-06-05 17:26:55 +080029In addition the current logging is very difficult to understand behavior
30and performance.
liangke6cb3c152018-01-29 16:25:08 +080031
32
33Proposed Change
34===============
35
36The proposed change will include three parts.
37
38Filebeat container
39------------------
40
Ethan Lynnb3e79cc2018-06-05 17:26:55 +080041Logging architecture[Log_Architecture]_ use Filebeat collects logs from
42multi-vim containers and ships them to the
43centralized logging stack. To enable this feature it need to add Filebeat
44container in multi-vim pod that was
liangke6cb3c152018-01-29 16:25:08 +080045deployed by OOM, as well Yaml file will be used to configure Filebeat.
46
47.. [Log_Architecture] https://wiki.onap.org/display/DW/Logging+Architecture
48
49Tracing ID
50----------
51
Ethan Lynnb3e79cc2018-06-05 17:26:55 +080052ONAP logging uses a global unique "RequestID"[RequestID_Document]_ in logging
53to track the processing of each request
54across all the components, multi-vim will receive this id from http header
55by vary "X-TransactionID", then record it
liangke6cb3c152018-01-29 16:25:08 +080056in logs.
Ethan Lynnb3e79cc2018-06-05 17:26:55 +080057Meanwhile single component should generate a InvocationID that records the
58relationship between RequestID
59and InvocationID for proper tracing. So Mulit-vim will set unique InvocationID
60for each single request,also output it in logs.
liangke6cb3c152018-01-29 16:25:08 +080061
62.. [RequestID_Document] https://wiki.onap.org/pages/viewpage.action?pageId=20087036#ONAPApplicationLoggingGuidelinesv1.2(Beijing)-MDC-RequestID
63
64
65python AOP logging library
66--------------------------
67
Ethan Lynnb3e79cc2018-06-05 17:26:55 +080068Currently logging enhancement project just has java AOP logging library, For
69multi-vim which based on python need
70a python version. The basic feature of AOP logging library could provide
71customer configuration include retention
72policy、output location、text output format、message level and so on, support
73MDC context specific logging, able to
liangke6cb3c152018-01-29 16:25:08 +080074change configuration at runtime, and make logging quite fast.
75
liangkec0686782018-08-19 11:29:08 +080076Supporting Python3 version
77-------------------------
78Right now, this library only has be used in Python2 version. Python2 will not been
79maintained after 2020, besides part of ONAP project have used python3 version.
80It's be better to support Python2 and Python3 version
liangke6cb3c152018-01-29 16:25:08 +080081
82
liangkec0686782018-08-19 11:29:08 +080083Markers
84-------
85Markers can be used to characterize log entries. They allow message that has
86a specific meaning to be cheaply and easily identified in logger output, without
87inherently unreliable schemes like scanning for magic strings in the text of each
88log message.
89Onap logging requires the emission of markers reporting entry, exit and invocation
90as the execution if requests pass between ONAP components. This information is used
91to generate a call graph.
92Useful and commonplace, See https://stackoverflow.com/questions/4165558/best-practices-for-using-markers-in-slf4j-logback
liangke6cb3c152018-01-29 16:25:08 +080093
94
liangkec0686782018-08-19 11:29:08 +080095colored terminal output
96-----------------------
97As we known, in log4j coloring is supported. It would be better to render logging messages in colors.
98Bash colors refer: https://en.wikipedia.org/wiki/ANSI_escape_code#Colors
99
100The standard colors(nosupport windows) list as below:
101+---------------------+-------------------------+------------------------+
102| **Text color** | **Hightlight color** | **Text Attribute** |
103+=====================+==================================================+
104| Black | Black | Normal |
105+---------------------+--------------------------------------------------+
106| Red | Red | Bold |
107+---------------------+--------------------------------------------------+
108| Green | Green | Underline |
109+---------------------+--------------------------------------------------+
110| Yellow | Yellow | Blink |
111+------------------------------------------------------------------------+
112| Blue | Blue | Invert |
113+------------------------------------------------------------------------+
114| Purple | Purple | Hide |
115+------------------------------------------------------------------------+
116| Cyan | Cyan | |
117+------------------------------------------------------------------------+
118| White | White | |
119+------------------------------------------------------------------------+
liangke6cb3c152018-01-29 16:25:08 +0800120
121
liangkec0686782018-08-19 11:29:08 +0800122Test
123====
liangke6cb3c152018-01-29 16:25:08 +0800124
liangkec0686782018-08-19 11:29:08 +0800125#. Unit tests with tox
126#. CSIT tests, verify marker label in logging message