git: e8723f0a8cc8 - main - sysutils/graylog: update to 5.0.2

From: Dave Cottlehuber <dch_at_FreeBSD.org>
Date: Wed, 11 Jan 2023 22:11:32 UTC
The branch main has been updated by dch:

URL: https://cgit.FreeBSD.org/ports/commit/?id=e8723f0a8cc8cb102a21be5ddb2b430ec61fcc2b

commit e8723f0a8cc8cb102a21be5ddb2b430ec61fcc2b
Author:     Dave Cottlehuber <dch@FreeBSD.org>
AuthorDate: 2023-01-11 22:01:22 +0000
Commit:     Dave Cottlehuber <dch@FreeBSD.org>
CommitDate: 2023-01-11 22:08:28 +0000

    sysutils/graylog: update to 5.0.2
    
    - support JAVA_HOME
    - accept additional java parameters in rc.conf
    - OpenJDK17 is now required
    - remove unsupported JVM tunables
    
    Reported by:    Einar Bjarni Halldórsson <einar@isnic.is>
    Differential Revision: https://reviews.freebsd.org/D37979
---
 UPDATING                              |  8 +++++++
 sysutils/graylog/Makefile             | 13 +++++------
 sysutils/graylog/distinfo             |  8 +++----
 sysutils/graylog/files/graylog.in     | 41 +++++++++++++++++------------------
 sysutils/graylog/files/pkg-message.in | 23 ++++++++++----------
 sysutils/graylog/pkg-plist            |  3 ++-
 6 files changed, 50 insertions(+), 46 deletions(-)

diff --git a/UPDATING b/UPDATING
index b8fc689d5a0d..3fcbb66292c2 100644
--- a/UPDATING
+++ b/UPDATING
@@ -5,6 +5,14 @@ they are unavoidable.
 You should get into the habit of checking this file for changes each time
 you update your ports collection, before attempting any port upgrades.
 
+20230111:
+  AFFECTS: users of sysutils/graylog
+  AUTHOR: dch@freebsd.org
+
+  Graylog 5.x and higher effectively constrains ElasticSearch
+  dependencies, and in most cases will force a migration to
+  OpenSearch 2.x, now available in ports. Plan accordingly.
+
 20230104:
   AFFECTS: users of mail/spamassassin
   AUTHOR: cy@freebsd.org
diff --git a/sysutils/graylog/Makefile b/sysutils/graylog/Makefile
index da6582b23829..1b2566036643 100644
--- a/sysutils/graylog/Makefile
+++ b/sysutils/graylog/Makefile
@@ -1,9 +1,8 @@
 PORTNAME=	graylog
-DISTVERSION=	4.3.9
+DISTVERSION=	5.0.2
 CATEGORIES=	sysutils java
 MASTER_SITES=	https://downloads.graylog.org/releases/
-DISTFILES=	graylog/${DISTNAME}${EXTRACT_SUFX} \
-		graylog-integrations/graylog-integrations-plugins-${DISTVERSION}${EXTRACT_SUFX}
+DISTFILES=	graylog/${DISTNAME}${EXTRACT_SUFX}
 
 MAINTAINER=	dch@FreeBSD.org
 COMMENT=	Tool for centralized log collection
@@ -18,7 +17,7 @@ LICENSE_PERMS_SSPLv1=	dist-mirror dist-sell pkg-mirror pkg-sell auto-accept
 USES=		cpe tar:tgz
 USE_JAVA=	yes
 
-JAVA_VERSION=	1.8+
+JAVA_VERSION=	17+
 JAVA_EXTRACT=	yes
 JAVA_RUN=	yes
 
@@ -38,7 +37,8 @@ GRAYLOG_LOGS_DIR=	/var/log/graylog
 SUB_LIST=	GRAYLOG_DATA_DIR=${GRAYLOG_DATA_DIR} \
 		GRAYLOG_LOGS_DIR=${GRAYLOG_LOGS_DIR} \
 		GRAYLOGGROUP=${GRAYLOGGROUP} \
-		GRAYLOGUSER=${GRAYLOGUSER}
+		GRAYLOGUSER=${GRAYLOGUSER} \
+		JAVA_HOME=${JAVA_HOME}
 
 PLIST_SUB=	DISTVERSION=${DISTVERSION} \
 		GRAYLOG_DATA_DIR=${GRAYLOG_DATA_DIR} \
@@ -53,7 +53,6 @@ post-extract:
 		-e 's,^data_dir .+,data_dir = /var/db/graylog,' \
 		-e 's,^message_journal_dir .+,message_journal_dir = ${GRAYLOG_DATA_DIR}/journal,' \
 		-e 's,^node_id_file .+,node_id_file = ${ETCDIR}/server/node-id,' \
-		-e 's,^plugin_dir .+,plugin_dir = ${LOCALBASE}/share/graylog/plugin,' \
 	${WRKSRC}/graylog.conf.example
 
 do-install:
