I'm a lumberjack and I'm ok! I sleep when idle, then I ship logs all day!

I parse your logs, I eat the JVM agent for lunch!

(This project was recently renamed from 'lumberjack' to 'logstash-forwarder' to
make its intended use clear. The 'lumberjack' name now remains as the network
protocol, and 'logstash-forwarder' is the name of the program. It's still the
same lovely log forwarding program you love.)

WWW: https://github.com/elasticsearch/logstash-forwarder

PR:		ports/193012
Submitted by:	cheffo@freebsd-bg.org
This commit is contained in:
Carlo Strub 2014-09-05 20:50:47 +00:00
parent 970ea2ad54
commit 6f5894dc42
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=367389
9 changed files with 133 additions and 0 deletions

View File

@ -463,6 +463,7 @@
SUBDIR += logrotate
SUBDIR += logstalgia
SUBDIR += logstash
SUBDIR += logstash-forwarder
SUBDIR += logtool
SUBDIR += logwatch
SUBDIR += lookat

View File

@ -0,0 +1,30 @@
# $FreeBSD$
PORTNAME= logstash-forwarder
PORTVERSION= 0.3.1.20140725
CATEGORIES= sysutils
MAINTAINER= cheffo@freebsd-bg.org
COMMENT= Collect logs locally in preparation for processing elsewhere!
LICENSE= APACHE20
BUILD_DEPENDS= go:${PORTSDIR}/lang/go
USE_GITHUB= yes
GH_ACCOUNT= elasticsearch
GH_PROJECT= logstash-forwarder
GH_TAGNAME= ${GH_COMMIT}
GH_COMMIT= 8bb4001
USE_RC_SUBR= logstash-forwarder
SUB_FILES= pkg-message
do-build:
cd ${WRKSRC} && ${PREFIX}/bin/go build
do-install:
${INSTALL_PROGRAM} ${WRKSRC}/${GH_ACCOUNT}-${GH_PROJECT}-${GH_COMMIT} ${STAGEDIR}${PREFIX}/bin/${PORTNAME}
${INSTALL_DATA} ${WRKSRC}/logstash-forwarder.conf.example ${STAGEDIR}${PREFIX}/etc/logstash-forwarder.conf.example
.include <bsd.port.mk>

View File

@ -0,0 +1,2 @@
SHA256 (logstash-forwarder-0.3.1.20140725.tar.gz) = 302b8bf9e073e8604d6d8485d71d8cff9e32e6e97869093036f406b695c2abae
SIZE (logstash-forwarder-0.3.1.20140725.tar.gz) = 38998

View File

@ -0,0 +1,31 @@
#!/bin/sh
# $FreeBSD$
# PROVIDE: logstash_forwarder
# REQUIRE: DAEMON
# BEFORE: LOGIN
# KEYWORD: shutdown
# Add the following lines to /etc/rc.conf to enable logstash-forwarder:
# logstash_forwarder_enable (bool): Set to YES to logstash-forwarder
# Default: NO
# logstash_forwarder_flags (str): Extra flags passed to logstash-forwarder
# logstash_forwarder_conf (str): logstash-forwarder configuration file
# Default: ${PREFIX}/etc/logstash-forwarder.conf
. /etc/rc.subr
name="logstash_forwarder"
rcvar=logstash_forwarder_enable
command="%%PREFIX%%/bin/logstash-forwarder"
load_rc_config $name
[ -z "$logstash_forwarder_enable" ] && logstash_forwarder_enable="NO"
[ -z "$logstash_forwarder_conf" ] && logstash_forwarder_conf="%%PREFIX%%/etc/logstash-forwarder.conf"
[ -z "$logstash_forwarder_flags" ] && logstash_forwarder_flags=""
[ -n "$logstash_forwarder_conf" ] && logstash_forwarder_flags="$logstash_forwarder_flags -config=$logstash_forwarder_conf"
run_rc_command "$1"

View File

@ -0,0 +1,14 @@
--- fileinfo_freebsd.go.orig 1970-01-01 02:00:00.000000000 +0200
+++ fileinfo_freebsd.go 2014-08-15 15:55:47.824555519 +0300
@@ -0,0 +1,11 @@
+package main
+
+import (
+ "os"
+ "syscall"
+)
+
+func file_ids(info *os.FileInfo) (uint32, uint32) {
+ fstat := (*(info)).Sys().(*syscall.Stat_t)
+ return fstat.Ino, fstat.Dev
+}

View File

@ -0,0 +1,11 @@
--- filestate_freebsd.go.orig 1970-01-01 02:00:00.000000000 +0200
+++ filestate_freebsd.go 2014-08-15 15:56:07.164481962 +0300
@@ -0,0 +1,8 @@
+package main
+
+type FileState struct {
+ Source *string `json:"source,omitempty"`
+ Offset int64 `json:"offset,omitempty"`
+ Inode uint32 `json:"inode,omitempty"`
+ Device uint32 `json:"device,omitempty"`
+}

View File

@ -0,0 +1,31 @@
=========================================================================
If you want to run logstash-forwarder, add to /etc/rc.conf
logstash_forwarder_enable="YES"
Do not forget to edit your configuration file:
Default: ${PREFIX}/etc/logstash-forwarder.conf
Key points
You'll need an SSL CA to verify the server (host) with.
You can specify custom fields for each set of paths in the config file.
Any number of these may be specified. I use them to set fields like type
and other custom attributes relevant to each log.
Generating an ssl certificate
Logstash supports all certificates, including self-signed certificates.
To generate a certificate, you can run the following command:
$ openssl req -x509 -batch -nodes -newkey rsa:2048 -keyout \
logstash-forwarder.key -out logstash-forwarder.crt -days 365
This will generate a key at logstash-forwarder.key and the 1-year valid
certificate at logstash-forwarder.crt. Both the server that is running
logstash-forwarder as well as the logstash instances receiving logs will
require these files on disk to verify the authenticity of messages.
PROTECT YOUR KEYS!
=========================================================================

View File

@ -0,0 +1,9 @@
I'm a lumberjack and I'm ok! I sleep when idle, then I ship logs all day!
I parse your logs, I eat the JVM agent for lunch!
(This project was recently renamed from 'lumberjack' to 'logstash-forwarder' to
make its intended use clear. The 'lumberjack' name now remains as the network
protocol, and 'logstash-forwarder' is the name of the program. It's still the
same lovely log forwarding program you love.)
WWW: https://github.com/elasticsearch/logstash-forwarder

View File

@ -0,0 +1,4 @@
bin/logstash-forwarder
@unexec if cmp -s %D/etc/logstash-forwarder.conf.example %D/etc/logstash-forwarder.conf; then rm -f %D/etc/logstash-forwarder.conf; fi
etc/logstash-forwarder.conf.example
@exec if [ ! -f %D/etc/logstash-forwarder.conf ] ; then cp -p %D/%F %B/logstash-forwarder.conf; fi