aboutsummaryrefslogtreecommitdiffstats
path: root/kubernetes/aai/components/aai-resources/resources/config/localhost-access-logback.xml
blob: 07919a97a250ee13e02e1a8f6599e834132cf387 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
{{/*
<!--

    ============LICENSE_START=======================================================
    org.onap.aai
    ================================================================================
    Copyright © 2017 AT&T Intellectual Property. All rights reserved.
    Modifications Copyright © 2018 Amdocs, Bell Canada
    ================================================================================
    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.
    ============LICENSE_END=========================================================

    ECOMP is a trademark and service mark of AT&T Intellectual Property.

-->
*/}}
<configuration>
  <property name="AJSC_HOME" value="${AJSC_HOME:-.}" />

  <property name="logToFileEnabled" value='{{.Values.accessLogback.logToFileEnabled}}' />
  <property name="maxHistory" value='{{.Values.accessLogback.maxHistory}}' />
  <property name="totalSizeCap" value='{{.Values.accessLogback.totalSizeCap}}' />
  <property name="livenessAccessLogEnabled"
    value='{{.Values.accessLogback.livenessAccessLogEnabled}}' />


  <if condition='property("logToFileEnabled").contains("true")'>
    <then>
      <appender name="ACCESS"
        class="ch.qos.logback.core.rolling.RollingFileAppender">
        <file>${AJSC_HOME}/logs/ajsc-jetty/localhost_access.log</file>
        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
          <fileNamePattern>${AJSC_HOME}/logs/ajsc-jetty/localhost_access.log.%d{yyyy-MM-dd}.zip
          </fileNamePattern>
          <maxHistory>${maxHistory}</maxHistory>
          <totalSizeCap>${totalSizeCap}</totalSizeCap>
        </rollingPolicy>
        <encoder class="org.onap.aai.logging.CustomLogPatternLayoutEncoder">
          <Pattern>%a %u %z [%t] "%m %U%q" %s %b %y %i{X-TransactionId} %i{X-FromAppId}
            %i{X-Forwarded-For} %i{X-AAI-SSL-Client-CN} %i{X-AAI-SSL-Client-OU}
            %i{X-AAI-SSL-Client-O} %i{X-AAI-SSL-Client-L} %i{X-AAI-SSL-Client-ST}
            %i{X-AAI-SSL-Client-C} %i{X-AAI-SSL-Client-NotBefore} %i{X-AAI-SSL-Client-NotAfter}
            %i{X-AAI-SSL-Client-DN} %D</Pattern>
        </encoder>
      </appender>
      <appender-ref ref="ACCESS" />
    </then>
  </if>

  <appender name="STDOUTACCESS" class="ch.qos.logback.core.ConsoleAppender">
    <encoder class="org.onap.aai.logging.CustomLogPatternLayoutEncoder">
      <Pattern>%a %u %z [%t] "%m %U%q" %s %b %y %i{X-TransactionId} %i{X-FromAppId}
        %i{X-Forwarded-For} %i{X-AAI-SSL-Client-CN} %i{X-AAI-SSL-Client-OU} %i{X-AAI-SSL-Client-O}
        %i{X-AAI-SSL-Client-L} %i{X-AAI-SSL-Client-ST} %i{X-AAI-SSL-Client-C}
        %i{X-AAI-SSL-Client-NotBefore} %i{X-AAI-SSL-Client-NotAfter} %i{X-AAI-SSL-Client-DN} %D -
        "logType": "access"</Pattern>
    </encoder>
    <if condition='property("livenessAccessLogEnabled").contains("false")'>
      <then>
        <filter class="ch.qos.logback.core.filter.EvaluatorFilter">
          <evaluator class="ch.qos.logback.access.net.URLEvaluator">
            <URL>/aai/util/echo</URL>
          </evaluator>
          <OnMismatch>NEUTRAL</OnMismatch>
          <OnMatch>DENY</OnMatch>
        </filter>
      </then>
    </if>
  </appender>

  <appender-ref ref="STDOUTACCESS" />

</configuration>
{{/*
<!--
%a - Remote IP address
%A - Local IP address
%b - Bytes sent, excluding HTTP headers, or '-' if no bytes were sent
%B - Bytes sent, excluding HTTP headers
%h - Remote host name
%H - Request protocol
%l - Remote logical username from identd (always returns '-')
%m - Request method
%p - Local port
%q - Query string (prepended with a '?' if it exists, otherwise an empty string
%r - First line of the request
%s - HTTP status code of the response
%S - User session ID
%t - Date and time, in Common Log Format format
%u - Remote user that was authenticated
%U - Requested URL path
%v - Local server name
%I - current request thread name (can compare later with stacktraces)

%z - Custom pattern that parses the cert for the subject
%y - Custom pattern determines rest or dme2
-->
*/}}