Skip to content

Commit

Permalink
Synced from upstream git
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.dev.unifiedpost.com/repos/it/puppet/modules/logstash/trunk@6 981703c8-b323-4728-b969-ff5e5cfaebfe
  • Loading branch information
Kris Buytaert committed Feb 21, 2012
1 parent 2bf8bf9 commit 2283db2
Show file tree
Hide file tree
Showing 9 changed files with 417 additions and 47 deletions.
9 changes: 2 additions & 7 deletions files/indexer.conf
Expand Up @@ -3,17 +3,12 @@ input {
# ship logs to the 'rawlogs' fanout queue.
type => "all"
host => "127.0.0.1"
exchange_type => "fanout"
name => "rawlogs"
exchange => "rawlogs"
name => "rawlogs_consumer"
}
}

filter {
multiline {
type => "JavaStackTraces"
pattern => "^\t"
what => "previous"
}
grok {
type => "syslog" # for logs of type "syslog"
pattern => "%{SYSLOGLINE}"
Expand Down
56 changes: 56 additions & 0 deletions files/indexer.conf.1.0.7
@@ -0,0 +1,56 @@
input {
amqp {
# ship logs to the 'rawlogs' fanout queue.
type => "all"
host => "127.0.0.1"
exchange_type => "fanout"
name => "rawlogs"
}
}

filter {
multiline {
type => "JavaStackTraces"
pattern => "^\t"
what => "previous"
}
grok {
type => "syslog" # for logs of type "syslog"
pattern => "%{SYSLOGLINE}"
# You can specify multiple 'pattern' lines
}

grok {
type => "apache-access" # for logs of type 'apache-access'
pattern => "%{COMBINEDAPACHELOG}"
}

date {
type => "syslog"

# The 'timestamp' and 'timestamp8601' names are for fields in the
# logstash event. The 'SYSLOGLINE' grok pattern above includes a field
# named 'timestamp' that is set to the normal syslog timestamp if it
# exists in the event.
timestamp => "MMM d HH:mm:ss" # syslog 'day' value can be space-leading
timestamp => "MMM dd HH:mm:ss"
timestamp8601 => ISO8601 # Some syslogs use ISO8601 time format
}

date {
type => "apache-access"
timestamp => "dd/MMM/yyyy:HH:mm:ss Z"
}
}

output {
stdout { }

# If your elasticsearch server is discoverable with multicast, use this:
#elasticsearch { }

# If you can't discover using multicast, set the address explicitly
elasticsearch {
host => "127.0.0.1"
}
}
4 changes: 2 additions & 2 deletions files/logstash-server
Expand Up @@ -13,7 +13,7 @@
#APP_NAME="@app.name@"
APP_NAME="LogstashServer"
#APP_LONG_NAME="@app.long.name@"
APP_LONG_NAME="Logstash Serverr Instance"
APP_LONG_NAME="Logstash Server Instance"

# Wrapper
WRAPPER_CMD="/usr/sbin/tanukiwrapper"
Expand Down Expand Up @@ -43,7 +43,7 @@ PIDDIR="/var/run"

# The following two lines are used by the chkconfig command. Change as is
# appropriate for your application. They should remain commented.
# chkconfig: 2345 20 80
# chkconfig: 2345 81 80
# description: @app.long.name@

# Do not modify anything beyond this point
Expand Down
2 changes: 1 addition & 1 deletion files/logstash-shipper
Expand Up @@ -43,7 +43,7 @@ PIDDIR="/var/run"

# The following two lines are used by the chkconfig command. Change as is
# appropriate for your application. They should remain commented.
# chkconfig: 2345 20 80
# chkconfig: 2345 81 80
# description: @app.long.name@

# Do not modify anything beyond this point
Expand Down
2 changes: 1 addition & 1 deletion files/logstash-web
Expand Up @@ -43,7 +43,7 @@ PIDDIR="/var/run"

# The following two lines are used by the chkconfig command. Change as is
# appropriate for your application. They should remain commented.
# chkconfig: 2345 20 80
# chkconfig: 2345 81 80
# description: @app.long.name@

# Do not modify anything beyond this point
Expand Down
81 changes: 45 additions & 36 deletions manifests/init.pp
Expand Up @@ -2,28 +2,29 @@
class logstash::common {

file {
"/usr/local/logstash/":
ensure => "directory";
"/etc/logstash/":
ensure => "directory";
"/usr/local/logstash/bin/":
ensure => "directory";
"/usr/local/logstash/lib/":
ensure => "directory";
"/usr/local/logstash/conf":
ensure => "directory";
"/usr/local/logstash/logs":
ensure => "directory";
"/var/log/logstash/":
ensure => "directory",
'/usr/local/logstash/':
ensure => 'directory';
'/etc/logstash/':
ensure => 'directory';
'/usr/local/logstash/bin/':
ensure => 'directory';
'/usr/local/logstash/lib/':
ensure => 'directory';
'/usr/local/logstash/conf':
ensure => 'directory';
'/usr/local/logstash/logs':
ensure => 'directory';
'/var/log/logstash/':
ensure => 'directory',
recurse => true;
}


# Obviously I abused fpm to create a logstash package and put it on my repository
# Obviously I abused fpm to create a logstash package and put it on my
# repository
package {
"logstash":
ensure => "latest";
'logstash':
ensure => 'latest';
}
}

Expand All @@ -35,25 +36,30 @@



class logstash::shipper ($logstash_server ='localhost',
$logfiles = '"/var/log/messages", "/var/log/syslog", "/var/log/*.log"' )
class logstash::shipper (
$logstash_server ='localhost',
$verbose = 'no',
$jarname ='logstash-1.1.0-monolithic.jar',
# TODO This needs refactoring :)
$logfiles = '"/var/log/messages", "/var/log/syslog", "/var/log/*.log"'
)
{

file {
'/etc/logstash/shipper.conf':
ensure => 'file',
group => '0',
mode => '644',
mode => '0644',
owner => '0',
content => template("logstash/shipper.conf.erb"),
content => template('logstash/shipper.conf.erb'),
}


file {
'/etc/rc.d/init.d/logstash-shipper':
ensure => 'file',
group => '0',
mode => '755',
mode => '0755',
owner => '0',
source => 'puppet:///modules/logstash/logstash-shipper' ;
}
Expand All @@ -65,9 +71,9 @@
'/usr/local/logstash/conf/shipper-wrapper.conf':
ensure => 'file',
group => '0',
mode => '644',
mode => '0644',
owner => '0',
source => 'puppet:///modules/logstash/shipper-wrapper.conf';
content => template('logstash/shipper-wrapper.conf.erb');
}

service { 'logstash-shipper':
Expand All @@ -81,7 +87,7 @@
file { '/etc/logrotate.d/syslog':
ensure => 'file',
group => '0',
mode => '644',
mode => '0644',
owner => '0',
source => 'puppet:///modules/logstash/syslog.logrotate';
}
Expand All @@ -91,23 +97,26 @@
}


class logstash::server {

class logstash::server(
$verbose = 'no',
$jarname ='logstash-1.1.0-monolithic.jar'
)
{

file {
'/etc/logstash/indexer.conf':
ensure => 'file',
group => '0',
mode => '644',
mode => '0644',
owner => '0',
source => "puppet:///modules/logstash/indexer.conf";
source => 'puppet:///modules/logstash/indexer.conf';
}

file {
'/etc/rc.d/init.d/logstash-server':
ensure => 'file',
group => '0',
mode => '755',
mode => '0755',
owner => '0',
source => 'puppet:///modules/logstash/logstash-server' ;
}
Expand All @@ -119,9 +128,9 @@
'/usr/local/logstash/conf/server-wrapper.conf':
ensure => 'file',
group => '0',
mode => '644',
mode => '0644',
owner => '0',
source => 'puppet:///modules/logstash/server-wrapper.conf';
content => template('logstash/server-wrapper.conf.erb');
}

service { 'logstash-server':
Expand All @@ -134,14 +143,14 @@

}

class logstash::web {
class logstash::web ($jarname ='logstash-1.1.0-monolithic.jar') {


file {
'/etc/rc.d/init.d/logstash-web':
ensure => 'file',
group => '0',
mode => '755',
mode => '0755',
owner => '0',
source => 'puppet:///modules/logstash/logstash-web' ;
}
Expand All @@ -153,9 +162,9 @@
'/usr/local/logstash/conf/web-wrapper.conf':
ensure => 'file',
group => '0',
mode => '644',
mode => '0644',
owner => '0',
source => 'puppet:///modules/logstash/web-wrapper.conf';
content => template('logstash/web-wrapper.conf.erb');
}


Expand Down
103 changes: 103 additions & 0 deletions templates/server-wrapper.conf.erb
@@ -0,0 +1,103 @@
#********************************************************************
# Wrapper Properties
#********************************************************************
# Java Application
wrapper.java.command=java

# Java Main class. This class must implement the WrapperListener interface
# or guarantee that the WrapperManager class is initialized. Helper
# classes are provided to do this for you. See the Integration section
# of the documentation for details.
#wrapper.java.mainclass=org.tanukisoftware.wrapper.WrapperSimpleApp
wrapper.java.mainclass=org.tanukisoftware.wrapper.WrapperJarApp

# Java Classpath (include wrapper.jar) Add class path elements as
# needed starting from 1
wrapper.java.classpath.1=/usr/share/java/tanukiwrapper.jar
wrapper.java.classpath.2=/usr/local/logstash/lib/<%= jarname %>

# Java Library Path (location of Wrapper.DLL or libwrapper.so)
wrapper.java.library.path.1=/usr/lib64

# Java Additional Parameters
#wrapper.java.additional.1=

# Initial Java Heap Size (in MB)
#wrapper.java.initmemory=3

# Maximum Java Heap Size (in MB)
#wrapper.java.maxmemory=64

# Application parameters. Add parameters as needed starting from 1
wrapper.app.parameter.1=/usr/local/logstash/lib/<%= jarname %>
wrapper.app.parameter.2=agent
wrapper.app.parameter.3=-f
wrapper.app.parameter.4=/etc/logstash/indexer.conf
<% if verbose == 'yes' %>
wrapper.app.parameter.5=-vvvvv
<% end %>


#********************************************************************
# Wrapper Logging Properties
#********************************************************************
# Format of output for the console. (See docs for formats)
wrapper.console.format=PM

# Log Level for console output. (See docs for log levels)
wrapper.console.loglevel=INFO

# Log file to use for wrapper output logging.
wrapper.logfile=/var/log/logstash/server-wrapper.log

# Format of output for the log file. (See docs for formats)
wrapper.logfile.format=LPTM

# Log Level for log file output. (See docs for log levels)
wrapper.logfile.loglevel=INFO

# Maximum size that the log file will be allowed to grow to before
# the log is rolled. Size is specified in bytes. The default value
# of 0, disables log rolling. May abbreviate with the 'k' (kb) or
# 'm' (mb) suffix. For example: 10m = 10 megabytes.
wrapper.logfile.maxsize=0

# Maximum number of rolled log files which will be allowed before old
# files are deleted. The default value of 0 implies no limit.
wrapper.logfile.maxfiles=0

# Log Level for sys/event log output. (See docs for log levels)
wrapper.syslog.loglevel=NONE

#********************************************************************
# Wrapper Windows Properties
#********************************************************************
# Title to use when running as a console
wrapper.console.title=@app.long.name@

#********************************************************************
# Wrapper Windows NT/2000/XP Service Properties
#********************************************************************
# WARNING - Do not modify any of these properties when an application
# using this configuration file has been installed as a service.
# Please uninstall the service before modifying this section. The
# service can then be reinstalled.

# Name of the service
wrapper.ntservice.name=@app.name@

# Display name of the service
wrapper.ntservice.displayname=@app.long.name@

# Description of the service
wrapper.ntservice.description=@app.description@

# Service dependencies. Add dependencies as needed starting from 1
wrapper.ntservice.dependency.1=

# Mode in which the service is installed. AUTO_START or DEMAND_START
wrapper.ntservice.starttype=AUTO_START

# Allow the service to interact with the desktop.
wrapper.ntservice.interactive=false

0 comments on commit 2283db2

Please sign in to comment.