Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 17 Next »

CPS-10 - Getting issue details... STATUS


Sources

ONAP Application Logging Specification v1.2 (Casablanca)#HowtoLog

Issues/Decisions

#

Issue/Decision

Notes

Decision

1Are the logging guidelines set by the Logging Enhancement Project suitable for a cloud environment?

2Do we need a second appender for errors?
  • one file only

  • Later we will have a file to track who is accessing it, who is registering for the access...but we are not at that point yet
  • Within the log folder we could have multiple files for:

    • debug.log
    • audit.log
    • metric.log
    • error.log

    Logs will be archived each day.

Meeting Notes 11/12/20 

https://docs.onap.org/projects/onap-logging-analytics/en/latest/Logging_Enhancements_Project/logging_enhancements_project.html#id33

The logging enhancement team has proposed to split the log to multiple files: 

  • debug.log
  • audit.log
  • metric.log
  • error.log


Toine has suggested we follow this approach but exclude error logging. 


Before making anymore decisions we will investigate this project as we have some concerns about the logging standards in the logging enhancement project.

3The application should only logs to stdout and not in files?
  • By doing so we can leverage Kubernetes standard logging design.

  • If logging to files is provided, It would be good to also have a way to disable it to avoid file space management questions on worker nodes or pvc depending where logs files would be kept.

  • For monitoring, it is more complex to operate applications that are each one using specific logs files.

  • By having all applications logging to stdout, all logs can be collected in a common standard way and published and re-used anywhere that is convenient for any operations team (using filebeat or elk stack for example).

    See https://kubernetes.io/docs/concepts/cluster-administration/logging/ 


  • Whether user will be using Kubernetes / Azure or single manual deployment, features capability should be the same. We should not enforce to use anything specific to achieve the same service solution.
  • Many company enforce to  have those separate type of log files by security policy. Usually they store the audits logs ones.
    With log properties, you always can change the level log. And also alterate/disable the logs appenders at runtime.

Meeting Notes 11/12/20 

  • We want the logging to be easily configurable and allow for different implementations on how to collect logs. We will expose this configuration in the helm charts.  
  • Our default logging will be std out as it is easily configurable. 



4Is the file location ok?

 ../log/${logName}.log


I think this is ok. Logs will be placed in pods once deployed. 

I think we will need to set a property in our SpringBootApplication class for the log dir.


5Disk space

<property name="maxFileSize" value="20MB" />

Once the log reaches this value it is zipped.



New ONAP Component Checklist

Add this procedure to the Project Proposal Template

By following a few simple rules:

  • Your component's output will be indexed automatically. 
  • Analytics will be able to trace invocation through your component.

Obligations fall into two categories:

  1. Conventions regarding configuration, line format and output. 
  2. Ensuring the propagation of contextual information. 

You must:

  1. Choose a Logging provider and/or EELF. Decisions, decisions.
  2. Create a configuration file based on an existing archetype. See ONAP Application Logging Specification v1.2 (Casablanca)#Configuration.
  3. Read your configuration file when your components initialize logging.
  4. Write logs to a standard location so that they can be shipped by Filebeat for indexing. See ONAP Application Logging Specification v1.2 (Casablanca)#Output Location.
  5. Report transaction state:
    1. Retrieve, default and propagate RequestID. See ONAP Application Logging Specification v1.2 (Casablanca)#MDC - RequestID.
    2. At each invocation of one ONAP component by another:
      1. Initialize and propagate InvocationID. See ONAP Application Logging Specification v1.2 (Casablanca)#MDC - Invocation ID.
      2. Report INVOKE and SYNCHRONOUS markers in caller. 
      3. Report ENTRY and EXIT markers in recipient. 
  6. Write useful logs!

 They are unordered. 

Current Log Config


Dependencies (pom)
  <dependency>
      <!-- For logging -->
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
    </dependency>


Logging level is configured in the application.yaml
...

logging:
    level:
        org:
            springframework: INFO


Logback configuration is done in logback-spring.xml
<configuration scan="true" debug="false">
    <include resource="org/springframework/boot/logging/logback/base.xml" />

    <property name="queueSize" value="256" />
    <property name="maxFileSize" value="20MB" />
    <property name="maxHistory" value="30" />
    <property name="totalSizeCap" value="20MB" />

    <!-- log file names -->
    <property name="logName" value="cps" />

    <property name="currentTimeStamp" value="%d{"yyyy-MM-dd'T'HH:mm:ss.SSSXXX",UTC}"/>

    <property name="debugPattern"
        value="%d{yyyy-MM-dd'T'HH:mm:ss.SSSXXX}|%thread|%X{RequestID}| %logger{50} - %msg%n" />

    <appender name="Debug"
        class="ch.qos.logback.core.rolling.RollingFileAppender">
        <file>../log/${logName}.log</file>
        <rollingPolicy
            class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
            <fileNamePattern>${logName}.%d{yyyy-MM-dd}.%i.log.zip
            </fileNamePattern>
            <maxFileSize>${maxFileSize}</maxFileSize>
            <maxHistory>${maxHistory}</maxHistory>
            <totalSizeCap>${totalSizeCap}</totalSizeCap>
        </rollingPolicy>
        <encoder>
            <pattern>${debugPattern}</pattern>
        </encoder>
    </appender>

    <appender name="asyncDebug" class="ch.qos.logback.classic.AsyncAppender">
        <queueSize>256</queueSize>
        <appender-ref ref="Debug" />
        <includeCallerData>true</includeCallerData>
    </appender>

    <logger name="org.onap.cps" level="DEBUG" additivity="false">
        <appender-ref ref="asyncDebug" />
    </logger>


    <root level="INFO">
        <appender-ref ref="asyncDebug" />
    </root>

</configuration>


To generate logging add the following parameter and imports

import lombok.extern.slf4j.Slf4j;

@Slf4j


Log files are generated in your development workspace folder - ../log/${logName}.log

2020-12-09T11:31:51.792Z|qtp1971152916-37|| org.onap.cps.rest.controller.CpsRestController - error message
2020-12-09T11:31:51.792Z|qtp1971152916-37|| org.onap.cps.rest.controller.CpsRestController - debug message

cps.log


  • No labels