Skip to content

Conversation

Copy link

Copilot AI commented Dec 4, 2025

Summary (non-technical, complete)

Fixes test failures on systems with mixed-case hostnames (e.g., build32U10b32b1b199). The DNS cache was incorrectly lowercasing hostnames when they should preserve the original case from DNS resolution.

References

Refs: https://github.com/rsyslog/rsyslog/issues/PLACEHOLDER (issue describing parsertest-parse1-udp.sh failure on cloud hosts)

Notes

Root cause: runtime/dnscache.c:setLocalHostName() was using fqdnLowerCase instead of fqdn when creating the localName property.

What changed:

  • Extract hostname from case-preserved fqdn property (not fqdnLowerCase)
  • Create new property when extracting short hostname from FQDN
  • Preserves behavior: fqdnLowerCase still available for case-insensitive matching

Before/After:

// Before: always lowercased
etry->localName = etry->fqdnLowerCase;  // "myhost.example.com" → "myhost"

// After: case preserved
fqdnStr = propGetSzStr(etry->fqdn);     // "MyHost.example.com" → "MyHost"
prop.CreateStringProp(&etry->localName, hostbuf, i);

Impact: UDP messages without hostnames now preserve case from reverse DNS. Affects:

  • parsertest-parse1-udp.sh
  • parsertest-parse-nodate-udp.sh
  • Any UDP-based test relying on source hostname

Most existing deployments unaffected (hostnames typically lowercase by convention).


Quick check (optional)

  • Commit message follows rules (ASCII; title ≤62, body ≤72; <component>:).
  • Commit message includes non-technical "why", Impact (if behavior/tests changed), and a one-line Before/After when behavior changed.
  • Used the Commit Assistant or mirrored its structure.
Original prompt

使用一台云主机编译rsyslog的时候,rsyslog tests 用例parsertest-parse1-udp.sh失败,日志报错信息如下,请帮助分析原因,并解决问题。 tr: write error: Broken pipe
testbench: TZ env var not set, setting it to UTC

01:55:00[0] Test: ./parsertest-parse1-udp.sh

Obtaining HOSTNAME (prerequisite, not actual test)

config rstb_607389_d1146e46d42O_.conf is:
1 module(load="../plugins/imdiag/.libs/imdiag")
2 global(inputs.timeout.shutdown="60000"
3 default.action.queue.timeoutshutdown="20000"
4 default.action.queue.timeoutEnqueue="20000")
5 # use legacy-style for the following settings so that we can override if needed
6 $MainmsgQueueTimeoutEnqueue 20000
7 $MainmsgQueueTimeoutShutdown 10000
8 $IMDiagListenPortFileName rstb_607389_d1146e46d42O.imdiag.port
9 $IMDiagServerRun 0
10 $IMDiagAbortTimeout 580
11
12 :syslogtag, contains, "rsyslogd" ./rstb_607389_d1146e46d42O.started
13 ###### end of testbench instrumentation part, test conf follows:
14 module(load="../plugins/imtcp/.libs/imtcp")
15 input(type="imtcp" port="0" listenPortFileName="rstb_607389_d1146e46d42O.tcpflood_port")
16
17 $template hostname,"%hostname%"
18 local0.* ./rstb_607389_d1146e46d42O.HOSTNAME;hostname
rsyslogd: NOTE: RSYSLOG_DEBUG_TIMEOUTS_TO_STDERR activated
main Q:Reg: worker start requested, num workers currently 0
main Q:Reg: wrkr start initiated with state 0, num workers now 1
rsyslog debug: main Q:Reg: worker 0xaaaeb2314660 started
rsyslog debug: main Q:Reg: started with state 3, num workers now 1
01:55:00[0] rstb_607389_d1146e46d42O:.pid found, pid 2477558
01:55:00[0] rsyslogd startup msg seen, pid 2477558
waiting for file rstb_607389_d1146e46d42O.imdiag.port
imdiag port: 43797
waiting for file rstb_607389_d1146e46d42O.tcpflood_port
TCPFLOOD_PORT now: 36821
starting run 1
Sending 1 messages.

