Operations
This page covers the day-to-day running of a production server: how it starts and stops, what to monitor, where logs go and how long history is kept, how to get alerted, and which environment variables reach your steps.
Running as a Service
The script installer sets up a service for you. To write one yourself, follow the page for your platform:
| Platform | Guide |
|---|---|
| Linux | systemd |
| macOS | launchd |
| Windows | Windows Service |
| Containers | Docker, Docker Compose, Kubernetes |
Whether runs in progress survive a restart depends on the service manager. See Keep Runs Across Restarts.
Graceful Shutdown
dagu start-all, dagu server, dagu scheduler, and dagu worker shut down on SIGTERM or SIGINT. Two settings decide what happens to the runs they started:
# config.yaml
signal_handling:
drain_timeout: 5m # DAGU_SIGNAL_DRAIN_TIMEOUT, default 0 (no wait)
enable_propagation: true # DAGU_SIGNAL_PROPAGATION, default falsedrain_timeoutlets runs finish before Dagu stops. Use it in containers, where stopping the container ends every run inside it. A worker also bounds the wait for its tasks withworker.shutdown_timeout(default60s).enable_propagationstops the remaining runs cleanly. Each run stops its steps within its cleanup time, runs itsabortandexithandlers, and records its final status. Runs that start after the signal arrives are not included.
While Dagu waits, a repeated SIGTERM is ignored, because container runtimes and service managers can send it more than once. A second SIGINT, such as pressing Ctrl+C again, exits immediately.
level=INFO msg="Waiting for running DAG processes to finish" processes=1 timeout=5m0s
level=INFO msg="Running DAG processes finished"When the timeout passes first, Dagu logs DAG processes still running after the drain timeout.
Give the service manager more time than the drain plus the slowest cleanup: raise TimeoutStopSec in a systemd unit, or stop_grace_period in Docker Compose. docker stop waits only 10 seconds by default.
Monitoring
| Need | Use |
|---|---|
| Failures, missed deadlines, and server health across many servers, with alerts | Dagu Console Monitoring |
| CPU, memory, disk, and load of one server | Resource Monitoring |
| Metrics for Prometheus and Grafana | Prometheus Metrics |
| Traces of runs and steps | OpenTelemetry |
| Liveness probes | GET /api/v1/health on the server, GET /health on port 8090 of dagu scheduler |
Monitoring Across Servers
Connect servers to Dagu Console and turn on Monitoring to see them in one place. Dagu Console alerts by email, chat, PagerDuty, or webhook when a workflow fails, misses its deadline, or runs far past its usual time, and when a server stops reporting or its disk is almost full. See Alerts and Email. The server reports over outbound HTTPS and sends metadata only.
Resource Monitoring
The System Status page charts the CPU, memory, disk, and load average of the server. Disk is the disk that holds the data directory. In a container with limits, CPU and memory are measured against those limits.
# config.yaml
monitoring:
retention: 24h # DAGU_MONITORING_RETENTION, how long history is kept in memory
interval: 5s # DAGU_MONITORING_INTERVAL, how often a sample is takenHistory is kept in memory and starts empty after a restart. To read it from a script:
curl -H "Authorization: Bearer $DAGU_API_TOKEN" \
'http://localhost:8080/api/v1/services/resources/history?duration=30m'duration defaults to 1h and is capped at retention. The endpoint needs the developer, manager, or admin role.
Prometheus Metrics
The server exposes metrics at /api/v1/metrics. See Prometheus Metrics for every metric, scrape settings, and example queries.
Logging
Dagu writes application logs (server, scheduler, worker, and run activity) to standard error, where the service manager collects them, plus optional HTTP access logs from the web server. Run logs and step output go to files under paths.log_dir.
| Setting | Env | Default | Effect |
|---|---|---|---|
log_format | DAGU_LOG_FORMAT | text | text or json |
debug | DAGU_DEBUG | false | Adds DEBUG messages with source locations, and request headers in access logs |
access_log_mode | DAGU_ACCESS_LOG_MODE | none | Which HTTP requests are logged; see below |
paths.log_dir | DAGU_LOG_DIR | $DAGU_HOME/logs | Where run logs and step output are written |
Request headers make each access log entry much larger, so turn debug on only while you diagnose a problem. Restart the server after changing these settings.
HTTP Access Logs
access_log_mode | Logs |
|---|---|
none | No HTTP requests. Application logs, warnings and errors included, are unaffected. |
non-public | Every request except the health, login, and initial setup endpoints, and the metrics endpoint when metrics are public. |
all | Every request. |
When a reverse proxy already records HTTP requests, keep none to avoid duplicate logs.
Log Cleanup
Each DAG keeps its run history for hist_retention_days days, 30 by default. Set it in a DAG, or in base.yaml for every DAG:
hist_retention_days: 7- Old runs are removed when the DAG starts its next run. A DAG that no longer runs keeps its history until you remove it.
- Removal deletes the run's log, step output, status files, sub-DAG logs, and artifact directory.
- To keep a number of runs instead of days, set
hist_retention_runs. A DAG cannot set both. 0means the default of 30 days. A negative value is rejected.
To remove history by hand, use dagu rm --history:
dagu rm -H --dry-run my-workflow # preview
dagu rm -H --older-than 30d my-workflow # remove runs older than 30 days
dagu rm -H -d my-workflow # remove history and the DAG fileThe command keeps active runs, and asks before it deletes unless --force is set. Use dagu history to review runs first, or dagu history --format json to export them.
Alerting
| Want | Use |
|---|---|
| Slack, Teams, Google Chat, email, Telegram, webhook, or command alerts managed in the web UI | Notifications |
| PagerDuty or SolarWinds incidents that open on failure and resolve on recovery | Incident Routing |
| Email from a DAG definition | Email Notifications |
| Any call from a DAG on failure or success | Lifecycle Handlers |
| Alerts from Prometheus | Alerting Rules |
| Alerts across servers | Dagu Console alerts |
Security
Environment Variable Filtering
Steps and sub-DAG runs do not inherit the whole environment of the Dagu process. Dagu passes an allowlist, and never passes its own credentials.
| Passed to steps | Names |
|---|---|
| Unix and macOS | PATH, HOME, USER, SHELL, TMPDIR, TERM, EDITOR, VISUAL, LANG, LC_ALL, LC_CTYPE, TZ, LD_LIBRARY_PATH, XDG_CONFIG_HOME, XDG_DATA_HOME, XDG_CACHE_HOME, XDG_STATE_HOME, DOCKER_HOST, DOCKER_TLS_VERIFY, DOCKER_CERT_PATH, DOCKER_API_VERSION |
| Windows | USERPROFILE, SYSTEMROOT, WINDIR, SYSTEMDRIVE, COMSPEC, PATHEXT, TEMP, TMP, PATH, PSMODULEPATH, HOME, TZ, APPDATA, LOCALAPPDATA, USERNAME, USERDOMAIN, PROGRAMFILES, PROGRAMFILES(X86), PROGRAMDATA, SSH_AUTH_SOCK, SSH_AGENT_PID, DOCKER_HOST, DOCKER_TLS_VERIFY, DOCKER_CERT_PATH, DOCKER_API_VERSION |
| All platforms, by prefix | DAGU_, DAG_, LC_, KUBERNETES_ |
Matching is case-sensitive on Unix and case-insensitive on Windows. To pass more variables that exist in the Dagu process environment, list them in the server configuration:
env_passthrough: # DAGU_ENV_PASSTHROUGH=SSL_CERT_FILE,HTTPS_PROXY
- SSL_CERT_FILE
- HTTPS_PROXY
env_passthrough_prefixes: # DAGU_ENV_PASSTHROUGH_PREFIXES=AWS_
- AWS_Every variable is still available for ${VAR} expansion while Dagu parses the DAG, so a workflow can copy a value into its own env:. See Environment Variables.
Dagu's own credentials are never passed or expanded, even though they start with DAGU_, and env_passthrough does not change this:
DAGU_AUTH_BASIC_PASSWORD,DAGU_AUTH_OIDC_CLIENT_SECRET,DAGU_AUTH_TOKEN_SECRET,DAGU_AUTH_BUILTIN_INITIAL_ADMIN_PASSWORDDAGU_ENCRYPTION_KEY,DAGU_SECRETS_VAULT_TOKEN,DAGU_LICENSE,DAGU_LICENSE_KEY,DAGU_CLOUD_RUN_KEYDAGU_PEER_TOKEN,DAGU_WORKER_INVITE,DAGU_TUNNEL_TAILSCALE_AUTH_KEYDAGU_GITSYNC_AUTH_TOKEN,DAGU_GITSYNC_AUTH_SSH_PASSPHRASE,DAGU_XLSX_PASSWORD- The
_FILEforms that name a file holding one of these, such asDAGU_AUTH_BASIC_PASSWORD_FILE. See Secrets From Files.
Dagu's own processes, such as the dagu start process that runs a DAG, still receive them. To give a step one of these values, declare it as a secret, which also masks it in logs:
secrets:
- name: VAULT_TOKEN
provider: env
key: DAGU_SECRETS_VAULT_TOKEN
steps:
- id: read_config
run: vault kv get secret/appSee Secrets for providers and masking.



