File: //etc/vector/examples/environment_variables.yaml
# Environment Variables Example
# ------------------------------------------------------------------------------
# A simple example that demonstrates Vector's environment variable
# interpolation syntax. More information can be found in the Environment
# Variables section in our docs:
#
# https://vector.dev/docs/setup/configuration#environment-variables
data_dir: "/var/lib/vector"
# Ingests Apache 2 log data by tailing one or more log files
# Example: 194.221.90.140 - - [22/06/2019:11:55:14 -0400] "PUT /integrate" 100 2213
# Docs: https://vector.dev/docs/reference/sources/file
sources:
apache_logs:
type: "file"
include: [ "/var/log/apache2/*.log" ]
# ignore files older than 1 day
ignore_older_secs: 86400
# Add a field based on the value of the HOSTNAME env var
# Docs: https://vector.dev/docs/reference/transforms/remap
transforms:
add_host:
inputs: [ "apache_logs" ]
type: "remap"
source: |
'''
.host = get_env_var!("HOSTNAME")
'''
# Print the data to STDOUT for inspection
# Docs: https://vector.dev/docs/reference/sinks/console
sinks:
out:
inputs: [ "add_host" ]
type: "console"
encoding:
codec: "json"