00000001 messages sent
runtime: 0.000
End of tcpflood Run
Shutting down instance 1
imdiag: wait q_empty: qsize 0 nempty 1
imdiag[43797]: mainqueue empty
rsyslogd debug: info: trying to cooperatively stop input ../plugins/imdiag/.libs/imdiag, timeout 60000 ms
rsyslogd debug: info: trying to cooperatively stop input imtcp, timeout 60000 ms
rsyslog debug: main Q:Reg/w0: enter WrkrExecCleanup
rsyslog debug: 0xaaaeb23147f0: worker exiting
rsyslog debug: main Q:Reg/w0: thread joined
01:55:01[1] wait on shutdown of 2477558
HOSTNAME is: build32U10b32b1b199
mkdir: cannot create directory 'rstb_607389_d1146e46d42O.spool': File exists
config rstb_607389_d1146e46d42O_.conf is:
1 module(load="../plugins/imdiag/.libs/imdiag")
2 global(inputs.timeout.shutdown="60000"
3 default.action.queue.timeoutshutdown="20000"
4 default.action.queue.timeoutEnqueue="20000")
5 # use legacy-style for the following settings so that we can override if needed
6 $MainmsgQueueTimeoutEnqueue 20000
7 $MainmsgQueueTimeoutShutdown 10000
8 $IMDiagListenPortFileName rstb_607389_d1146e46d42O.imdiag.port
9 $IMDiagServerRun 0
10 $IMDiagAbortTimeout 580
11
12 :syslogtag, contains, "rsyslogd" ./rstb_607389_d1146e46d42O.started
13 ###### end of testbench instrumentation part, test conf follows:
14
15 module(load="../plugins/imudp/.libs/imudp")
16 input(type="imudp" port="54403" ruleset="ruleset1")
17
18 global(localHostname="localhost")
19
20 template(name="outfmt" type="string" string="%PRI%,%syslogfacility-text%,%syslogseverity-text%,%timestamp%,%hostname%,%programname%,%syslogtag%,%msg%\n")
21
22 ruleset(name="ruleset1") {
23 action(type="omfile" file=echo $RSYSLOG_OUT_LOG
24 template="outfmt")
25 }
26
rsyslogd: NOTE: RSYSLOG_DEBUG_TIMEOUTS_TO_STDERR activated
main Q:Reg: worker start requested, num workers currently 0
main Q:Reg: wrkr start initiated with state 0, num workers now 1
rsyslog debug: main Q:Reg: worker 0xaaacd7cc5540 started
rsyslog debug: main Q:Reg: started with state 3, num workers now 1
01:55:01[1] rstb_607389_d1146e46d42O:.pid found, pid 2477609
01:55:01[1] rsyslogd startup msg seen, pid 2477609
waiting for file rstb_607389_d1146e46d42O.imdiag.port
imdiag port: 40363
starting run 1
Sending 1 messages.

00000001 messages sent
runtime: 0.000
End of tcpflood Run
starting run 1
Sending 1 messages.

00000001 messages sent
runtime: 0.000
End of tcpflood Run
starting run 1
Sending 1 messages.

00000001 messages sent
runtime: 0.000
End of tcpflood Run
starting run 1
Sending 1 messages.

00000001 messages sent
runtime: 0.000
End of tcpflood Run
starting run 1
Sending 1 messages.

00000001 messages sent
runtime: 0.000
End of tcpflood Run
starting run 1
Sending 1 messages.

00000001 messages sent
runtime: 0.000
End of tcpflood Run
starting run 1
Sending 1 messages.

00000001 messages sent
runtime: 0.000
End of tcpflood ...


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits December 4, 2025 06:26
The dnscache.c setLocalHostName() function was incorrectly using
the lowercase version (fqdnLowerCase) when creating the localName
property. This caused hostnames to be lowercased even when case
preservation was expected.

Changes:
- Use fqdn instead of fqdnLowerCase to preserve original case
- Extract hostname portion from case-preserved fqdn
- Create new property with correct case for localName

This fixes the parsertest-parse1-udp.sh test failure where
hostnames like build32U10b32b1b199 were being lowercased to
build32u10b32b1b199.

Co-authored-by: linker99 <[email protected]>
Copilot AI changed the title [WIP] Fix rsyslog parsertest-parse1-udp.sh failure dnscache: preserve hostname case in localName property Dec 4, 2025
Copilot AI requested a review from linker99 December 4, 2025 06:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants