My X-Openstack-Request-Id is not showing up in opensearch

Bug #2030499 reported by Ivan Galben
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
kolla-ansible
New
Undecided
Unassigned

Bug Description

**Bug Report**
What happened:

Hi.
If I enter my request id as stated in the documentation https://docs.openstack.org/api-guide/compute/faults.html it doesn't show up in opensearch.

Requests without my request id go well, I see an entry in opensearch
2023-08-06 03:51:31.951 35 INFO nova.api.openstack.requestlog [None req-bbcafeda-8d1a-4b80-948d-58c48c408060 b2098ef1f52a4451a8c9860708a118d4 8e0ea207eddd4960abaddd3c610640ba - - default default] 172.31.153.100 "GET /v2.1/os-availability-zone" status: 200 len: 97 microversion: 2.93 time: 0.012029

But when i send my own tracking request id 'X-Openstack-Request-Id'

curl --location 'http://172.31.168.100:9696/v2.0/networks' \
--header 'X-Auth-Token: $TOKEN' \
--header 'X-Openstack-Request-Id: req-3dccb8c4-08fe-4706-a91d-aeaeaeaeaeae'

it is not in Opensearch, there is an entry in /var/log/kolla/nova/nova-api.log
2023-08-06 03:51:31.885 34 INFO nova.api.openstack.requestlog [req-3dccb8c4-08fe-4706-a91d-aeaeaeaeaeae req-231c5129-eca9-41fd-8486-ccec69c978f9 b2098ef1f52a4451a8c9860708a118d4 8e0ea207eddd4960abaddd3c610640ba - - default default] 172.31.153.100 "GET /v2.1/limits?tenant_id=b1c3908d4a8342b18df522b6f53d6049" status: 200 len: 302 microversion: 2.93 time: 0.017379

The parser kolla-venv/share/kolla-ansible/ansible/roles/common/templates/conf/input/00-global.conf.j2
(\S+ req-)?((?<request_id>\S+) (?<user_id>\S+) (?<tenant_id>\S+) (?<domain_id>\S+) (?<system_scope>\S+) (?<user_domain>\S+) (?<project_domain>\S+)|-)
is missing an entry to handle the extra request id field.

What you expected to happen:
Fluentd config needs an extra field for Request ID

How to reproduce it:
curl --location 'http://172.31.168.100:9696/v2.0/networks' \
--header 'X-Auth-Token: $TOKEN' \
--header 'X-Openstack-Request-Id: req-3dccb8c4-08fe-4706-a91d-aeaeaeaeaeae'

Regex is available at: https://rubular.com/r/cdLiZTuautF8Zz

**Environment**:
* OS (e.g. from /etc/os-release): Rocky Linux
* Kernel (e.g. `uname -a`): 5.14.0-162.12.1.el9_1.0.2.x86_64
* Docker version if applicable (e.g. `docker version`): Docker version 20.10.21, build baeda1f
* Kolla-Ansible version (e.g. `git head or tag or stable branch` or pip package version if using release): https://github.com/openstack/kolla-ansible/tree/stable/zed
* Docker image Install type (source/binary): binary
* Docker image distribution: zed
* Are you using official images from Docker Hub or self built?
* If self built - Kolla version and environment used to build:
* Share your inventory file, globals.yml and other configuration files if relevant

cat kolla-venv/share/kolla-ansible/ansible/roles/common/templates/conf/input/00-global.conf.j2
#jinja2: trim_blocks: False
{% if fluentd_enabled_input_openstack_services | length > 0 -%}
<source>
  @type tail
  path {% for service in fluentd_enabled_input_openstack_services %}/var/log/kolla/{{ service }}/*.log{% if not loop.last %},{% endif %}{% endfor %}
  exclude_path ["/var/log/kolla/neutron/dnsmasq.log",
                "/var/log/kolla/ironic/dnsmasq.log",
                "/var/log/kolla/*/*-access.log",
                "/var/log/kolla/*/*-error.log",
                "/var/log/kolla/*/*_access.log",
                "/var/log/kolla/*/*_error.log"]
  pos_file /var/run/td-agent/kolla-openstack.pos
  tag kolla.*
  ignore_repeated_permission_error true
  enable_watch_timer false
  <parse>
    @type multiline
    format_firstline /^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}.\d{3} \d+ \S+ \S+ \[.*\]/
    format1 /^(?<Timestamp>\S+ \S+) (?<Pid>\d+) (?<log_level>\S+) (?<python_module>\S+) \[(\S+ req-)?((?<request_id>\S+) (?<user_id>\S+) (?<tenant_id>\S+) (?<domain_id>\S+) (?<system_scope>\S+) (?<user_domain>\S+) (?<project_domain>\S+)|-)\] (?<Payload>.*)?$/
    time_key Timestamp
    keep_time_key true
    time_format %F %T.%L
  </parse>
</source>
{%- endif %}

description: updated
description: updated
description: updated
description: updated
description: updated
description: updated
description: updated
Revision history for this message
Ivan Galben (kasparhouser) wrote (last edit ):

It might be possible to change to something like this https://rubular.com/r/SVuMoBgd2IbEoA
(\S+ )?((?<x_request_id>\S+) (?<request_id>\S+) (?<user_id>\S+) (?<tenant_id>\S+) (?<domain_id>\S+) (?<system_scope>\S+) (?<user_domain>\S+) (?<project_domain>\S+)|-)

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.