@@ -66,8 +65,6 @@ do-install:
 		${STAGEDIR}${ETCDIR}/graylog.conf.sample
 	${INSTALL_DATA} ${WRKDIR}/log4j2.xml \
 		${STAGEDIR}${ETCDIR}/log4j2.xml.sample
-	cd ${WRKDIR}/graylog-integrations-plugins-${DISTVERSION}/plugin && \
-	    ${COPYTREE_SHARE} . ${STAGEDIR}${DATADIR}/plugin/
 	cd ${WRKSRC}/plugin && \
 	    ${COPYTREE_SHARE} . ${STAGEDIR}${DATADIR}/plugin/
 
diff --git a/sysutils/graylog/distinfo b/sysutils/graylog/distinfo
index b49adb71a630..05394c263ae6 100644
--- a/sysutils/graylog/distinfo
+++ b/sysutils/graylog/distinfo
@@ -1,5 +1,3 @@
-TIMESTAMP = 1668610419
-SHA256 (graylog/graylog-4.3.9.tgz) = 04cc3a538ecb41014554cdf8ae069d31eb69613b63e91dc4fae53476d4dc1fae
-SIZE (graylog/graylog-4.3.9.tgz) = 205517890
-SHA256 (graylog-integrations/graylog-integrations-plugins-4.3.9.tgz) = 21035ef2dfad2c2dc7c7913527b44232727d9d9291cb3f922585b2dae0154610
-SIZE (graylog-integrations/graylog-integrations-plugins-4.3.9.tgz) = 29305007
+TIMESTAMP = 1673040775
+SHA256 (graylog/graylog-5.0.2.tgz) = 183e7f87bb037dec51d4b3d146d1684e4d8095ce7bf0dfb5ef5faf9b06734792
+SIZE (graylog/graylog-5.0.2.tgz) = 252827584
diff --git a/sysutils/graylog/files/graylog.in b/sysutils/graylog/files/graylog.in
index 3530a2a57120..aff849de8e10 100644
--- a/sysutils/graylog/files/graylog.in
+++ b/sysutils/graylog/files/graylog.in
@@ -19,7 +19,7 @@
 #   Name of the graylog group
 #
 # graylog_config (string)
-#   Default value %%ETCDIR%%/server/server.conf
+#   Default value %%ETCDIR%%/graylog.conf
 #   Path to the graylog configuration file
 #
 # graylog_min_mem (string):
@@ -45,6 +45,10 @@
 # graylog_log_config (string):
 #   Default value: %%ETCDIR%%/server/log4j2.xml
 #   Path to the Graylog Server logfile
+#
+# graylog_java_home (path):
+#   Default value: %%JAVA_HOME%%
+#   Set it to the root of the JDK to use.
 
 . /etc/rc.subr
 
@@ -53,38 +57,31 @@ rcvar=graylog_enable
 load_rc_config $name
 
 : ${graylog_enable:="NO"}
-: ${graylog_user:="%%GRAYLOGUSER%%"}
-: ${graylog_group:="%%GRAYLOGGROUP%%"}
 : ${graylog_config:="%%ETCDIR%%/graylog.conf"}
-: ${graylog_min_mem:="256m"}
-: ${graylog_max_mem:="1g"}
-: ${graylog_dir:="%%DATADIR%%"}
 : ${graylog_data_dir:="%%GRAYLOG_DATA_DIR%%"}
+: ${graylog_dir:="%%DATADIR%%"}
+: ${graylog_group:="%%GRAYLOGGROUP%%"}
+: ${graylog_java_home:="%%JAVA_HOME%%"}
+: ${graylog_java_opts:=""}
+: ${graylog_log_config:="%%ETCDIR%%/log4j2.xml"}
 : ${graylog_logs_dir:="%%GRAYLOG_LOGS_DIR%%"}
+: ${graylog_max_mem:="1g"}
+: ${graylog_min_mem:="256m"}
 : ${graylog_run_dir:="/var/run/graylog"}
-: ${graylog_log_config:="%%ETCDIR%%/log4j2.xml"}
+: ${graylog_user:="%%GRAYLOGUSER%%"}
 
 java_options=" \
-    -Djava.awt.headless=true \
     -Dapp=${name} \
+    -Djava.awt.headless=true \
     -Dlog4j.configurationFile=${graylog_log_config} \
-    -Xms${graylog_min_mem} \
-    -Xmx${graylog_max_mem} \
-    -XX:-OmitStackTraceInFastThrow \
-    -XX:+AggressiveOpts \
-    -XX:+CMSClassUnloadingEnabled \
-    -XX:+CMSConcurrentMTEnabled \
-    -XX:+CMSParallelRemarkEnabled \
-    -XX:+DisableExplicitGC \
     -XX:+HeapDumpOnOutOfMemoryError \
     -XX:+ResizeTLAB \
-    -XX:+UseCMSInitiatingOccupancyOnly \
     -XX:+UseCompressedOops \
-    -XX:+UseConcMarkSweepGC \
-    -XX:+UseFastAccessorMethods \
-    -XX:+UseParNewGC \
-    -XX:CMSInitiatingOccupancyFraction=75 \
+    -XX:-OmitStackTraceInFastThrow \
     -XX:NewRatio=1 \
+    -Xms${graylog_min_mem} \
+    -Xmx${graylog_max_mem} \
+    ${graylog_java_opts} \
     "
 
 app_pidfile="${graylog_run_dir}/${name}.pid"
