Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 1949097

Summary: [RHOSP16.1][rsyslog] - miss configuration generated in 50_openstack_logs.conf on compute node [InstanceHA]
Product: Red Hat OpenStack Reporter: Nilesh <nchandek>
Component: puppet-rsyslogAssignee: Martin Magr <mmagr>
Status: CLOSED WORKSFORME QA Contact: Ofer Blaut <oblaut>
Severity: high Docs Contact:
Priority: high    
Version: 16.1 (Train)CC: lmadsen, lnatapov, mflusche, mmagr, mrunge
Target Milestone: z8Keywords: Reopened, Triaged, ZStream
Target Release: 16.1 (Train on RHEL 8.2)   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-09-20 09:05:39 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Nilesh 2021-04-13 12:36:43 UTC
Description of problem:

* Deployed RHOSP16.1 with instance HA. 
* After the deploy, **/var/lib/config-data/puppet-generated/rsyslog/etc/rsyslog.d/50_openstack_logs.conf** is generated with missconfiguration parameter. 
```
)
# pacemaker_remote_system.pacemaker_remote
input(type="imfile"
  file="/var/log/pacemaker.log"
  startmsg.regex="^[^ ]*\s*[^ ]* [^ ]* \[[^ ]*\] [^ ]*"
  tag="system.pacemaker_remote"
)
```
Issue [1]

```
file="/var/log/pacemaker.log" -- this file path is not present in the compute node the correct file path is **/var/log/pacemaker/pacemaker.log**
```
Issue [2]

```
startmsg.regex="^[^ ]*\s*[^ ]* [^ ]* \[[^ ]*\] [^ ]*"  -- this regex is incorrectly configured, the correct one is ``startmsg.regex="^[a-zA-Z]{3} [0-9]{2} [:0-9]{8}" ``
```

* With this **startmsg.regex="^[^ ]*\s*[^ ]* [^ ]* \[[^ ]*\] [^ ]*" ** setting it does not sent the logs to elastic server, should be correctly configured. 




How reproducible:

* deployed with instanceHA

```
(undercloud) [stack@undercloud-0 ~]$ cat v1_deploy.sh 
#!/bin/bash
time openstack overcloud deploy --templates  /home/stack/templates/rendered/ \
-r /home/stack/templates/instanceha_roles_data.yaml \
-e /home/stack/templates/extra/scheduler_hints_env.yaml \
-e /home/stack/templates/extra/node-info.yaml \
-e /home/stack/templates/nic-config/network-environment.yaml \
-e /home/stack/templates/rendered/environments/network-isolation.yaml \
-e /home/stack/containers-prepare-parameter.yaml \
-e /home/stack/templates/rendered/environments/ceph-ansible/ceph-ansible.yaml \
-e /home/stack/templates/storage/storageinfo.yaml \
-e /home/stack/templates/rsyslog/logging-environment-rsyslog.yaml \
-e /usr/share/openstack-tripleo-heat-templates/environments/compute-instanceha.yaml \
-e /home/stack/templates/extra/fencing.yaml \
--libvirt-type qemu --timeout 120  
(undercloud) [stack@undercloud-0 ~]$ 
```

```
Node List:
  * Online: [ cnilesh-controller-prod-0 ]
  * RemoteOnline: [ cnilesh-compute-iha-prod-0 cnilesh-compute-iha-prod-1 ]
  * GuestOnline: [ galera-bundle-0@cnilesh-controller-prod-0 ovn-dbs-bundle-0@cnilesh-controller-prod-0 rabbitmq-bundle-0@cnilesh-controller-prod-0 redis-bundle-0@cnilesh-controller-prod-0 ]
```

* The compute nodes only starts sending logs to ELK if I manually change the line startmsg.regex="^[^ ]*\s*[^ ]* [^ ]* \[[^ ]*\] [^ ]*" to startmsg.regex="^[a-zA-Z]{3} [0-9]{2} [:0-9]{8}"


Expected results:

