diff --git a/deploy/asapo_orchestration_docker/scripts/fluent-bit-nginx.conf.tpl b/deploy/asapo_orchestration_docker/scripts/fluent-bit-nginx.conf.tpl new file mode 100644 index 0000000000000000000000000000000000000000..b407e0e3798dda4b247c097758232cdeaa7b1daa --- /dev/null +++ b/deploy/asapo_orchestration_docker/scripts/fluent-bit-nginx.conf.tpl @@ -0,0 +1,55 @@ +[SERVICE] + Parsers_File /etc/td-agent-bit/parsers.conf + Parsers_File /var/run/asapo/fluent-bit-cluster-custom-parsers.conf + +[INPUT] + Name tail + Path ${NOMAD_ALLOC_DIR}/${NOMAD_ALLOC_ID}/alloc/logs/nginx*.0 + Tag asapo.nginx + DB ${NOMAD_TASK_DIR}/logs.db + Parser level + +[FILTER] + Name modify + Match * + Condition Key_value_matches level (?i)^d.* + Set level DEBUG + +[FILTER] + Name modify + Match * + Condition Key_value_matches level (?i)^(i.*|no.*) + Set level INFO + +[FILTER] + Name modify + Match * + Condition Key_value_matches level (?i)^w.* + Set level WARNING + +[FILTER] + Name modify + Match * + Condition Key_value_matches level (?i)^er.* + Set level ERROR + +[FILTER] + Name modify + Match * + Condition Key_value_matches level (?i)^(c.*|a.*|emerg|exception) + Set level CRITICAL + +[FILTER] + Name modify + Match * + Add level UNKNOWN + +{{ range service "influxdb" }} +[OUTPUT] + Name influxdb + Match * + Host {{ .Address }} + Port {{ .Port }} + Database logs + Tag_Keys level +{{ end }} diff --git a/deploy/asapo_orchestration_docker/scripts/nginx.nmd.tpl b/deploy/asapo_orchestration_docker/scripts/nginx.nmd.tpl index 7039978756e409bb3b15b2b12861226ccf390c5b..72c13ddeda606b5764ad7155610bfb70ec998696 100644 --- a/deploy/asapo_orchestration_docker/scripts/nginx.nmd.tpl +++ b/deploy/asapo_orchestration_docker/scripts/nginx.nmd.tpl @@ -67,5 +67,20 @@ job "asapo-nginx" { change_signal = "SIGHUP" } } + + task "fluent-bit" { + driver = "raw_exec" + + config { + command = "/opt/td-agent-bit/bin/td-agent-bit" + args = ["-c", "local/fluent-bit.conf"] + } + + template { + source = "${scripts_dir}/fluent-bit-nginx.conf.tpl" + destination = "local/fluent-bit.conf" + change_mode = "restart" + } + } # fluent-bit } }