@@ -103,6 +100,8 @@ command_args=" \
     --no-pid-file \
     --configfile ${graylog_config}"
 
+export JAVA_HOME=${graylog_java_home}
+
 required_files="%%LOCALBASE%%/bin/java ${graylog_config}"
 
 graylog_precmd() {
diff --git a/sysutils/graylog/files/pkg-message.in b/sysutils/graylog/files/pkg-message.in
index 0c2d6783ab52..04fdeb212817 100644
--- a/sysutils/graylog/files/pkg-message.in
+++ b/sysutils/graylog/files/pkg-message.in
@@ -11,28 +11,29 @@ When running graylog in a jail, you need to set enforce_statfs for the jail.
 
 For a single-node installation, install:
 
-- databases/mongodb40 or higher
-- textproc/elasticsearch6 or higher
+- databases/mongodb50 or higher
+- textproc/opensearch 1.3, 2.0 or higher
 
 And ensure that the elasticsearch cluster name matches that used by graylog.
 
+See https://go2docs.graylog.org/5-0/downloading_and_installing_graylog/installing_graylog.html
+
 EOM
 }
 { type: upgrade
   message: <<EOM
-Graylog v4.3.0+ will not start up, unless the internal stats collector
-is disabled with disable_native_system_stats_collector=true
-
-See https://github.com/Graylog2/graylog2-server/issues/12542 for details.
+Graylog v5.0 requires significant preparation to migrate both to newer
+MongoDB and to switch from older ElasticSearch to the new OpenSearch.
 
-graylog now has a *minimum* dependency of elasticsearch6 or higher. You
-may need to re-index after upgrading to ES6, please refer to graylog
+You may need to re-index OpenSearch after migrating, refer to upstream
 docs for more details.
 
-- textproc/elasticsearch6 or higher
-- databases/mongodb40 or higher
+https://go2docs.graylog.org/5-0/upgrading_graylog/upgrading_to_graylog_5.0.x.htm
+
+- textproc/opensearch 1.3, 2.0 or higher
+- databases/mongodb50 or higher
 
-Remember to backup both MongoDB & ES6 databases before upgrading Graylog
+Remember to backup both MongoDB & ES/OS databases before upgrading Graylog
 itself.
 
 Beginning with v4.0, Graylog Open Source is licensed under the
diff --git a/sysutils/graylog/pkg-plist b/sysutils/graylog/pkg-plist
index dca62c13b94f..49a1ea04c686 100644
--- a/sysutils/graylog/pkg-plist
+++ b/sysutils/graylog/pkg-plist
@@ -3,11 +3,12 @@
 %%DATADIR%%/plugin/%%PORTNAME%%-plugin-collector-%%DISTVERSION%%.jar
 %%DATADIR%%/plugin/%%PORTNAME%%-plugin-integrations-%%DISTVERSION%%.jar
 %%DATADIR%%/plugin/%%PORTNAME%%-plugin-threatintel-%%DISTVERSION%%.jar
-%%DATADIR%%/plugin/%%PORTNAME%%-storage-elasticsearch6-%%DISTVERSION%%.jar
 %%DATADIR%%/plugin/%%PORTNAME%%-storage-elasticsearch7-%%DISTVERSION%%.jar
+%%DATADIR%%/plugin/%%PORTNAME%%-storage-opensearch2-%%DISTVERSION%%.jar
 @dir(%%GRAYLOGUSER%%,%%GRAYLOGGROUP%%,750) %%ETCDIR%%/server
 @dir(%%GRAYLOGUSER%%,%%GRAYLOGGROUP%%,750) %%GRAYLOG_DATA_DIR%%
 @dir(%%GRAYLOGUSER%%,%%GRAYLOGGROUP%%,750) %%GRAYLOG_DATA_DIR%%/journal
 @dir(%%GRAYLOGUSER%%,%%GRAYLOGGROUP%%,750) %%GRAYLOG_LOGS_DIR%%
 @sample(%%GRAYLOGUSER%%,%%GRAYLOGGROUP%%,440) %%ETCDIR%%/graylog.conf.sample
 @sample(%%GRAYLOGUSER%%,%%GRAYLOGGROUP%%,440) %%ETCDIR%%/log4j2.xml.sample
+