Linux Service (systemd)
Use this page to run the collector as a background service on Linux.
Prerequisites
Section titled “Prerequisites”- Linux host with
systemd - Root privileges (
sudo) - Valid collector config file
Recommended License Path
Section titled “Recommended License Path”sudo install -d -m 0750 /etc/ms-teams-observability-agentsudo install -m 0640 -o root -g ms-teams-observability-agent \ ./license.json /etc/ms-teams-observability-agent/license.jsonlicense: filepath: /etc/ms-teams-observability-agent/license.jsonSecrets in the service environment
Section titled “Secrets in the service environment”A reference such as ${env:GRAPH_CLIENT_SECRET} in the configuration is resolved from
the environment of the collector process. For a systemd service, provide the secrets with
a drop-in that reads a root-owned file, instead of writing them in the installed YAML:
sudo install -d -m 0755 /etc/systemd/system/ms-teams-observability-agent@default.service.dsudo tee /etc/systemd/system/ms-teams-observability-agent@default.service.d/secrets.conf >/dev/null <<'EOF'[Service]EnvironmentFile=/etc/ms-teams-observability-agent/secrets.envEOF
# root:ms-teams-observability-agent 0640 — one KEY=value per linesudo install -m 0640 -o root -g ms-teams-observability-agent \ ./secrets.env /etc/ms-teams-observability-agent/secrets.env
sudo systemctl daemon-reloadsudo systemctl restart ms-teams-observability-agent@default.serviceGRAPH_CLIENT_SECRET=...SPLUNK_HEC_TOKEN=...Enable the Service
Section titled “Enable the Service”sudo ms-teams-agent service enable-service --config /absolute/path/config.yamlsudo ms-teams-agent service statusEnable a Named Service (Optional)
Section titled “Enable a Named Service (Optional)”sudo ms-teams-agent service enable-service \ --config /etc/ms-teams-observability-agent/prod.yaml \ --instance prod
sudo ms-teams-agent service status --instance prodCommon Operations
Section titled “Common Operations”sudo ms-teams-agent service status --instance defaultsudo ms-teams-agent service restart --instance defaultsudo systemctl status ms-teams-observability-agent@default.servicesudo journalctl -u ms-teams-observability-agent@default.service -fUpdate Configuration Safely
Section titled “Update Configuration Safely”-
Back up your config file.
-
Install updated config:
Terminal window sudo ms-teams-agent service install-config \--config /etc/ms-teams-observability-agent/prod.yaml \--instance prod \--service-restart-if-active -
Verify status and logs.
Disable the Service
Section titled “Disable the Service”sudo ms-teams-agent service disable-service --instance default