Configure ODL Logging mechanism

ODL logs to either console for containarised deployment and to file
for non-containarised deployment. For containarised deployments, logs
can then be read via "docker logs".

We need both JVM and karaf (ODL application) logs together to debug
any failure scenario and for them to correlate. JVM logs to console
and not to a file. Karaf can log to file and console. So we make
karaf and JVM both log to console and read these logs via docker logs.

In cases when ODL container restarts, "docker logs" retain logs from
previous broken container so there is no loss of logs in these cases.

Change-Id: I2fe56df082c5d9206015f156f5f1b3cfca63c982
This commit is contained in:
Janki Chhatbar 2017-12-21 12:13:42 +05:30
parent e8ab069d1c
commit 85d2c53c35
4 changed files with 16 additions and 5 deletions

View File

@ -72,7 +72,7 @@ outputs:
config_image: {get_param: DockerOpendaylightConfigImage}
kolla_config:
/var/lib/kolla/config_files/opendaylight_api.json:
command: /opt/opendaylight/bin/karaf
command: /opt/opendaylight/bin/karaf server
config_files:
- source: "/var/lib/kolla/config_files/src/*"
dest: "/"
@ -100,7 +100,6 @@ outputs:
-
- /var/lib/kolla/config_files/opendaylight_api.json:/var/lib/kolla/config_files/config.json:ro
- /var/lib/config-data/puppet-generated/opendaylight/:/var/lib/kolla/config_files/src:ro
- /var/log/containers/opendaylight:/opt/opendaylight/data/log
- /var/lib/opendaylight/journal:/opt/opendaylight/journal
- /var/lib/opendaylight/snapshots:/opt/opendaylight/snapshots
environment:
@ -111,15 +110,13 @@ outputs:
path: "{{ item }}"
state: directory
with_items:
- /var/log/containers/opendaylight
- /var/lib/opendaylight/snapshots
- /var/lib/opendaylight/journal
- name: opendaylight logs readme
copy:
dest: /var/log/opendaylight/readme.txt
content: |
Log files from opendaylight containers can be found under
/var/log/containers/opendaylight.
Logs from opendaylight container can be found by running "docker logs opendaylight_api"
ignore_errors: true
upgrade_tasks:
- name: Check if opendaylight is deployed

View File

@ -13,3 +13,4 @@ parameter_defaults:
NeutronPluginExtensions: 'port_security'
NeutronMechanismDrivers: 'opendaylight_v2'
NeutronServicePlugins: 'odl-router_v2,trunk'
OpenDaylightLogMechanism: 'console'

View File

@ -66,6 +66,14 @@ parameters:
- allowed_values:
- conntrack
- controller
OpenDaylightLogMechanism:
description: Logging mechanism to be used
default: 'file'
type: string
constraints:
- allowed_values:
- file
- console
outputs:
role_data:
@ -89,6 +97,7 @@ outputs:
- 2550
- 8185
opendaylight::snat_mechanism: {get_param: OpenDaylightSNATMechanism}
opendaylight::log_mechanism: {get_param: OpenDaylightLogMechanism}
step_config: |
include tripleo::profile::base::neutron::opendaylight
upgrade_tasks:

View File

@ -0,0 +1,4 @@
---
features:
- Configure ODL to log karaf logs to file for non-containarised deployment and
to console for containarised deployment.