fluent-plugin-loggly-syslog 0.0.1 → 0.0.2.pre.dev

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c68ae6c198aea7f521a803b15fd091466097f35c
4
- data.tar.gz: a747883c0d520bb704b15da4356f9d2a151fec35
3
+ metadata.gz: 472fbf0db16ebe0e3e379ce41dd5596c712055ba
4
+ data.tar.gz: a22ccd3c758d4dae117529193e467ad73f3e1ddf
5
5
  SHA512:
6
- metadata.gz: 6f28963cd215109c1a07c643dcee01d70bcff0188eefd624d38852740a43f4dc73f6808346d1056a60ec63f7cb0aa901543a334d5ea9aa5cb6bbda03bfac27db
7
- data.tar.gz: cada91d2dbae9eedbdb1bec3c305f9cd237e04c7c1630aa36e15cde4f35c5beb3b96f3905a3405beddf771853e79a6ccb875e61216662b41e8b38eebbaf7bd2a
6
+ metadata.gz: ae628a8832dc4d61484e76c13dbdbcd2e509f6be003acad4912101059d198b77c7e3541c0ccc93ef4fa4a05b15c90a7fe23ad8784bbe38681b05cef947ff9420
7
+ data.tar.gz: 62b82c595417fe87f09b53b1cf2a5cf70571dec92d68198bf814a454287cebdb60634d4fe2472ef8d03db7b4b83ccfa883bee299f2a110cfd549f5cd6ac0597e
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Fluent::Plugin::LogglySyslog
2
2
 
