Add a port of logstash7

This commit is contained in:
Greg Lewis 2019-11-27 18:08:43 +00:00
parent 85353adae3
commit c3e24629b7
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=518514
10 changed files with 267 additions and 0 deletions

View file

@ -611,6 +611,7 @@
SUBDIR += logstash-forwarder
SUBDIR += logstash5
SUBDIR += logstash6
SUBDIR += logstash7
SUBDIR += logtool
SUBDIR += logwatch
SUBDIR += lookat

View file

@ -0,0 +1,74 @@
# Created by: Daniel Solsona <daniel@ish.com.au>, Guido Falsi <madpilot@FreeBSD.org>
# $FreeBSD$
PORTNAME= logstash
PORTVERSION= 7.4.2
CATEGORIES= sysutils java
MASTER_SITES= http://artifacts.elastic.co/downloads/logstash/
PKGNAMESUFFIX= 7
MAINTAINER= elastic@FreeBSD.org
COMMENT= Server-side data ingest and transfomation tool
LICENSE= APACHE20
RUN_DEPENDS= ${LOCALBASE}/bin/bash:shells/bash
USES= cpe shebangfix
CONFLICTS= logstash5-[0-9]* logstash6-[0-9]*
SHEBANG_FILES= bin/*
CPE_VENDOR= elasticsearch
USE_JAVA= yes
JAVA_VERSION= 1.8+
JAVA_RUN= yes
NO_BUILD= yes
USERS= logstash
GROUPS= logstash
LOGSTASH_DIR= ${PREFIX}/${PORTNAME}
USE_RC_SUBR= logstash
LOGSTASH_HOME?= ${PREFIX}/${PORTNAME}
SUB_LIST= JAVA_HOME=${JAVA_HOME} \
LOGSTASH_HOME=${LOGSTASH_HOME}
LOGSTASH_CONF_FILES= jvm.options log4j2.properties logstash.yml \
pipelines.yml startup.options
LOGSTASH_JRUBY_SUBDIR= vendor/jruby/bin
LOGSTASH_JRUBY_BIN_FILES= ast gem irb jgem jirb jirb_swing jruby \
jruby.bash jruby.sh jrubyc rake rdoc ri testrb
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_DIR})
${CHMOD} ${BINMODE} ${STAGEDIR}${LOGSTASH_DIR}/bin/*
.for x in ${LOGSTASH_JRUBY_BIN_FILES}
${CHMOD} ${BINMODE} ${STAGEDIR}${LOGSTASH_DIR}/${LOGSTASH_JRUBY_SUBDIR}/${x}
.endfor
${INSTALL} -lrs ${STAGEDIR}${ETCDIR} ${STAGEDIR}${LOGSTASH_DIR}/config
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,logstash,) logstash/data" >> ${TMPPLIST}
.include <bsd.port.mk>

View file

@ -0,0 +1,3 @@
TIMESTAMP = 1574817559
SHA256 (logstash-7.4.2.tar.gz) = 57c09116e95cb80e0b70e4a508890d56859cb5dc74cc15fc6145ea9bdbbabaaa
SIZE (logstash-7.4.2.tar.gz) = 173285633

View file

@ -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"
}
}

View file

@ -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"

View file

@ -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
#

View file

@ -0,0 +1,11 @@
--- vendor/jruby/bin/jruby.orig 2018-02-16 20:50:22 UTC
+++ vendor/jruby/bin/jruby
@@ -244,7 +244,7 @@ do
# Match -Xa.b.c=d to translate to -Da.b.c=d as a java option
-X*)
val=${1:2}
- if expr "$val" : '.*[.]' > /dev/null; then
+ if expr -- "$val" : '.*[.]' > /dev/null; then
java_args=("${java_args[@]}" "-Djruby.${val}")
else
ruby_args=("${ruby_args[@]}" "-X${val}")

View file

@ -0,0 +1,11 @@
--- vendor/jruby/bin/jruby.bash.orig 2018-02-16 20:50:22 UTC
+++ vendor/jruby/bin/jruby.bash
@@ -244,7 +244,7 @@ do
# Match -Xa.b.c=d to translate to -Da.b.c=d as a java option
-X*)
val=${1:2}
- if expr "$val" : '.*[.]' > /dev/null; then
+ if expr -- "$val" : '.*[.]' > /dev/null; then
java_args=("${java_args[@]}" "-Djruby.${val}")
else
ruby_args=("${ruby_args[@]}" "-X${val}")

View file

@ -0,0 +1,5 @@
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."
WWW: https://www.elastic.co/products/logstash

View file

@ -0,0 +1,13 @@
[
{ type: install
message: <<EOM
To start logstash as an agent during startup, add
logstash_enable="YES"
to your /etc/rc.conf.
Extra options can be found in startup script.
EOM
}
]