You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* feat(logging): add fluent-bit log shipping
Implements #3430.
This PR is partially implemented using Cursor.
* Fix pyright errors by using try/except/else pattern for optional imports
* refactor(fluentbit): cleanup protocol lambdas and address codex comments
* feat(fluentbit): validate next_token format and raise ServerClientError for malformed tokens
* chore(fluentbit): address quick comments
* feat(fluentbit): add tag prefix support to HTTPFluentBitWriter
The following optional environment variables can be used to customize the Fluent-bit integration:
257
+
258
+
**Fluent-bit settings:**
259
+
260
+
- `DSTACK_SERVER_FLUENTBIT_PORT` – The Fluent-bit port. Defaults to `24224`.
261
+
- `DSTACK_SERVER_FLUENTBIT_PROTOCOL` – The protocol to use: `forward` or `http`. Defaults to `forward`.
262
+
- `DSTACK_SERVER_FLUENTBIT_TAG_PREFIX` – The tag prefix for logs. Defaults to `dstack`.
263
+
264
+
**Elasticsearch/OpenSearch settings (for full mode only):**
265
+
266
+
- `DSTACK_SERVER_ELASTICSEARCH_HOST` – The Elasticsearch/OpenSearch host for reading logs. If not set, runs in ship-only mode.
267
+
- `DSTACK_SERVER_ELASTICSEARCH_INDEX` – The Elasticsearch/OpenSearch index pattern. Defaults to `dstack-logs`.
268
+
- `DSTACK_SERVER_ELASTICSEARCH_API_KEY` – The Elasticsearch/OpenSearch API key for authentication.
269
+
270
+
??? info "Fluent-bit configuration"
271
+
Configure Fluent-bit to receive logs and forward them to Elasticsearch or OpenSearch. Example configuration:
272
+
273
+
```ini
274
+
[INPUT]
275
+
Name forward
276
+
Listen 0.0.0.0
277
+
Port 24224
278
+
279
+
[OUTPUT]
280
+
Name es
281
+
Match dstack.*
282
+
Host elasticsearch.example.com
283
+
Port 9200
284
+
Index dstack-logs
285
+
Suppress_Type_Name On
286
+
```
287
+
288
+
??? info "Required dependencies"
289
+
To use Fluent-bit log storage, install the `fluentbit` extras:
290
+
291
+
```shell
292
+
$ pip install "dstack[all]" -U
293
+
# or
294
+
$ pip install "dstack[fluentbit]" -U
295
+
```
296
+
225
297
## File storage
226
298
227
299
When using [files](../concepts/dev-environments.md#files) or [repos](../concepts/dev-environments.md#repos), `dstack` uploads local files and diffs to the server so that you can have access to them within runs. By default, the files are stored in the DB and each upload is limited to 2MB. You can configure an object storage to be used for uploads and increase the default limit by setting the `DSTACK_SERVER_CODE_UPLOAD_LIMIT` environment variable
@@ -426,8 +498,10 @@ If a deployment is stuck due to a deadlock when applying DB migrations, try scal
426
498
427
499
??? info "Can I run multiple replicas of dstack server?"
428
500
429
-
Yes, you can if you configure `dstack` to use [PostgreSQL](#postgresql) and [AWS CloudWatch](#aws-cloudwatch).
501
+
Yes, you can if you configure `dstack` to use [PostgreSQL](#postgresql) and an external log storage
502
+
such as [AWS CloudWatch](#aws-cloudwatch), [GCP Logging](#gcp-logging), or [Fluent-bit](#fluent-bit).
430
503
431
504
??? info "Does dstack server support blue-green or rolling deployments?"
432
505
433
-
Yes, it does if you configure `dstack` to use [PostgreSQL](#postgresql) and [AWS CloudWatch](#aws-cloudwatch).
506
+
Yes, it does if you configure `dstack` to use [PostgreSQL](#postgresql) and an external log storage
507
+
such as [AWS CloudWatch](#aws-cloudwatch), [GCP Logging](#gcp-logging), or [Fluent-bit](#fluent-bit).
Copy file name to clipboardExpand all lines: docs/docs/reference/environment-variables.md
+7Lines changed: 7 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -113,6 +113,13 @@ For more details on the options below, refer to the [server deployment](../guide
113
113
- `DSTACK_SERVER_CLOUDWATCH_LOG_GROUP`{ #DSTACK_SERVER_CLOUDWATCH_LOG_GROUP } – The CloudWatch Logs group for storing workloads logs. If not set, the default file-based log storage is used.
114
114
- `DSTACK_SERVER_CLOUDWATCH_LOG_REGION`{ #DSTACK_SERVER_CLOUDWATCH_LOG_REGION } – The CloudWatch Logs region. Defaults to `None`.
115
115
- `DSTACK_SERVER_GCP_LOGGING_PROJECT`{ #DSTACK_SERVER_GCP_LOGGING_PROJECT } – The GCP Logging project for storing workloads logs. If not set, the default file-based log storage is used.
116
+
- `DSTACK_SERVER_FLUENTBIT_HOST`{ #DSTACK_SERVER_FLUENTBIT_HOST } – The Fluent-bit host for log forwarding. If set, enables Fluent-bit log storage.
117
+
- `DSTACK_SERVER_FLUENTBIT_PORT`{ #DSTACK_SERVER_FLUENTBIT_PORT } – The Fluent-bit port. Defaults to `24224`.
118
+
- `DSTACK_SERVER_FLUENTBIT_PROTOCOL`{ #DSTACK_SERVER_FLUENTBIT_PROTOCOL } – The protocol to use: `forward` or `http`. Defaults to `forward`.
119
+
- `DSTACK_SERVER_FLUENTBIT_TAG_PREFIX`{ #DSTACK_SERVER_FLUENTBIT_TAG_PREFIX } – The tag prefix for logs. Defaults to `dstack`.
120
+
- `DSTACK_SERVER_ELASTICSEARCH_HOST`{ #DSTACK_SERVER_ELASTICSEARCH_HOST } – The Elasticsearch/OpenSearch host for reading logs back through dstack. Optional; if not set, Fluent-bit runs in ship-only mode (logs are forwarded but not readable through dstack UI/CLI).
121
+
- `DSTACK_SERVER_ELASTICSEARCH_INDEX`{ #DSTACK_SERVER_ELASTICSEARCH_INDEX } – The Elasticsearch/OpenSearch index pattern. Defaults to `dstack-logs`.
122
+
- `DSTACK_SERVER_ELASTICSEARCH_API_KEY`{ #DSTACK_SERVER_ELASTICSEARCH_API_KEY } – The Elasticsearch/OpenSearch API key for authentication.
- `DSTACK_DEFAULT_SERVICE_CLIENT_MAX_BODY_SIZE`{ #DSTACK_DEFAULT_SERVICE_CLIENT_MAX_BODY_SIZE } – Request body size limit for services running with a gateway, in bytes. Defaults to 64 MiB.
118
125
- `DSTACK_SERVICE_CLIENT_TIMEOUT`{ #DSTACK_SERVICE_CLIENT_TIMEOUT } – Timeout in seconds for HTTP requests sent from the in-server proxy and gateways to service replicas. Defaults to 60.
0 commit comments