logstash-lite 0.2.20101118134500
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/logstash +56 -0
- data/bin/logstash-web +6 -0
- data/etc/logstash-elasticsearch-rabbitmq-river.yaml +41 -0
- data/etc/logstash-mongodb-storage.yaml +5 -0
- data/etc/logstash-parser.yaml +20 -0
- data/etc/logstash-reader.yaml +8 -0
- data/etc/logstash-shipper.yaml +18 -0
- data/etc/logstash-standalone.yaml +47 -0
- data/etc/prod.yaml +38 -0
- data/etc/redhat/logstash +92 -0
- data/etc/redhat/logstash-agent +83 -0
- data/etc/redhat/logstash-agent.sysconfig +7 -0
- data/etc/redhat/logstash.spec +171 -0
- data/etc/redhat/logstash.sysconfig +18 -0
- data/etc/tograylog.yaml +37 -0
- data/examples/test.rb +38 -0
- data/lib/logstash.rb +3 -0
- data/lib/logstash/agent.rb +116 -0
- data/lib/logstash/event.rb +70 -0
- data/lib/logstash/filters.rb +17 -0
- data/lib/logstash/filters/base.rb +17 -0
- data/lib/logstash/filters/date.rb +59 -0
- data/lib/logstash/filters/field.rb +29 -0
- data/lib/logstash/filters/grok.rb +74 -0
- data/lib/logstash/filters/grokdiscovery.rb +60 -0
- data/lib/logstash/inputs.rb +18 -0
- data/lib/logstash/inputs/amqp.rb +48 -0
- data/lib/logstash/inputs/base.rb +32 -0
- data/lib/logstash/inputs/file.rb +47 -0
- data/lib/logstash/inputs/syslog.rb +123 -0
- data/lib/logstash/inputs/tcp.rb +51 -0
- data/lib/logstash/logging.rb +82 -0
- data/lib/logstash/namespace.rb +6 -0
- data/lib/logstash/outputs.rb +15 -0
- data/lib/logstash/outputs/amqp.rb +48 -0
- data/lib/logstash/outputs/base.rb +29 -0
- data/lib/logstash/outputs/elasticsearch.rb +71 -0
- data/lib/logstash/outputs/gelf.rb +35 -0
- data/lib/logstash/outputs/mongodb.rb +19 -0
- data/lib/logstash/outputs/stdout.rb +15 -0
- data/lib/logstash/outputs/websocket.rb +35 -0
- data/lib/logstash/time.rb +27 -0
- data/lib/logstash/web/lib/elasticsearch.rb +79 -0
- data/lib/logstash/web/public/css/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- data/lib/logstash/web/public/css/smoothness/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
- data/lib/logstash/web/public/css/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
- data/lib/logstash/web/public/css/smoothness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/lib/logstash/web/public/css/smoothness/images/ui-bg_glass_75_dadada_1x400.png +0 -0
- data/lib/logstash/web/public/css/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
- data/lib/logstash/web/public/css/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
- data/lib/logstash/web/public/css/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
- data/lib/logstash/web/public/css/smoothness/images/ui-icons_222222_256x240.png +0 -0
- data/lib/logstash/web/public/css/smoothness/images/ui-icons_2e83ff_256x240.png +0 -0
- data/lib/logstash/web/public/css/smoothness/images/ui-icons_454545_256x240.png +0 -0
- data/lib/logstash/web/public/css/smoothness/images/ui-icons_888888_256x240.png +0 -0
- data/lib/logstash/web/public/css/smoothness/images/ui-icons_cd0a0a_256x240.png +0 -0
- data/lib/logstash/web/public/css/smoothness/jquery-ui-1.8.5.custom.css +572 -0
- data/lib/logstash/web/public/js/flot/API.txt +1024 -0
- data/lib/logstash/web/public/js/flot/FAQ.txt +71 -0
- data/lib/logstash/web/public/js/flot/LICENSE.txt +22 -0
- data/lib/logstash/web/public/js/flot/Makefile +15 -0
- data/lib/logstash/web/public/js/flot/NEWS.txt +340 -0
- data/lib/logstash/web/public/js/flot/PLUGINS.txt +105 -0
- data/lib/logstash/web/public/js/flot/README.txt +81 -0
- data/lib/logstash/web/public/js/flot/examples/ajax.html +143 -0
- data/lib/logstash/web/public/js/flot/examples/annotating.html +75 -0
- data/lib/logstash/web/public/js/flot/examples/arrow-down.gif +0 -0
- data/lib/logstash/web/public/js/flot/examples/arrow-left.gif +0 -0
- data/lib/logstash/web/public/js/flot/examples/arrow-right.gif +0 -0
- data/lib/logstash/web/public/js/flot/examples/arrow-up.gif +0 -0
- data/lib/logstash/web/public/js/flot/examples/basic.html +38 -0
- data/lib/logstash/web/public/js/flot/examples/data-eu-gdp-growth-1.json +4 -0
- data/lib/logstash/web/public/js/flot/examples/data-eu-gdp-growth-2.json +4 -0
- data/lib/logstash/web/public/js/flot/examples/data-eu-gdp-growth-3.json +4 -0
- data/lib/logstash/web/public/js/flot/examples/data-eu-gdp-growth-4.json +4 -0
- data/lib/logstash/web/public/js/flot/examples/data-eu-gdp-growth-5.json +4 -0
- data/lib/logstash/web/public/js/flot/examples/data-eu-gdp-growth.json +4 -0
- data/lib/logstash/web/public/js/flot/examples/data-japan-gdp-growth.json +4 -0
- data/lib/logstash/web/public/js/flot/examples/data-usa-gdp-growth.json +4 -0
- data/lib/logstash/web/public/js/flot/examples/dual-axis.html +39 -0
- data/lib/logstash/web/public/js/flot/examples/graph-types.html +75 -0
- data/lib/logstash/web/public/js/flot/examples/hs-2004-27-a-large_web.jpg +0 -0
- data/lib/logstash/web/public/js/flot/examples/image.html +45 -0
- data/lib/logstash/web/public/js/flot/examples/index.html +43 -0
- data/lib/logstash/web/public/js/flot/examples/interacting.html +93 -0
- data/lib/logstash/web/public/js/flot/examples/layout.css +6 -0
- data/lib/logstash/web/public/js/flot/examples/navigate.html +118 -0
- data/lib/logstash/web/public/js/flot/examples/selection.html +114 -0
- data/lib/logstash/web/public/js/flot/examples/setting-options.html +65 -0
- data/lib/logstash/web/public/js/flot/examples/stacking.html +77 -0
- data/lib/logstash/web/public/js/flot/examples/thresholding.html +54 -0
- data/lib/logstash/web/public/js/flot/examples/time.html +71 -0
- data/lib/logstash/web/public/js/flot/examples/tracking.html +95 -0
- data/lib/logstash/web/public/js/flot/examples/turning-series.html +98 -0
- data/lib/logstash/web/public/js/flot/examples/visitors.html +90 -0
- data/lib/logstash/web/public/js/flot/examples/zooming.html +98 -0
- data/lib/logstash/web/public/js/flot/excanvas.js +1427 -0
- data/lib/logstash/web/public/js/flot/excanvas.min.js +1 -0
- data/lib/logstash/web/public/js/flot/jquery.colorhelpers.js +174 -0
- data/lib/logstash/web/public/js/flot/jquery.colorhelpers.min.js +1 -0
- data/lib/logstash/web/public/js/flot/jquery.flot.crosshair.js +156 -0
- data/lib/logstash/web/public/js/flot/jquery.flot.crosshair.min.js +1 -0
- data/lib/logstash/web/public/js/flot/jquery.flot.image.js +237 -0
- data/lib/logstash/web/public/js/flot/jquery.flot.image.min.js +1 -0
- data/lib/logstash/web/public/js/flot/jquery.flot.js +2119 -0
- data/lib/logstash/web/public/js/flot/jquery.flot.min.js +1 -0
- data/lib/logstash/web/public/js/flot/jquery.flot.navigate.js +272 -0
- data/lib/logstash/web/public/js/flot/jquery.flot.navigate.min.js +1 -0
- data/lib/logstash/web/public/js/flot/jquery.flot.selection.js +299 -0
- data/lib/logstash/web/public/js/flot/jquery.flot.selection.min.js +1 -0
- data/lib/logstash/web/public/js/flot/jquery.flot.stack.js +152 -0
- data/lib/logstash/web/public/js/flot/jquery.flot.stack.min.js +1 -0
- data/lib/logstash/web/public/js/flot/jquery.flot.threshold.js +103 -0
- data/lib/logstash/web/public/js/flot/jquery.flot.threshold.min.js +1 -0
- data/lib/logstash/web/public/js/flot/jquery.js +4376 -0
- data/lib/logstash/web/public/js/flot/jquery.min.js +19 -0
- data/lib/logstash/web/public/js/jquery-hashchange-1.0.0.js +121 -0
- data/lib/logstash/web/public/js/jquery.livequery.js +250 -0
- data/lib/logstash/web/public/js/jquery.tmpl.min.js +1 -0
- data/lib/logstash/web/public/js/logstash.js +202 -0
- data/lib/logstash/web/server.rb +90 -0
- data/lib/logstash/web/views/header.haml +8 -0
- data/lib/logstash/web/views/layout.haml +21 -0
- data/lib/logstash/web/views/main/index.haml +5 -0
- data/lib/logstash/web/views/search/ajax.haml +32 -0
- data/lib/logstash/web/views/search/results.haml +17 -0
- data/lib/logstash/web/views/style.sass +50 -0
- data/patterns/firewalls +2 -0
- data/patterns/grok-patterns +90 -0
- data/patterns/haproxy +5 -0
- data/patterns/linux-syslog +7 -0
- data/patterns/nagios +7 -0
- data/patterns/ruby +2 -0
- metadata +228 -0
data/bin/logstash
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
$: << File.dirname($0) + "/../lib"
|
4
|
+
|
5
|
+
require "rubygems"
|
6
|
+
require "eventmachine"
|
7
|
+
require "logstash/agent"
|
8
|
+
require "optparse"
|
9
|
+
require "yaml"
|
10
|
+
|
11
|
+
Settings = Struct.new(:config_file, :daemonize)
|
12
|
+
|
13
|
+
settings = Settings.new
|
14
|
+
settings.daemonize = false
|
15
|
+
settings.config_file = nil
|
16
|
+
progname = File.basename($0)
|
17
|
+
|
18
|
+
opts = OptionParser.new do |opts|
|
19
|
+
opts.banner = "Usage: #{progname} [options]"
|
20
|
+
|
21
|
+
opts.on("-f CONFIGFILE", "--config CONFIGFILE",
|
22
|
+
"Load the logstash config from a specific file") do |arg|
|
23
|
+
settings.config_file = arg
|
24
|
+
end
|
25
|
+
|
26
|
+
#opts.on("-d", "--daemonize", "Daemonize (default is run in foreground)") do
|
27
|
+
#settings.daemonize = true
|
28
|
+
#end
|
29
|
+
end
|
30
|
+
|
31
|
+
begin
|
32
|
+
opts.parse!
|
33
|
+
if settings.config_file == "" or settings.config_file == nil
|
34
|
+
raise "No config file given. (missing -f or --config flag?)"
|
35
|
+
end
|
36
|
+
|
37
|
+
rescue
|
38
|
+
$stderr.puts "#{progname}: #{$!}"
|
39
|
+
$stderr.puts opts
|
40
|
+
exit(1)
|
41
|
+
end
|
42
|
+
|
43
|
+
# TODO(sissel): put the config management stuff in LogStash::Agent
|
44
|
+
if !File.exist?(settings.config_file)
|
45
|
+
$stderr.puts "Config file '#{settings.config_file}' does not exist."
|
46
|
+
end
|
47
|
+
|
48
|
+
begin
|
49
|
+
config = YAML::load_file(settings.config_file)
|
50
|
+
rescue => e
|
51
|
+
$stderr.puts "Loading config file '#{settings.config_file}' failed: #{e}"
|
52
|
+
exit 1
|
53
|
+
end
|
54
|
+
|
55
|
+
agent = LogStash::Agent.new(config)
|
56
|
+
agent.run
|
data/bin/logstash-web
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
---
|
2
|
+
# this is a sample logstash config (code is still highly in change, so
|
3
|
+
# this could change later)
|
4
|
+
#
|
5
|
+
#
|
6
|
+
inputs:
|
7
|
+
# Give a list of inputs. Tag them for easy query/filter later.
|
8
|
+
linux-syslog: # this is the 'linux-syslog' type
|
9
|
+
- /var/log/messages # watch /var/log/messages (uses eventmachine-tail)
|
10
|
+
- /var/log/kern.log
|
11
|
+
- /var/log/auth.log
|
12
|
+
- /var/log/user.log
|
13
|
+
apache-access: # similar, different type.
|
14
|
+
- /var/log/apache2/access.log
|
15
|
+
- /b/access
|
16
|
+
apache-error:
|
17
|
+
- /var/log/apache2/error.log
|
18
|
+
filters:
|
19
|
+
- grok:
|
20
|
+
linux-syslog: # for logs of type 'linux-syslog'
|
21
|
+
patterns:
|
22
|
+
- %{SYSLOGLINE}
|
23
|
+
apache-access: # for logs of type 'apache-error'
|
24
|
+
patterns:
|
25
|
+
- %{COMBINEDAPACHELOG}
|
26
|
+
- date:
|
27
|
+
linux-syslog: # for logs of type 'linux-syslog'
|
28
|
+
# Look for a field 'timestamp' with this format, parse and it for the timestamp
|
29
|
+
# This field comes from the SYSLOGLINE pattern
|
30
|
+
timestamp: "%b %e %H:%M:%S"
|
31
|
+
apache-access:
|
32
|
+
timestamp: "%d/%b/%Y:%H:%M:%S %Z"
|
33
|
+
outputs:
|
34
|
+
- stdout:///
|
35
|
+
- "elasticsearch://localhost:9200/logs/all?method=river&type=rabbitmq&host=127.0.0.1&user=guest&pass=guest&vhost=/&queue=es"
|
36
|
+
# But we could write to mongodb, too.
|
37
|
+
# - mongodb://localhost/parsedlogs
|
38
|
+
# And also write to an AMQP topic
|
39
|
+
# - amqp://localhost/topic/parsedlogs
|
40
|
+
# Write to stdout ... etc.
|
41
|
+
# - stdout:///
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# Example config that parses rawlogs with grok and puts them on another AMQP topic
|
2
|
+
inputs:
|
3
|
+
- amqp://localhost/topic/rawlogs
|
4
|
+
outputs:
|
5
|
+
- amqp://localhost/topic/parsedlogs
|
6
|
+
- stdout:///
|
7
|
+
filters:
|
8
|
+
grok:
|
9
|
+
linux-syslog: # for logs tagged 'linux-syslog'
|
10
|
+
timestamp:
|
11
|
+
key: date
|
12
|
+
format: %b %e %H:%M:%S
|
13
|
+
patterns:
|
14
|
+
- %{SYSLOGLINE}
|
15
|
+
apache-access: # for logs tagged 'apache-error'
|
16
|
+
timestamp:
|
17
|
+
key: timestamp
|
18
|
+
format: %d/%b/%Y:%H:%M:%S %Z
|
19
|
+
patterns:
|
20
|
+
- %{COMBINEDAPACHELOG}
|
@@ -0,0 +1,18 @@
|
|
1
|
+
---
|
2
|
+
configname: shipper
|
3
|
+
# Example config that only ships log data from files to an AMQP topic
|
4
|
+
inputs:
|
5
|
+
linux-syslog:
|
6
|
+
- /var/log/messages
|
7
|
+
- /var/log/kern.log
|
8
|
+
- /var/log/auth.log
|
9
|
+
- /var/log/user.log
|
10
|
+
apache-access:
|
11
|
+
- /var/log/apache2/access.log
|
12
|
+
- /b/access
|
13
|
+
apache-error:
|
14
|
+
- /var/log/apache2/access.log
|
15
|
+
unknown:
|
16
|
+
- /b/randomdata
|
17
|
+
outputs:
|
18
|
+
- amqp://localhost/topic/rawlogs
|
@@ -0,0 +1,47 @@
|
|
1
|
+
---
|
2
|
+
# this is a sample logstash config (code is still highly in change, so
|
3
|
+
# this could change later)
|
4
|
+
#
|
5
|
+
#
|
6
|
+
inputs:
|
7
|
+
# Give a list of inputs. Tag them for easy query/filter later.
|
8
|
+
linux-syslog: # this is the 'linux-syslog' type
|
9
|
+
- /var/log/messages # watch /var/log/messages (uses eventmachine-tail)
|
10
|
+
- /var/log/kern.log
|
11
|
+
- /var/log/auth.log
|
12
|
+
- /var/log/user.log
|
13
|
+
apache-access: # similar, different type.
|
14
|
+
- /var/log/apache2/access.log
|
15
|
+
- /b/access
|
16
|
+
apache-error:
|
17
|
+
- /var/log/apache2/error.log
|
18
|
+
filters:
|
19
|
+
- grok:
|
20
|
+
linux-syslog: # for logs of type 'linux-syslog'
|
21
|
+
patterns:
|
22
|
+
- %{SYSLOGLINE}
|
23
|
+
apache-access: # for logs of type 'apache-error'
|
24
|
+
patterns:
|
25
|
+
- %{COMBINEDAPACHELOG}
|
26
|
+
- grokdiscovery:
|
27
|
+
linux-syslog:
|
28
|
+
- message
|
29
|
+
- DATA
|
30
|
+
- GREEDYDATA
|
31
|
+
- date:
|
32
|
+
linux-syslog: # for logs of type 'linux-syslog'
|
33
|
+
# Look for a field 'timestamp' with this format, parse and it for the timestamp
|
34
|
+
# This field comes from the SYSLOGLINE pattern
|
35
|
+
timestamp: "%b %e %H:%M:%S"
|
36
|
+
timestamp8601: ISO8601
|
37
|
+
apache-access:
|
38
|
+
timestamp: "%d/%b/%Y:%H:%M:%S %Z"
|
39
|
+
outputs:
|
40
|
+
- stdout:///
|
41
|
+
- elasticsearch://localhost:9200/logs/all
|
42
|
+
# But we could write to mongodb, too.
|
43
|
+
# - mongodb://localhost/parsedlogs
|
44
|
+
# And also write to an AMQP topic
|
45
|
+
# - amqp://localhost/topic/parsedlogs
|
46
|
+
# Write to stdout ... etc.
|
47
|
+
# - stdout:///
|
data/etc/prod.yaml
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
---
|
2
|
+
inputs:
|
3
|
+
all:
|
4
|
+
- amqp://activemq/topic/logstash-events
|
5
|
+
linux-syslog:
|
6
|
+
- /var/log/messages
|
7
|
+
- /var/log/kern.log
|
8
|
+
- /var/log/auth.log
|
9
|
+
- /var/log/user.log
|
10
|
+
apache-access:
|
11
|
+
- /var/log/apache2/access.log
|
12
|
+
apache-error:
|
13
|
+
- /var/log/apache2/error.log
|
14
|
+
filters:
|
15
|
+
- grok:
|
16
|
+
linux-syslog: # for logs of type 'linux-syslog'
|
17
|
+
patterns:
|
18
|
+
- %{SYSLOGLINE}
|
19
|
+
apache-access: # for logs of type 'apache-error'
|
20
|
+
patterns:
|
21
|
+
- %{COMBINEDAPACHELOG}
|
22
|
+
nagios:
|
23
|
+
patterns:
|
24
|
+
- %{NAGIOSLOGLINE}
|
25
|
+
- date:
|
26
|
+
linux-syslog: # for logs of type 'linux-syslog'
|
27
|
+
# Look for a field 'timestamp' with this format, parse and it for the timestamp
|
28
|
+
# This field comes from the SYSLOGLINE pattern
|
29
|
+
timestamp: "%b %e %H:%M:%S"
|
30
|
+
timestamp8601: ISO8601
|
31
|
+
apache-access:
|
32
|
+
timestamp: "%d/%b/%Y:%H:%M:%S %Z"
|
33
|
+
nagios:
|
34
|
+
epochtime: %s
|
35
|
+
outputs:
|
36
|
+
- stdout:///
|
37
|
+
#- elasticsearch://localhost:9200/logstash/all
|
38
|
+
- "elasticsearch://localhost:9200/logstash/all_river?method=river&type=rabbitmq&host=activemq&user=guest&pass=guest&vhost=/&queue=es"
|
data/etc/redhat/logstash
ADDED
@@ -0,0 +1,92 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
#
|
3
|
+
# chkconfig: - 70 45
|
4
|
+
# description: The LogStash daemon processes, indexes, and searches logs centrally
|
5
|
+
# processname: logstashd
|
6
|
+
# config: /etc/sysconfig/logstash
|
7
|
+
|
8
|
+
# Standard LSB functions
|
9
|
+
#. /lib/lsb/init-functions
|
10
|
+
|
11
|
+
# Source function library.
|
12
|
+
. /etc/init.d/functions
|
13
|
+
|
14
|
+
# Defaults. Override in /etc/sysconfig/logstash
|
15
|
+
USER=logstash
|
16
|
+
OPTIONS=""
|
17
|
+
INDEX=true
|
18
|
+
PARSERS=1
|
19
|
+
DEBUG=false
|
20
|
+
DIR=/opt/logstash
|
21
|
+
CONFIG=$DIR/etc/logstashd.yaml
|
22
|
+
LOGFILE=/var/logstash/logstashd.log
|
23
|
+
|
24
|
+
if [ -f /etc/sysconfig/logstash ]; then
|
25
|
+
. /etc/sysconfig/logstash
|
26
|
+
fi
|
27
|
+
|
28
|
+
RETVAL=0
|
29
|
+
prog="logstashd"
|
30
|
+
|
31
|
+
start () {
|
32
|
+
echo -n $"Starting $prog: "
|
33
|
+
mkdir -p /var/run/logstash
|
34
|
+
chown $USER /var/run/logstash
|
35
|
+
|
36
|
+
if $DEBUG; then
|
37
|
+
OPTIONS="$OPTIONS -d"
|
38
|
+
fi
|
39
|
+
if ! $INDEX; then
|
40
|
+
OPTIONS="$OPTIONS -I"
|
41
|
+
fi
|
42
|
+
OPTIONS="$OPTIONS -p $PARSERS"
|
43
|
+
OPTIONS="$OPTIONS --pidfile /var/run/logstash/logstashd.pid"
|
44
|
+
OPTIONS="$OPTIONS --logfile $LOGFILE"
|
45
|
+
OPTIONS="$OPTIONS $CONFIG"
|
46
|
+
|
47
|
+
daemon --user $USER --pidfile /var/run/logstash/logstashd.pid \
|
48
|
+
$DIR/bin/logstashd $OPTIONS
|
49
|
+
RETVAL=$?
|
50
|
+
echo
|
51
|
+
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/logstashd
|
52
|
+
}
|
53
|
+
|
54
|
+
stop () {
|
55
|
+
echo -n $"Stopping $prog: "
|
56
|
+
killproc -p /var/run/logstash/logstashd.pid $DIR/bin/logstashd
|
57
|
+
RETVAL=$?
|
58
|
+
echo
|
59
|
+
if [ $RETVAL -eq 0 ] ; then
|
60
|
+
rm -f /var/lock/subsys/logstashd
|
61
|
+
rm -f /var/run/logstash/logstashd.pid
|
62
|
+
fi
|
63
|
+
}
|
64
|
+
|
65
|
+
restart () {
|
66
|
+
stop
|
67
|
+
start
|
68
|
+
}
|
69
|
+
|
70
|
+
# See how we were called.
|
71
|
+
case "$1" in
|
72
|
+
start)
|
73
|
+
start
|
74
|
+
;;
|
75
|
+
stop)
|
76
|
+
stop
|
77
|
+
;;
|
78
|
+
status)
|
79
|
+
status -p /var/run/logstash/logstashd.pid logstashd
|
80
|
+
;;
|
81
|
+
restart|reload|force-reload)
|
82
|
+
restart
|
83
|
+
;;
|
84
|
+
condrestart)
|
85
|
+
[ -f /var/lock/subsys/logstashd ] && restart || :
|
86
|
+
;;
|
87
|
+
*)
|
88
|
+
echo $"Usage: $0 {start|stop|status|restart|reload|force-reload|condrestart}"
|
89
|
+
exit 1
|
90
|
+
esac
|
91
|
+
|
92
|
+
exit $?
|
@@ -0,0 +1,83 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
#
|
3
|
+
# chkconfig: - 70 45
|
4
|
+
# description: The LogStash collection agent
|
5
|
+
# processname: logstash-agent
|
6
|
+
# config: /etc/sysconfig/logstash
|
7
|
+
|
8
|
+
# Standard LSB functions
|
9
|
+
#. /lib/lsb/init-functions
|
10
|
+
|
11
|
+
# Source function library.
|
12
|
+
. /etc/init.d/functions
|
13
|
+
|
14
|
+
# Defaults. Override in /etc/sysconfig/logstash-agent
|
15
|
+
OPTIONS=""
|
16
|
+
DEBUG=false
|
17
|
+
DIR=/opt/logstash
|
18
|
+
CONFIG=$DIR/etc/logstash-agent.yaml
|
19
|
+
LOGFILE=/var/log/logstash-agent.log
|
20
|
+
|
21
|
+
if [ -f /etc/sysconfig/logstash-agent ]; then
|
22
|
+
. /etc/sysconfig/logstash-agent
|
23
|
+
fi
|
24
|
+
|
25
|
+
RETVAL=0
|
26
|
+
prog="logstash-agent"
|
27
|
+
|
28
|
+
start () {
|
29
|
+
echo -n $"Starting $prog: "
|
30
|
+
|
31
|
+
if $DEBUG; then
|
32
|
+
OPTIONS="$OPTIONS -d"
|
33
|
+
fi
|
34
|
+
OPTIONS="$OPTIONS --pidfile /var/run/logstash-agent.pid"
|
35
|
+
OPTIONS="$OPTIONS --logfile $LOGFILE"
|
36
|
+
OPTIONS="$OPTIONS $CONFIG"
|
37
|
+
|
38
|
+
daemon --pidfile /var/run/logstash-agent.pid \
|
39
|
+
$DIR/bin/logstash-agent $OPTIONS
|
40
|
+
RETVAL=$?
|
41
|
+
echo
|
42
|
+
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/logstash-agent
|
43
|
+
}
|
44
|
+
|
45
|
+
stop () {
|
46
|
+
echo -n $"Stopping $prog: "
|
47
|
+
killproc -p /var/run/logstash-agent.pid logstash-agent
|
48
|
+
RETVAL=$?
|
49
|
+
echo
|
50
|
+
if [ $RETVAL -eq 0 ] ; then
|
51
|
+
rm -f /var/lock/subsys/logstash-agent
|
52
|
+
rm -f /var/run/logstash-agent.pid
|
53
|
+
fi
|
54
|
+
}
|
55
|
+
|
56
|
+
restart () {
|
57
|
+
stop
|
58
|
+
start
|
59
|
+
}
|
60
|
+
|
61
|
+
# See how we were called.
|
62
|
+
case "$1" in
|
63
|
+
start)
|
64
|
+
start
|
65
|
+
;;
|
66
|
+
stop)
|
67
|
+
stop
|
68
|
+
;;
|
69
|
+
status)
|
70
|
+
status -p /var/run/logstash-agent.pid logstash-agent
|
71
|
+
;;
|
72
|
+
restart|reload|force-reload)
|
73
|
+
restart
|
74
|
+
;;
|
75
|
+
condrestart)
|
76
|
+
[ -f /var/lock/subsys/logstash-agent ] && restart || :
|
77
|
+
;;
|
78
|
+
*)
|
79
|
+
echo $"Usage: $0 {start|stop|status|restart|reload|force-reload|condrestart}"
|
80
|
+
exit 1
|
81
|
+
esac
|
82
|
+
|
83
|
+
exit $?
|
@@ -0,0 +1,171 @@
|
|
1
|
+
%define logstash_dir /opt/logstash
|
2
|
+
|
3
|
+
Name: logstash
|
4
|
+
Version: 0
|
5
|
+
Release: 1
|
6
|
+
License: BSD
|
7
|
+
URL: http://code.google.com/p/logstash
|
8
|
+
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(id -u)
|
9
|
+
Source0: http://code.google.com/p/logstash/downloads/%{name}-%{version}.tar.gz
|
10
|
+
Summary: Centralized log indexing and searching
|
11
|
+
Group: Applications/System
|
12
|
+
BuildArch: noarch
|
13
|
+
|
14
|
+
%description
|
15
|
+
LogStash
|
16
|
+
|
17
|
+
%package server
|
18
|
+
Summary: LogStash parsing, indexing, and searching server
|
19
|
+
Requires: %{name}-libs = %{version}-%{release}
|
20
|
+
Requires: grok-ruby
|
21
|
+
Requires(pre): shadow-utils
|
22
|
+
Requires(post): chkconfig
|
23
|
+
Requires(preun): chkconfig
|
24
|
+
Requires(preun): initscripts
|
25
|
+
Requires(postun): initscripts
|
26
|
+
Group: Applications/System
|
27
|
+
|
28
|
+
%description server
|
29
|
+
LogStash daemon.
|
30
|
+
|
31
|
+
%package libs
|
32
|
+
Summary: LogStash common Ruby libraries
|
33
|
+
Requires: ruby >= 1.8.5
|
34
|
+
Group: Applications/System
|
35
|
+
|
36
|
+
%description libs
|
37
|
+
LogStash Ruby libraries.
|
38
|
+
|
39
|
+
%package agent
|
40
|
+
Summary: LogStash log file collection agent
|
41
|
+
Requires: %{name}-libs = %{version}-%{release}
|
42
|
+
Requires(post): chkconfig
|
43
|
+
Requires(preun): chkconfig
|
44
|
+
Requires(preun): initscripts
|
45
|
+
Requires(postun): initscripts
|
46
|
+
Group: Applications/System
|
47
|
+
|
48
|
+
%description agent
|
49
|
+
LogStash file collection agent.
|
50
|
+
|
51
|
+
%package web
|
52
|
+
Summary: LogStash web query interface
|
53
|
+
Requires: %{name}-libs = %{version}-%{release}
|
54
|
+
Group: Applications/System
|
55
|
+
|
56
|
+
%description web
|
57
|
+
LogStash web query interface.
|
58
|
+
|
59
|
+
%prep
|
60
|
+
%setup
|
61
|
+
|
62
|
+
%install
|
63
|
+
rm -rf %{buildroot}
|
64
|
+
%{__mkdir_p} %{buildroot}%{logstash_dir}
|
65
|
+
%{__mkdir_p} %{buildroot}%{logstash_dir}/docs
|
66
|
+
%{__mkdir_p} %{buildroot}/etc/init.d
|
67
|
+
%{__mkdir_p} %{buildroot}/etc/sysconfig
|
68
|
+
%{__mkdir_p} %{buildroot}/var/logstash
|
69
|
+
tar cf - bin etc/*.yaml lib patterns web \
|
70
|
+
| (cd %{buildroot}%{logstash_dir} && tar xf -)
|
71
|
+
install -c etc/redhat/logstash %{buildroot}/etc/init.d/logstash
|
72
|
+
install -c etc/redhat/logstash-agent %{buildroot}/etc/init.d/logstash-agent
|
73
|
+
install -c etc/redhat/logstash.sysconfig %{buildroot}/etc/sysconfig/logstash
|
74
|
+
install -c etc/redhat/logstash-agent.sysconfig \
|
75
|
+
%{buildroot}/etc/sysconfig/logstash-agent
|
76
|
+
install -c docs/AgentConfiguration.wiki %{buildroot}%{logstash_dir}/docs/
|
77
|
+
install -c docs/Design.wiki %{buildroot}%{logstash_dir}/docs/
|
78
|
+
install -c docs/NetworkDesign.wiki %{buildroot}%{logstash_dir}/docs/
|
79
|
+
install -c docs/Scaling.wiki %{buildroot}%{logstash_dir}/docs/
|
80
|
+
install -c docs/ServerConfiguration.wiki %{buildroot}%{logstash_dir}/docs/
|
81
|
+
|
82
|
+
%clean
|
83
|
+
rm -rf $RPM_BUILD_ROOT
|
84
|
+
|
85
|
+
%files libs
|
86
|
+
%defattr(-, root, root, 0755)
|
87
|
+
%{logstash_dir}/lib/config
|
88
|
+
%{logstash_dir}/lib/log.rb
|
89
|
+
%{logstash_dir}/lib/log/json.rb
|
90
|
+
%{logstash_dir}/lib/log/text.rb
|
91
|
+
%{logstash_dir}/lib/logs.rb
|
92
|
+
%{logstash_dir}/lib/net/clients
|
93
|
+
%{logstash_dir}/lib/net/common.rb
|
94
|
+
%{logstash_dir}/lib/net/messages
|
95
|
+
%{logstash_dir}/lib/net.rb
|
96
|
+
%{logstash_dir}/lib/program.rb
|
97
|
+
%{logstash_dir}/lib/util.rb
|
98
|
+
%{logstash_dir}/lib/db/index.rb
|
99
|
+
%{logstash_dir}/lib/db/indexreader.rb
|
100
|
+
%{logstash_dir}/lib/programs/agent.rb
|
101
|
+
|
102
|
+
%files server
|
103
|
+
%defattr(-, root, root, 0755)
|
104
|
+
/etc/init.d/logstash
|
105
|
+
%config(noreplace) /etc/sysconfig/logstash
|
106
|
+
%{logstash_dir}/bin/list_log_keys.rb
|
107
|
+
%{logstash_dir}/bin/list_log_types.rb
|
108
|
+
%{logstash_dir}/bin/logstashd
|
109
|
+
%{logstash_dir}/bin/search.rb
|
110
|
+
%{logstash_dir}/docs/Design.wiki
|
111
|
+
%{logstash_dir}/docs/NetworkDesign.wiki
|
112
|
+
%{logstash_dir}/docs/Scaling.wiki
|
113
|
+
%{logstash_dir}/docs/ServerConfiguration.wiki
|
114
|
+
%{logstash_dir}/lib/log
|
115
|
+
%{logstash_dir}/lib/net/servers
|
116
|
+
%{logstash_dir}/patterns
|
117
|
+
%config(noreplace) %{logstash_dir}/etc/logstashd.yaml
|
118
|
+
%defattr(-, logstash, logstash, 0775)
|
119
|
+
/var/logstash
|
120
|
+
|
121
|
+
%files agent
|
122
|
+
%defattr(-, root, root, 0755)
|
123
|
+
/etc/init.d/logstash-agent
|
124
|
+
%config(noreplace) /etc/sysconfig/logstash-agent
|
125
|
+
%{logstash_dir}/bin/logstash-agent
|
126
|
+
%{logstash_dir}/docs/AgentConfiguration.wiki
|
127
|
+
%{logstash_dir}/lib/net/clients/agent.rb
|
128
|
+
%{logstash_dir}/lib/file/tail/since.rb
|
129
|
+
%config(noreplace) %{logstash_dir}/etc/logstash-agent.yaml
|
130
|
+
|
131
|
+
%files web
|
132
|
+
%defattr(-, root, root, 0755)
|
133
|
+
%{logstash_dir}/web
|
134
|
+
|
135
|
+
%pre server
|
136
|
+
getent group logstash &>/dev/null || groupadd -r logstash
|
137
|
+
getent passwd logstash &>/dev/null || \
|
138
|
+
useradd -r -g logstash -d %{logstash_dir} -s /sbin/nologin \
|
139
|
+
-c "LogStash Daemon" logstash
|
140
|
+
|
141
|
+
%post server
|
142
|
+
/sbin/chkconfig --add logstash
|
143
|
+
|
144
|
+
%post agent
|
145
|
+
/sbin/chkconfig --add logstash-agent
|
146
|
+
|
147
|
+
%preun server
|
148
|
+
if [ "$1" = 0 ] ; then
|
149
|
+
/sbin/service logstash stop &>/dev/null
|
150
|
+
/sbin/chkconfig --del logstash &>/dev/null || true
|
151
|
+
fi
|
152
|
+
|
153
|
+
%preun agent
|
154
|
+
if [ "$1" = 0 ] ; then
|
155
|
+
/sbin/service logstash-agent stop &>/dev/null
|
156
|
+
/sbin/chkconfig --del logstash-agent &>/dev/null || true
|
157
|
+
fi
|
158
|
+
|
159
|
+
%postun server
|
160
|
+
if [ "$1" -ge 1 ]; then
|
161
|
+
/sbin/service logstash condrestart &>/dev/null || true
|
162
|
+
fi
|
163
|
+
|
164
|
+
%postun agent
|
165
|
+
if [ "$1" -ge 1 ]; then
|
166
|
+
/sbin/service logstash-agent condrestart &>/dev/null || true
|
167
|
+
fi
|
168
|
+
|
169
|
+
%changelog
|
170
|
+
* Mon Oct 19 2009 Pete Fritchman <petef@databits.net> - 0.3.0-1
|
171
|
+
- Initial packaging
|