Component
sight
Problem Statement
agentsight currently reads its SLS log upload path from runtime.sls_logtail_path in agentsight.json, but ilogtail is the canonical source of the cloud-distributed log path (SLS_LOG_PATH in /etc/anolisa/ilogtail.cfg). Operators need a switch that opts agentsight into ilogtail's path without manually editing the JSON config.
Proposed Solution
Add a background watcher thread that polls /etc/anolisa/enable_token_collector once per second:
- When the trigger file exists, parse
SLS_LOG_PATH from /etc/anolisa/ilogtail.cfg (INI key=value, supports single/double quotes) and write it to runtime.sls_logtail_path of the agentsight config file.
- When the trigger file is removed, clear
runtime.sls_logtail_path (write empty string).
The existing config-watcher detects the resulting IN_CLOSE_WRITE and activates the SLS LogtailExporter. This commit only adds the bridging layer — SLS activation logic is unchanged.
Implementation highlights:
- Enable
serde_json preserve_order so JSON field order stays stable across rewrites.
- State machine caches last applied state to skip redundant disk writes.
write_runtime_sls_path() is idempotent (no-op when value unchanged).
- Hardcoded production paths and 1s poll interval (no extra public API).
Alternatives Considered
- Embedding ilogtail.cfg parsing into the existing config-watcher: rejected — keeps watcher responsibilities mixed and forces tighter coupling to ilogtail's INI format.
- Inotify-only watch on the enable_file: rejected — file deletion + recreation cycles are simpler and more reliable to handle via 1s polling; deletions still propagate within 1 polling window.
Additional Context
- Tests:
- 13 unit tests in
src/unified.rs (read parsing + JSON rewriting + state-machine simulation).
scripts/int-test-token-collector.sh integration script: 9/9 PASS on a non-ECS host (phase 2 auto-skipped) and 10/10 PASS on a real ECS host with valid metadata where the disable→clear path is exercised end-to-end.
- Compatibility: Existing SLS uid validation guard at
AgentSight::new() is unchanged; bridging cannot loosen the safety check.
Component
sight
Problem Statement
agentsight currently reads its SLS log upload path from
runtime.sls_logtail_pathinagentsight.json, but ilogtail is the canonical source of the cloud-distributed log path (SLS_LOG_PATHin/etc/anolisa/ilogtail.cfg). Operators need a switch that opts agentsight into ilogtail's path without manually editing the JSON config.Proposed Solution
Add a background watcher thread that polls
/etc/anolisa/enable_token_collectoronce per second:SLS_LOG_PATHfrom/etc/anolisa/ilogtail.cfg(INIkey=value, supports single/double quotes) and write it toruntime.sls_logtail_pathof the agentsight config file.runtime.sls_logtail_path(write empty string).The existing config-watcher detects the resulting
IN_CLOSE_WRITEand activates the SLSLogtailExporter. This commit only adds the bridging layer — SLS activation logic is unchanged.Implementation highlights:
serde_jsonpreserve_orderso JSON field order stays stable across rewrites.write_runtime_sls_path()is idempotent (no-op when value unchanged).Alternatives Considered
Additional Context
src/unified.rs(read parsing + JSON rewriting + state-machine simulation).scripts/int-test-token-collector.shintegration script: 9/9 PASS on a non-ECS host (phase 2 auto-skipped) and 10/10 PASS on a real ECS host with valid metadata where the disable→clear path is exercised end-to-end.AgentSight::new()is unchanged; bridging cannot loosen the safety check.