Add OS version to rsyslog template.#22111
Merged
qiluo-msft merged 12 commits intosonic-net:masterfrom Apr 29, 2025
Merged
Conversation
Contributor
Author
|
/azpw run Azure.sonic-buildimage |
Collaborator
|
/AzurePipelines run Azure.sonic-buildimage |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Collaborator
|
/azp run Azure.sonic-buildimage |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Collaborator
|
/azp run Azure.sonic-buildimage |
|
Azure Pipelines will not run the associated pipelines, because the pull request was updated after the run command was issued. Review the pull request again and issue a new run command. |
Collaborator
|
/azp run Azure.sonic-buildimage |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Contributor
Author
|
/azpw run Azure.sonic-buildimage |
Collaborator
|
/AzurePipelines run Azure.sonic-buildimage |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Collaborator
|
/azp run Azure.sonic-buildimage |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Collaborator
|
/azp run Azure.sonic-buildimage |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Collaborator
|
/azp run Azure.sonic-buildimage |
|
Azure Pipelines will not run the associated pipelines, because the pull request was updated after the run command was issued. Review the pull request again and issue a new run command. |
Collaborator
|
/azp run Azure.sonic-buildimage |
|
Azure Pipelines successfully started running 1 pipeline(s). |
qiluo-msft
reviewed
Apr 18, 2025
11 tasks
qiluo-msft
approved these changes
Apr 22, 2025
qiluo-msft
reviewed
Apr 22, 2025
|
|
||
| hostname=$(hostname) | ||
|
|
||
| syslog_with_osversion=$(sonic-db-cli CONFIG_DB hget "DEVICE_METADATA|localhost" "syslog_with_osversion") |
Collaborator
Collaborator
|
/azp run Azure.sonic-buildimage |
|
Azure Pipelines will not run the associated pipelines, because the pull request was updated after the run command was issued. Review the pull request again and issue a new run command. |
Collaborator
|
/azp run Azure.sonic-buildimage |
|
Azure Pipelines will not run the associated pipelines, because the pull request was updated after the run command was issued. Review the pull request again and issue a new run command. |
Contributor
Author
|
/azpw run Azure.sonic-buildimage |
Collaborator
|
/AzurePipelines run Azure.sonic-buildimage |
|
Azure Pipelines will not run the associated pipelines, because the pull request was updated after the run command was issued. Review the pull request again and issue a new run command. |
Collaborator
|
/azp run Azure.sonic-buildimage |
|
Azure Pipelines successfully started running 1 pipeline(s). |
qiluo-msft
approved these changes
Apr 29, 2025
qiluo-msft
pushed a commit
to sonic-net/sonic-host-services
that referenced
this pull request
Apr 29, 2025
…art 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 sonic-net/sonic-buildimage#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 service
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
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.
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
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.
Which release branch to backport (provide reason below if selected)
Tested branch (Please provide the tested image version)
Description for the changelog
Add OS version to rsyslog template.
Link to config_db schema for YANG module changes
A picture of a cute animal (not mandatory but encouraged)