Commit 8237b5d
authored
Monitor rsyslog feature flag change and update rsyslog config by restart rsyslog-config service (#245)
Monitor rsyslog feature flag change and update rsyslog config by restart rsyslog-config service
#### Why I did it
Another PR add new feature flag syslog_with_osversion
#22111
##### Work item tracking
- Microsoft ADO **(number only)**: 31890431
#### How I did it
Update hostcfgd to minitor DEVICE_METADATA table change and restart rsyslog-config service to update rsyslog template.
#### How to verify it
Pass all test case.
Manually verified the code change work:
admin@vlab-01:~$ sonic-db-cli CONFIG_DB hset "DEVICE_METADATA|localhost" "syslog_with_osversion" "true"
1
admin@vlab-01:~$ sudo cat /var/log/syslog | grep "DeviceMetaCfg"
2025 Apr 22 08:38:12.642805 vlab-01 INFO hostcfgd: DeviceMetaCfg: Restart rsyslog-config after feature flag change to true
admin@vlab-01:~$ sonic-db-cli CONFIG_DB hset "DEVICE_METADATA|localhost" "syslog_with_osversion" "false"
0
admin@vlab-01:~$ sudo cat /var/log/syslog | grep "DeviceMetaCfg"
2025 Apr 22 08:38:41.561592 vlab-01 INFO hostcfgd: DeviceMetaCfg: Restart rsyslog-config after feature flag change to false
admin@vlab-01:~$ sudo systemctl status rsyslog-config
● rsyslog-config.service - Update rsyslog configuration
Loaded: loaded (/lib/systemd/system/rsyslog-config.service; enabled-runtime; preset: enabled)
Active: active (exited) since Tue 2025-04-22 08:38:41 UTC; 23s ago
Process: 846029 ExecStart=/usr/bin/rsyslog-config.sh (code=exited, status=0/SUCCESS)
Main PID: 846029 (code=exited, status=0/SUCCESS)
Apr 22 08:38:40 vlab-01 systemd[1]: Starting rsyslog-config.service - Update rsyslog configuration...
Apr 22 08:38:41 vlab-01 systemd[1]: Finished rsyslog-config.service - Update rsyslog configuration.
#### Description for the changelog
Monitor rsyslog feature flag change and update rsyslog config by restart rsyslog-config service1 parent 55cee71 commit 8237b5d
2 files changed
+46
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1423 | 1423 | | |
1424 | 1424 | | |
1425 | 1425 | | |
| 1426 | + | |
1426 | 1427 | | |
1427 | 1428 | | |
1428 | 1429 | | |
| |||
1431 | 1432 | | |
1432 | 1433 | | |
1433 | 1434 | | |
| 1435 | + | |
1434 | 1436 | | |
1435 | 1437 | | |
1436 | 1438 | | |
| |||
1491 | 1493 | | |
1492 | 1494 | | |
1493 | 1495 | | |
| 1496 | + | |
| 1497 | + | |
| 1498 | + | |
| 1499 | + | |
| 1500 | + | |
| 1501 | + | |
| 1502 | + | |
| 1503 | + | |
| 1504 | + | |
| 1505 | + | |
| 1506 | + | |
| 1507 | + | |
| 1508 | + | |
| 1509 | + | |
| 1510 | + | |
| 1511 | + | |
| 1512 | + | |
| 1513 | + | |
| 1514 | + | |
| 1515 | + | |
| 1516 | + | |
| 1517 | + | |
| 1518 | + | |
| 1519 | + | |
| 1520 | + | |
| 1521 | + | |
1494 | 1522 | | |
1495 | 1523 | | |
1496 | 1524 | | |
| |||
2281 | 2309 | | |
2282 | 2310 | | |
2283 | 2311 | | |
| 2312 | + | |
2284 | 2313 | | |
2285 | 2314 | | |
2286 | 2315 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
247 | 247 | | |
248 | 248 | | |
249 | 249 | | |
| 250 | + | |
250 | 251 | | |
251 | 252 | | |
252 | 253 | | |
| |||
306 | 307 | | |
307 | 308 | | |
308 | 309 | | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
309 | 326 | | |
310 | 327 | | |
311 | 328 | | |
| |||
0 commit comments