diff options
| author | JP Dillingham <jp@dillingham.me> | 2023-11-04 16:42:10 -0500 |
|---|---|---|
| committer | JP Dillingham <jp@dillingham.me> | 2023-11-04 16:42:10 -0500 |
| commit | 540f1d24aa9625651c45d00cf5458392872ada1f (patch) | |
| tree | d73d5a8fae65cff9cd27f36a04196f77a540a460 | |
| parent | 8438098eb54bb586733bdeff8d675fed9f3744e8 (diff) | |
| download | slskd-540f1d24aa9625651c45d00cf5458392872ada1f.tar.gz | |
add option to disable disk logging
| -rw-r--r-- | config/slskd.example.yml | 1 | ||||
| -rw-r--r-- | docs/config.md | 12 | ||||
| -rw-r--r-- | src/slskd/Core/Options.cs | 9 |
3 files changed, 18 insertions, 4 deletions
diff --git a/config/slskd.example.yml b/config/slskd.example.yml index 138a5cb5..93a30a98 100644 --- a/config/slskd.example.yml +++ b/config/slskd.example.yml @@ -124,6 +124,7 @@ # incomplete: 43200 # 30 days # logs: 259200 # 180 days # logger: +# disk: true # loki: ~ # metrics: # enabled: false diff --git a/docs/config.md b/docs/config.md index c6325cfd..bd4cc124 100644 --- a/docs/config.md +++ b/docs/config.md @@ -838,18 +838,22 @@ instance_name: default ## Loggers -By default, the application logs to disk (`/logs` in the application directory). Logs can optionally be forwarded to external services, and the targets can be expanded to any service supported by a [Serilog Sink](https://github.com/serilog/serilog/wiki/Provided-Sinks). Support for targets is added on an as-needed basis and within reason. +By default, the application logs to console and to disk (`/logs` in the application directory); disk logging can be disabled. + +Logs can optionally be forwarded to external services, and the targets can be expanded to any service supported by a [Serilog Sink](https://github.com/serilog/serilog/wiki/Provided-Sinks). Support for targets is added on an as-needed basis and within reason. The current list of available targets is: -| Command Line | Environment Variable | Description | -| ------------ | -------------------------- | ---------------------------------- | -| `--loki` | `SLSKD_LOKI` | The URL to a Grafana Loki instance | +| Command Line | Environment Variable | Description | +| ------------------ | -------------------------- | ---------------------------------- | +| `--loki` | `SLSKD_LOKI` | The URL to a Grafana Loki instance | +| `--no-disk-logger` | `SLSKD_NO_DISK_LOGGER` | Disable logging to disk | #### **YAML** ```yaml logger: loki: ~ + disk: true ``` ## Metrics diff --git a/src/slskd/Core/Options.cs b/src/slskd/Core/Options.cs index 85cf133e..62334742 100644 --- a/src/slskd/Core/Options.cs +++ b/src/slskd/Core/Options.cs @@ -1082,6 +1082,15 @@ namespace slskd [Description("optional; url to a Grafana Loki instance to which to log")] [RequiresRestart] public string Loki { get; init; } = null; + + /// <summary> + /// Gets a value indicating whether to write logs to disk. + /// </summary> + [Argument(default, "no-disk-logger")] + [EnvironmentVariable("NO_DISK_LOGGER")] + [Description("disable logging to disk")] + [RequiresRestart] + public bool Disk { get; init; } = true; } /// <summary> |