* File  **/var/lib/config-data/puppet-generated/rsyslog/etc/rsyslog.d/50_openstack_logs.conf** shuold have correct configuration on compute node. 
* RHOSP 16.1

Comment 1 Matthias Runge 2021-04-14 15:07:04 UTC
I'm going to close this as a duplicate

*** This bug has been marked as a duplicate of bug 1945075 ***

Comment 11 Leif Madsen 2021-05-26 15:20:51 UTC
*** Bug 1962497 has been marked as a duplicate of this bug. ***

Comment 13 Martin Magr 2021-07-01 20:33:51 UTC
I just can't reproduce this. When I deploy latest 16.1 I get following rsyslog config on compute node:

[heat-admin@compute-0 ~]$ cat /var/lib/config-data/puppet-generated/rsyslog/etc/rsyslog.d/50_openstack_logs.conf
module(load="imfile")
module(load="omelasticsearch")
# nova_compute_openstack.nova.compute
input(type="imfile"
  file="/var/log/containers/nova/nova-compute.log"
  tag="openstack.nova.compute"
  startmsg.regex="^[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}(.[0-9]+ [0-9]+)? (DEBUG|INFO|WARNING|ERROR) "
)

template (name="rsyslog-node-index" type="list"
)
{
    constant(value="compute-0.redhat.local-" )
    property(dateFormat="year" name="timereported" )
    constant(value="." )
    property(dateFormat="month" name="timereported" )
    constant(value="." )
    property(dateFormat="day" name="timereported" )
}

template (name="rsyslog-record" type="list"
 option.jsonf="on")
{
    property(format="jsonf" name="timereported" outname="@timestamp" )
    property(format="jsonf" name="hostname" outname="host" )
    property(format="jsonf" name="syslogseverity-text" outname="severity" )
    property(format="jsonf" name="syslogfacility-text" outname="facility" )
    property(format="jsonf" name="syslogtag" outname="tag" )
    property(format="jsonf" name="app-name" outname="source" )
    property(format="jsonf" name="msg" outname="message" )
}
# elasticsearch
action(type="omelasticsearch"
    name="elasticsearch"
    dynSearchIndex="on"
    errorfile="/var/log/rsyslog/omelasticsearch.log"
    searchIndex="rsyslog-node-index"
    template="rsyslog-record"
  )
