|
| 1 | +This guide explains how to use custom configuration file locations and |
| 2 | +dynamic configuration reloading in OpenObserve to manage deployments |
| 3 | +without system restarts. |
| 4 | + |
| 5 | +## Overview |
| 6 | +Earlier versions of OpenObserve only read the **.env** file from the current |
| 7 | +directory with no way to specify a different path. When running |
| 8 | +OpenObserve in different deployment modes (Kubernetes, virtual machines, |
| 9 | +and systemd services) existing frameworks require config files in |
| 10 | +specific locations. <br><br> |
| 11 | +Additionally, when configuration changes are needed, you need to restart |
| 12 | +the whole cluster or the system, which is expensive. They cause |
| 13 | +downtime, drop capacity and bandwidth, and you do not want to restart |
| 14 | +your whole cluster just to change a simple configuration like increasing |
| 15 | +an interval by 2 seconds. |
| 16 | +<br><br> |
| 17 | +OpenObserve now provides a custom config file CLI argument (`-c` or |
| 18 | +`--config`) to specify config files at any location, and a Config Watcher |
| 19 | +that monitors the config file and automatically reloads specific |
| 20 | +configurations every 30 seconds without requiring a restart. |
| 21 | + |
| 22 | +!!! note "Who should use this" |
| 23 | + These features are for you if you: |
| 24 | + |
| 25 | + - Deploy OpenObserve on virtual machines (VMs) |
| 26 | + - Run OpenObserve as systemd services or system daemons |
| 27 | + - Use custom deployment frameworks without container orchestration tools like Kubernetes |
| 28 | + - Need to avoid expensive restarts that cause downtime |
| 29 | + |
| 30 | +!!! note "Who does NOT need this" |
| 31 | + You do not need these features if you: |
| 32 | + |
| 33 | + - Deploy OpenObserve in Kubernetes clusters |
| 34 | + - Use container orchestration platforms |
| 35 | + |
| 36 | + **Why Kubernetes users do not need this** |
| 37 | + <br> |
| 38 | + In Kubernetes deployments: |
| 39 | + |
| 40 | + - Configurations are managed through ConfigMaps, Secrets, and environment variables in YAML manifests |
| 41 | + - Any configuration change automatically triggers pod restarts and rollouts |
| 42 | + - Kubernetes handles configuration updates through its native mechanisms |
| 43 | + - The .env file pattern is not used in containerized deployments |
| 44 | + |
| 45 | +## Custom config file CLI argument |
| 46 | + |
| 47 | +### What it does |
| 48 | +It adds a CLI argument to the OpenObserve binary that allows you to pass |
| 49 | +a path to a config file, adding flexibility to load environment |
| 50 | +variables from different files. Earlier versions strictly looked for the |
| 51 | +.env file in the current directory. |
| 52 | + |
| 53 | +### How to use |
| 54 | + |
| 55 | +```bash linenums="1" |
| 56 | +# Short form |
| 57 | +./openobserve -c /path/to/your/config/file |
| 58 | + |
| 59 | +``` |
| 60 | + |
| 61 | +```bash linenums="1" |
| 62 | +# Long form |
| 63 | +./openobserve --config /path/to/your/config/file |
| 64 | +``` |
| 65 | + |
| 66 | +## Dynamic configuration reload |
| 67 | + |
| 68 | +### What it does |
| 69 | +It adds a job to watch the config file. The watcher monitors the config |
| 70 | +file and reloads the configuration if any changes are detected, allowing |
| 71 | +configuration updates without restarting OpenObserve. |
| 72 | + |
| 73 | +### How it works |
| 74 | + |
| 75 | +- Runs every 30 seconds by default (configurable via `ZO_CONFIG_WATCHER_INTERVAL` environment variable) |
| 76 | +- Watches the active config file (.env by default, or custom file if specified using `-c` flag) |
| 77 | +- Detects changes to configuration values |
| 78 | +- Automatically reloads changes for reloadable configurations only |
| 79 | +- If no config file exists, the watcher remains inactive |
| 80 | + |
| 81 | +### Workflow example |
| 82 | + |
| 83 | +1. OpenObserve is running with a config file |
| 84 | +2. Edit the config file and change a reloadable configuration (for example, stream stats interval from 2 to 5 seconds) |
| 85 | +3. Wait up to 30 seconds |
| 86 | +4. Change is applied automatically without any restart and downtime |
| 87 | + |
| 88 | +### Limitation: Only specific configs are reloadable |
| 89 | + |
| 90 | +Any configuration not in the list below requires a full OpenObserve |
| 91 | +restart to take effect. |
| 92 | + |
| 93 | +### Reloadable environment variables |
| 94 | +| Category | Environment Variables | |
| 95 | +|----------|----------------------| |
| 96 | +| **Data Processing Intervals** | - ZO_FILE_PUSH_INTERVAL<br>- ZO_MEM_PERSIST_INTERVAL<br>- ZO_COMPACT_INTERVAL<br>- ZO_COMPACT_OLD_DATA_INTERVAL<br>- ZO_COMPACT_SYNC_TO_DB_INTERVAL<br>- ZO_COMPACT_JOB_RUN_TIMEOUT<br>- ZO_COMPACT_JOB_CLEAN_WAIT_TIME<br>- ZO_COMPACT_PENDING_JOBS_METRIC_INTERVAL | |
| 97 | +| **Cache Management** | - ZO_MEMORY_CACHE_GC_INTERVAL<br>- ZO_MEMORY_CACHE_MAX_SIZE<br>- ZO_MEMORY_CACHE_DATAFUSION_MAX_SIZE<br>- ZO_DISK_CACHE_GC_INTERVAL<br>- ZO_DISK_CACHE_MAX_SIZE<br>- ZO_DISK_CACHE_SKIP_SIZE<br>- ZO_DISK_CACHE_RELEASE_SIZE<br>- ZO_DISK_CACHE_GC_SIZE<br>- ZO_S3_SYNC_TO_CACHE_INTERVAL | |
| 98 | +| **Metrics and Monitoring** | - ZO_METRICS_LEADER_PUSH_INTERVAL<br>- ZO_METRICS_LEADER_ELECTION_INTERVAL<br>- ZO_CALCULATE_STATS_INTERVAL<br>- ZO_CALCULATE_STATS_STEP_LIMIT<br>- ZO_TELEMETRY_HEARTBEAT | |
| 99 | +| **Scheduling** | - ZO_ALERT_SCHEDULE_INTERVAL<br>- ZO_DERIVED_STREAM_SCHEDULE_INTERVAL<br>- ZO_SCHEDULER_CLEAN_INTERVAL<br>- ZO_SCHEDULER_WATCH_INTERVAL<br>- ZO_SEARCH_JOB_SCHEDULE_INTERVAL<br>- ZO_SEARCH_JOB_SCHEDULER_INTERVAL<br>- ZO_DISTINCT_VALUES_INTERVAL | |
| 100 | +| **Job and Process Timeouts** | - ZO_SEARCH_JOB_TIMEOUT<br>- ZO_SEARCH_JOB_RUN_TIMEOUT<br>- ZO_SEARCH_JOB_RETENTION<br>- ZO_SEARCH_JOB_DELETE_INTERVAL<br>- ZO_HEALTH_CHECK_TIMEOUT | |
| 101 | +| **Memory and Buffer Sizes** | - ZO_MEMORY_CACHE_SKIP_SIZE<br>- ZO_MEMORY_CACHE_RELEASE_SIZE<br>- ZO_MEMORY_CACHE_GC_SIZE<br>- ZO_MEM_TABLE_MAX_SIZE | |
| 102 | +| **File Sizes** | - ZO_MAX_FILE_SIZE_ON_DISK<br>- ZO_MAX_FILE_SIZE_IN_MEMORY<br>- ZO_MAX_FILE_RETENTION_TIME<br>- ZO_COMPACT_MAX_FILE_SIZE | |
| 103 | +| **Network and Protocol Sizes** | - ZO_STREAMING_RESPONSE_CHUNK_SIZE_MB | |
| 104 | +| **Batch Sizes** | - ZO_COMPACT_BATCH_SIZE<br>- ZO_EVENTS_BATCH_SIZE | |
| 105 | +| **Pipeline Configuration** | - ZO_PIPELINE_OFFSET_FLUSH_INTERVAL<br>- ZO_PIPELINE_REMOTE_REQUEST_TIMEOUT<br>- ZO_PIPELINE_WAL_SIZE_LIMIT<br>- ZO_PIPELINE_BATCH_SIZE<br>- ZO_PIPELINE_BATCH_TIMEOUT_MS<br>- ZO_PIPELINE_BATCH_SIZE_BYTES<br>- ZO_PIPELINE_BATCH_RETRY_INITIAL_DELAY_MS<br>- ZO_PIPELINE_BATCH_RETRY_MAX_DELAY_MS<br>- ZO_PIPELINE_MAX_FILE_SIZE_ON_DISK_MB | |
| 106 | +| **WAL and Buffer Configurations** | - ZO_WAL_WRITE_BUFFER_SIZE<br>- ZO_WAL_WRITE_QUEUE_SIZE | |
| 107 | +| **Search Group Configuration** | - O2_SEARCH_GROUP_BASE_SECS<br>- O2_SEARCH_GROUP_BASE_SPEED<br>- O2_SEARCH_GROUP_LONG_MAX_CPU<br>- O2_SEARCH_GROUP_SHORT_MAX_CPU<br>- O2_SEARCH_GROUP_LONG_MAX_CONCURRENCY<br>- O2_SEARCH_GROUP_SHORT_MAX_CONCURRENCY<br>- O2_SEARCH_GROUP_LONG_MAX_MEMORY<br>- O2_SEARCH_GROUP_SHORT_MAX_MEMORY<br>- O2_SEARCH_GROUP_USER_SHORT_MAX_CONCURRENCY<br>- O2_SEARCH_GROUP_USER_LONG_MAX_CONCURRENCY | |
| 108 | +| **AI Configuration** | - O2_AI_ENABLED<br>- O2_AI_API_URL<br>- O2_AI_MODEL<br>- O2_AI_PROVIDER<br>- O2_AI_API_KEY | |
| 109 | +| **Other Configurations** | - ZO_ROUTE_MAX_CONNECTIONS<br>- ZO_ENRICHMENT_TABLE_MERGE_INTERVAL<br>- ZO_DOWNSAMPLING_DOWNSAMPLING_INTERVAL<br>- ZO_DATAFUSION_FILE_STAT_CACHE_MAX_ENTRIES<br>- ZO_SCHEMA_MAX_FIELDS_TO_ENABLE_UDS | |
0 commit comments