|
| 1 | +--- |
| 2 | +# generated by https://github.com/hashicorp/terraform-plugin-docs |
| 3 | +page_title: "logtail_collector Resource - terraform-provider-logtail" |
| 4 | +subcategory: "" |
| 5 | +description: |- |
| 6 | + This resource allows you to create, modify, and delete Better Stack Collectors. For more information about the Collectors API check https://betterstack.com/docs/logs/api/collectors/ |
| 7 | +--- |
| 8 | + |
| 9 | +# logtail_collector (Resource) |
| 10 | + |
| 11 | +This resource allows you to create, modify, and delete Better Stack Collectors. For more information about the Collectors API check https://betterstack.com/docs/logs/api/collectors/ |
| 12 | + |
| 13 | +## Example Usage |
| 14 | + |
| 15 | +```terraform |
| 16 | +# Collector with dual-layer VRL: on-host PII redaction + server-side enrichment |
| 17 | +resource "logtail_collector" "production" { |
| 18 | + name = "Production Docker" |
| 19 | + platform = "docker" |
| 20 | + note = "Docker hosts with PII redaction for GDPR compliance" |
| 21 | +
|
| 22 | + logs_retention = 30 |
| 23 | + metrics_retention = 90 |
| 24 | +
|
| 25 | + # On-host VRL runs inside your infrastructure — raw data never leaves your network |
| 26 | + configuration { |
| 27 | + vrl_transformation = <<-EOT |
| 28 | + # Redact e-mail addresses |
| 29 | + if is_string(.message) { |
| 30 | + .message = replace!(.message, r'[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}', "[REDACTED_EMAIL]") |
| 31 | + } |
| 32 | + # Redact known PII fields |
| 33 | + if exists(.user_email) { .user_email = "[REDACTED]" } |
| 34 | + if exists(.client_ip) { .client_ip = "[REDACTED]" } |
| 35 | + EOT |
| 36 | +
|
| 37 | + components { |
| 38 | + logs_host = true |
| 39 | + logs_docker = true |
| 40 | + ebpf_metrics = true |
| 41 | + } |
| 42 | + } |
| 43 | +
|
| 44 | + # Server-side VRL runs during ingestion on Better Stack |
| 45 | + source_vrl_transformation = <<-EOT |
| 46 | + .environment = "production" |
| 47 | + .compliance_redacted = true |
| 48 | + EOT |
| 49 | +} |
| 50 | +``` |
| 51 | + |
| 52 | +<!-- schema generated by tfplugindocs --> |
| 53 | +## Schema |
| 54 | + |
| 55 | +### Required |
| 56 | + |
| 57 | +- `name` (String) The name of this collector. |
| 58 | +- `platform` (String) The platform of this collector. This value can be set only when creating a new collector and cannot be changed later. Valid values are: `docker`, `swarm`, `kubernetes`, `proxy`. |
| 59 | + |
| 60 | +### Optional |
| 61 | + |
| 62 | +- `configuration` (Block List, Max: 1) Collector-level configuration including active components, sampling rates, batching, and VRL transformations. These settings run on the collector host inside your infrastructure. (see [below for nested schema](#nestedblock--configuration)) |
| 63 | +- `custom_bucket` (Block List, Max: 1) Optional custom bucket configuration for the collector. Once set, it cannot be removed. (see [below for nested schema](#nestedblock--custom_bucket)) |
| 64 | +- `data_region` (String) Data region (e.g. `eu`, `us`) or private cluster name to create the collector in. This can only be set at creation time. Note: the API may return a different identifier (the internal storage region name) than the value you provided. |
| 65 | +- `databases` (Block List) Database connections for the collector. (see [below for nested schema](#nestedblock--databases)) |
| 66 | +- `ingesting_paused` (Boolean) Whether ingestion is paused for this collector. |
| 67 | +- `live_tail_pattern` (String) Freeform text template for formatting Live tail output with columns wrapped in {column} brackets. Example: "PID: {message_json.pid} {level} {message}" |
| 68 | +- `logs_retention` (Number) Data retention for logs in days. Allowed values: 7, 30, 60, 90, 180, 365, 730, 1095, 1460, 1825. There might be additional charges for longer retention. |
| 69 | +- `metrics_retention` (Number) Data retention for metrics in days. Allowed values: 7, 30, 60, 90, 180, 365, 730, 1095, 1460, 1825. There might be additional charges for longer retention. |
| 70 | +- `note` (String) A description or note about this collector. |
| 71 | +- `proxy_config` (Block List, Max: 1) Proxy settings including buffering proxy, SSL/TLS, and HTTP Basic Authentication. Only applicable to `proxy` platform collectors. (see [below for nested schema](#nestedblock--proxy_config)) |
| 72 | +- `source_group_id` (Number) The ID of the source group (folder) this collector belongs to. Set to `0` to remove from a group. |
| 73 | +- `source_vrl_transformation` (String) Server-side VRL transformation that runs during ingestion on Better Stack. Use this for enrichment, routing, or light normalization that doesn't involve sensitive data. For PII redaction and sensitive data filtering, prefer `configuration.vrl_transformation` which runs on the collector host and ensures raw data never leaves your network. Read more about [VRL transformations](https://betterstack.com/docs/logs/using-logtail/transforming-ingested-data/logs-vrl/). |
| 74 | +- `team_name` (String) Used to specify the team the resource should be created in when using global tokens. |
| 75 | +- `user_vector_config` (String) Custom Vector YAML configuration for additional sources and transforms beyond the built-in component toggles. Must not contain `command:` directives. |
| 76 | + |
| 77 | +### Read-Only |
| 78 | + |
| 79 | +- `created_at` (String) The time when this collector was created. |
| 80 | +- `databases_count` (Number) The number of database connections configured for this collector. |
| 81 | +- `hosts_count` (Number) The number of hosts connected to this collector. |
| 82 | +- `hosts_up_count` (Number) The number of hosts currently online. |
| 83 | +- `id` (String) The ID of this collector. |
| 84 | +- `pinged_at` (String) The time when this collector last received data. |
| 85 | +- `secret` (String, Sensitive) The secret token used to authenticate collector hosts. |
| 86 | +- `source_id` (Number) The ID of the underlying source. Use this with `logtail_metric` to define metrics on this collector's data. |
| 87 | +- `status` (String) The current status of this collector. |
| 88 | +- `team_id` (String) The team ID for this resource. |
| 89 | +- `updated_at` (String) The time when this collector was last updated. |
| 90 | + |
| 91 | +<a id="nestedblock--configuration"></a> |
| 92 | +### Nested Schema for `configuration` |
| 93 | + |
| 94 | +Optional: |
| 95 | + |
| 96 | +- `components` (Block List, Max: 1) Enable or disable specific collector components. Maps to the Logs, Metrics, and eBPF tabs in the collector settings UI. (see [below for nested schema](#nestedblock--configuration--components)) |
| 97 | +- `disk_batch_size_mb` (Number) Disk buffer size in MB for outgoing requests. Minimum 256 MB. |
| 98 | +- `logs_sample_rate` (Number) Sample rate for logs (0-100). |
| 99 | +- `memory_batch_size_mb` (Number) Memory batch size in MB for outgoing requests. Maximum 40 MB. |
| 100 | +- `namespace_option` (Block Set) Per-namespace overrides for log sampling rate and trace ingestion (Kubernetes only). Order-independent; entries are identified by name. (see [below for nested schema](#nestedblock--configuration--namespace_option)) |
| 101 | +- `service_option` (Block Set) Per-service overrides for log sampling rate and trace ingestion. Only includes user-managed services; internal collector services (`better-stack-beyla`, `better-stack-collector`) are excluded. Use the `logtail_collector` data source to see all discovered services. (see [below for nested schema](#nestedblock--configuration--service_option)) |
| 102 | +- `traces_sample_rate` (Number) Sample rate for traces (0-100). |
| 103 | +- `vrl_transformation` (String) VRL transformation that runs on the collector host, inside your infrastructure, before data is transmitted to Better Stack. Use this for PII redaction and sensitive data filtering — raw data never leaves your network. For server-side transformations that run during ingestion on Better Stack, use the top-level `source_vrl_transformation` attribute instead. Read more about [VRL transformations](https://betterstack.com/docs/logs/using-logtail/transforming-ingested-data/logs-vrl/). |
| 104 | + |
| 105 | +<a id="nestedblock--configuration--components"></a> |
| 106 | +### Nested Schema for `configuration.components` |
| 107 | + |
| 108 | +Optional: |
| 109 | + |
| 110 | +- `ebpf_metrics` (Boolean) Enable eBPF-based metrics collection. |
| 111 | +- `ebpf_tracing_basic` (Boolean) Enable basic eBPF tracing. |
| 112 | +- `ebpf_tracing_full` (Boolean) Enable full eBPF tracing. |
| 113 | +- `logs_collector_internals` (Boolean) Collect internal collector logs. |
| 114 | +- `logs_docker` (Boolean) Collect Docker container logs. |
| 115 | +- `logs_host` (Boolean) Collect host-level logs. |
| 116 | +- `logs_kubernetes` (Boolean) Collect Kubernetes logs. |
| 117 | +- `metrics_apache` (Boolean) Collect Apache metrics. |
| 118 | +- `metrics_databases` (Boolean) Collect database metrics via the cluster agent. |
| 119 | +- `metrics_nginx` (Boolean) Collect Nginx metrics. |
| 120 | + |
| 121 | + |
| 122 | +<a id="nestedblock--configuration--namespace_option"></a> |
| 123 | +### Nested Schema for `configuration.namespace_option` |
| 124 | + |
| 125 | +Required: |
| 126 | + |
| 127 | +- `name` (String) Namespace name. |
| 128 | + |
| 129 | +Optional: |
| 130 | + |
| 131 | +- `ingest_traces` (Boolean) Whether to ingest traces for this namespace. |
| 132 | +- `log_sampling` (Number) Log sampling rate (0-100). |
| 133 | + |
| 134 | + |
| 135 | +<a id="nestedblock--configuration--service_option"></a> |
| 136 | +### Nested Schema for `configuration.service_option` |
| 137 | + |
| 138 | +Required: |
| 139 | + |
| 140 | +- `name` (String) Service name. |
| 141 | + |
| 142 | +Optional: |
| 143 | + |
| 144 | +- `ingest_traces` (Boolean) Whether to ingest traces for this service. |
| 145 | +- `log_sampling` (Number) Log sampling rate (0-100). |
| 146 | + |
| 147 | + |
| 148 | + |
| 149 | +<a id="nestedblock--custom_bucket"></a> |
| 150 | +### Nested Schema for `custom_bucket` |
| 151 | + |
| 152 | +Required: |
| 153 | + |
| 154 | +- `access_key_id` (String) Access key ID for the bucket. |
| 155 | +- `endpoint` (String) Bucket endpoint URL. |
| 156 | +- `name` (String) Bucket name. |
| 157 | +- `secret_access_key` (String, Sensitive) Secret access key for the bucket. |
| 158 | + |
| 159 | +Optional: |
| 160 | + |
| 161 | +- `keep_data_after_retention` (Boolean) Whether to keep data in the bucket after the retention period. |
| 162 | + |
| 163 | + |
| 164 | +<a id="nestedblock--databases"></a> |
| 165 | +### Nested Schema for `databases` |
| 166 | + |
| 167 | +Required: |
| 168 | + |
| 169 | +- `host` (String) The database host. |
| 170 | +- `port` (Number) The database port. |
| 171 | +- `service_type` (String) The type of database service. |
| 172 | + |
| 173 | +Optional: |
| 174 | + |
| 175 | +- `password` (String, Sensitive) The database password. |
| 176 | +- `ssl_mode` (String) SSL mode for PostgreSQL connections. Valid values: `disable`, `require`, `verify-ca`. |
| 177 | +- `tls` (String) TLS mode for MySQL connections. Valid values: `false`, `true`, `skip-verify`, `preferred`. |
| 178 | +- `username` (String) The database username. |
| 179 | + |
| 180 | +Read-Only: |
| 181 | + |
| 182 | +- `id` (Number) The ID of this database connection (assigned by the API). |
| 183 | + |
| 184 | + |
| 185 | +<a id="nestedblock--proxy_config"></a> |
| 186 | +### Nested Schema for `proxy_config` |
| 187 | + |
| 188 | +Optional: |
| 189 | + |
| 190 | +- `buffering_proxy_listen_on` (String) Address and port for the buffering proxy to listen on. |
| 191 | +- `enable_buffering_proxy` (Boolean) Enable the HTTP buffering proxy for the collector. |
| 192 | +- `enable_http_basic_auth` (Boolean) Enable HTTP Basic Authentication for the collector proxy. |
| 193 | +- `enable_ssl_certificate` (Boolean) Enable custom SSL/TLS certificate for the collector. |
| 194 | +- `http_basic_auth_password` (String, Sensitive) Password for HTTP Basic Authentication. This value is write-only and never returned by the API. |
| 195 | +- `http_basic_auth_username` (String) Username for HTTP Basic Authentication. |
| 196 | +- `ssl_certificate_host` (String) Hostname for the SSL certificate. |
0 commit comments