3
- [![Gem Version](https://badge.fury.io/rb/fluent-plugin-loggly-syslog.svg)](https://badge.fury.io/rb/fluent-plugin-loggly-syslog) [![CircleCI](https://circleci.com/gh/solarwinds/fluent-plugin-loggly-syslog/tree/master.svg?style=shield)](https://circleci.com/gh/solarwinds/fluent-plugin-loggly-syslog/tree/master)
3
+ [![Gem Version](https://badge.fury.io/rb/fluent-plugin-loggly-syslog.svg)](https://badge.fury.io/rb/fluent-plugin-loggly-syslog)
4
4
 
5
5
  ## Description
6
6
 
@@ -19,7 +19,7 @@ gem install fluent-plugin-loggly-syslog
19
19
 
20
20
  This is a buffered output plugin for Fluentd that's configured to send logs to Loggly using the [syslog endpoint](https://www.loggly.com/docs/streaming-syslog-without-using-files/).
21
21
 
22
- Each log line will arrive in Loggly with 2 payloads, the json representation of the fluent record and the data from the syslog wrapper.
22
+ Each log line will arrive in Loggly with 2 payloads: the json representation of the fluent record and the data from the syslog wrapper.
23
23
 
24
24
  Data from the syslog wrapper includes:
25
25
  ```
@@ -85,7 +85,7 @@ Simply enable the fluent-plugin-kubernetes_metadata_filter gem in your Fluentd s
85
85
  Then add the following annotation to each namespace or pod that you'd like to redirect logs for:
86
86
 
87
87
  ```
88
- solarwinds.io/loggly_token: 'https://logs-01.loggly.com/inputs/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'
88
+ solarwinds.io/loggly_token: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'
89
89
  ```
90
90
 
91
91
  If both a pod and the namespace it's in have this annotation, the pod's annotation takes precedence.
@@ -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-loggly-syslog"
7
- spec.version = "0.0.1"
7
+ spec.version = "0.0.2-dev"
8
8
  spec.authors = ["Chris Rust"]
9
9
  spec.email = ["chris.rust@solarwinds.com"]
10
10
 
@@ -12,12 +12,16 @@ module Fluent
12
12
  config_param :loggly_hostname, :string, default: nil
13
13
  config_param :loggly_host, :string, default: 'logs-01.loggly.com'
14
14
  config_param :loggly_port, :integer, default: 6514
15
+ config_param :discard_unannotated_pod_logs, :bool, default: false
15
16
  # overriding default flush_interval (60 sec) from Fluent::BufferedOutput
16
17
  config_param :flush_interval, :time, default: 1
17
18
 
18
19
  # register as 'loggly_syslog' fluent plugin
19
20
  Fluent::Plugin.register_output('loggly_syslog', self)
20
21
 
22
+ # declare const string for nullifying token if we decide to discard records
23
+ DISCARD_STRING = 'DISCARD'
24
+
21
25
  def configure(conf)
22
26
  super
23
27
  # parses fluent config
@@ -41,8 +45,10 @@ module Fluent
41
45
  def write(chunk)
42
46
  chunk.msgpack_each { |(tag, time, record)|
43
47
  token = pick_token(record)
44
- packet = create_packet(tag, time, record, token)
45
- send_to_loggly(packet)
48
+ unless token.eql? DISCARD_STRING
49
+ packet = create_packet(tag, time, record, token)
50
+ send_to_loggly(packet)
51
+ end
46
52
  }
47
53
  end
48
54
 
@@ -70,6 +76,9 @@ module Fluent
70
76
  # else if kubernetes namespace has papertrail destination as annotation, use it
71
77
  elsif record.dig('kubernetes', 'namespace_annotations', 'solarwinds_io/loggly_token')
72
78
  token = record['kubernetes']['namespace_annotations']['solarwinds_io/loggly_token']
79
+ # else if it is a kubernetes log and we're discarding unannotated logs
80
+ elsif record.dig('kubernetes') && @discard_unannotated_pod_logs
81
+ token = DISCARD_STRING
73
82
  # else use pre-configured destination
74
83
  else
75
84
  token = @loggly_token
@@ -85,18 +94,18 @@ module Fluent
85
94
  # [xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx@41058 tag="syslog"] \
86
95
  # message'
87
96
 
88
- pri = 134 # 134 is hardcoded facility local0 and severity info
89
- version = 1 # Syslog Protocol v1
90
- record_time = time ? Time.at(time) : Time.now
91
- timestamp = record_time.to_datetime.rfc3339
92
- hostname = @loggly_hostname || '-'
93
- app_name = tag || '-'
94
- procid = '-' # set procid and msgid to NILVALUE
95
- msgid = '-'
96
- pen = 41058 # Loggly's Private Enterprise Number is 41058
97
- tag = @loggly_tag ? " tag=\"#{@loggly_tag}\"" : '' # write tag only if passed in through config
97
+ pri = 134 # 134 is hardcoded facility local0 and severity info
98
+ version = 1 # Syslog Protocol v1
99
+ record_time = time ? Time.at(time) : Time.now
100
+ timestamp = record_time.to_datetime.rfc3339
101
+ hostname = @loggly_hostname || '-'
102
+ app_name = tag || '-'
103
+ procid = '-' # set procid and msgid to NILVALUE
104
+ msgid = '-'
105
+ pen = 41058 # Loggly's Private Enterprise Number is 41058
106
+ tag = @loggly_tag ? " tag=\"#{@loggly_tag}\"" : '' # write tag only if passed in through config
98
107
  structured_data = "[#{token}@#{pen}#{tag}]"
99
- msg = record.to_json
108
+ msg = record.to_json
100
109
 
101
110
  "<#{pri}>#{version} #{timestamp} #{hostname} #{app_name} #{procid} #{msgid} #{structured_data} #{msg}"
102
111
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-loggly-syslog
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2.pre.dev
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Rust
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-05-15 00:00:00.000000000 Z
11
+ date: 2018-07-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fluentd
@@ -117,9 +117,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
117
117
  version: '0'
118
118
  required_rubygems_version: !ruby/object:Gem::Requirement
119
119
  requirements:
120
- - - ">="
120
+ - - ">"
121
121
  - !ruby/object:Gem::Version
122
- version: '0'
122
+ version: 1.3.1
123
123
  requirements: []
124
124
  rubyforge_project:
125
125
  rubygems_version: 2.5.2.2