[heat-admin@compute-0 ~]$ 
[heat-admin@compute-0 ~]$ sudo podman logs rsyslog
+ sudo -E kolla_set_configs
INFO:__main__:Loading config file at /var/lib/kolla/config_files/config.json
INFO:__main__:Validating config file
INFO:__main__:Kolla config strategy set to: COPY_ALWAYS
INFO:__main__:Copying service configuration files
INFO:__main__:Copying /var/lib/kolla/config_files/src/etc/rsyslog.d/50_openstack_logs.conf to /etc/rsyslog.d/50_openstack_logs.conf
INFO:__main__:Deleting /etc/rsyslog.conf
INFO:__main__:Copying /var/lib/kolla/config_files/src/etc/rsyslog.conf to /etc/rsyslog.conf
INFO:__main__:Writing out command to execute
INFO:__main__:Setting permission for /var/lib/rsyslog
INFO:__main__:Setting permission for /var/log/rsyslog
++ cat /run_command
+ CMD='/usr/sbin/rsyslogd -n'
+ ARGS=
+ sudo kolla_copy_cacerts
Running command: '/usr/sbin/rsyslogd -n'
+ [[ ! -n '' ]]
+ . kolla_extend_start
+ echo 'Running command: '\''/usr/sbin/rsyslogd -n'\'''
+ exec /usr/sbin/rsyslogd -n
rsyslogd: imfile: no working or state file directory set, imfile will create state files in the current working directory (probably the root dir). Use global(workDirectory="/some/path") to set the working directory [v8.1911.0-3.el8 try https://www.rsyslog.com/e/2450 ]
rsyslogd: imfile: on startup file '/var/log/containers/nova/nova-compute.log' does not exist but is configured in static file monitor - this may indicate a misconfiguration. If the file appears at a later time, it will automatically be processed. Reason: No such file or directory [v8.1911.0-3.el8]
rsyslogd: omelasticsearch: we are suspending ourselfs due to server failure 7: Failed to connect to localhost port 9200: Connection refused [v8.1911.0-3.el8 try https://www.rsyslog.com/e/2007 ]
[heat-admin@compute-0 ~]$

We can ignore the error on nova-compute.log since rsyslog is being deployed before nova, so the log did not exist when rsyslog started, but was created a while after.

[heat-admin@compute-0 ~]$ sudo ls -l /var/log/containers/nova/
total 7936
-rw-r--r--. 1 42436 42436 4041700 Jul  1 20:23 nova-compute.log
-rw-r--r--. 1 42436 42436       0 Jul  1 14:44 nova-manage.log
[heat-admin@compute-0 ~]$ 
[heat-admin@compute-0 ~]$ sudo podman exec -it rsyslog ls -l /var/log/containers/nova/
total 7936
-rw-r--r--. 1 nova nova 4055775 Jul  1 20:24 nova-compute.log
-rw-r--r--. 1 nova nova       0 Jul  1 14:44 nova-manage.log
[heat-admin@compute-0 ~]$ 

And yes I used instanceha for deployment:
(.venv-infrared) [root@lenovo-p720-rdo-13 infrared]$ grep instanceha osp16-user-config.yaml -B10 -A2
rhos_release_rpm: "http://rhos-release.virt.bos.redhat.com/repos/rhos-release/rhos-release-latest.noarch.rpm"

tripleo_heat_templates: #[]
  # STF deploy
  #- /usr/share/openstack-tripleo-heat-templates/environments/metrics/qdr-edge-only.yaml
  #- /usr/share/openstack-tripleo-heat-templates/environments/metrics/collectd-write-qdr.yaml
  #- /usr/share/openstack-tripleo-heat-templates/environments/metrics/ceilometer-write-qdr.yaml
  # logging deploy
  - /usr/share/openstack-tripleo-heat-templates/environments/logging-environment-rsyslog.yaml
  # BZ1949097
  - /usr/share/openstack-tripleo-heat-templates/environments/compute-instanceha.yaml

custom_templates:
(.venv-infrared) [root@lenovo-p720-rdo-13 infrared]$ 
(.venv-infrared) [root@lenovo-p720-rdo-13 infrared]$ grep osp16-user-config.yaml deploy_osp16.sh -B13 -A3
infrared tripleo-overcloud \
    -o overcloud-install.yml \
    --version $OSP_VERSION \
    --deployment-files virt \
    --network-backend geneve \
    --network-protocol ipv4 \
    --storage-external no \
    --overcloud-ssl no \
    --introspect yes \
    --tagging yes \
    --deploy yes \
    --containers yes \
    --ntp-server "${NTP_SERVER}" \
    --overcloud-templates osp16-user-config.yaml \
    --registry-mirror $CONTAINER_REGISTRY \
    --registry-undercloud-skip no && \
\
(.venv-infrared) [root@lenovo-p720-rdo-13 infrared]$ grep OSP_VERSION= deploy_osp16.sh
OSP_VERSION=16.1
(.venv-infrared) [root@lenovo-p720-rdo-13 infrared]$

Were you using latest OSP16.1 or you are running some older z-release? Can you provide me exact reproducer please?

Comment 15 Martin Magr 2021-09-14 12:53:31 UTC
Any update here?

I was not able to reproduce that on 16.2 too.

[root@compute-0 ~]# podman ps | grep rsys
b090d9c2dc62  undercloud-0.ctlplane.redhat.local:8787/rh-osbs/rhosp16-openstack-rsyslog:16.2_20210901.2                     kolla_start  23 hours ago  Up About a minute ago          rsyslog
[root@compute-0 ~]# podman logs rsyslog
+ sudo -E kolla_set_configs
+ sudo -E kolla_set_configs
INFO:__main__:Loading config file at /var/lib/kolla/config_files/config.json
INFO:__main__:Validating config file
INFO:__main__:Kolla config strategy set to: COPY_ALWAYS
INFO:__main__:Copying service configuration files
INFO:__main__:Deleting /etc/rsyslog.d/50_openstack_logs.conf
INFO:__main__:Copying /var/lib/kolla/config_files/src/etc/rsyslog.d/50_openstack_logs.conf to /etc/rsyslog.d/50_openstack_logs.conf
INFO:__main__:Deleting /etc/rsyslog.conf
INFO:__main__:Copying /var/lib/kolla/config_files/src/etc/rsyslog.conf to /etc/rsyslog.conf
INFO:__main__:Writing out command to execute
INFO:__main__:Setting permission for /var/lib/rsyslog
INFO:__main__:Setting permission for /var/log/rsyslog
++ cat /run_command
+ CMD='/usr/sbin/rsyslogd -n'
+ ARGS=
+ [[ ! -n '' ]]
+ . kolla_extend_start
+ echo 'Running command: '\''/usr/sbin/rsyslogd -n'\'''
Running command: '/usr/sbin/rsyslogd -n'
+ exec /usr/sbin/rsyslogd -n
rsyslogd: imfile: no working or state file directory set, imfile will create state files in the current working directory (probably the root dir). Use global(workDirectory="/some/path") to set the working directory [v8.1911.0-7.el8_4.2 try https://www.rsyslog.com/e/2450 ]
rsyslogd: omelasticsearch: we are suspending ourselfs due to server failure 7: Failed to connect to localhost port 9200: Connection refused [v8.1911.0-7.el8_4.2 try https://www.rsyslog.com/e/2007 ]
[root@compute-0 ~]#
[root@compute-0 ~]# podman exec -it rsyslog cat /etc/rsyslog.d/50_openstack_logs.conf
module(load="imfile")
module(load="omelasticsearch")
# nova_compute_openstack.nova.compute
input(type="imfile"
  file="/var/log/containers/nova/nova-compute.log"
  tag="openstack.nova.compute"
  startmsg.regex="^[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}(.[0-9]+ [0-9]+)? (DEBUG|INFO|WARNING|ERROR) "
)

template (name="rsyslog-node-index" type="list"
)
{
    constant(value="compute-0.redhat.local-" )
    property(dateFormat="year" name="timereported" )
    constant(value="." )
    property(dateFormat="month" name="timereported" )
    constant(value="." )
    property(dateFormat="day" name="timereported" )
}

template (name="rsyslog-record" type="list"
 option.jsonf="on")
{
    property(dateFormat="rfc3339" format="jsonf" name="timereported" outname="@timestamp" )
    property(format="jsonf" name="hostname" outname="host" )
    property(format="jsonf" name="syslogseverity" outname="severity" )
    property(format="jsonf" name="syslogfacility-text" outname="facility" )
    property(format="jsonf" name="syslogtag" outname="tag" )
    property(format="jsonf" name="app-name" outname="source" )
    property(format="jsonf" name="msg" outname="message" )
    property(format="jsonf" name="$!metadata!filename" outname="file" )
    constant(format="jsonf" outname="cloud" value="overcloud.localdomain" )
    constant(format="jsonf" outname="region" value="regionOne" )
}
# elasticsearch
action(type="omelasticsearch"
    name="elasticsearch"
    dynSearchIndex="on"
    errorfile="/var/log/rsyslog/omelasticsearch.log"
    searchIndex="rsyslog-node-index"
    template="rsyslog-record"
  )
[root@compute-0 ~]#

Comment 19 Martin Magr 2021-09-20 09:05:39 UTC
Ok, in that case I suggest to update customers environment to latest 16.1 z-release or redeploy with NovaComputeLoggingSource parameter value from comment #17.