Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 21 Nov 2013 12:35:12 +0000 (UTC)
From:      Guido Falsi <madpilot@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r334480 - in head/sysutils/logstash: . files
Message-ID:  <201311211235.rALCZC2i084048@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: madpilot
Date: Thu Nov 21 12:35:12 2013
New Revision: 334480
URL: http://svnweb.freebsd.org/changeset/ports/334480

Log:
  - Upgrade to 1.2.1
  - Make sample config file work with BSD syslog
  - Startup script fixes
  - Convert to staging
  
  PR:		ports/182492
  Submitted by:	Regis A. Despres <regis.despres@gmail.com> (maintainer)

Modified:
  head/sysutils/logstash/Makefile
  head/sysutils/logstash/distinfo   (contents, props changed)
  head/sysutils/logstash/files/logstash.conf.sample   (contents, props changed)
  head/sysutils/logstash/files/logstash.in
  head/sysutils/logstash/pkg-plist   (contents, props changed)

Modified: head/sysutils/logstash/Makefile
==============================================================================
--- head/sysutils/logstash/Makefile	Thu Nov 21 12:28:29 2013	(r334479)
+++ head/sysutils/logstash/Makefile	Thu Nov 21 12:35:12 2013	(r334480)
@@ -2,10 +2,10 @@
 # $FreeBSD$
 
 PORTNAME=	logstash
-PORTVERSION=	1.1.13
+PORTVERSION=	1.2.1
 CATEGORIES=	sysutils java
 MASTER_SITES=	https://logstash.objects.dreamhost.com/release/ \
-		http://semicomplete.com/files/logstash/
+		https://download.elasticsearch.org/logstash/logstash/
 DISTNAME=	${PORTNAME}-${PORTVERSION}-flatjar
 EXTRACT_SUFX=	.jar
 EXTRACT_ONLY=
@@ -32,20 +32,13 @@ PLIST_SUB+=	LOGSTASH_HOME=${LOGSTASH_HOM
 		LOGSTASH_RUN=${LOGSTASH_RUN} \
 		LOGSTASH_DATA_DIR=${LOGSTASH_DATA_DIR}
 
-NO_STAGE=	yes
 do-install:
-	${MKDIR} ${LOGSTASH_RUN}
-	${MKDIR} ${ETCDIR}
-	${MKDIR} ${LOGSTASH_HOME}
-	${MKDIR} ${LOGSTASH_DATA_DIR}
-	${INSTALL_DATA} ${DISTDIR}/${DIST_SUBDIR}/${LOGSTASH_JAR} ${LOGSTASH_HOME}
-	${INSTALL_DATA} ${FILESDIR}/logstash.conf.sample ${ETCDIR}
-	@if [ ! -f ${ETCDIR}/logstash.conf ]; then \
-		${CP} -p ${ETCDIR}/logstash.conf.sample ${ETCDIR}/logstash.conf ; \
-	fi
-	${INSTALL_DATA} ${FILESDIR}/elasticsearch.yml.sample ${ETCDIR}
-	@if [ ! -f ${ETCDIR}/elasticsearch.yml ]; then \
-		${CP} -p ${ETCDIR}/elasticsearch.yml.sample ${ETCDIR}/elasticsearch.yml ; \
-	fi
+	${MKDIR} ${STAGEDIR}${ETCDIR}
+	${MKDIR} ${STAGEDIR}${LOGSTASH_HOME}
+	${MKDIR} ${STAGEDIR}${LOGSTASH_RUN}
+	${MKDIR} ${STAGEDIR}${LOGSTASH_DATA_DIR}
+	${INSTALL_DATA} ${DISTDIR}/${DIST_SUBDIR}/${LOGSTASH_JAR} ${STAGEDIR}${LOGSTASH_HOME}
+	${INSTALL_DATA} ${FILESDIR}/logstash.conf.sample ${STAGEDIR}${ETCDIR}
+	${INSTALL_DATA} ${FILESDIR}/elasticsearch.yml.sample ${STAGEDIR}${ETCDIR}
 
 .include <bsd.port.mk>

Modified: head/sysutils/logstash/distinfo
==============================================================================
--- head/sysutils/logstash/distinfo	Thu Nov 21 12:28:29 2013	(r334479)
+++ head/sysutils/logstash/distinfo	Thu Nov 21 12:35:12 2013	(r334480)
@@ -1,2 +1,2 @@
-SHA256 (logstash-1.1.13-flatjar.jar) = 5ba0639ff4da064c2a4f6a04bd7006b1997a6573859d3691e210b6855e1e47f1
-SIZE (logstash-1.1.13-flatjar.jar) = 69485313
+SHA256 (logstash-1.2.1-flatjar.jar) = d0b8a56fb1aa71d54c2bab71709d900b359fdf8c6d7d6ff15578423a0d86ee23
+SIZE (logstash-1.2.1-flatjar.jar) = 81648562

Modified: head/sysutils/logstash/files/logstash.conf.sample
==============================================================================
--- head/sysutils/logstash/files/logstash.conf.sample	Thu Nov 21 12:28:29 2013	(r334479)
+++ head/sysutils/logstash/files/logstash.conf.sample	Thu Nov 21 12:35:12 2013	(r334480)
@@ -1,27 +1,42 @@
 input {
-  file {
-    type => "system logs"
 
-  #  # Wildcards work, here :)
-  #  path => [ "/var/log/*.log", "/var/log/messages", "/var/log/syslog" ]
-    path => [ "/var/log/messages" ]
-  }
-
-  #file {
-  #  type => "Hudson-access"
-  #  path => "/var/log/www/hudson.ish.com.au-access_log"
-  #}
+	file {
+		type => "syslog"
+	    #  # Wildcards work, here :)
+	    #  path => [ "/var/log/*.log", "/var/log/messages", "/var/log/syslog" ]
+	    path => "/var/log/messages"
+	    start_position => "beginning"
+	}
+}
 
-  #file {
-  #          type => "Syslog"
-  #  path => "/var/log/messages"
-  #}
+filter {
+  if [type] == "syslog" {
+	grok {
+	  match => { "message" => "%{SYSLOGTIMESTAMP:syslog_timestamp} %{SYSLOGHOST:syslog_hostname} (%{DATA:syslog_program}(?:\[%{POSINT:syslog_pid}\])?: %{GREEDYDATA:syslog_message}|%{GREEDYDATA:syslog_message})" }
+	  add_field => [ "received_at", "%{@timestamp}" ]
+	  add_field => [ "received_from", "%{@source_host}" ]
+	}
+    
+    if !("_grokparsefailure" in [tags]) {
+      mutate {
+        replace => [ "@source_host", "%{syslog_hostname}" ]
+        replace => [ "@message", "%{syslog_message}" ]
+      }
+    }
+    mutate {
+      remove_field => [ "syslog_hostname", "syslog_message" ]
+    }
+    date {
+      match => [ "syslog_timestamp","MMM  d HH:mm:ss", "MMM dd HH:mm:ss", "ISO8601" ] 
+    }
+	syslog_pri { }
+  }
 }
 
 output {
   # Emit events to stdout for easy debugging of what is going through
   # logstash.
-  #stdout { }
+  #stdout { debug => "true" }
 
   # This will use elasticsearch to store your logs.
   # The 'embedded' option will cause logstash to run the elasticsearch

Modified: head/sysutils/logstash/files/logstash.in
==============================================================================
--- head/sysutils/logstash/files/logstash.in	Thu Nov 21 12:28:29 2013	(r334479)
+++ head/sysutils/logstash/files/logstash.in	Thu Nov 21 12:35:12 2013	(r334480)
@@ -33,6 +33,8 @@ rcvar=logstash_enable
 
 load_rc_config ${name}
 
+logdir="/var/log"
+
 : ${logstash_enable="NO"}
 : ${logstash_home="%%LOGSTASH_HOME%%"}
 : ${logstash_config="%%PREFIX%%/etc/${name}/${name}.conf"}
@@ -52,7 +54,6 @@ if [ -d $piddir ]; then
 	mkdir -p $piddir
 fi
 
-logdir="/var/log"
 command="/usr/sbin/daemon"
 
 java_cmd="${logstash_java_home}/bin/java"
@@ -67,12 +68,12 @@ if checkyesno logstash_log; then
 fi
 
 if [ ${logstash_mode} = "standalone" ]; then
-	logstash_args="agent -f ${logstash_config} -- web --port ${logstash_port} --backend elasticsearch:///?local ${logstash_log_options}"
+	logstash_args="agent -f ${logstash_config} ${logstash_log_options} -- web --port ${logstash_port}"
 	logstash_elastic_options="-Des.path.data=${logstash_elastic_datadir}"
 elif [ ${logstash_mode} = "agent" ]; then
 	logstash_args="agent -f ${logstash_config} ${logstash_log_options}"
 elif [ ${logstash_mode} = "web" ]; then
-	logstash_args="web --port ${logstash_port} --backend elasticsearch://${logstash_elastic_backend}/ ${logstash_log_options}"
+	logstash_args="web --port ${logstash_port} ${logstash_log_options}"
 fi
 
 command_args="-f -p ${pidfile} ${java_cmd} ${logstash_elastic_options} -jar ${logstash_jar} ${logstash_args}"

Modified: head/sysutils/logstash/pkg-plist
==============================================================================
--- head/sysutils/logstash/pkg-plist	Thu Nov 21 12:28:29 2013	(r334479)
+++ head/sysutils/logstash/pkg-plist	Thu Nov 21 12:35:12 2013	(r334480)
@@ -7,7 +7,7 @@
 @unexec if cmp -s %D/%%ETCDIR%%/elasticsearch.yml.sample %D/%%ETCDIR%%/elasticsearch.yml; then rm -f %D/%%ETCDIR%%/elasticsearch.yml; fi
 %%ETCDIR%%/elasticsearch.yml.sample
 @exec if [ ! -f  %D/%%ETCDIR%%/elasticsearch.yml ] ; then cp -p %D/%F %B/elasticsearch.yml; fi
-@dirrmtry %%LOGSTASH_DATA_DIR%%
 @dirrmtry %%LOGSTASH_HOME%%
 @dirrmtry %%ETCDIR%%
-@dirrmtry %%LOGSTASH_RUN%%
+@unexec rmdir %%LOGSTASH_DATA_DIR%% 2>/dev/null || true
+@unexec rmdir %%LOGSTASH_RUN%% 2>/dev/null || true



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201311211235.rALCZC2i084048>