--- title: Writer weight: 4 menu: docs: parent: "vmanomaly-components" weight: 4 aliases: - /anomaly-detection/components/writer.html --- For exporting data, VictoriaMetrics Anomaly Detection (`vmanomaly`) primarily employs the [VmWriter](#vm-writer), which writes produced anomaly scores **(preserving initial labelset and optionally applying additional ones)** back to VictoriaMetrics. This writer is tailored for smooth data export within the VictoriaMetrics ecosystem. Future updates will introduce additional export methods, offering users more flexibility in data handling and integration. ## VM writer ### Config parameters
Parameter | Example | Description |
---|---|---|
`class` | `writer.vm.VmWriter` or `vm` starting from [`v1.13.0`](https://docs.victoriametrics.com/anomaly-detection/changelog/#v1130) | Name of the class needed to enable writing to VictoriaMetrics or Prometheus. VmWriter is the default option, if not specified. |
`datasource_url` | `http://localhost:8481/` | Datasource URL address |
`tenant_id` | `0:0`, `multitenant` (starting from [v1.16.2](https://docs.victoriametrics.com/anomaly-detection/changelog/#v1162)) | For VictoriaMetrics Cluster version only, tenants are identified by `accountID` or `accountID:projectID`. Starting from [v1.16.2](https://docs.victoriametrics.com/anomaly-detection/changelog/#v1162), `multitenant` [endpoint](https://docs.victoriametrics.com/cluster-victoriametrics/?highlight=writes#multitenancy-via-labels) is supported, to write data to multiple [tenants](https://docs.victoriametrics.com/cluster-victoriametrics/#multitenancy). See VictoriaMetrics Cluster [multitenancy docs](https://docs.victoriametrics.com/cluster-victoriametrics/#multitenancy) |
`metric_format` | `__name__: "vmanomaly_$VAR"` |
Metrics to save the output (in metric names or labels). Must have `__name__` key. Must have a value with `$VAR` placeholder in it to distinguish between resulting metrics. Supported placeholders:
|
`for: "$QUERY_KEY"` | ||
`run: "test_metric_format"` | ||
`config: "io_vm_single.yaml"` | ||
`import_json_path` | `/api/v1/import` | Optional, to override the default import path |
`health_path` | `/health` | Absolute or relative URL address where to check the availability of the datasource. Optional, to override the default `/health` path. |
`user` | `USERNAME` | BasicAuth username |
`password` | `PASSWORD` | BasicAuth password |
`timeout` | `5s` | Timeout for the requests, passed as a string |
`verify_tls` | `false` | Verify TLS certificate. If `False`, it will not verify the TLS certificate. If `True`, it will verify the certificate using the system's CA store. If a path to a CA bundle file (like `ca.crt`), it will verify the certificate using the provided CA bundle. |
`tls_cert_file` | `path/to/cert.crt` | Path to a file with the client certificate, i.e. `client.crt`. Available since [v1.16.3](https://docs.victoriametrics.com/anomaly-detection/changelog/#v1163). |
`tls_key_file` | `path/to/key.crt` | Path to a file with the client certificate key, i.e. `client.key`. Available since [v1.16.3](https://docs.victoriametrics.com/anomaly-detection/changelog/#v1163). |
`bearer_token` | `token` | Token is passed in the standard format with header: `Authorization: bearer {token}` |
`bearer_token_file` | `path_to_file` | Path to a file, which contains token, that is passed in the standard format with header: `Authorization: bearer {token}`. Available since [v1.15.9](https://docs.victoriametrics.com/anomaly-detection/changelog/#v1159) |