fluent-plugin-kubernetes_tagged_remote_syslog 0.3.6 → 0.4.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +6 -5
- data/VERSION +1 -1
- data/lib/fluent/plugin/out_kubernetes_tagged_remote_syslog.rb +10 -2
- data/test/plugin/out_kubernetes_tagged_remote_syslog.rb +6 -5
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 76332363b3bb391b7ef10c1d22322ccd9c5f5dde
|
4
|
+
data.tar.gz: 6b580a9a7db8649d807ab5995ba2f4e149eaed9c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aa408fcfa941a8f84fed0086a7b45fbc87756fe622261f6d278ae61810a3f2844cdd76ebe1ceb5f9ed3543355f23bd7b5aa465c864d123c6357a22c422c291c1
|
7
|
+
data.tar.gz: 170c7f8a21e9a57948765977c582b6f0eb485df763cafce1eb1bd332ef9f14a1b4ea3496d506ba2c325bd69abba3c5fb485f600980f1013566ddb171036ac0d2
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
# fluent-plugin-kubernetes_tagged_remote_syslog
|
2
|
-
|
3
1
|
<!-- [](https://travis-ci.org/kvitajakub/fluent-plugin-kubernetes_tagged_remote_syslog) -->
|
4
2
|
|
3
|
+
# fluent-plugin-kubernetes_tagged_remote_syslog
|
4
|
+
|
5
5
|
[Fluentd](http://fluentd.org) plugin for output to remote syslog service (e.g. [Papertrail](http://papertrailapp.com/)). It is meant to use in Kubernetes environment with [kubernetes_metadata_filter](https://github.com/fabric8io/fluent-plugin-kubernetes_metadata_filter) plugin annotating the messages.
|
6
6
|
|
7
7
|
This plugin was created because regular remote syslog Fluentd plugins doesn't work well with kubernetes annotated messages. `hostname`/`program` fields have not helpful values `localhost`/`fluentd` and actual message is unreadable compact JSON.
|
@@ -16,7 +16,8 @@ This plugin was created because regular remote syslog Fluentd plugins doesn't wo
|
|
16
16
|
Default input should be JSON message annotated with kubernetes info:
|
17
17
|
```
|
18
18
|
{
|
19
|
-
"log": "
|
19
|
+
"log": "log me\n",
|
20
|
+
"time": "2015-05-05T19:54:41.248307+00:00",
|
20
21
|
"stream": "stderr",
|
21
22
|
"docker": {
|
22
23
|
"id": "df14e0d5ae4c07284fa636d739c8fc2e6b52bc344658de7d3f08c36a2e804115",
|
@@ -36,12 +37,12 @@ Default input should be JSON message annotated with kubernetes info:
|
|
36
37
|
```
|
37
38
|
This will become:
|
38
39
|
```
|
39
|
-
default fabric8-console-controller-98rqc:
|
40
|
+
default fabric8-console-controller-98rqc: log me\n
|
40
41
|
```
|
41
42
|
|
42
43
|
And at the message receive Papertrail will add a timestamp in front of the message:
|
43
44
|
```
|
44
|
-
May 05 19:54:45 default fabric8-console-controller-98rqc:
|
45
|
+
May 05 19:54:45 default fabric8-console-controller-98rqc: log me\n
|
45
46
|
```
|
46
47
|
|
47
48
|
## Usage
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.4.0
|
@@ -22,6 +22,14 @@ module Fluent
|
|
22
22
|
super
|
23
23
|
end
|
24
24
|
|
25
|
+
def shorten_name(str)
|
26
|
+
if str.length > 31
|
27
|
+
return str.sub(str[24...-5],"..")
|
28
|
+
else
|
29
|
+
return str
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
25
33
|
def emit(tag, es, chain)
|
26
34
|
es.each do |_time, record|
|
27
35
|
record.each_pair do |_k, v|
|
@@ -37,8 +45,8 @@ module Fluent
|
|
37
45
|
@port,
|
38
46
|
facility: record['facility'] || @facility,
|
39
47
|
severity: record['severity'] || @severity,
|
40
|
-
program: (record.dig('kubernetes', @program) || @program)
|
41
|
-
local_hostname: (record.dig('kubernetes', @hostname) || @hostname)
|
48
|
+
program: shorten_name(record.dig('kubernetes', @program) || @program),
|
49
|
+
local_hostname: shorten_name(record.dig('kubernetes', @hostname) || @hostname))
|
42
50
|
|
43
51
|
@loggers[tag].transmit((if record.key?('log') then record['log'] else record end).to_s)
|
44
52
|
end
|
@@ -1,13 +1,14 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require 'test_helper'
|
2
|
+
require 'json'
|
3
|
+
require 'fluent/plugin/out_kubernetes_tagged_remote_syslog'
|
3
4
|
|
4
5
|
class KubernetesTaggedRemoteSyslogOutputTest < MiniTest::Unit::TestCase
|
5
6
|
def setup
|
6
7
|
Fluent::Test.setup
|
7
8
|
end
|
8
9
|
|
9
|
-
def create_driver(conf = CONFIG,
|
10
|
-
Fluent::Test::OutputTestDriver.new(Fluent::KubernetesTaggedRemoteSyslogOutput,
|
10
|
+
def create_driver(conf = CONFIG, program = "test.kubernetes_tagged_remote_syslog")
|
11
|
+
Fluent::Test::OutputTestDriver.new(Fluent::KubernetesTaggedRemoteSyslogOutput, program) {}.configure(conf)
|
11
12
|
end
|
12
13
|
|
13
14
|
def test_configure
|
@@ -45,7 +46,7 @@ class KubernetesTaggedRemoteSyslogOutputTest < MiniTest::Unit::TestCase
|
|
45
46
|
host example.com
|
46
47
|
port 5566
|
47
48
|
severity debug
|
48
|
-
|
49
|
+
program rewrited.${tag_parts[1]}
|
49
50
|
]
|
50
51
|
|
51
52
|
d.run do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-kubernetes_tagged_remote_syslog
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Richard Lee, Jakub Kvita
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-09-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -119,7 +119,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
119
119
|
version: '0'
|
120
120
|
requirements: []
|
121
121
|
rubyforge_project:
|
122
|
-
rubygems_version: 2.
|
122
|
+
rubygems_version: 2.6.13
|
123
123
|
signing_key:
|
124
124
|
specification_version: 4
|
125
125
|
summary: Fluentd output plugin for remote syslog. This is meant for processing kubernetes
|