logging: start Alloy after dynamic hostname setter when enabled #1684
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.
Description of Changes
This PR fixes an issue where net-vm logs were missing in Grafana, while logs from other VMs on the same device were still present (https://jira.tii.ae/browse/SSRCSP-7542).
In net-vm, the hostname is set dynamically and is later exposed by journald as
__journal__hostname, which is used byalloy.serviceto label and ship logs. In some cases,alloy.servicewas starting before the dynamic hostname was set, leading to inconsistent or missing net-vm logs when filtering by machine/device identifier.To avoid this race,
alloy.serviceis now started after the dynamic hostname setter service, but only when that service is enabled.Type of Change
Related Issues / Tickets
https://jira.tii.ae/browse/SSRCSP-7542
Checklist
make-checksand it passesTesting Instructions
Applicable Targets
aarch64aarch64x86_64x86_64x86_64Installation Method
nixos-rebuild ... switchTest Steps To Verify:
net-vm2.1.
[ghaf@ghaf-0013702975:~]$ logger "testing this PR"3.1. Plese note that the
hoston Grafana should be set as the dynamic hosname (e.g., ghaf-0013702975)3.2. You should be able to visualize all the logs from net-vm (using the dynamic hostname), including the new generated log: