Project

General

Profile

Actions

Bug #26290

open

The relayd reports parser can break on multiline fields in logs

Added by Alexis Mousset 23 days ago. Updated 17 days ago.

Status:
Pending release
Priority:
1 (highest)
Category:
Agent
Target version:
Severity:
UX impact:
User visibility:
Effort required:
Priority:
0
Name check:
To do
Fix check:
To do
Regression:
No

Description

There are 3 broken reports after a debious log:

E| compliant     upgrade_rudder_agent_on_| 30 - Determine RedHat ve| version            Set the string redhat.version to the output of 'awk 'BEGIN{ FS = "=" } /^VERSION=/{ print $2 }' /etc/os-release | grep -E -o "[0-9.]+"' was correct
2025-01-31T16:57:59+00:00 R: The 'awk 'BEGIN{ FS = "=" } /^VERSION=/{ print $2 }' /etc/os-release | grep -E -o "[0-9.]+"' command returned '15
2025-01-31T16:57:59+00:00 4'
2025-01-31T16:57:59+00:00 R: @@upgrade_rudder_agent_on_redhat_families@@log_info@@740c5a88-e56f-4955-9a8f-3a6a1975c925@@c843af2b-7b80-464c-979c-48238b40645d@@8eb7e5fa-eb62-4fad-b03a-7c28f6d343db@@40-10 - Rudder public repository set to repository.rudder.io for OS 15
2025-01-31T16:57:59+00:00 4 with Rudder 8.2@@/etc/yum.repos.d/rudder.repo@@2025-01-31 16:57:58+00:00##e12ae89a-7463-45fc-b0d2-b0e65f7d181c@#Build file /etc/yum.repos.d/rudder.repo from mustache type template /var/rudder/cfengine-community/inputs/upgrade_rudder_agent_on_redhat_families/1.0/resources/rudder.public.repo.tpl was correct
2025-01-31T16:57:59+00:00 R: @@upgrade_rudder_agent_on_redhat_families@@result_success@@740c5a88-e56f-4955-9a8f-3a6a1975c925@@c843af2b-7b80-464c-979c-48238b40645d@@8eb7e5fa-eb62-4fad-b03a-7c28f6d343db@@40-10 - Rudder public repository set to repository.rudder.io for OS 15
2025-01-31T16:57:59+00:00 4 with Rudder 8.2@@/etc/yum.repos.d/rudder.repo@@2025-01-31 16:57:58+00:00##e12ae89a-7463-45fc-b0d2-b0e65f7d181c@#Build file /etc/yum.repos.d/rudder.repo from mustache template /var/rudder/cfengine-community/inputs/upgrade_rudder_agent_on_redhat_families/1.0/resources/rudder.public.repo.tpl was correct
2025-01-31T16:57:59+00:00 R: @@upgrade_rudder_agent_on_redhat_families@@result_na@@740c5a88-e56f-4955-9a8f-3a6a1975c925@@c843af2b-7b80-464c-979c-48238b40645d@@5de65f37-e442-4201-bc7d-567125891616@@40-20 - Rudder private repository set to repository.rudder.io for OS 15
2025-01-31T16:57:59+00:00 4 with Rudder 8.2@@/etc/yum.repos.d/rudder.repo@@2025-01-31 16:57:58+00:00##e12ae89a-7463-45fc-b0d2-b0e65f7d181c@#Skipping method 'File from a mustache template' with key parameter '/etc/yum.repos.d/rudder.repo' since condition 'redhat_rudder_password_provided_true' is not reached was not applicable
   info          upgrade_rudder_agent_on_| 50 - Rudder repository f| /etc/yum.repos.d/| Ensure permissions mode 644, owner root and group root on /etc/yum.repos.d/rudder.repo on type all with 0 recursion level was correct
E| compliant     upgrade_rudder_agent_on_| 50 - Rudder repository f| /etc/yum.repos.d/| Ensure permissions mode 644, owner root and group root on /etc/yum.repos.d/rudder.repo was correct

Files

clipboard-202502061427-8q1hx.png (64.1 KB) clipboard-202502061427-8q1hx.png Alexis Mousset, 2025-02-06 14:27
Actions #1

Updated by Elaad FURREEDAN 22 days ago

  • Priority changed from N/A to To review
Actions #2

Updated by Nicolas CHARLES 17 days ago

  • Assignee set to Alexis Mousset
  • Priority changed from To review to 1 (highest)

It is a multi-line because the variable value is

15


But we should support that gracefully

Actions #3

Updated by Alexis Mousset 17 days ago

  • Status changed from New to In progress
Actions #4

Updated by Alexis Mousset 17 days ago · Edited

The problem

The variable from command method produces a variable containing

15
4

for which the reporting works correctly. The value is then used as component for other methods, which break. The awk parser only handles multiline values for the message field, not others:

2025-01-31T16:57:59+00:00 R: @@upgrade_rudder_agent_on_redhat_families@@log_info@@740c5a88-e56f-4955-9a8f-3a6a1975c925@@c843af2b-7b80-464c-979c-48238b40645d@@8eb7e5fa-eb62-4fad-b03a-7c28f6d343db@@40-10 - Rudder public repository set to repository.rudder.io for OS 15
2025-01-31T16:57:59+00:00 4 with Rudder 8.2@@/etc/yum.repos.d/rudder.repo@@2025-01-31 16:57:58+00:00##e12ae89a-7463-45fc-b0d2-b0e65f7d181c@#Build file /etc/yum.repos.d/rudder.repo from mustache type template /var/rudder/cfengine-community/inputs/upgrade_rudder_agent_on_redhat_families/1.0/resources/rudder.public.repo.tpl was correct

On the relayd/server side, the line is parsed almost correctly (here with 15\n1):

The date is not removed from the beginning of the line.

What to do

  • We will fix the parsing problem in relayd to handle the value correctly.
  • On the awk side, a fix would require a massive change in how reports are parsed. This code is old and comes with absolutely no tests, so it would also be quite risky.
Actions #5

Updated by Alexis Mousset 17 days ago

  • Status changed from New to In progress
Actions #6

Updated by Alexis Mousset 17 days ago

  • Status changed from In progress to Pending technical review
  • Assignee changed from Alexis Mousset to Félix DALLIDET
  • Pull Request set to https://github.com/Normation/rudder/pull/6162
Actions #7

Updated by Alexis Mousset 17 days ago

  • Subject changed from The awk reports parser can break on multiline logs to The relayd reports parser can break on multiline fields in logs
Actions #8

Updated by Alexis Mousset 17 days ago

  • Status changed from Pending technical review to Pending release
Actions

Also available in: Atom PDF