aboutsummaryrefslogtreecommitdiffstats
path: root/sysutils
diff options
context:
space:
mode:
authorfeld <feld@FreeBSD.org>2018-03-10 00:27:35 +0800
committerfeld <feld@FreeBSD.org>2018-03-10 00:27:35 +0800
commite93dada11f892702a2be4a1570dbf147dbac0c91 (patch)
treef23a45bd87585f8b5d216899a4381e7048d8c4ec /sysutils
parentf4c9cdbb10bb5d58f4bdfde5308e4a52a47b79f6 (diff)
downloadfreebsd-ports-gnome-e93dada11f892702a2be4a1570dbf147dbac0c91.tar.gz
freebsd-ports-gnome-e93dada11f892702a2be4a1570dbf147dbac0c91.tar.zst
freebsd-ports-gnome-e93dada11f892702a2be4a1570dbf147dbac0c91.zip
sysutils/logstash6: Many improvements
- all config files are now in ETCDIR - rc script is updated to use logsearch.yml to locate logging config (logstash.conf) This will not break existing setups that used the ETCDIR/logstash.conf file, as that is now part of the default logstash.yml file - added configtest to rc script - sample logstash.conf file no longer includes invalid syntax - pkg-message had historical messages removed
Diffstat (limited to 'sysutils')
-rw-r--r--sysutils/logstash6/Makefile14
-rw-r--r--sysutils/logstash6/files/logstash.conf.sample12
-rw-r--r--sysutils/logstash6/files/logstash.in27
-rw-r--r--sysutils/logstash6/files/patch-config_logstash.yml11
-rw-r--r--sysutils/logstash6/pkg-message7
5 files changed, 43 insertions, 28 deletions
diff --git a/sysutils/logstash6/Makefile b/sysutils/logstash6/Makefile
index 2d863eb74e19..02f76518a3d9 100644
--- a/sysutils/logstash6/Makefile
+++ b/sysutils/logstash6/Makefile
@@ -3,6 +3,7 @@
PORTNAME= logstash
PORTVERSION= 6.2.2
+PORTREVISION= 1
CATEGORIES= sysutils java
MASTER_SITES= http://artifacts.elastic.co/downloads/logstash/
PKGNAMESUFFIX= 6
@@ -34,15 +35,23 @@ SUB_LIST= JAVA_HOME=${JAVA_HOME} \
LOGSTASH_HOME=${LOGSTASH_HOME}
LOGSTASH_BIN_FILES= logstash
+LOGSTASH_CONF_FILES= jvm.options log4j2.properties logstash.yml pipelines.yml
LOGSTASH_JRUBY_SUBDIR= vendor/jruby/bin
LOGSTASH_JRUBY_BIN_FILES= ast irb jirb jruby jruby.sh rdoc testrb gem \
jgem jirb_swing jruby.bash jrubyc rake ri
+post-patch:
+ ${REINPLACE_CMD} 's|%%ETCDIR%%|${ETCDIR}|g' ${WRKSRC}/config/logstash.yml
+
do-install:
@${FIND} ${WRKSRC} -name '*.bat' -delete
${MKDIR} ${STAGEDIR}${ETCDIR}
- @(cd ${WRKSRC} && ${COPYTREE_SHARE} . ${STAGEDIR}${LOGSTASH_DIR})
${INSTALL_DATA} ${FILESDIR}/logstash.conf.sample ${STAGEDIR}${ETCDIR}
+.for x in ${LOGSTASH_CONF_FILES}
+ ${INSTALL_DATA} ${WRKSRC}/config/${x} ${STAGEDIR}${ETCDIR}/${x}.sample
+.endfor
+ ${RM} -rf ${WRKSRC}/config
+ @(cd ${WRKSRC} && ${COPYTREE_SHARE} . ${STAGEDIR}${LOGSTASH_DIR})
.for x in ${LOGSTASH_BIN_FILES}
@${CHMOD} ${BINMODE} ${STAGEDIR}${LOGSTASH_DIR}/bin/${x}
.endfor
@@ -52,6 +61,9 @@ do-install:
post-install:
${ECHO} "@sample ${ETCDIR}/logstash.conf.sample" >> ${TMPPLIST}
+.for x in ${LOGSTASH_CONF_FILES}
+ ${ECHO} "@sample ${ETCDIR}/${x}.sample" >> ${TMPPLIST}
+.endfor
${FIND} -s ${STAGEDIR}${PREFIX}/logstash -not -type d | ${SORT} | \
${SED} -e 's#^${STAGEDIR}${PREFIX}/##' >> ${TMPPLIST}
${ECHO} "@dir logstash/data" >> ${TMPPLIST}
diff --git a/sysutils/logstash6/files/logstash.conf.sample b/sysutils/logstash6/files/logstash.conf.sample
index 2f974f7d721f..cd5959910a36 100644
--- a/sysutils/logstash6/files/logstash.conf.sample
+++ b/sysutils/logstash6/files/logstash.conf.sample
@@ -14,16 +14,8 @@ filter {
#
# if [type] == "syslog" {
# grok {
-# match => { "message" => "%{SYSLOGTIMESTAMP:syslog_timestamp} %{SYSLOGHOST:syslog_hostname} (%{DATA:syslog_program}(?:\[%{POSINT:syslog_pid}\])?: %{GREEDYDATA:syslog_message}|%{GREEDYDATA:syslog_message})" }
-# add_field => [ "received_at", "%{@timestamp}" ]
-# add_field => [ "received_from", "%{@source_host}" ]
-# }
-#
-# if !("_grokparsefailure" in [tags]) {
-# mutate {
-# replace => [ "@source_host", "%{syslog_hostname}" ]
-# replace => [ "@message", "%{syslog_message}" ]
-# }
+# #patterns_dir => ["/usr/local/etc/logstash/patterns"]
+# match => { "message" => "(<%{POSINT:syslog_pri}>)?%{SYSLOGTIMESTAMP:syslog_timestamp} %{SYSLOGHOST:syslog_hostname} (%{DATA:syslog_program}(?:\[%{POSINT:syslog_pid}\])?: %{GREEDYDATA:syslog_message}|%{GREEDYDATA:syslog_message})" }
# }
# mutate {
# remove_field => [ "syslog_hostname", "syslog_message" ]
diff --git a/sysutils/logstash6/files/logstash.in b/sysutils/logstash6/files/logstash.in
index dae70d7a91d6..85548a9b07c0 100644
--- a/sysutils/logstash6/files/logstash.in
+++ b/sysutils/logstash6/files/logstash.in
@@ -16,8 +16,8 @@
# Logstash installation directory.
#
# logstash_config (string):
-# Default value: /usr/local/etc/${name}/${name}.conf
-# Logstash configuration file path.
+# Default value: /usr/local/etc/${name}
+# Logstash configuration path.
#
# logstash_log (bool):
# Set to "NO" by default.
@@ -56,21 +56,18 @@ logdir="/var/log"
: ${logstash_enable="NO"}
: ${logstash_home="%%LOGSTASH_HOME%%"}
-: ${logstash_config="%%ETCDIR%%/${name}.conf"}
+: ${logstash_config="%%ETCDIR%%"}
: ${logstash_log="YES"}
: ${logstash_log_dir="${logdir}/${name}"}
: ${logstash_java_home="%%JAVA_HOME%%"}
: ${logstash_java_opts=""}
: ${logstash_opts=""}
-piddir=/var/run/${name}
-pidfile=${piddir}/${name}.pid
-
-if [ -d $piddir ]; then
- mkdir -p $piddir
-fi
+pidfile=/var/run/${name}/${name}.pid
+extra_commands=configtest
start_precmd="logstash_precmd"
+configtest_cmd=configtest
logstash_cmd="${logstash_home}/bin/logstash"
procname="${logstash_java_home}/bin/java"
@@ -82,7 +79,7 @@ if checkyesno logstash_log; then
logstash_log_options=" -l ${logstash_log_dir}"
fi
-logstash_args="-f ${logstash_config} ${logstash_log_options} ${logstash_opts}"
+logstash_args="--path.settings ${logstash_config} ${logstash_log_options} ${logstash_opts}"
JAVA_OPTS="${logstash_java_opts}"
JAVA_HOME="${logstash_java_home}"
@@ -99,10 +96,20 @@ PATH=/usr/local/bin:$PATH
logstash_precmd()
{
+ /usr/bin/install -d -o root -g wheel -m 755 ${pidfile%/*}
/usr/bin/install -d -o root -g wheel -m 755 ${logstash_log_dir}
/usr/bin/install -d -o root -g wheel -m 755 /var/db/logstash
/usr/bin/install -d -o root -g wheel -m 755 /var/run/logstash
}
+configtest()
+{
+ echo "${name} configtest:"
+ echo "WARNING: this does not check validity of Grok patterns!"
+ echo "WARNING: this does not check validity of Grok patterns!"
+ echo "WARNING: this does not check validity of Grok patterns!"
+ ${logstash_cmd} --path.settings ${logstash_config} --config.test_and_exit
+}
+
run_rc_command "$1"
diff --git a/sysutils/logstash6/files/patch-config_logstash.yml b/sysutils/logstash6/files/patch-config_logstash.yml
new file mode 100644
index 000000000000..e6d45d08195c
--- /dev/null
+++ b/sysutils/logstash6/files/patch-config_logstash.yml
@@ -0,0 +1,11 @@
+--- config/logstash.yml.orig 2018-03-09 15:21:48 UTC
++++ config/logstash.yml
+@@ -61,7 +61,7 @@
+ #
+ # Where to fetch the pipeline configuration for the main pipeline
+ #
+-# path.config:
++path.config: %%ETCDIR%%/logstash.conf
+ #
+ # Pipeline configuration string for the main pipeline
+ #
diff --git a/sysutils/logstash6/pkg-message b/sysutils/logstash6/pkg-message
index 4add4e93a4c7..5bdbbef04281 100644
--- a/sysutils/logstash6/pkg-message
+++ b/sysutils/logstash6/pkg-message
@@ -5,10 +5,3 @@ To start logstash as an agent during startup, add
to your /etc/rc.conf.
Extra options can be found in startup script.
-
-NOTE: Since version 1.5.0, logstash is started in agent mode.
-The Kibana web application is no longer embedded in this Logstash
-distribution.
-
-NOTE: Since version 2, logstash does not support an embedded
-ElasticSearch instance.