Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 9 Mar 2018 16:27:36 +0000 (UTC)
From:      Mark Felder <feld@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r463971 - in head/sysutils/logstash6: . files
Message-ID:  <201803091627.w29GRa6d071173@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: feld
Date: Fri Mar  9 16:27:35 2018
New Revision: 463971
URL: https://svnweb.freebsd.org/changeset/ports/463971

Log:
  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

Added:
  head/sysutils/logstash6/files/patch-config_logstash.yml   (contents, props changed)
Modified:
  head/sysutils/logstash6/Makefile
  head/sysutils/logstash6/files/logstash.conf.sample
  head/sysutils/logstash6/files/logstash.in
  head/sysutils/logstash6/pkg-message

Modified: head/sysutils/logstash6/Makefile
==============================================================================
--- head/sysutils/logstash6/Makefile	Fri Mar  9 16:20:58 2018	(r463970)
+++ head/sysutils/logstash6/Makefile	Fri Mar  9 16:27:35 2018	(r463971)
@@ -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}

Modified: head/sysutils/logstash6/files/logstash.conf.sample
==============================================================================
--- head/sysutils/logstash6/files/logstash.conf.sample	Fri Mar  9 16:20:58 2018	(r463970)
+++ head/sysutils/logstash6/files/logstash.conf.sample	Fri Mar  9 16:27:35 2018	(r463971)
@@ -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" ]

Modified: head/sysutils/logstash6/files/logstash.in
==============================================================================
--- head/sysutils/logstash6/files/logstash.in	Fri Mar  9 16:20:58 2018	(r463970)
+++ head/sysutils/logstash6/files/logstash.in	Fri Mar  9 16:27:35 2018	(r463971)
@@ -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
+pidfile=/var/run/${name}/${name}.pid
 
-if [ -d $piddir ]; then
-  mkdir -p $piddir
-fi
-
+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,9 +96,19 @@ 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
 }
 
 

Added: head/sysutils/logstash6/files/patch-config_logstash.yml
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sysutils/logstash6/files/patch-config_logstash.yml	Fri Mar  9 16:27:35 2018	(r463971)
@@ -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
+ #

Modified: head/sysutils/logstash6/pkg-message
==============================================================================
--- head/sysutils/logstash6/pkg-message	Fri Mar  9 16:20:58 2018	(r463970)
+++ head/sysutils/logstash6/pkg-message	Fri Mar  9 16:27:35 2018	(r463971)
@@ -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.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201803091627.w29GRa6d071173>