Bug 182492 - Upgrade sysutils/logstash to version 1.2.1 and add some sample conf tweak
Summary: Upgrade sysutils/logstash to version 1.2.1 and add some sample conf tweak
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: Guido Falsi
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-09-29 18:50 UTC by Regis A. Despres
Modified: 2013-11-21 12:40 UTC (History)
0 users

See Also:


Attachments
logstash.head.diff (4.09 KB, patch)
2013-09-29 18:50 UTC, Regis A. Despres
no flags Details | Diff
logstash.diff (5.95 KB, patch)
2013-10-15 17:19 UTC, Guido Falsi
no flags Details | Diff
logstash.diff (6.04 KB, patch)
2013-11-07 09:07 UTC, Guido Falsi
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Regis A. Despres 2013-09-29 18:50:00 UTC
	- Upgrade to version 1.2.1 see https://github.com/logstash/logstash/blob/master/CHANGELOG. Thanks to Daniel's inputs
	- Removed not needed backend option from logsatsh_args. 
	- Moved logstash_log_options to the right place from logsatsh_args. 
	- Moved logdir declaration before it is used. Thanks to Daniel's input
	- Changed logstash config sample in order to default to a working IRL BSD syslog to elasticsearch example

Fix: Patch  attached :
How-To-Repeat: 	
	N//A
Comment 1 Guido Falsi freebsd_committer freebsd_triage 2013-09-29 19:10:00 UTC
Responsible Changed
From-To: freebsd-ports-bugs->madpilot

I'll take it.
Comment 2 Guido Falsi freebsd_committer freebsd_triage 2013-10-15 17:19:37 UTC
Hi,

I have modified the port to also support staging.

Please test attached patch and report back if you can approve it.

Regarding the instability of this version you reported to me via email, 
do you have any news? Did you get some feedback from upstream?

Thanks.

-- 
Guido Falsi <madpilot@FreeBSD.org>
Comment 3 Regis A. Despres 2013-10-15 19:11:29 UTC
Hey Guido,


Cool, I'll look into it within 1 week ; hard time @work.


Thanks & regards,



--=20
Regis A. Despres

On Oct 15, 2013, at 6:19 PM, Guido Falsi <madpilot@FreeBSD.org> wrote:

> Hi,
>=20
> I have modified the port to also support staging.
>=20
> Please test attached patch and report back if you can approve it.
>=20
> Regarding the instability of this version you reported to me via =
email, do you have any news? Did you get some feedback from upstream?
>=20
> Thanks.
>=20
> --=20
> Guido Falsi <madpilot@FreeBSD.org>
> <logstash.diff>
Comment 4 rdespres 2013-11-06 09:39:49 UTC
Hi there,

Since staging implementation Ive found that LOGSTASH_RUN isnt populated, ive tried to modify Makefile w/a line ${MKDIR} ${STAGEDIR}${LOGSTASH_RUN} without success.
The quick and dirty? way to handle the no valid pid file rc.d script error is to switch piddir=/var/run/${name} w/ piddir=/var/run/ .
We might also remove the es config sample ; if someone need more es control lets install es package.
Let me know if this ok for you.


Regards,




Regis A. Despres

 
On 15 Oct 2013, at 18:19, Guido Falsi <madpilot@FreeBSD.org> wrote:

> Hi,
> 
> I have modified the port to also support staging.
> 
> Please test attached patch and report back if you can approve it.
> 
> Regarding the instability of this version you reported to me via email, do you have any news? Did you get some feedback from upstream?
> 
> Thanks.
> 
> -- 
> Guido Falsi <madpilot@FreeBSD.org>
> <logstash.diff>

Comment 5 Guido Falsi freebsd_committer freebsd_triage 2013-11-07 09:07:04 UTC
I'm sorry my previous patch actually contained an error, which prevented 
those directories from being created.

Here is a fixed patch.

-- 
Guido Falsi <madpilot@FreeBSD.org>
Comment 6 dfilter service freebsd_committer freebsd_triage 2013-11-21 12:35:32 UTC
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
_______________________________________________
svn-ports-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-ports-all
To unsubscribe, send any mail to "svn-ports-all-unsubscribe@freebsd.org"
Comment 7 Guido Falsi freebsd_committer freebsd_triage 2013-11-21 12:35:36 UTC
State Changed
From-To: open->closed

Committed. Thanks!