git: 887999abeb3b - main - sysutils/logstash: New port: Server-side data ingestion and transformation tool (8.x version)
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 11 Sep 2022 01:02:49 UTC
The branch main has been updated by acm: URL: https://cgit.FreeBSD.org/ports/commit/?id=887999abeb3b4ccea679cb82e13b6da4861c435b commit 887999abeb3b4ccea679cb82e13b6da4861c435b Author: Jose Alonso Cardenas Marquez <acm@FreeBSD.org> AuthorDate: 2022-09-11 01:01:45 +0000 Commit: Jose Alonso Cardenas Marquez <acm@FreeBSD.org> CommitDate: 2022-09-11 01:01:45 +0000 sysutils/logstash: New port: Server-side data ingestion and transformation tool (8.x version) Logstash is an open source, server-side data processing pipeline that ingests data from a multitude of sources simultaneously, transforms it, and then sends it to your favorite "stash." --- sysutils/Makefile | 1 + sysutils/logstash8/Makefile | 88 +++++++++++++++ sysutils/logstash8/distinfo | 3 + sysutils/logstash8/files/logstash.conf.sample | 17 +++ sysutils/logstash8/files/logstash.in | 121 +++++++++++++++++++++ sysutils/logstash8/files/patch-config_logstash.yml | 11 ++ sysutils/logstash8/files/pkg-message.in | 18 +++ sysutils/logstash8/pkg-descr | 3 + 8 files changed, 262 insertions(+) diff --git a/sysutils/Makefile b/sysutils/Makefile index 515064649e92..8693aa8e6592 100644 --- a/sysutils/Makefile +++ b/sysutils/Makefile @@ -662,6 +662,7 @@ SUBDIR += logstash-forwarder SUBDIR += logstash6 SUBDIR += logstash7 + SUBDIR += logstash8 SUBDIR += logtool SUBDIR += logwatch SUBDIR += loki diff --git a/sysutils/logstash8/Makefile b/sysutils/logstash8/Makefile new file mode 100644 index 000000000000..a74e80662d4f --- /dev/null +++ b/sysutils/logstash8/Makefile @@ -0,0 +1,88 @@ +PORTNAME= logstash +PORTVERSION= 8.4.1 +DISTVERSIONSUFFIX= -darwin-x86_64 +CATEGORIES= sysutils java +MASTER_SITES= https://artifacts.elastic.co/downloads/logstash/ +PKGNAMESUFFIX= 8 + +MAINTAINER= acm@FreeBSD.org +COMMENT= Server-side data ingestion and transformation tool (8.x version) +WWW= https://www.elastic.co/products/logstash + +LICENSE= APACHE20 + +ONLY_FOR_ARCHS= aarch64 amd64 + +RUN_DEPENDS= ${LOCALBASE}/bin/bash:shells/bash + +USES= cpe shebangfix + +CPE_VENDOR= elastic +USE_JAVA= yes +JAVA_VERSION= 11+ +JAVA_RUN= yes +USE_RC_SUBR= logstash + +SHEBANG_FILES= bin/* + +CONFLICTS= logstash6 logstash7 + +NO_BUILD= yes +SUB_FILES= pkg-message +SUB_LIST= JAVA_HOME=${JAVA_HOME} \ + LOGSTASH_HOME=${LOGSTASH_HOME} + +WRKSRC= ${WRKDIR}/${PORTNAME}-${DISTVERSION} + +USERS= logstash +GROUPS= logstash + +LOGSTASH_CONF_FILES= jvm.options log4j2.properties logstash.yml \ + pipelines.yml startup.options +LOGSTASH_HOME?= ${PREFIX}/${PORTNAME} +LOGSTASH_JRUBY_BIN_FILES= ast gem irb jgem jirb jirb_swing jruby \ + jruby.bash jruby.sh jrubyc rake rdoc ri +LOGSTASH_JRUBY_SUBDIR= vendor/jruby/bin + +post-patch: + ${REINPLACE_CMD} 's|%%ETCDIR%%|${ETCDIR}|g' ${WRKSRC}/config/logstash.yml + ${FIND} ${WRKSRC} -name '*.orig' -delete + +do-install: + ${FIND} ${WRKSRC} -name '*.bat' -delete + ${MKDIR} ${STAGEDIR}${ETCDIR} + ${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_HOME}) + ${CHMOD} ${BINMODE} ${STAGEDIR}${LOGSTASH_HOME}/bin/* +.for x in ${LOGSTASH_JRUBY_BIN_FILES} + ${CHMOD} ${BINMODE} ${STAGEDIR}${LOGSTASH_HOME}/${LOGSTASH_JRUBY_SUBDIR}/${x} +.endfor + ${FIND} ${STAGEDIR}${LOGSTASH_HOME}/vendor/bundle/jruby/2.6.0/gems \ + ${STAGEDIR}${LOGSTASH_HOME}/vendor/jruby/lib/ruby/gems/shared/gems \ + -type d -empty -delete + ${INSTALL} -lrs ${STAGEDIR}${ETCDIR} ${STAGEDIR}${LOGSTASH_HOME}/config + ${RM} -rf ${STAGEDIR}${LOGSTASH_HOME}/vendor/jruby/lib/jni + ${MKDIR} ${STAGEDIR}${LOGSTASH_HOME}/vendor/jruby/lib/jni + (cd ${WRKSRC}/vendor/jruby/lib/jni && \ + ${COPYTREE_SHARE} ${ARCH:S/amd64/x86_64/}-FreeBSD \ + ${STAGEDIR}${LOGSTASH_HOME}/vendor/jruby/lib/jni) + +post-install: + ${ECHO} "@sample ${ETCDIR}/logstash.conf.sample" >> ${TMPPLIST} +.for x in ${LOGSTASH_CONF_FILES} + ${ECHO} "@sample ${ETCDIR}/${x}.sample" >> ${TMPPLIST} +.endfor + ${ECHO} "@dir logstash/vendor/bundle/jruby/2.6.0/build_info" >> ${TMPPLIST} + ${ECHO} "@dir logstash/vendor/bundle/jruby/2.6.0/cache" >> ${TMPPLIST} + ${ECHO} "@dir logstash/vendor/bundle/jruby/2.6.0/doc" >> ${TMPPLIST} + ${ECHO} "@dir logstash/vendor/bundle/jruby/2.6.0/extensions" >> ${TMPPLIST} + ${ECHO} "@dir logstash/vendor/jruby/lib/ruby/gems/shared/cache" >> ${TMPPLIST} + ${FIND} -s ${STAGEDIR}${PREFIX}/logstash -not -type d | ${SORT} | \ + ${SED} -e 's#^${STAGEDIR}${PREFIX}/##' >> ${TMPPLIST} + ${ECHO} "@dir(logstash,logstash,) logstash/data" >> ${TMPPLIST} + +.include <bsd.port.mk> diff --git a/sysutils/logstash8/distinfo b/sysutils/logstash8/distinfo new file mode 100644 index 000000000000..4767d5cf0f57 --- /dev/null +++ b/sysutils/logstash8/distinfo @@ -0,0 +1,3 @@ +TIMESTAMP = 1662857451 +SHA256 (logstash-8.4.1-darwin-x86_64.tar.gz) = 30691b89a014451fbd8bc0735716e5826d56ef549ab1fc2b7e1b1b8097b16f13 +SIZE (logstash-8.4.1-darwin-x86_64.tar.gz) = 327204972 diff --git a/sysutils/logstash8/files/logstash.conf.sample b/sysutils/logstash8/files/logstash.conf.sample new file mode 100644 index 000000000000..2fa9229d62bf --- /dev/null +++ b/sysutils/logstash8/files/logstash.conf.sample @@ -0,0 +1,17 @@ +# Sample Logstash configuration for creating a simple +# Beats -> Logstash -> Elasticsearch pipeline. + +input { + beats { + port => 5044 + } +} + +output { + elasticsearch { + hosts => ["http://localhost:9200"] + index => "%{[@metadata][beat]}-%{[@metadata][version]}-%{+YYYY.MM.dd}" + #user => "elastic" + #password => "changeme" + } +} diff --git a/sysutils/logstash8/files/logstash.in b/sysutils/logstash8/files/logstash.in new file mode 100644 index 000000000000..8e3f931e6f0b --- /dev/null +++ b/sysutils/logstash8/files/logstash.in @@ -0,0 +1,121 @@ +#!/bin/sh + +# Configuration settings for logstash in /etc/rc.conf: +# +# PROVIDE: logstash +# REQUIRE: DAEMON +# BEFORE: LOGIN +# KEYWORD: shutdown +# +# logstash_enable (bool): +# Default value: "NO" +# Flag that determines whether Logstash is enabled. +# +# logstash_home (string): +# Default value: "/usr/local/logstash" +# Logstash installation directory. +# +# logstash_config (string): +# Default value: /usr/local/etc/${name} +# Logstash configuration path. +# +# logstash_log (bool): +# Set to "NO" by default. +# Set it to "YES" to enable logstash logging to file +# Default output to /var/log/logstash.log +# +# logstash_log_file (string): +# Default value: "${logdir}/${name}.log" +# Log file path. +# +# logstash_java_home (string): +# Default value: "/usr/local/openjdk8" +# Root directory of the desired Java SDK. +# The JAVA_HOME environment variable is set with the contents of this +# variable. +# +# logstash_java_opts (string): +# Default value: "" +# Options to pass to the Java Virtual Machine. +# The JAVA_OPTS environment variable is set with the contents of this +# variable. +# +# logstash_opts (string): +# Default value: "" +# Additional command line flags for logstash, eg. "-r" +# + +. /etc/rc.subr + +name=logstash +rcvar=logstash_enable + +load_rc_config ${name} + +logdir="/var/log" + +: ${logstash_enable="NO"} +: ${logstash_user="logstash"} +: ${logstash_group="logstash"} +: ${logstash_home="%%LOGSTASH_HOME%%"} +: ${logstash_config="%%ETCDIR%%"} +: ${logstash_log="YES"} +: ${logstash_log_dir="${logdir}/${name}"} +: ${logstash_java_home="%%JAVA_HOME%%"} +: ${logstash_java_opts=""} +: ${logstash_opts=""} + +pidfile=/var/run/${name}/${name}.pid + +extra_commands="configtest reload" +start_precmd="logstash_precmd" +configtest_cmd=configtest + +logstash_cmd="${logstash_home}/bin/logstash" +procname="${logstash_java_home}/bin/java" + +logstash_chdir=${logstash_home} +logstash_log_options="" + +if checkyesno logstash_log; then + logstash_log_options=" -l ${logstash_log_dir}" +fi + +logstash_args="--path.settings ${logstash_config} ${logstash_log_options} ${logstash_opts}" + +JAVA_OPTS="${logstash_java_opts}" +JAVA_HOME="${logstash_java_home}" +export JAVA_OPTS +export JAVA_HOME + +command="/usr/sbin/daemon" +command_args="-f -p ${pidfile} ${logstash_cmd} ${logstash_args}" +required_files="${logstash_home} ${logstash_java_home} ${logstash_cmd} ${logstash_config}" + +# Include /usr/local/bin in path because Logstash startup scripts +# assume bash is in path. +PATH=/usr/local/bin:$PATH + +logstash_precmd() +{ + /usr/bin/install -d -o ${logstash_user} -g ${logstash_group} -m 755 ${pidfile%/*} + /usr/bin/install -d -o ${logstash_user} -g ${logstash_group} -m 755 ${logstash_log_dir} + /usr/bin/install -d -o ${logstash_user} -g ${logstash_group} -m 755 /var/db/logstash + /usr/bin/install -d -o ${logstash_user} -g ${logstash_group} -m 755 /var/run/logstash + + if [ -d ${logstash_home}/data/queue ]; then + chown ${logstash_user}:${logstash_group} ${logstash_home}/data/queue + fi +} + +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/logstash8/files/patch-config_logstash.yml b/sysutils/logstash8/files/patch-config_logstash.yml new file mode 100644 index 000000000000..e6d45d08195c --- /dev/null +++ b/sysutils/logstash8/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/logstash8/files/pkg-message.in b/sysutils/logstash8/files/pkg-message.in new file mode 100644 index 000000000000..73894160a3c1 --- /dev/null +++ b/sysutils/logstash8/files/pkg-message.in @@ -0,0 +1,18 @@ +[ +{ type: install + message: <<EOM +Logstash 8 was installed + +1) To start logstash as an agent during startup, add + + logstash_enable="YES" + + to your /etc/rc.conf. + +2) Extra options can be found in startup script. + +3) WARNING: In order for logstash to work properly, + you need /proc filesystem mounted. +EOM +} +] diff --git a/sysutils/logstash8/pkg-descr b/sysutils/logstash8/pkg-descr new file mode 100644 index 000000000000..ece40f16d8d2 --- /dev/null +++ b/sysutils/logstash8/pkg-descr @@ -0,0 +1,3 @@ +Logstash is an open source, server-side data processing pipeline that +ingests data from a multitude of sources simultaneously, transforms it, +and then sends it to your favorite "stash."