Skip to content

Commit

Permalink
- Update packaging
Browse files Browse the repository at this point in the history
- Split config files
  • Loading branch information
jordansissel committed Oct 18, 2010
1 parent b13f9bf commit 694aae5
Show file tree
Hide file tree
Showing 8 changed files with 108 additions and 95 deletions.
10 changes: 10 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,13 @@ task :tar do
sh "cd /tmp/logstash-build && " \
"tar -czf #{outdir}/logstash-#{version}.tar.gz logstash-#{version}"
end

task :package do
system("gem build logstash.gemspec")
end

task :publish do
latest_gem = %x{ls -t logstash*.gem}.split("\n").first
system("gem push #{latest_gem}")
end

88 changes: 47 additions & 41 deletions bin/logstash
Original file line number Diff line number Diff line change
Expand Up @@ -3,50 +3,56 @@
require "rubygems"
require "eventmachine"
require "logstash/agent"
require "yaml"
require "optparse"

case ARGV[0]
when "client"
config = {
"input" => [
"/var/log/messages",
"/var/log/apache2/access.log",
],
"output" => [
"amqp://localhost/topic/testing",
"websocket:///",
"mongodb://localhost/testdb",
],
}
when "server"
config = {
"input" => [
"amqp://localhost/topic/testing",
],
"filter" => [
"grok",
],
"output" => [
"stdout:///",
"amqp://localhost/topic/parsed",
],
}
when "standalone"
config = {
"input" => [
"/var/log/messages",
"/var/log/apache2/access.log",
],
"filter" => [
"grok",
],
"output" => [
"mongodb://localhost/testdb",
],
}
else
puts "Don't know what you want me to do."
Settings = Struct.new(:config_file, :daemonize)

settings = Settings.new
settings.daemonize = false
settings.config_file = nil

opts = OptionParser.new do |opts|
opts.banner = "Usage; #{$0} [options]"

opts.on("-f CONFIGFILE", "--config CONFIGFILE",
"Load the logstash config from a specific file") do |arg|
settings.config_file = arg
end

#opts.on("-d", "--daemonize", "Daemonize (default is run in foreground)") do
#settings.daemonize = true
#end
end

opts.parse!(ARGV)

# TODO(sissel): put the config management stuff in LogStash::Agent
if settings.config_file == "" or settings.config_file == nil
$stderr.puts "No config file given. (missing -f or --config flag?)"
exit 1
end

if !File.exist?(settings.config_file)
$stderr.puts "Config file '#{settings.config_file}' does not exist."
exit 1
end

begin
config = YAML::load_file(settings.config_file)
rescue => e
$stderr.puts "Loading config file '#{settings.config_file}' failed: #{e}"
exit 1
end

#config = nil
#confignames = []
#YAML::load_documents(file) do |doc|
#confignames << doc["configname"]
#if doc["configname"] == ARGV[0]
#config = doc
#end
#end

agent = LogStash::Agent.new(config)
agent.run
9 changes: 0 additions & 9 deletions etc/logstash-agent.yaml

This file was deleted.

5 changes: 5 additions & 0 deletions etc/logstash-mongodb-storage.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Example config that reads parsed logs from AMQP and dumps results into mongodb
inputs:
- amqp://localhost/topic/parsedlogs
outputs:
- mongodb://localhost/parsedlogs
20 changes: 20 additions & 0 deletions etc/logstash-parser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Example config that parses rawlogs with grok and puts them on another AMQP topic
inputs:
- amqp://localhost/topic/rawlogs
outputs:
- amqp://localhost/topic/parsedlogs
- stdout:///
filters:
grok:
linux-syslog: # for logs tagged 'linux-syslog'
timestamp:
key: date
format: %b %e %H:%M:%S
patterns:
- %{SYSLOGLINE}
apache-access: # for logs tagged 'apache-error'
timestamp:
key: timestamp
format: %d/%b/%Y:%H:%M:%S %Z
patterns:
- %{COMBINEDAPACHELOG}
8 changes: 8 additions & 0 deletions etc/logstash-reader.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Example config that reads parsed logs from AMQP and prints to stdout
inputs:
- amqp://localhost/topic/parsedlogs
#filters:
#field:
#- progname.include?("tester")
outputs:
- stdout:///
18 changes: 18 additions & 0 deletions etc/logstash-shipper.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
configname: shipper
# Example config that only ships log data from files to an AMQP topic
inputs:
linux-syslog:
- /var/log/messages
- /var/log/kern.log
- /var/log/auth.log
- /var/log/user.log
apache-access:
- /var/log/apache2/access.log
- /b/access
apache-error:
- /var/log/apache2/access.log
unknown:
- /b/randomdata
outputs:
- amqp://localhost/topic/rawlogs
45 changes: 0 additions & 45 deletions etc/logstashd.yaml

This file was deleted.

0 comments on commit 694aae5

Please sign in to comment.