Deploy `vector` config for `Docker` logs.
This commit is contained in:
parent
2b451d6db8
commit
cc9ce1806e
|
@ -0,0 +1,8 @@
|
|||
# -------------------------------------------
|
||||
# Specifying the default settings:
|
||||
# -------------------------------------------
|
||||
node.reverse_merge!({
|
||||
'docker' => {
|
||||
'loki' => '192.168.10.101'
|
||||
}
|
||||
})
|
|
@ -1,3 +1,5 @@
|
|||
include_recipe './attributes.rb'
|
||||
|
||||
include_recipe './install.rb'
|
||||
|
||||
include_recipe './setup.rb'
|
||||
|
|
|
@ -37,3 +37,18 @@ remote_file '/etc/cron.d/docker-housekeep' do
|
|||
group 'root'
|
||||
mode '644'
|
||||
end
|
||||
|
||||
# Deploy config file for `vector`:
|
||||
template '/etc/vector/docker.toml' do
|
||||
owner 'root'
|
||||
group 'root'
|
||||
mode '644'
|
||||
|
||||
variables(LOKI: node['docker']['loki'],
|
||||
HOSTNAME: node[:hostname]
|
||||
)
|
||||
|
||||
source 'templates/etc/vector/docker.toml.erb'
|
||||
|
||||
notifies :restart, 'service[vector-docker]'
|
||||
end
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
data_dir = "/var/lib/vector"
|
||||
|
||||
[sources.docker]
|
||||
type = "docker"
|
||||
|
||||
[transforms.docker-transform]
|
||||
type = "remove_fields"
|
||||
inputs = ["docker"]
|
||||
fields = ["container_created_at", "container_id", "container_name"]
|
||||
|
||||
[sinks.docker-logs]
|
||||
type = "loki"
|
||||
inputs = ["docker-transform"]
|
||||
endpoint = "http://<%= @LOKI %>:3100"
|
||||
healthcheck = true
|
||||
remove_timestamp = true
|
||||
|
||||
encoding.codec = "text"
|
||||
|
||||
labels.level = "info"
|
||||
labels.job = "docker"
|
||||
labels.hostname = "<%= @HOSTNAME %>"
|
Loading…
Reference in New Issue