ansible : add alloy role
This commit is contained in:
34
ansible/roles/alloy/templates/config.j2
Normal file
34
ansible/roles/alloy/templates/config.j2
Normal file
@@ -0,0 +1,34 @@
|
||||
otelcol.receiver.filelog "file" {
|
||||
include = ["/in/*.log"]
|
||||
operators = [{
|
||||
type = "regex_parser",
|
||||
regex = `^(?P<timestamp>\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{2}:\d{2}) (?P<msg>.*)$`,
|
||||
timestamp = {
|
||||
parse_from = "attributes.timestamp",
|
||||
layout = "%Y-%m-%dT%H:%M:%S%j",
|
||||
},
|
||||
message = {
|
||||
parse_from = "attributes.msg",
|
||||
},
|
||||
},{
|
||||
type = "remove",
|
||||
field = "attributes.timestamp",
|
||||
}]
|
||||
output {
|
||||
logs = [otelcol.exporter.syslog.outsyslog.input]
|
||||
}
|
||||
}
|
||||
otelcol.exporter.file "outfile" {
|
||||
path = "/out/output.log"
|
||||
}
|
||||
|
||||
otelcol.exporter.syslog "outsyslog" {
|
||||
endpoint = "slaithier-promax14"
|
||||
}
|
||||
|
||||
otelcol.exporter.debug "default" {}
|
||||
|
||||
logging {
|
||||
level = "{{ alloy_log_level }}"
|
||||
format = "logfmt"
|
||||
}
|
||||
8
ansible/roles/alloy/templates/default.j2
Normal file
8
ansible/roles/alloy/templates/default.j2
Normal file
@@ -0,0 +1,8 @@
|
||||
# The configuration file holding the Grafana Alloy configuration.
|
||||
CONFIG_FILE="{{ alloy_config_file }}"
|
||||
|
||||
# User-defined arguments to pass to the run command.
|
||||
CUSTOM_ARGS="{{ alloy_run_args }}"
|
||||
|
||||
# Restart on system upgrade. Defaults to true.
|
||||
RESTART_ON_UPGRADE={{ alloy_restart_on_upgrade }}
|
||||
19
ansible/roles/alloy/templates/systemd_service.j2
Normal file
19
ansible/roles/alloy/templates/systemd_service.j2
Normal file
@@ -0,0 +1,19 @@
|
||||
[Unit]
|
||||
Description=Vendor-neutral programmable observability pipelines.
|
||||
Documentation=https://grafana.com/docs/alloy/
|
||||
Wants=network-online.target
|
||||
After=network-online.target
|
||||
|
||||
[Service]
|
||||
Restart=always
|
||||
User={{ alloy_username }}
|
||||
Group={{ alloy_groupname }}
|
||||
Environment=HOSTNAME=%H
|
||||
EnvironmentFile=/etc/default/alloy
|
||||
WorkingDirectory={{ alloy_working_directory }}
|
||||
ExecStart={{ alloy_binary_dir }}/alloy run $CUSTOM_ARGS --storage.path={{ alloy_working_directory }} $CONFIG_FILE
|
||||
ExecReload=/usr/bin/env kill -HUP $MAINPID
|
||||
TimeoutStopSec=20s
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
Reference in New Issue
Block a user