-
Notifications
You must be signed in to change notification settings - Fork 111
Monitor rsyslog feature flag change and update rsyslog config by restart rsyslog-config service #245
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
qiluo-msft
merged 5 commits into
sonic-net:master
from
liuh-80:dev/liuh/monitor_rsyslog_change
Apr 29, 2025
Merged
Monitor rsyslog feature flag change and update rsyslog config by restart rsyslog-config service #245
qiluo-msft
merged 5 commits into
sonic-net:master
from
liuh-80:dev/liuh/monitor_rsyslog_change
Apr 29, 2025
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
11 tasks
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
qiluo-msft
reviewed
Apr 22, 2025
scripts/hostcfgd
Outdated
syslog.syslog(syslog.LOG_DEBUG, | ||
f'DeviceMetaCfg: syslog with os version: {syslog_with_osversion}') | ||
|
||
if syslog_with_osversion is None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
qiluo-msft
pushed a commit
to sonic-net/sonic-buildimage
that referenced
this pull request
Apr 29, 2025
Add OS version to rsyslog template. Why I did it Add OS version information to rsyslog will help investigation SONiC issue happened during OS upgrade. Work item tracking Microsoft ADO (number only): 31890431 How I did it Add OS version to rsyslog template Make this feature CONFIG_DB flag: DEVICE_METADATA table 'syslog_with_osversion' field A hostcfgd PR to restart rsyslog-config service accotding to config change: sonic-net/sonic-host-services#245 How to verify it Pass all test case. Manually verified the syslog contains version info after enable it.
qiluo-msft
approved these changes
Apr 29, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
sonic-net/sonic-buildimage#22111
Work item tracking
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"$ sudo cat /var/log/syslog | grep "DeviceMetaCfg"1
admin@vlab-01:
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"$ sudo cat /var/log/syslog | grep "DeviceMetaCfg"0
admin@vlab-01:
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.
Which release branch to backport (provide reason below if selected)
Tested branch (Please provide the tested image version)
Description for the changelog
Monitor rsyslog feature flag change and update rsyslog config by restart rsyslog-config service
Link to config_db schema for YANG module changes
A picture of a cute animal (not mandatory but encouraged)