fluent-plugin-loggly 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: e69791c57bf0556adc54867ea0cdde7155e48b92
4
+ data.tar.gz: db45d8653e767dd2b6b6cac369b20c99c3ca1494
5
+ SHA512:
6
+ metadata.gz: 1c16c260042e4cb97a051842661723619362e07b23feb31a89ceaf64e311254294d0bf7b033f0111da44df54092460f801178c46206bb606c1188c8731f7d2f9
7
+ data.tar.gz: eccdb87df2f3f7b89c92752ac8667b8e97ae6476ea1e575e9c3a417288443e93093ec36b15b8919918d44d5ec1de3a2877f8f5f4ec1b471c06a2534623099b9a
data/README.md CHANGED
@@ -1,8 +1,35 @@
1
- Loggly plugin for [Fluentd](http://fluentd.org)
1
+ Loggly plugin for [Fluentd](http://www.fluentd.org)
2
2
  =============
3
- With fluent-plugin-loggly you will be able to use the service loggly.com as output for you fluentd logs.
3
+ With fluent-plugin-loggly you will be able to use [Loggly](http://loggly.com) as output the logs you collect with Fluentd.
4
+
5
+ ## Getting Started for Gen2 ([Read here for the difference between Gen1 and Gen2](https://www.loggly.com/docs/gen2-overview-for-gen1-users/))
6
+ * Install [Fluentd](http://www.fluentd.org/download)
7
+ * gem install fluent-plugin-loggly
8
+ * Make sure you have an account with Loggly.
9
+ * Configure Fluentd as below:
10
+ ~~~~~
11
+ <match your_match>
12
+ type loggly
13
+ loggly_url https://logs-01.loggly.com/inputs/xxx-xxxx-xxxx-xxxxx-xxxxxxxxxx
14
+ </match>
15
+ ~~~~~
16
+ or if you want to use buffered plugin:
17
+ ~~~~~
18
+ <match your_match>
19
+ type loggly_buffered
20
+ loggly_url https://logs-01.loggly.com/bulk/xxx-xxxx-xxxx-xxxxx-xxxxxxxxxx
21
+ output_include_time true # add 'timestamp' record into log. (default: true)
22
+ buffer_type file
23
+ buffer_path /path/to/buffer/file
24
+ flush_interval 10s
25
+ </match>
26
+ ~~~~~
27
+ Note that buffered plugin uses bulk import to improve performance, so make sure to set Bulk endpoint to loggly_url.
28
+
29
+ The `xxx-xxxx...` is your Loggly access token.
30
+
31
+ ## Getting Started for Gen 1
4
32
 
5
- # Getting Started
6
33
  * Install fluentd http://fluentd.org
7
34
  * gem install fluent-plugin-loggly
8
35
  * Make sure you have an account at loggly.com.
@@ -12,17 +39,6 @@ With fluent-plugin-loggly you will be able to use the service loggly.com as outp
12
39
  * Get the url that could by used to do HTTPS POST (this will be used for configuration of the plugin).
13
40
  It should be something like https://logs.loggly.com/inputs/xxx-xxxx-xxxx-xxxxx-xxxxxxxxxx
14
41
 
15
- ## Parameters
16
- **loggly_url** the url to your loggly input (string)
17
-
18
- Setup the loggly output:
19
42
 
20
- ~~~~~
21
- <match your_match>
22
- type loggly
23
- loggly_url https://logs.loggly.com/inputs/xxx-xxxx-xxxx-xxxxx-xxxxxxxxxx
24
- </match>
25
- ~~~~~
26
-
27
- # TODO
28
- ?
43
+ ## Parameters
44
+ **loggly_url** the url to your loggly input (string).
@@ -3,7 +3,7 @@ $:.push File.expand_path("../lib", __FILE__)
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "fluent-plugin-loggly"
6
- s.version = "0.0.4"
6
+ s.version = "0.0.5"
7
7
  s.authors = ["Patrik Antonsson"]
8
8
  s.email = ["patant@gmail.com"]
9
9
  s.homepage = "https://github.com/patant/fluent-plugin-loggly"
@@ -18,8 +18,4 @@ Gem::Specification.new do |s|
18
18
  s.require_paths = ["lib"]
19
19
  s.required_ruby_version = Gem::Requirement.new(">= 1.9.3")
20
20
  s.add_dependency('net-http-persistent', '>= 2.7')
21
-
22
- # specify any dependencies here; for example:
23
- # s.add_development_dependency "rspec"
24
- # s.add_runtime_dependency "rest-client"
25
21
  end
@@ -0,0 +1,71 @@
1
+ =begin
2
+
3
+ Copyright (C) 2012 Patrik Antonsson
4
+
5
+ Licensed to the Apache Software Foundation (ASF) under one
6
+ or more contributor license agreements. See the NOTICE file
7
+ distributed with this work for additional information
8
+ regarding copyright ownership. The ASF licenses this file
9
+ to you under the Apache License, Version 2.0 (the
10
+ "License"); you may not use this file except in compliance
11
+ with the License. You may obtain a copy of the License at
12
+
13
+ http://www.apache.org/licenses/LICENSE-2.0
14
+
15
+ Unless required by applicable law or agreed to in writing,
16
+ software distributed under the License is distributed on an
17
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
18
+ KIND, either express or implied. See the License for the
19
+ specific language governing permissions and limitations
20
+ under the License.
21
+
22
+ =end
23
+
24
+ class LogglyOutputBuffred < Fluent::BufferedOutput
25
+ Fluent::Plugin.register_output('loggly_buffered', self)
26
+ config_param :loggly_url, :string, :default => nil
27
+ config_param :output_include_time, :bool, :default => true # Recommended
28
+
29
+ unless method_defined?(:log)
30
+ define_method("log") { $log }
31
+ end
32
+
33
+ def configure(conf)
34
+ super
35
+ $log.debug "Loggly url #{@loggly_url}"
36
+ end
37
+
38
+ def start
39
+ super
40
+ require 'net/http/persistent'
41
+ @uri = URI @loggly_url
42
+ @http = Net::HTTP::Persistent.new 'fluentd-plugin-loggly'
43
+ @http.headers['Content-Type'] = 'text'
44
+ end
45
+
46
+ def shutdown
47
+ super
48
+ end
49
+
50
+ def format(tag, time, record)
51
+ [tag, time, record].to_msgpack
52
+ end
53
+
54
+ def write(chunk)
55
+ records = []
56
+ chunk.msgpack_each {|tag,time,record|
57
+ record['timestamp'] = Time.at(time).iso8601 if @output_include_time
58
+ records.push(record.to_json)
59
+ }
60
+ $log.debug "#{records.length} records sent"
61
+ post = Net::HTTP::Post.new @uri.path
62
+ post.body = records.join("\n")
63
+ begin
64
+ response = @http.request @uri, post
65
+ $log.debug "HTTP Response code #{response.code}"
66
+ $log.error response.body if response.code != "200"
67
+ rescue
68
+ $log.error "Error connecting to loggly verify the url #{@loggly_url}"
69
+ end
70
+ end
71
+ end
@@ -1,7 +1,7 @@
1
1
  module Fluent
2
2
  module Plugin
3
3
  module Loggly
4
- VERSION = "0.0.4"
4
+ VERSION = "0.0.5"
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,30 +1,27 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-loggly
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
5
- prerelease:
4
+ version: 0.0.5
6
5
  platform: ruby
7
6
  authors:
8
7
  - Patrik Antonsson
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2014-02-25 00:00:00.000000000 Z
11
+ date: 2015-04-23 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: net-http-persistent
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - '>='
20
18
  - !ruby/object:Gem::Version
21
19
  version: '2.7'
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - '>='
28
25
  - !ruby/object:Gem::Version
29
26
  version: '2.7'
30
27
  description: Fluentd pluging (fluentd.org) for output to loggly (loggly.com)
@@ -43,28 +40,28 @@ files:
43
40
  - lib/fluent-plugin-loggly.rb
44
41
  - lib/fluent-plugin-loggly/version.rb
45
42
  - lib/fluent/plugin/out_loggly.rb
43
+ - lib/fluent/plugin/out_loggly_buffered.rb
46
44
  homepage: https://github.com/patant/fluent-plugin-loggly
47
45
  licenses: []
46
+ metadata: {}
48
47
  post_install_message:
49
48
  rdoc_options: []
50
49
  require_paths:
51
50
  - lib
52
51
  required_ruby_version: !ruby/object:Gem::Requirement
53
- none: false
54
52
  requirements:
55
- - - ! '>='
53
+ - - '>='
56
54
  - !ruby/object:Gem::Version
57
55
  version: 1.9.3
58
56
  required_rubygems_version: !ruby/object:Gem::Requirement
59
- none: false
60
57
  requirements:
61
- - - ! '>='
58
+ - - '>='
62
59
  - !ruby/object:Gem::Version
63
60
  version: '0'
64
61
  requirements: []
65
62
  rubyforge_project: fluent-plugin-loggly
66
- rubygems_version: 1.8.23
63
+ rubygems_version: 2.1.11
67
64
  signing_key:
68
- specification_version: 3
65
+ specification_version: 4
69
66
  summary: Fluentd plugin for output to loggly
70
67
  test_files: []