From 6db53968f38fc48d5dcd3e18da74f94e3307e104 Mon Sep 17 00:00:00 2001 From: yo Date: Fri, 1 Apr 2022 13:47:07 +0200 Subject: [PATCH] Add log file --- files/elasticsearch_exporter.in | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/files/elasticsearch_exporter.in b/files/elasticsearch_exporter.in index 4af1998..cd07370 100644 --- a/files/elasticsearch_exporter.in +++ b/files/elasticsearch_exporter.in @@ -20,6 +20,9 @@ # or above. [debug,info,warn,error] # (default: "info") # +# elasticsearch_exporter_log_file (str): log messages to this file +# (default: "/var/log/elasticsearch_exporter.log") +# . /etc/rc.subr @@ -32,11 +35,12 @@ load_rc_config $name : ${elasticsearch_exporter_listen=":9114"} : ${elasticsearch_exporter_endpoint="http://localhost:9200"} : ${elasticsearch_exporter_log_level="info"} +: ${elasticsearch_exporter_log_file="/var/log/elasticsearch_exporter.log"} : ${elasticsearch_exporter_pidfile:="/var/run/elasticsearch_exporter.pid"} : ${elasticsearch_exporter_user:="prometheus"} command="/usr/local/bin/elasticsearch_exporter" -command_args="--es.uri=\${elasticsearch_exporter_endpoint} --web.listen-address=\${elasticsearch_exporter_listen} --log.level=\${elasticsearch_exporter_log_level}" +command_args="--es.uri=\${elasticsearch_exporter_endpoint} --web.listen-address=\${elasticsearch_exporter_listen} --log.level=\${elasticsearch_exporter_log_level} 2>&1 > ${elasticsearch_exporter_log_file}" start_cmd="/usr/sbin/daemon -u ${elasticsearch_exporter_user} ${command} ${command_args}" run_rc_command "$1"