fluent-plugin-logentries 0.2.6 → 0.2.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/README.md +3 -3
- data/fluent-plugin-logentries.gemspec +1 -1
- data/lib/fluent/plugin/out_logentries.rb +13 -6
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5beb1e38eb0e532236e6f2f436313c463acc3345
|
4
|
+
data.tar.gz: a7f2329cdaa95765e437d50ee809d3784f5da269
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5697474e7c8cc0687872c3ab9d944457e842f330826b9b09f979419d405a5e63477bdc3ed546f039227c68e8c3621c2973ae98ada074ec4dd04dc1f9f6eb7044
|
7
|
+
data.tar.gz: 930745d5d730c51de345847fd57570d926dfc5d8c38fef31ddc60d4b2c09302f9a52f416bf42decf6ee74ec8086dc1774629cfb70e4535d584d4857951e94afe
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -20,14 +20,14 @@ install with gem or fluent-gem command as:
|
|
20
20
|
app: MY-LOGENTRIES-TOKEN
|
21
21
|
access: ANOTHER-LOGENTRIES-TOKEN (*)
|
22
22
|
error: ANOTHER-LOGENTRIES-TOKEN-1 (*)
|
23
|
-
|
23
|
+
Another-app:
|
24
24
|
app: 2bfbea1e-10c3-4419-bdad-7e6435882e1f
|
25
25
|
access: 5deab21c-04b1-9122-abdc-09adb2eda22 (*)
|
26
26
|
error: 9acfbeba-c92c-1229-ccac-12c58d82ecc (*)
|
27
27
|
```
|
28
|
-
(*) `access` and `error are optional, if you don't use multiple log per host just provide an app token.
|
28
|
+
(*) `access` and `error` are optional, if you don't use multiple log per host just provide an app token.
|
29
29
|
|
30
|
-
This file is read
|
30
|
+
This file is read on changes, it allows on fly modifications.
|
31
31
|
## Usage
|
32
32
|
|
33
33
|
```
|
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = "fluent-plugin-logentries"
|
7
|
-
spec.version = "0.2.
|
7
|
+
spec.version = "0.2.8"
|
8
8
|
spec.authors = ["Woorank"]
|
9
9
|
spec.email = ["dev@woorank.com"]
|
10
10
|
spec.summary = "Logentries output plugin for Fluent event collector"
|
@@ -2,7 +2,7 @@ require 'socket'
|
|
2
2
|
require 'yaml'
|
3
3
|
require 'openssl'
|
4
4
|
|
5
|
-
class LogentriesOutput < Fluent::BufferedOutput
|
5
|
+
class Fluent::LogentriesOutput < Fluent::BufferedOutput
|
6
6
|
class ConnectionFailure < StandardError; end
|
7
7
|
# First, register the plugin. NAME is the name of this plugin
|
8
8
|
# and identifies the plugin in the configuration file.
|
@@ -77,7 +77,7 @@ class LogentriesOutput < Fluent::BufferedOutput
|
|
77
77
|
|
78
78
|
# Returns the correct token to use for a given tag / records
|
79
79
|
def get_token(tag, record)
|
80
|
-
app_name = record["app_name"] ||
|
80
|
+
app_name = record["app_name"] || ''
|
81
81
|
|
82
82
|
# Config Structure
|
83
83
|
# -----------------------
|
@@ -86,7 +86,7 @@ class LogentriesOutput < Fluent::BufferedOutput
|
|
86
86
|
# access: TOKEN (optional)
|
87
87
|
# error: TOKEN (optional)
|
88
88
|
@tokens.each do |key, value|
|
89
|
-
if tag.index(key) != nil || app_name
|
89
|
+
if tag.index(key) != nil || app_name == key
|
90
90
|
default = value['app']
|
91
91
|
|
92
92
|
case tag
|
@@ -118,14 +118,15 @@ class LogentriesOutput < Fluent::BufferedOutput
|
|
118
118
|
|
119
119
|
# Clean up the string to avoid blank line in logentries
|
120
120
|
message = record["message"].rstrip()
|
121
|
-
send_logentries(
|
121
|
+
send_logentries(token, message)
|
122
|
+
|
122
123
|
end
|
123
124
|
end
|
124
125
|
|
125
|
-
def send_logentries(data)
|
126
|
+
def send_logentries(token, data)
|
126
127
|
retries = 0
|
127
128
|
begin
|
128
|
-
client.write data
|
129
|
+
client.write("#{token} #{data} \n")
|
129
130
|
rescue Errno::ECONNREFUSED, Errno::ETIMEDOUT => e
|
130
131
|
if retries < @max_retries
|
131
132
|
retries += 1
|
@@ -135,6 +136,12 @@ class LogentriesOutput < Fluent::BufferedOutput
|
|
135
136
|
retry
|
136
137
|
end
|
137
138
|
raise ConnectionFailure, "Could not push logs to Logentries after #{retries} retries. #{e.message}"
|
139
|
+
rescue Errno::EMSGSIZE
|
140
|
+
str_length = data.length
|
141
|
+
send_logentries(token, data[0..str_length/2])
|
142
|
+
send_logentries(token, data[(str_length/2)+1..str_length])
|
143
|
+
|
144
|
+
log.warm "Message Too Long, re-sending it in two part..."
|
138
145
|
end
|
139
146
|
end
|
140
147
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-logentries
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Woorank
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-02-
|
11
|
+
date: 2015-02-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|