diff --git a/docker/services/logging/files/opendaylight-api.yaml b/docker/services/logging/files/opendaylight-api.yaml new file mode 100644 index 0000000000..a035ebb2e6 --- /dev/null +++ b/docker/services/logging/files/opendaylight-api.yaml @@ -0,0 +1,32 @@ +heat_template_version: rocky + +description: > + Logging configuration for containerized OpenDaylight API service +outputs: + config_settings: + description: Extra hieradata needed to log to files in the host. + value: null + docker_config: + description: Extra containers needed for logging to files in the host. + value: + step_1: {} + volumes: + description: The volumes needed to log to files in the host. + value: + - /var/log/containers/opendaylight:/opt/opendaylight/data/log + host_prep_tasks: + description: Extra ansible tasks needed for logging to files in the host. + value: + - name: create persistent logs directory + file: + path: "{{ item }}" + state: directory + with_items: + - /var/log/containers/opendaylight + - /var/log/opendaylight + - name: opendaylight logs readme + copy: + dest: /var/log/opendaylight/readme.txt + content: | + Logs from OpenDaylight container can be found at /var/log/containers/opendaylight/karaf.log + ignore_errors: true \ No newline at end of file diff --git a/docker/services/opendaylight-api.yaml b/docker/services/opendaylight-api.yaml index 898a3fe9ed..ed50917e83 100644 --- a/docker/services/opendaylight-api.yaml +++ b/docker/services/opendaylight-api.yaml @@ -72,6 +72,9 @@ resources: RoleName: {get_param: RoleName} RoleParameters: {get_param: RoleParameters} + OpenDaylightApiLogging: + type: OS::TripleO::Services::Logging::OpenDaylightApi + outputs: role_data: description: Role data for the OpenDaylight API role. @@ -133,38 +136,33 @@ outputs: volumes: list_concat: - {get_attr: [ContainersCommon, volumes]} + - {get_attr: [OpenDaylightApiLogging, volumes]} - - /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/lib/opendaylight/journal:/opt/opendaylight/journal - /var/lib/opendaylight/snapshots:/opt/opendaylight/snapshots - /var/lib/opendaylight/data:/opt/opendaylight/data - - /var/log/containers/opendaylight:/opt/opendaylight/data/log environment: - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS metadata_settings: get_attr: [OpenDaylightBase, role_data, metadata_settings] host_prep_tasks: - - name: Delete cache folder - file: - path: /var/lib/opendaylight/data/cache - state: absent - - name: create persistent directories - file: - path: "{{ item }}" - state: directory - with_items: - - /var/lib/opendaylight/snapshots - - /var/lib/opendaylight/journal - - /var/lib/opendaylight/data - - /var/log/opendaylight - - /var/log/containers/opendaylight - - name: opendaylight logs readme - copy: - dest: /var/log/opendaylight/readme.txt - content: | - Logs from opendaylight container can be found by running "sudo docker logs opendaylight_api" and are also available in /var/log/containers/opendaylight/karaf.log - ignore_errors: true + list_concat: + - {get_attr: [OpenDaylightApiLogging, host_prep_tasks]} + - + - name: Delete cache folder + file: + path: /var/lib/opendaylight/data/cache + state: absent + - name: create persistent directories + file: + path: "{{ item }}" + state: directory + with_items: + - /var/lib/opendaylight/snapshots + - /var/lib/opendaylight/journal + - /var/lib/opendaylight/data upgrade_tasks: - when: step|int == 0 tags: common diff --git a/environments/services-baremetal/neutron-opendaylight.yaml b/environments/services-baremetal/neutron-opendaylight.yaml index bc0f864f92..a828c36d4a 100644 --- a/environments/services-baremetal/neutron-opendaylight.yaml +++ b/environments/services-baremetal/neutron-opendaylight.yaml @@ -13,4 +13,3 @@ parameter_defaults: NeutronPluginExtensions: 'port_security' NeutronMechanismDrivers: 'opendaylight_v2' NeutronServicePlugins: 'odl-router_v2,trunk' - OpenDaylightLogMechanism: 'console' diff --git a/environments/services/neutron-opendaylight.yaml b/environments/services/neutron-opendaylight.yaml index 8ace95a97e..c2504d60f0 100644 --- a/environments/services/neutron-opendaylight.yaml +++ b/environments/services/neutron-opendaylight.yaml @@ -14,4 +14,3 @@ parameter_defaults: NeutronPluginExtensions: 'port_security' NeutronMechanismDrivers: 'opendaylight_v2' NeutronServicePlugins: 'odl-router_v2,trunk' - OpenDaylightLogMechanism: 'console' diff --git a/overcloud-resource-registry-puppet.j2.yaml b/overcloud-resource-registry-puppet.j2.yaml index 5054bb3cb9..fc6f44b557 100644 --- a/overcloud-resource-registry-puppet.j2.yaml +++ b/overcloud-resource-registry-puppet.j2.yaml @@ -338,6 +338,7 @@ resource_registry: OS::TripleO::Services::Logging::NovaCommon: docker/services/logging/files/nova-common.yaml OS::TripleO::Services::Logging::NovaLibvirt: OS::Heat::None OS::TripleO::Services::Logging::NovaPlacement: docker/services/logging/files/nova-placement.yaml + OS::TripleO::Services::Logging::OpenDaylightApi: docker/services/logging/files/opendaylight-api.yaml OS::TripleO::Services::Logging::PankoApi: docker/services/logging/files/panko-api.yaml # Tempest diff --git a/releasenotes/notes/odl_stand_alone_log_config-5358ec26f7e7a970.yaml b/releasenotes/notes/odl_stand_alone_log_config-5358ec26f7e7a970.yaml new file mode 100644 index 0000000000..019301ff16 --- /dev/null +++ b/releasenotes/notes/odl_stand_alone_log_config-5358ec26f7e7a970.yaml @@ -0,0 +1,9 @@ +--- +features: + - | + Configure ODL to log to file instead of console. Also ODL + log configuration has been moved out of general service + configurations to a stand-alone config file at + docker/services/logging/files/opendaylight-api.yaml. ODL + logs are now accessible at /var/log/containers/opendaylight/ + karaf.log \ No newline at end of file