NATS Sink
The Vector nats
sink
sends logs to NATS.
Configuration
- Common
- Advanced
- vector.toml
- vector.yaml
- vector.json
[sinks.my_sink_id]# Generaltype = "nats" # requiredinputs = ["my-source-or-transform-id", "prefix-*"] # requiredsubject = "{{ host }}" # requiredurl = "nats://demo.nats.io" # required# Encodingencoding.codec = "json" # required# Healthcheckhealthcheck.enabled = true # optional, default
- commonrequiredtable
encoding
Configures the encoding specific sink behavior.
- commonrequiredstring
codec
The encoding codec used to serialize the events before outputting.
- Syntax:
literal
- View examples
- Syntax:
- optional[string]
except_fields
Prevent the sink from encoding the specified labels.
- View examples
- optional[string]
only_fields
Prevent the sink from encoding the specified labels.
- View examples
- enumoptionalstring
timestamp_format
How to format event timestamps.
- Syntax:
literal
- Default:
"rfc3339"
- Enum, must be one of:
"rfc3339"
"unix"
- View examples
- Syntax:
- commonoptionaltable
healthcheck
Health check options for the sink. See Health checks for more info.
- commonoptionalbool
enabled
Enables/disables the healthcheck upon Vector boot.
- Default:
true
- View examples
- Default:
- optionalstring
name
A name assigned to the NATS connection.
- Syntax:
literal
- Default:
"vector"
- View examples
- Syntax:
- commonrequiredstring
subject
The NATS subject to publish messages to.
This field supports Vector's template syntax, which enables the use of dynamic per-event values.
- Syntax:
template
- View examples
- Syntax:
- commonrequiredstring
url
The NATS URL to connect to. The url must take the form of
nats://server:port
.- Syntax:
literal
- View examples
- Syntax:
Telemetry
This component provides the following metrics that can be retrieved through
the internal_metrics
source. See the
metrics section in the
monitoring page for more info.
- counter
missing_keys_total
The total number of failed template renders due to missed keys from the event. This metric includes the following tags:
instance
- The Vector instance identified by host and port.job
- The name of the job producing Vector metrics.
- counter
processed_bytes_total
The total number of bytes processed by the component. This metric includes the following tags:
component_kind
- The Vector component kind.component_name
- The Vector component ID.component_type
- The Vector component type.instance
- The Vector instance identified by host and port.job
- The name of the job producing Vector metrics.
- counter
processed_events_total
The total number of events processed by this component. This metric includes the following tags:
component_kind
- The Vector component kind.component_name
- The Vector component ID.component_type
- The Vector component type.file
- The file that produced the errorinstance
- The Vector instance identified by host and port.job
- The name of the job producing Vector metrics.
- counter
events_in_total
The total number of events accepted by this component. This metric includes the following tags:
component_kind
- The Vector component kind.component_name
- The Vector component ID.component_type
- The Vector component type.instance
- The Vector instance identified by host and port.job
- The name of the job producing Vector metrics.
- counter
send_errors_total
The total number of errors sending messages. This metric includes the following tags:
component_kind
- The Vector component kind.component_name
- The Vector component ID.component_type
- The Vector component type.instance
- The Vector instance identified by host and port.job
- The name of the job producing Vector metrics.
- counter
events_out_total
The total number of events emitted by this component. This metric includes the following tags:
component_kind
- The Vector component kind.component_name
- The Vector component ID.component_type
- The Vector component type.instance
- The Vector instance identified by host and port.job
- The name of the job producing Vector metrics.
How It Works
Health checks
Health checks ensure that the downstream service is accessible and ready to accept data. This check is performed upon sink initialization. If the health check fails an error will be logged and Vector will proceed to start.
Require health checks
If you'd like to exit immediately upon a health
check failure, you can pass the
--require-healthy
flag:
vector --config /etc/vector/vector.toml --require-healthy
Disable health checks
If you'd like to disable health checks for this
sink you can set the healthcheck
option to
false
.
State
This component is stateless, meaning its behavior is consistent across each input.