Syslog Example For InfluxDB Port
Pete Wright
pete at nomadlogic.org
Wed Mar 21 22:55:09 UTC 2018
On 03/21/2018 15:44, Ben Woods wrote:
> On Thu, 22 Mar 2018 at 5:49 am, Pete Wright <pete at nomadlogic.org> wrote:
>
>> Interestingly enough I'm unable to get log messages to end up in
>> /var/log/influxdb/influxd.log. When I manually run daemon, without any
>> syslog flags passed, I do see plenty of logs ending up in stdout tho.
>> I'm guessing I'm tired and missing something obvious - any other
>> influxdb people have logging working as expected?
>
> Sorry to ask a basic question, but have you made sure that the file
> /var/log/influxd/influxdb.log exists, so that syslog can write to it?
no worries! i'm tired and spread kinda thin at the moment :)
yes, i ensured that the file and directory exist ahead of time:
$ ls -l /var/log/ |grep influx && ls -l /var/log/influxdb/
drwxr-xr-x 2 root wheel 512 Mar 21 21:21 influxdb
total 0
-rw-r--r-- 1 root wheel 0 Mar 21 21:21 influxd.log
> Can you provide the entire contents your /etc/syslog.conf file, and the
> relevant included files?
sure thing.
syslogd.conf (once i get this working i plan on moving relevant bits to
/etc/syslog.d/influx.conf):
# $FreeBSD: releng/11.1/etc/syslog.conf 308721 2016-11-16 07:04:49Z bapt $
#
# Spaces ARE valid field separators in this file. However,
# other *nix-like systems still insist on using tabs as field
# separators. If you are sharing this file between systems, you
# may want to use only tabs as field separators here.
# Consult the syslog.conf(5) manpage.
*.err;kern.warning;auth.notice;mail.crit /dev/console
*.notice;authpriv.none;kern.debug;lpr.info;mail.crit;news.err
/var/log/messages
security.* /var/log/security
auth.info;authpriv.info /var/log/auth.log
mail.info /var/log/maillog
lpr.info /var/log/lpd-errs
ftp.info /var/log/xferlog
cron.* /var/log/cron
!-devd
*.=debug /var/log/debug.log
*.emerg *
# uncomment this to log all writes to /dev/console to /var/log/console.log
# touch /var/log/console.log and chmod it to mode 600 before it will work
#console.info /var/log/console.log
# uncomment this to enable logging of all log messages to /var/log/all.log
# touch /var/log/all.log and chmod it to mode 600 before it will work
#*.* /var/log/all.log
# uncomment this to enable logging to a remote loghost named loghost
#*.* @loghost
# uncomment these if you're running inn
# news.crit /var/log/news/news.crit
# news.err /var/log/news/news.err
# news.notice /var/log/news/news.notice
# Uncomment this if you wish to see messages produced by devd
# !devd
# *.>=notice /var/log/devd.log
!ppp
*.* /var/log/ppp.log
daemon.* /var/log/influxdb/influxd.log
include /etc/syslog.d
include /usr/local/etc/syslog.d
the rc script is default as well:
#!/bin/sh
# $FreeBSD: branches/2018Q1/databases/influxdb/files/influxd.in 449830
2017-09-14 11:17:52Z eugen $
# PROVIDE: influxd
# REQUIRE: DAEMON NETWORKING
# BEFORE: LOGIN
# KEYWORD: shutdown
# Add the following lines to /etc/rc.conf to enable influxdb:
# influxd_enable="YES"
#
# influxd_enable (bool): Set to YES to enable influxd
# Default: NO
# influxd_conf (str): influxd configuration file
# Default: ${PREFIX}/etc/influxd.conf
# influxd_user (str): influxd daemon user
# Default: influxd
# influxd_group (str): influxd daemon group
# Default: influxd
# influxd_flags (str): Extra flags passed to influxd
#
# influxd_facility (str): Syslog facility to use
# Default: daemon
# influxd_priority (str): Syslog priority to use
# Default: info
. /etc/rc.subr
name="influxd"
rcvar=influxd_enable
load_rc_config $name
: ${influxd_enable:="NO"}
: ${influxd_user:="influxd"}
: ${influxd_group:="influxd"}
: ${influxd_flags:=""}
: ${influxd_facility:="daemon"}
: ${influxd_priority:="info"}
: ${influxd_conf:="/usr/local/etc/${name}.conf"}
: ${influxd_options:="${influxdb_flags} -config=${influxd_conf}"}
# daemon
influxd_pidfile="/var/run/influxdb/${name}.pid"
procname="/usr/local/bin/${name}"
command=/usr/sbin/daemon
start_precmd="influxd_precmd"
start_cmd="influxd_startcmd_daemon"
influxd_precmd()
{
install -d -o ${influxd_user} /var/run/influxdb/
}
influxd_startcmd_daemon()
{
echo "Starting ${name}."
/usr/sbin/daemon -c -p ${influxd_pidfile} -S -s ${influxd_priority}
-l ${influxd_facility} \
-u ${influxd_user} ${procname} ${influxd_options}
}
influxd_startcmd_logger()
{
echo "Starting ${name}."
/usr/sbin/daemon -c -p ${influxd_pidfile} -u ${influxd_user}
/bin/sh -c "${procname} ${influxd_options} 2>&1 \
| /usr/bin/logger -t ${name} -p
${influxd_facility}.${influxd_priority}"
}
run_rc_command "$1"
Thanks ben!
-pete
--
Pete Wright
pete at nomadlogic.org
@nomadlogicLA
More information about the freebsd-ports
mailing list