[LOG] Add canonicalization for VID logs 25/7325/2
authorVidya Shinde <VIDYASH@amdocs.com>
Fri, 11 Aug 2017 09:41:49 +0000 (15:11 +0530)
committerVidya Shinde <vidya.shinde@amdocs.com>
Fri, 11 Aug 2017 10:22:41 +0000 (15:52 +0530)
Canonicalization of path for log provider configuration file and log files

Change-Id: Ifc7fec117f7d6f2fcb7a67b0861582ce5f50342f
Issue-ID: LOG-27
Signed-off-by: Vidya Shinde <vidya.shinde@amdocs.com>
onap/vid/README.md [new file with mode: 0644]
onap/vid/conf/logback.xml [new file with mode: 0644]

diff --git a/onap/vid/README.md b/onap/vid/README.md
new file mode 100644 (file)
index 0000000..05c5a0a
--- /dev/null
@@ -0,0 +1,20 @@
+##############################################################################################################################################
+## VID logging configuration
+=====================================================================================
+VID has two docker containers - vid-server and vid-mariadb. 
+The canonical logging implementation is only done for the container, vid-server.
+Canonical logs will be generated at /var/log/onap/vid/
+=================================================================================================
+## Instructions for deployment
+=================================================================================================
+  1. Log provider file is available at the path, /tomcat/webapps/vid/WEB-INF/classes/, in the container
+  2. Copy the canonical logback.xml from 'vid' directory (of gerrit) into the path mentioned in step 1.
+  3. Create the canonical path, /var/log/onap/vid/, on the host VM.
+  4. Provide write permissions for "others" user for directory created in step 3.
+  5. Volume-Mount: The vid-server container requires one host path mapped as volume in the container
+       5.1. Log file path:
+        Host path -      /var/log/onap/vid/ mapped to 
+        Container path - /var/log/onap/vid/        
+       5.2. Log Provider file path:     
+        Note: Log provider path cannot be configured externally as it is bundled inside a WAR.  
+##############################################################################################################################################
diff --git a/onap/vid/conf/logback.xml b/onap/vid/conf/logback.xml
new file mode 100644 (file)
index 0000000..5656303
--- /dev/null
@@ -0,0 +1,299 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ================================================================================
+  eCOMP Portal SDK
+  ================================================================================
+  Copyright (C) 2017 AT&amp;T Intellectual Property
+  ================================================================================
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+  
+       http://www.apache.org/licenses/LICENSE-2.0
+  
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+  ================================================================================
+  -->
+<configuration scan="true" scanPeriod="3 seconds" debug="true">
+   <!--  specify the base path of the log directory -->
+   <property name="logDir" value="/var/log/onap" />
+   <!--  specify the component name -->
+   <property name="componentName" value="vid" />
+   <!-- The directory where logs are written -->
+   <property name="logDirectory" value="${logDir}/${componentName}" />
+   <property name="pattern" value="%d{&amp;quot;yyyy-MM-dd'T'HH:mm:ss.SSSXXX&amp;quot;, UTC}\t[%thread]\t%-5level\t%logger{36}\t%replace(%replace(%replace(%mdc){'\t','\\\\t'}){', ','\t'}){'\n', '\\\\n'}\t%replace(%replace(%msg){'\n', '\\\\n'}){'\t','\\\\t'}%n" />
+   <!--  log file names -->
+   <property name="generalLogName" value="application" />
+   <property name="errorLogName" value="error" />
+   <property name="metricsLogName" value="metrics" />
+   <property name="auditLogName" value="audit" />
+   <property name="debugLogName" value="debug" />
+   <!--  other constants -->
+   <property name="queueSize" value="256" />
+   <property name="maxFileSize" value="50MB" />
+   <property name="maxHistory" value="30" />
+   <property name="totalSizeCap" value="10GB" />
+   <!-- Example evaluator filter applied against console appender -->
+   <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+      <encoder>
+         <pattern>${pattern}</pattern>
+      </encoder>
+   </appender>
+   <!-- ============================================================================ -->
+   <!-- EELF Appenders -->
+   <!-- ============================================================================ -->
+   <!-- The EELFAppender is used to record events to the general application 
+    log -->
+   <appender name="EELF" class="ch.qos.logback.core.rolling.RollingFileAppender">
+      <file>${logDirectory}/${generalLogName}.log</file>
+      <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
+         <fileNamePattern>${logDirectory}/${generalLogName}.%d{yyyy-MM-dd}.%i.log</fileNamePattern>
+         <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
+            <maxFileSize>${maxFileSize}</maxFileSize>
+         </timeBasedFileNamingAndTriggeringPolicy>
+         <maxHistory>${maxHistory}</maxHistory>
+         <totalSizeCap>${totalSizeCap}</totalSizeCap>
+      </rollingPolicy>
+      <encoder>
+         <pattern>${pattern}</pattern>
+      </encoder>
+      <filter class="org.openecomp.portalapp.util.CustomLoggingFilter" />
+   </appender>
+   <appender name="asyncEELF" class="ch.qos.logback.classic.AsyncAppender">
+      <queueSize>${queueSize}</queueSize>
+      <includeCallerData>true</includeCallerData>
+      <appender-ref ref="EELF" />
+   </appender>
+   <!-- EELF Security Appender. This appender is used to record security events 
+    to the security log file. Security events are separate from other loggers 
+    in EELF so that security log records can be captured and managed in a secure 
+    way separate from the other logs. This appender is set to never discard any 
+    events. -->
+   <!--     
+  <appender name="EELFSecurity"
+    class="ch.qos.logback.core.rolling.RollingFileAppender">
+    <file>${logDirectory}/${securityLogName}.log</file>
+    <rollingPolicy
+      class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
+      <fileNamePattern>${logDirectory}/${securityLogName}.%i.log.zip
+      </fileNamePattern>
+      <minIndex>1</minIndex>
+      <maxIndex>9</maxIndex>
+    </rollingPolicy>
+    <triggeringPolicy
+      class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
+      <maxFileSize>5MB</maxFileSize>
+    </triggeringPolicy>
+    <encoder>
+      <pattern>${defaultPattern}</pattern>
+    </encoder>
+  </appender>
+  
+  <appender name="asyncEELFSecurity" class="ch.qos.logback.classic.AsyncAppender">
+    <queueSize>256</queueSize>
+    <discardingThreshold>0</discardingThreshold>
+    <appender-ref ref="EELFSecurity" />
+  </appender>
+   -->
+   <!-- EELF Performance Appender. This appender is used to record performance 
+    records. -->
+   <!--
+  <appender name="EELFPerformance"
+    class="ch.qos.logback.core.rolling.RollingFileAppender">
+    <file>${logDirectory}/${performanceLogName}.log</file>
+    <rollingPolicy
+      class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
+      <fileNamePattern>${logDirectory}/${performanceLogName}.%i.log.zip
+      </fileNamePattern>
+      <minIndex>1</minIndex>
+      <maxIndex>9</maxIndex>
+    </rollingPolicy>
+    <triggeringPolicy
+      class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
+      <maxFileSize>5MB</maxFileSize>
+    </triggeringPolicy>
+    <encoder>
+      <outputPatternAsHeader>true</outputPatternAsHeader>
+      <pattern>${defaultPattern}</pattern>
+    </encoder>
+  </appender>
+  <appender name="asyncEELFPerformance" class="ch.qos.logback.classic.AsyncAppender">
+    <queueSize>256</queueSize>
+    <appender-ref ref="EELFPerformance" />
+  </appender>
+  -->
+   <!-- EELF Server Appender. This appender is used to record Server related 
+    logging events. The Server logger and appender are specializations of the 
+    EELF application root logger and appender. This can be used to segregate Server 
+    events from other components, or it can be eliminated to record these events 
+    as part of the application root log. -->
+   <!--
+  <appender name="EELFServer"
+    class="ch.qos.logback.core.rolling.RollingFileAppender">
+    <file>${logDirectory}/${serverLogName}.log</file>
+    <rollingPolicy
+      class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
+      <fileNamePattern>${logDirectory}/${serverLogName}.%i.log.zip
+      </fileNamePattern>
+      <minIndex>1</minIndex>
+      <maxIndex>9</maxIndex>
+    </rollingPolicy>
+    <triggeringPolicy
+      class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
+      <maxFileSize>5MB</maxFileSize>
+    </triggeringPolicy>
+    <encoder>
+        <pattern>${defaultPattern}</pattern>
+    </encoder>
+  </appender>
+  <appender name="asyncEELFServer" class="ch.qos.logback.classic.AsyncAppender">
+    <queueSize>256</queueSize>
+    <appender-ref ref="EELFServer" />
+  </appender>
+   -->
+   <!-- EELF Policy Appender. This appender is used to record Policy engine 
+    related logging events. The Policy logger and appender are specializations 
+    of the EELF application root logger and appender. This can be used to segregate 
+    Policy engine events from other components, or it can be eliminated to record 
+    these events as part of the application root log. -->
+   <!--
+  <appender name="EELFPolicy"
+    class="ch.qos.logback.core.rolling.RollingFileAppender">
+    <file>${logDirectory}/${policyLogName}.log</file>
+    <rollingPolicy
+      class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
+      <fileNamePattern>${logDirectory}/${policyLogName}.%i.log.zip
+      </fileNamePattern>
+      <minIndex>1</minIndex>
+      <maxIndex>9</maxIndex>
+    </rollingPolicy>
+    <triggeringPolicy
+      class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
+      <maxFileSize>5MB</maxFileSize>
+    </triggeringPolicy>
+    <encoder>
+        <pattern>${defaultPattern}</pattern>
+    </encoder>
+  </appender>
+  <appender name="asyncEELFPolicy" class="ch.qos.logback.classic.AsyncAppender">
+    <queueSize>256</queueSize>
+    <appender-ref ref="EELFPolicy" />
+  </appender>
+  -->
+   <!-- EELF Audit Appender. This appender is used to record audit engine 
+    related logging events. The audit logger and appender are specializations 
+    of the EELF application root logger and appender. This can be used to segregate 
+    Policy engine events from other components, or it can be eliminated to record 
+    these events as part of the application root log. -->
+   <appender name="EELFAudit" class="ch.qos.logback.core.rolling.RollingFileAppender">
+      <file>${logDirectory}/${auditLogName}.log</file>
+      <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
+         <fileNamePattern>${logDirectory}/${auditLogName}.%d{yyyy-MM-dd}.%i.log</fileNamePattern>
+         <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
+            <maxFileSize>${maxFileSize}</maxFileSize>
+         </timeBasedFileNamingAndTriggeringPolicy>
+         <maxHistory>${maxHistory}</maxHistory>
+         <totalSizeCap>${totalSizeCap}</totalSizeCap>
+      </rollingPolicy>
+      <encoder>
+         <pattern>${pattern}</pattern>
+      </encoder>
+   </appender>
+   <appender name="asyncEELFAudit" class="ch.qos.logback.classic.AsyncAppender">
+      <queueSize>${queueSize}</queueSize>
+      <appender-ref ref="EELFAudit" />
+   </appender>
+   <appender name="EELFMetrics" class="ch.qos.logback.core.rolling.RollingFileAppender">
+      <file>${logDirectory}/${metricsLogName}.log</file>
+      <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
+         <fileNamePattern>${logDirectory}/${metricsLogName}.%d{yyyy-MM-dd}.%i.log</fileNamePattern>
+         <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
+            <maxFileSize>${maxFileSize}</maxFileSize>
+         </timeBasedFileNamingAndTriggeringPolicy>
+         <maxHistory>${maxHistory}</maxHistory>
+         <totalSizeCap>${totalSizeCap}</totalSizeCap>
+      </rollingPolicy>
+      <encoder>
+         <pattern>${pattern}</pattern>
+      </encoder>
+   </appender>
+   <appender name="asyncEELFMetrics" class="ch.qos.logback.classic.AsyncAppender">
+      <queueSize>${queueSize}</queueSize>
+      <appender-ref ref="EELFMetrics" />
+   </appender>
+   <appender name="EELFError" class="ch.qos.logback.core.rolling.RollingFileAppender">
+      <file>${logDirectory}/${errorLogName}.log</file>
+      <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
+         <fileNamePattern>${logDirectory}/${errorLogName}.%d{yyyy-MM-dd}.%i.log</fileNamePattern>
+         <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
+            <maxFileSize>${maxFileSize}</maxFileSize>
+         </timeBasedFileNamingAndTriggeringPolicy>
+         <maxHistory>${maxHistory}</maxHistory>
+         <totalSizeCap>${totalSizeCap}</totalSizeCap>
+      </rollingPolicy>
+      <encoder>
+         <pattern>${pattern}</pattern>
+      </encoder>
+   </appender>
+   <appender name="asyncEELFError" class="ch.qos.logback.classic.AsyncAppender">
+      <queueSize>${queueSize}</queueSize>
+      <appender-ref ref="EELFError" />
+   </appender>
+   <appender name="EELFDebug" class="ch.qos.logback.core.rolling.RollingFileAppender">
+      <file>${logDirectory}/${debugLogName}.log</file>
+      <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
+         <fileNamePattern>${logDirectory}/${debugLogName}.%d{yyyy-MM-dd}.%i.log</fileNamePattern>
+         <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
+            <maxFileSize>${maxFileSize}</maxFileSize>
+         </timeBasedFileNamingAndTriggeringPolicy>
+         <maxHistory>${maxHistory}</maxHistory>
+         <totalSizeCap>${totalSizeCap}</totalSizeCap>
+      </rollingPolicy>
+      <encoder>
+         <pattern>${pattern}</pattern>
+      </encoder>
+   </appender>
+   <appender name="asyncEELFDebug" class="ch.qos.logback.classic.AsyncAppender">
+      <queueSize>${queueSize}</queueSize>
+      <appender-ref ref="EELFDebug" />
+   </appender>
+   <!-- ============================================================================ -->
+   <!--  EELF loggers -->
+   <!-- ============================================================================ -->
+   <logger name="com.att.eelf" level="debug" additivity="false">
+      <appender-ref ref="asyncEELF" />
+   </logger>
+   <!--
+  <logger name="com.att.eelf.security" level="info" additivity="false">
+    <appender-ref ref="asyncEELFSecurity" />
+  </logger>
+  <logger name="com.att.eelf.perf" level="info" additivity="false">
+    <appender-ref ref="asyncEELFPerformance" />
+  </logger>
+  <logger name="com.att.eelf.server" level="info" additivity="false">
+    <appender-ref ref="asyncEELFServer" />
+  </logger>
+  <logger name="com.att.eelf.policy" level="info" additivity="false">
+    <appender-ref ref="asyncEELFPolicy" />
+  </logger>
+  -->
+   <logger name="com.att.eelf.audit" level="info" additivity="false">
+      <appender-ref ref="asyncEELFAudit" />
+   </logger>
+   <logger name="com.att.eelf.metrics" level="info" additivity="false">
+      <appender-ref ref="asyncEELFMetrics" />
+   </logger>
+   <logger name="com.att.eelf.error" level="info" additivity="false">
+      <appender-ref ref="asyncEELFError" />
+   </logger>
+   <logger name="com.att.eelf.debug" level="debug" additivity="false">
+      <appender-ref ref="asyncEELFDebug" />
+   </logger>
+   <root level="INFO">
+      <appender-ref ref="asyncEELF" />
+   </root>
+</configuration>
\ No newline at end of file