From 85d2c53c35ab9d50d6ddea2e66c9f86d2fed4934 Mon Sep 17 00:00:00 2001 From: Janki Chhatbar Date: Thu, 21 Dec 2017 12:13:42 +0530 Subject: [PATCH] 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 --- docker/services/opendaylight-api.yaml | 7 ++----- environments/services-docker/neutron-opendaylight.yaml | 1 + puppet/services/opendaylight-api.yaml | 9 +++++++++ .../notes/ODL_log_mechanism-99f008362d2392de.yaml | 4 ++++ 4 files changed, 16 insertions(+), 5 deletions(-) create mode 100644 releasenotes/notes/ODL_log_mechanism-99f008362d2392de.yaml diff --git a/docker/services/opendaylight-api.yaml b/docker/services/opendaylight-api.yaml index 82aa1e15bb..f2020d1187 100644 --- a/docker/services/opendaylight-api.yaml +++ b/docker/services/opendaylight-api.yaml @@ -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 diff --git a/environments/services-docker/neutron-opendaylight.yaml b/environments/services-docker/neutron-opendaylight.yaml index 873957aea6..cde1883c0e 100644 --- a/environments/services-docker/neutron-opendaylight.yaml +++ b/environments/services-docker/neutron-opendaylight.yaml @@ -13,3 +13,4 @@ parameter_defaults: NeutronPluginExtensions: 'port_security' NeutronMechanismDrivers: 'opendaylight_v2' NeutronServicePlugins: 'odl-router_v2,trunk' + OpenDaylightLogMechanism: 'console' \ No newline at end of file diff --git a/puppet/services/opendaylight-api.yaml b/puppet/services/opendaylight-api.yaml index a23edc014f..abb526acbb 100644 --- a/puppet/services/opendaylight-api.yaml +++ b/puppet/services/opendaylight-api.yaml @@ -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: diff --git a/releasenotes/notes/ODL_log_mechanism-99f008362d2392de.yaml b/releasenotes/notes/ODL_log_mechanism-99f008362d2392de.yaml new file mode 100644 index 0000000000..a622e4089f --- /dev/null +++ b/releasenotes/notes/ODL_log_mechanism-99f008362d2392de.yaml @@ -0,0 +1,4 @@ +--- +features: + - Configure ODL to log karaf logs to file for non-containarised deployment and + to console for containarised deployment. \ No newline at end of file