Add log file

This commit is contained in:
yo 2022-04-01 13:47:07 +02:00
parent 2225303af9
commit 6db53968f3

View File

@ -20,6 +20,9 @@
# or above. [debug,info,warn,error] # or above. [debug,info,warn,error]
# (default: "info") # (default: "info")
# #
# elasticsearch_exporter_log_file (str): log messages to this file
# (default: "/var/log/elasticsearch_exporter.log")
#
. /etc/rc.subr . /etc/rc.subr
@ -32,11 +35,12 @@ load_rc_config $name
: ${elasticsearch_exporter_listen=":9114"} : ${elasticsearch_exporter_listen=":9114"}
: ${elasticsearch_exporter_endpoint="http://localhost:9200"} : ${elasticsearch_exporter_endpoint="http://localhost:9200"}
: ${elasticsearch_exporter_log_level="info"} : ${elasticsearch_exporter_log_level="info"}
: ${elasticsearch_exporter_log_file="/var/log/elasticsearch_exporter.log"}
: ${elasticsearch_exporter_pidfile:="/var/run/elasticsearch_exporter.pid"} : ${elasticsearch_exporter_pidfile:="/var/run/elasticsearch_exporter.pid"}
: ${elasticsearch_exporter_user:="prometheus"} : ${elasticsearch_exporter_user:="prometheus"}
command="/usr/local/bin/elasticsearch_exporter" 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}" start_cmd="/usr/sbin/daemon -u ${elasticsearch_exporter_user} ${command} ${command_args}"
run_rc_command "$1" run_rc_command "$1"