#!/sbin/openrc-run

name=filebeat
description="FileBeat - Lightweight shipper for logs"
command=/usr/bin/filebeat
command_args="$filebeat_opts"
command_background=true
pidfile=/run/${RC_SVCNAME}.pid
output_log=/var/log/${RC_SVCNAME}.log
error_log=/var/log/${RC_SVCNAME}.log

extra_commands="checkconfig"
description_checkconfig="Verify configuration file"

start_pre() {
	checkpath -f -m 0644 "$output_log"
}

depend() {
	need net
	after firewall
}

checkconfig() {
	$command test config -c /etc/filebeat/filebeat.yml
}

start_pre() {
	ebegin "checking configuration"
	checkconfig
}
