fluent-plugin-sns 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/AUTHORS ADDED
@@ -0,0 +1 @@
1
+ Yudai Odagiri <ixixizko _at_ gmail.com>
data/README.rdoc ADDED
@@ -0,0 +1,44 @@
1
+ = Amazon SNS output plugin for Fluent
2
+
3
+ == Install
4
+ $ gem install fluent-plugin-sns
5
+
6
+ == Component
7
+
8
+ === SNSOutput
9
+
10
+ Send fluent-event as message to amazon SNS.
11
+
12
+ == Configuratin
13
+
14
+ === SNSOutput
15
+
16
+ <match sns.**>
17
+
18
+ type sns
19
+
20
+ # following attibutes are required
21
+
22
+ aws_key_id {your_aws_key_id}
23
+ aws_sec_key {your_aws_secret_key}
24
+
25
+ sns_topic_name {sns_topic_name}
26
+
27
+ # following attibutes are optional
28
+
29
+ sns_subject_key {sns_subject_key}
30
+ sns_subject {sns_subject} #constant subject
31
+
32
+ </match>
33
+
34
+ == TODO
35
+ - implement!
36
+
37
+ === More configuration
38
+
39
+ == Tool
40
+
41
+ == Copyright
42
+
43
+ Copyright:: Copyright (c) 2011- Yudai Odagiri
44
+ License:: Apache License, Version 2.0
data/Rakefile ADDED
@@ -0,0 +1,31 @@
1
+ require 'rake'
2
+ require 'rake/testtask'
3
+ require 'rake/clean'
4
+
5
+ begin
6
+ require 'jeweler'
7
+ Jeweler::Tasks.new do |gemspec|
8
+ gemspec.name = "fluent-plugin-sns"
9
+ gemspec.summary = "Amazon SNS output plugin for Fluent event collector"
10
+ gemspec.author = "Yudai Odagiri"
11
+ gemspec.email = "ixixizko@gmail.com"
12
+ gemspec.homepage = "http://github.com/fluent"
13
+ gemspec.has_rdoc = false
14
+ gemspec.require_paths = ["lib"]
15
+ gemspec.add_dependency "fluentd", "~> 0.10.0"
16
+ gemspec.test_files = Dir["test/**/*.rb"]
17
+ gemspec.files = Dir["lib/**/*", "test/**/*.rb"] + %w[VERSION AUTHORS Rakefile]
18
+ gemspec.executables = []
19
+ end
20
+ Jeweler::GemcutterTasks.new
21
+ rescue LoadError
22
+ puts "Jeweler not available. Install it with: gem install jeweler"
23
+ end
24
+
25
+ Rake::TestTask.new(:test) do |t|
26
+ t.test_files = Dir['test/*_test.rb']
27
+ t.ruby_opts = ['-rubygems'] if defined? Gem
28
+ t.ruby_opts << '-I.'
29
+ end
30
+
31
+ task :default => [:build]
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.1.0
@@ -0,0 +1,53 @@
1
+ module Fluent
2
+
3
+ require 'aws-sdk'
4
+
5
+ class SNSOutput < Output
6
+
7
+ Fluent::Plugin.register_output('sns', self)
8
+
9
+ include SetTagKeyMixin
10
+ config_set_default :include_tag_key, false
11
+
12
+ include SetTimeKeyMixin
13
+ config_set_default :include_time_key, true
14
+
15
+ config_param :aws_key_id, :string
16
+ config_param :aws_sec_key, :string
17
+
18
+ config_param :sns_topic_name, :string
19
+ config_param :sns_subject_key, :string, :default => nil
20
+ config_param :sns_subject, :string, :default => nil
21
+ config_param :sns_endpoint, :string, :default => 'sns.ap-northeast-1.amazonaws.com'
22
+
23
+ def configure(conf)
24
+ super
25
+ end
26
+
27
+ def start
28
+ super
29
+ AWS.config(
30
+ :access_key_id => @aws_key_id,
31
+ :secret_access_key => @aws_sec_key,
32
+ :sns_endpoint => @sns_endpoint )
33
+
34
+ @sns = AWS::SNS.new
35
+ @topic = @sns.topics.create(@sns_topic_name)
36
+ end
37
+
38
+ def shutdown
39
+ super
40
+ end
41
+
42
+ def emit(tag, es, chain)
43
+ chain.next
44
+ es.each {|time,record|
45
+ record["time"] = Time.at(time).localtime
46
+ subject = record[@sns_subject_key] || @sns_subject || 'Fluent-Notification'
47
+ msg = @topic.publish(record.to_json, :subject => subject )
48
+ $stderr.puts "published topic: #{msg}"
49
+ }
50
+ end
51
+
52
+ end
53
+ end
metadata ADDED
@@ -0,0 +1,61 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fluent-plugin-sns
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Yudai Odagiri
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2011-10-17 00:00:00.000000000Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: fluentd
16
+ requirement: &70250792624520 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: 0.10.0
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: *70250792624520
25
+ description:
26
+ email: ixixizko@gmail.com
27
+ executables: []
28
+ extensions: []
29
+ extra_rdoc_files:
30
+ - README.rdoc
31
+ files:
32
+ - AUTHORS
33
+ - Rakefile
34
+ - VERSION
35
+ - lib/fluent/plugin/out_sns.rb
36
+ - README.rdoc
37
+ homepage: http://github.com/fluent
38
+ licenses: []
39
+ post_install_message:
40
+ rdoc_options: []
41
+ require_paths:
42
+ - lib
43
+ required_ruby_version: !ruby/object:Gem::Requirement
44
+ none: false
45
+ requirements:
46
+ - - ! '>='
47
+ - !ruby/object:Gem::Version
48
+ version: '0'
49
+ required_rubygems_version: !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ requirements: []
56
+ rubyforge_project:
57
+ rubygems_version: 1.8.7
58
+ signing_key:
59
+ specification_version: 3
60
+ summary: Amazon SNS output plugin for Fluent event collector
61
+ test_files: []