Sha256: 3d07d601a47c4e5a88f5e00a0283fd3f414006105692e64a7169b19ff44aa543
Contents?: true
Size: 889 Bytes
Versions: 25
Compression:
Stored size: 889 Bytes
Contents
#!/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
Version data entries
25 entries across 25 versions & 1 rubygems