mirror of
https://github.com/elastic/logstash.git
synced 2025-04-24 06:37:19 -04:00
purge unused stuff
This commit is contained in:
parent
5abb661de2
commit
ca871dd8a3
2 changed files with 0 additions and 94 deletions
|
@ -1,56 +0,0 @@
|
|||
#!/usr/bin/env ruby
|
||||
$: << "lib"
|
||||
|
||||
require "rubygems"
|
||||
require "logstash/agent"
|
||||
require "yaml"
|
||||
|
||||
collector_config = YAML.load <<"YAML"
|
||||
---
|
||||
inputs:
|
||||
foo:
|
||||
- internal:///
|
||||
outputs:
|
||||
- amqp://localhost/topic/logstash/testing
|
||||
YAML
|
||||
|
||||
receiver_config = YAML.load <<"YAML"
|
||||
---
|
||||
inputs:
|
||||
foo:
|
||||
- amqp://localhost/topic/logstash/testing
|
||||
outputs:
|
||||
- internal:///
|
||||
YAML
|
||||
|
||||
collector_agent = LogStash::Agent.new(collector_config)
|
||||
receiver_agent = LogStash::Agent.new(receiver_config)
|
||||
|
||||
data = ["hello world", "foo", "bar"]
|
||||
|
||||
EventMachine::run do
|
||||
receiver_agent.register
|
||||
collector_agent.register
|
||||
|
||||
EM::next_tick do
|
||||
# Register output callback on the receiver
|
||||
receiver_agent.outputs\
|
||||
.find { |o| o.is_a?(LogStash::Outputs::Internal) }\
|
||||
.callback do |event|
|
||||
puts event
|
||||
#puts expect.first == event.message
|
||||
#expect.shift
|
||||
#agent.stop
|
||||
end
|
||||
|
||||
EM::next_tick do
|
||||
# Send input to the collector
|
||||
expect = data.clone
|
||||
input = collector_agent.inputs\
|
||||
.find { |i| i.is_a?(LogStash::Inputs::Internal) }
|
||||
channel = input.channel
|
||||
data.each { |message| channel.push(message) }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,38 +0,0 @@
|
|||
#!/usr/bin/env ruby
|
||||
#
|
||||
# How to trigger the 'evil ip' message:
|
||||
# % logger -t "pantscon" "naughty host 14.33.24.55 $RANDOM"
|
||||
|
||||
require "rubygems"
|
||||
require "logstash/agent"
|
||||
|
||||
class MyAgent < LogStash::Agent
|
||||
def receive(event)
|
||||
filter(event) # Invoke any filters
|
||||
|
||||
return unless event["progname"][0] == "pantscon"
|
||||
return unless event.message =~ /naughty host/
|
||||
event["IP"].each do |ip|
|
||||
next unless ip.length > 0
|
||||
puts "Evil IP: #{ip}"
|
||||
end
|
||||
end # def receive
|
||||
end # class MyAgent
|
||||
|
||||
# Read a local file, parse it, and react accordingly (see MyAgent#receive)
|
||||
agent = MyAgent.new({
|
||||
"input" => [
|
||||
"/var/log/messages",
|
||||
],
|
||||
"filter" => [ "grok" ],
|
||||
})
|
||||
agent.run
|
||||
|
||||
# Read messages that we expect to be parsed by another agent. Reads
|
||||
# a particular AMQP topic for messages
|
||||
#agent = MyAgent.new({
|
||||
#"input" => [
|
||||
#"amqp://localhost/topic/parsed",
|
||||
#]
|
||||
#})
|
||||
#agent.run
|
Loading…
Add table
Add a link
Reference in a new issue