From owner-svn-ports-all@freebsd.org Wed Mar 21 05:37:38 2018 Return-Path: Delivered-To: svn-ports-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 71C3FF4A215; Wed, 21 Mar 2018 05:37:38 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 13D617CDAA; Wed, 21 Mar 2018 05:37:38 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0EA3026BBC; Wed, 21 Mar 2018 05:37:38 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2L5bb03015490; Wed, 21 Mar 2018 05:37:37 GMT (envelope-from lwhsu@FreeBSD.org) Received: (from lwhsu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2L5bbf8015483; Wed, 21 Mar 2018 05:37:37 GMT (envelope-from lwhsu@FreeBSD.org) Message-Id: <201803210537.w2L5bbf8015483@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: lwhsu set sender to lwhsu@FreeBSD.org using -f From: Li-Wen Hsu Date: Wed, 21 Mar 2018 05:37:37 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r465147 - in head/net-mgmt: . grok_exporter grok_exporter/files X-SVN-Group: ports-head X-SVN-Commit-Author: lwhsu X-SVN-Commit-Paths: in head/net-mgmt: . grok_exporter grok_exporter/files X-SVN-Commit-Revision: 465147 X-SVN-Commit-Repository: ports MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-ports-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the ports tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 05:37:38 -0000 Author: lwhsu Date: Wed Mar 21 05:37:37 2018 New Revision: 465147 URL: https://svnweb.freebsd.org/changeset/ports/465147 Log: Add net-mgmt/grok_exporter, export Prometheus metrics from arbitrary unstructured log data PR: 224455 Submitted by: Gasol Wu Added: head/net-mgmt/grok_exporter/ head/net-mgmt/grok_exporter/Makefile (contents, props changed) head/net-mgmt/grok_exporter/distinfo (contents, props changed) head/net-mgmt/grok_exporter/files/ head/net-mgmt/grok_exporter/files/config.yml.in (contents, props changed) head/net-mgmt/grok_exporter/files/grok_exporter.in (contents, props changed) head/net-mgmt/grok_exporter/pkg-descr (contents, props changed) head/net-mgmt/grok_exporter/pkg-plist (contents, props changed) Modified: head/net-mgmt/Makefile Modified: head/net-mgmt/Makefile ============================================================================== --- head/net-mgmt/Makefile Wed Mar 21 03:51:44 2018 (r465146) +++ head/net-mgmt/Makefile Wed Mar 21 05:37:37 2018 (r465147) @@ -76,6 +76,7 @@ SUBDIR += gnu-ipcalc SUBDIR += grepcidr SUBDIR += grepip + SUBDIR += grok_exporter SUBDIR += gsnmp SUBDIR += guifi-snpservices SUBDIR += hastmon Added: head/net-mgmt/grok_exporter/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/net-mgmt/grok_exporter/Makefile Wed Mar 21 05:37:37 2018 (r465147) @@ -0,0 +1,39 @@ +# $FreeBSD$ + +PORTNAME= grok_exporter +PORTVERSION= 0.2.3 +DISTVERSIONPREFIX=v +CATEGORIES= net-mgmt + +MAINTAINER= gasol.wu@gmail.com +COMMENT= Export Prometheus metrics from arbitrary unstructured log data + +LICENSE= APACHE20 +LICENSE_FILE= ${WRKSRC}/LICENSE + +ONLY_FOR_ARCHS= amd64 + +LIB_DEPENDS= libonig.so:devel/oniguruma + +USES= go +USE_GITHUB= yes +GH_ACCOUNT= fstab logstash-plugins:plugins +GH_PROJECT= logstash-patterns-core:plugins +GH_TAGNAME= 6d25c13:plugins + +GO_PKGNAME= github.com/${GH_ACCOUNT}/${PORTNAME} +USE_RC_SUBR= grok_exporter +SUB_FILES= config.yml + +do-build: + ${LN} -sf ${WRKSRC}/tailer/fileTailer_darwin.go ${WRKSRC}/tailer/fileTailer_freebsd.go + @(cd ${GO_WRKSRC}; ${SETENV} ${MAKE_ENV} ${GO_ENV} ${GO_CMD} build -o ${PORTNAME} .) + +do-install: + ${INSTALL_PROGRAM} ${GO_WRKSRC}/${PORTNAME} ${STAGEDIR}${PREFIX}/bin/${PORTNAME} + ${MKDIR} ${STAGEDIR}${ETCDIR} + ${INSTALL_DATA} ${WRKDIR}/config.yml ${STAGEDIR}${ETCDIR} + @(cd ${WRKSRC} && ${COPYTREE_SHARE} example ${STAGEDIR}${DATADIR}) + @(cd ${WRKSRC_plugins} && ${COPYTREE_SHARE} patterns ${STAGEDIR}${DATADIR}) + +.include Added: head/net-mgmt/grok_exporter/distinfo ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/net-mgmt/grok_exporter/distinfo Wed Mar 21 05:37:37 2018 (r465147) @@ -0,0 +1,5 @@ +TIMESTAMP = 1513652246 +SHA256 (fstab-grok_exporter-v0.2.3_GH0.tar.gz) = 2dd92d93b59979d409e11c2e5ca3fce28299529f63dde3423234264c0a846338 +SIZE (fstab-grok_exporter-v0.2.3_GH0.tar.gz) = 470262 +SHA256 (logstash-plugins-logstash-patterns-core-6d25c13_GH0.tar.gz) = 7f4986b695d82bcfd585b47635607267ce473a601df504672072b242ae7c607f +SIZE (logstash-plugins-logstash-patterns-core-6d25c13_GH0.tar.gz) = 27383 Added: head/net-mgmt/grok_exporter/files/config.yml.in ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/net-mgmt/grok_exporter/files/config.yml.in Wed Mar 21 05:37:37 2018 (r465147) @@ -0,0 +1,15 @@ +global: + config_version: 2 + +grok: + patterns_dir: %%DATADIR%%/patterns + +metrics: + - type: counter + name: log_messages_total + help: Number of lines in /var/log/messages + match: '%{GREEDYDATA}' + +server: + host: localhost + port: 9144 Added: head/net-mgmt/grok_exporter/files/grok_exporter.in ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/net-mgmt/grok_exporter/files/grok_exporter.in Wed Mar 21 05:37:37 2018 (r465147) @@ -0,0 +1,47 @@ +#!/bin/sh +# $FreeBSD$ + +# PROVIDE: grok_exporter +# REQUIRE: LOGIN +# KEYWORD: shutdown +# +# Add the following lines to /etc/rc.conf.local or /etc/rc.conf +# to enable this service: +# +# grok_exporter_enable (bool): Set to NO by default. +# Set it to YES to enable grok_exporter. +# grok_exporter_config (string): Set path to config file +# Default is "%%ETCDIR%%/config.yml". +# grok_exporter_user (string): Set user that grok_exporter will run under +# Default is "nobody". +# grok_exporter_group (string): Set group that grok_exporter will run under +# Default is "nobody". + +. /etc/rc.subr + +name=grok_exporter +desc="Grok prometheus exporter" +rcvar=grok_exporter_enable + +load_rc_config $name + +: ${grok_exporter_enable:=NO} +: ${grok_exporter_config:=%%ETCDIR%%/config.yml} +: ${grok_exporter_user:=nobody} +: ${grok_exporter_group:=nobody} + +pidfile=/var/run/grok_exporter.pid +command=/usr/sbin/daemon +procname=%%PREFIX%%/bin/grok_exporter +command_args="-p ${pidfile} /usr/bin/env ${procname} -config ${grok_exporter_config}" + +start_precmd=grok_exporter_startprecmd + +grok_exporter_startprecmd() +{ + if [ ! -e ${pidfile} ]; then + install -o ${grok_exporter_user} -g ${grok_exporter_group} /dev/null ${pidfile}; + fi +} + +run_rc_command "$1" Added: head/net-mgmt/grok_exporter/pkg-descr ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/net-mgmt/grok_exporter/pkg-descr Wed Mar 21 05:37:37 2018 (r465147) @@ -0,0 +1,12 @@ +Grok is a tool to parse crappy unstructured log data into something structured +and queryable. Grok is heavily used in Logstash to provide log data as input for +ElasticSearch. + +Grok ships with about 120 predefined patterns for syslog logs, apache and other +webserver logs, mysql logs, etc. It is easy to extend Grok with custom patterns. + +The grok_exporter aims at porting Grok from the ELK stack to Prometheus +monitoring. The goal is to use Grok patterns for extracting Prometheus metrics +from arbitrary log files. + +WWW: https://github.com/fstab/grok_exporter Added: head/net-mgmt/grok_exporter/pkg-plist ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/net-mgmt/grok_exporter/pkg-plist Wed Mar 21 05:37:37 2018 (r465147) @@ -0,0 +1,22 @@ +bin/grok_exporter +%%ETCDIR%%/config.yml +%%DATADIR%%/example/config.yml +%%DATADIR%%/example/exim-rejected-RCPT-examples.log +%%DATADIR%%/patterns/aws +%%DATADIR%%/patterns/bacula +%%DATADIR%%/patterns/bro +%%DATADIR%%/patterns/exim +%%DATADIR%%/patterns/firewalls +%%DATADIR%%/patterns/grok-patterns +%%DATADIR%%/patterns/haproxy +%%DATADIR%%/patterns/java +%%DATADIR%%/patterns/junos +%%DATADIR%%/patterns/linux-syslog +%%DATADIR%%/patterns/mcollective +%%DATADIR%%/patterns/mcollective-patterns +%%DATADIR%%/patterns/mongodb +%%DATADIR%%/patterns/nagios +%%DATADIR%%/patterns/postgresql +%%DATADIR%%/patterns/rails +%%DATADIR%%/patterns/redis +%%DATADIR%%/patterns/ruby