Skip to content

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:

PlatformGuide
Linuxsystemd
macOSlaunchd
WindowsWindows Service
ContainersDocker, 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:

yaml
# config.yaml
signal_handling:
  drain_timeout: 5m          # DAGU_SIGNAL_DRAIN_TIMEOUT, default 0 (no wait)
  enable_propagation: true   # DAGU_SIGNAL_PROPAGATION, default false
  • drain_timeout lets 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 with worker.shutdown_timeout (default 60s).
  • enable_propagation stops the remaining runs cleanly. Each run stops its steps within its cleanup time, runs its abort and exit handlers, 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.

text
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 ​

NeedUse
Failures, missed deadlines, and server health across many servers, with alertsDagu Console Monitoring
CPU, memory, disk, and load of one serverResource Monitoring
Metrics for Prometheus and GrafanaPrometheus Metrics
Traces of runs and stepsOpenTelemetry
Liveness probesGET /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.

Resource Usage charts on the System Status pageResource Usage charts on the System Status page

yaml
# 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 taken

History is kept in memory and starts empty after a restart. To read it from a script:

bash
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.

SettingEnvDefaultEffect
log_formatDAGU_LOG_FORMATtexttext or json
debugDAGU_DEBUGfalseAdds DEBUG messages with source locations, and request headers in access logs
access_log_modeDAGU_ACCESS_LOG_MODEnoneWhich HTTP requests are logged; see below
paths.log_dirDAGU_LOG_DIR$DAGU_HOME/logsWhere 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_modeLogs
noneNo HTTP requests. Application logs, warnings and errors included, are unaffected.
non-publicEvery request except the health, login, and initial setup endpoints, and the metrics endpoint when metrics are public.
allEvery 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:

yaml
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.
  • 0 means the default of 30 days. A negative value is rejected.

To remove history by hand, use dagu rm --history:

bash
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 file

The 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 ​

WantUse
Slack, Teams, Google Chat, email, Telegram, webhook, or command alerts managed in the web UINotifications
PagerDuty or SolarWinds incidents that open on failure and resolve on recoveryIncident Routing
Email from a DAG definitionEmail Notifications
Any call from a DAG on failure or successLifecycle Handlers
Alerts from PrometheusAlerting Rules
Alerts across serversDagu 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 stepsNames
Unix and macOSPATH, 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
WindowsUSERPROFILE, 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 prefixDAGU_, 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:

yaml
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_PASSWORD
  • DAGU_ENCRYPTION_KEY, DAGU_SECRETS_VAULT_TOKEN, DAGU_LICENSE, DAGU_LICENSE_KEY, DAGU_CLOUD_RUN_KEY
  • DAGU_PEER_TOKEN, DAGU_WORKER_INVITE, DAGU_TUNNEL_TAILSCALE_AUTH_KEY
  • DAGU_GITSYNC_AUTH_TOKEN, DAGU_GITSYNC_AUTH_SSH_PASSPHRASE, DAGU_XLSX_PASSWORD
  • The _FILE forms that name a file holding one of these, such as DAGU_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:

yaml
secrets:
  - name: VAULT_TOKEN
    provider: env
    key: DAGU_SECRETS_VAULT_TOKEN

steps:
  - id: read_config
    run: vault kv get secret/app

See Secrets for providers and masking.

Dagu is open source under the GNU General Public License v3.0.