diff --git a/net-mgmt/victoria-logs/Makefile b/net-mgmt/victoria-logs/Makefile index ae5f430c17ce..b0061fb87bbe 100644 --- a/net-mgmt/victoria-logs/Makefile +++ b/net-mgmt/victoria-logs/Makefile @@ -1,64 +1,69 @@ PORTNAME= victoria-logs PORTVERSION= 1.45.0 DISTVERSIONPREFIX= v -PORTREVISION= 1 +PORTREVISION= 2 CATEGORIES= net-mgmt MAINTAINER= samm@FreeBSD.org COMMENT= Fast and easy-to-use, open source logs solution WWW= https://victoriametrics.com/products/victorialogs/ LICENSE= APACHE20 LICENSE_FILE= ${WRKSRC}/LICENSE USES= gmake go:1.25+,modules,no_targets # we have to use github, as goproxy tags are wrong # see https://github.com/VictoriaMetrics/VictoriaLogs/issues/1071 USE_GITHUB= yes GH_ACCOUNT= VictoriaMetrics GH_PROJECT= VictoriaLogs USE_RC_SUBR?= victoria_logs GO_MOD_DIST= github GO_MODULE= github.com/${GH_ACCOUNT}/${GH_PROJECT} MAKE_ENV= BUILDINFO_TAG=tags-v${PORTVERSION}-victorialogs \ DATEINFO_TAG=${_GET_DATE:sh} \ GOFLAGS=-buildvcs=false \ GOOS=${OPSYS:tl} \ PKG_TAG=v${PORTVERSION} ALL_TARGET= ${PORTNAME}-pure vlogscli-pure vmalert-pure SUB_LIST+= VICTORIA_DATA=${VICTORIA_DATA} \ + VICTORIA_GROUP=${GROUPS} \ VICTORIA_LOGS=${VICTORIA_LOGS} \ + VICTORIA_RUN=${VICTORIA_RUN} \ VICTORIA_USER=${USERS} USERS= victoria-logs GROUPS= victoria-logs VICTORIA_DATA?= /var/db/victoria-logs VICTORIA_LOGS?= /var/log/victoria_logs +VICTORIA_RUN?= /var/run/victoria_logs PLIST_SUB+= VICTORIA_DATA=${VICTORIA_DATA} \ VICTORIA_GROUP=${GROUPS} \ VICTORIA_LOGS=${VICTORIA_LOGS} \ + VICTORIA_RUN=${VICTORIA_RUN} \ VICTORIA_USER=${USERS} OPTIONS_DEFINE= DOCS .if !defined(MASTERDIR) do-install: ${INSTALL_PROGRAM} ${INSTALL_WRKSRC}/bin/${PORTNAME}-pure \ ${STAGEDIR}${PREFIX}/bin/${PORTNAME} ${INSTALL_PROGRAM} ${INSTALL_WRKSRC}/bin/vlogscli-pure \ ${STAGEDIR}${PREFIX}/bin/vlogscli - @${MKDIR} ${STAGEDIR}${VICTORIA_DATA} ${STAGEDIR}${VICTORIA_LOGS} + @${MKDIR} ${STAGEDIR}${VICTORIA_DATA} ${STAGEDIR}${VICTORIA_LOGS} \ + ${STAGEDIR}${VICTORIA_RUN} do-install-DOCS-on: @${MKDIR} ${STAGEDIR}${DOCSDIR} ${MV} ${INSTALL_WRKSRC}/docs/victorialogs/* ${STAGEDIR}${DOCSDIR} .endif .include _GET_DATE= TZ= ${STAT} -f %Sm -t %Y%m%d-%H%M%S ${WRKSRC}/.gitignore diff --git a/net-mgmt/victoria-logs/files/victoria_logs.in b/net-mgmt/victoria-logs/files/victoria_logs.in index 715e8fba04cb..6a7413e82fb7 100644 --- a/net-mgmt/victoria-logs/files/victoria_logs.in +++ b/net-mgmt/victoria-logs/files/victoria_logs.in @@ -1,66 +1,28 @@ #!/bin/sh # PROVIDE: victoria_logs # REQUIRE: NETWORKING # BEFORE: DAEMON . /etc/rc.subr name="victoria_logs" desc="Fast and easy-to-use, open source logs solution" -rcvar="victoria_logs_enable" -pidfile="/var/run/${name}.pid" -daemon_pidfile="/var/run/${name}-daemon.pid" -logdir="%%VICTORIA_LOGS%%" -logfile="${logdir}/victoria_logs.log" -command="%%PREFIX%%/bin/victoria-logs" -victoria_logs_args=${victoria_logs_args-"--storageDataPath=%%VICTORIA_DATA%% --retentionPeriod=1 --httpListenAddr=:9428"} -victoria_logs_user="%%VICTORIA_USER%%" -load_rc_config ${name} +rcvar="${name}_enable" -start_cmd="start" -stop_cmd="stop" -status_cmd="status" -extra_commands="reload" +load_rc_config ${name} -start() -{ - [ ! -d ${logdir} ] && mkdir -p ${logdir} - touch ${logfile} - chown ${victoria_logs_user} ${logdir} ${logfile} - /usr/sbin/daemon -u ${victoria_logs_user} -f -R5 -p ${pidfile} -P ${daemon_pidfile} -o ${logfile} ${command} ${victoria_logs_args} -} +: ${victoria_logs_enable:="NO"} +: ${victoria_logs_args:="-storageDataPath=%%VICTORIA_DATA%% -retentionPeriod=1 -httpListenAddr=:9428"} -stop() -{ - if [ -f "${daemon_pidfile}" ]; then - pids=$( pgrep -F ${daemon_pidfile} 2>&1 ) - _err=$? - [ ${_err} -eq 0 ] && kill -9 ${pids} && /bin/rm -f ${daemon_pidfile} - fi - if [ -f "${pidfile}" ]; then - pids=$( pgrep -F ${pidfile} 2>&1 ) - _err=$? - [ ${_err} -eq 0 ] && kill -9 ${pids} && /bin/rm -f ${pidfile} - fi -} +pidfile="%%VICTORIA_RUN%%/${name}.pid" +daemon_pidfile="%%VICTORIA_RUN%%/${name}-daemon.pid" +logfile="%%VICTORIA_LOGS%%/${name}.log" +victoria_logs_user="%%VICTORIA_USER%%" +victoria_logs_group="%%VICTORIA_GROUP%%" +procname="%%PREFIX%%/bin/victoria-logs" +command="/usr/sbin/daemon" +command_args="-f -p ${pidfile} -P ${daemon_pidfile} -o ${logfile} -t ${name} ${procname} ${victoria_logs_args}" -status() -{ - if [ -f "${pidfile}" ]; then - pids=$( pgrep -F ${pidfile} 2>&1 ) - _err=$? - if [ ${_err} -eq 0 ]; then - echo "${name} is running as pid ${pids}" - exit 0 - else - echo "wrong pid: ${pids}" - exit 1 - fi - else - echo "no pidfile $pidfile" - exit 1 - fi -} run_rc_command "$1" diff --git a/net-mgmt/victoria-logs/pkg-plist b/net-mgmt/victoria-logs/pkg-plist index 2bc997d481b8..95688307d2af 100644 --- a/net-mgmt/victoria-logs/pkg-plist +++ b/net-mgmt/victoria-logs/pkg-plist @@ -1,56 +1,57 @@ bin/victoria-logs bin/vlogscli %%PORTDOCS%%%%DOCSDIR%%/CHANGELOG.md %%PORTDOCS%%%%DOCSDIR%%/FAQ.md %%PORTDOCS%%%%DOCSDIR%%/QuickStart.md %%PORTDOCS%%%%DOCSDIR%%/README.md %%PORTDOCS%%%%DOCSDIR%%/Roadmap.md %%PORTDOCS%%%%DOCSDIR%%/data-ingestion/Filebeat.md %%PORTDOCS%%%%DOCSDIR%%/data-ingestion/Fluentbit.md %%PORTDOCS%%%%DOCSDIR%%/data-ingestion/Logstash.md %%PORTDOCS%%%%DOCSDIR%%/data-ingestion/Promtail.md %%PORTDOCS%%%%DOCSDIR%%/data-ingestion/README.md %%PORTDOCS%%%%DOCSDIR%%/data-ingestion/Vector.md %%PORTDOCS%%%%DOCSDIR%%/data-ingestion/syslog.md %%PORTDOCS%%%%DOCSDIR%%/keyConcepts.md %%PORTDOCS%%%%DOCSDIR%%/logsql-examples.md %%PORTDOCS%%%%DOCSDIR%%/querying/README.md %%PORTDOCS%%%%DOCSDIR%%/victorialogs-datasource.md %%PORTDOCS%%%%DOCSDIR%%/_index.md %%PORTDOCS%%%%DOCSDIR%%/data-ingestion/Telegraf.md %%PORTDOCS%%%%DOCSDIR%%/data-ingestion/_index.md %%PORTDOCS%%%%DOCSDIR%%/data-ingestion/opentelemetry.md %%PORTDOCS%%%%DOCSDIR%%/provision_datasources.webp %%PORTDOCS%%%%DOCSDIR%%/querying/_index.md %%PORTDOCS%%%%DOCSDIR%%/data-ingestion/Fluentd.md %%PORTDOCS%%%%DOCSDIR%%/ha-victorialogs-single-node.webp %%PORTDOCS%%%%DOCSDIR%%/querying/vlogscli.md %%PORTDOCS%%%%DOCSDIR%%/data-ingestion/DataDogAgent.md %%PORTDOCS%%%%DOCSDIR%%/data-ingestion/Journald.md %%PORTDOCS%%%%DOCSDIR%%/vmalert.md %%PORTDOCS%%%%DOCSDIR%%/vmalert_victorialogs.excalidraw %%PORTDOCS%%%%DOCSDIR%%/vmalert_victorialogs.webp %%PORTDOCS%%%%DOCSDIR%%/cluster.md %%PORTDOCS%%%%DOCSDIR%%/logql-to-logsql.md %%PORTDOCS%%%%DOCSDIR%%/sql-to-logsql.md %%PORTDOCS%%%%DOCSDIR%%/Articles.md %%PORTDOCS%%%%DOCSDIR%%/Release-Guide.md %%PORTDOCS%%%%DOCSDIR%%/security-and-lb.md %%PORTDOCS%%%%DOCSDIR%%/vlagent.md %%PORTDOCS%%%%DOCSDIR%%/metrics.md %%PORTDOCS%%%%DOCSDIR%%/vlagent-metrics.md %%PORTDOCS%%%%DOCSDIR%%/logsql.md %%PORTDOCS%%%%DOCSDIR%%/integrations/_index.md %%PORTDOCS%%%%DOCSDIR%%/integrations/perses-datasource.webp %%PORTDOCS%%%%DOCSDIR%%/integrations/perses-logs-panel.webp %%PORTDOCS%%%%DOCSDIR%%/integrations/perses-overview.webp %%PORTDOCS%%%%DOCSDIR%%/integrations/perses-time-panel.webp %%PORTDOCS%%%%DOCSDIR%%/integrations/perses-variable.webp %%PORTDOCS%%%%DOCSDIR%%/integrations/perses.md %%PORTDOCS%%%%DOCSDIR%%/querying/vlogscli_common_flags.md %%PORTDOCS%%%%DOCSDIR%%/victoria_logs_common_flags.md %%PORTDOCS%%%%DOCSDIR%%/victoria_logs_enterprise_flags.md %%PORTDOCS%%%%DOCSDIR%%/vlagent_common_flags.md %%PORTDOCS%%%%DOCSDIR%%/vlagent_enterprise_flags.md @dir(%%VICTORIA_USER%%,%%VICTORIA_GROUP%%,750) %%VICTORIA_DATA%% @dir(%%VICTORIA_USER%%,%%VICTORIA_GROUP%%,750) %%VICTORIA_LOGS%% +@dir(%%VICTORIA_USER%%,%%VICTORIA_GROUP%%,750) %%VICTORIA_RUN%%