loggerstash 0.0.9 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f20d5ce8da4dbfec707d7b7ccd2dd6dba95a7f911980c3c4791e342a290034c0
4
- data.tar.gz: 5a335fdc5d9632439e9d75b3e141b5e09123b2de8d233acf70da8d5efee52a0c
3
+ metadata.gz: c4e961a1a3a243caad2487af5ef9d49ebe675d51cb85c54a615f40785ab8ad6c
4
+ data.tar.gz: befa0f4bc820cfb8340ac034796f782c72d62205a504e4f41fb7fabdab93f2c5
5
5
  SHA512:
6
- metadata.gz: a1e713734296868661da7ee81e9487dbce2173d41353abd9f9b665cb21e363d16929082fa1e4d5ab1c29b26075b7ae0126e9eaaec8c43b5dd57c57004084fc5b
7
- data.tar.gz: 2402ff129f1e76086a2f4c51bdc026f4a0a180b526644c70dd6ec7b595ef9e9324dc8c1852a36356a8a41c44c748cab170a0c0d1b102b74e207943e4aad95579
6
+ metadata.gz: f67b43b36d38f959b3ebe58fc60cee20ce077813458a8fffd720216e3af123c0df9d598c4aab222a44227272a0a2c43636b7efcd703c2286b2146b4b87e90992
7
+ data.tar.gz: 5286e5307c1d7c552e08b6301e9d0ef98abd0fac340592bf1b221f7c8de73535d0b54628487bbff005ecd27cdd1501eecc15d72d5396384d3a402a8a33ff34db
@@ -0,0 +1,47 @@
1
+ ---
2
+ name: Loggerstash Tests
3
+
4
+ "on":
5
+ pull_request:
6
+ push:
7
+ branches:
8
+ - master
9
+ tags:
10
+ - v*
11
+
12
+ jobs:
13
+ build:
14
+ runs-on: ubuntu-latest
15
+ name: Ruby ${{ matrix.ruby }}
16
+ strategy:
17
+ matrix:
18
+ ruby: ["2.7", "2.6", "2.5"]
19
+ steps:
20
+ - uses: actions/checkout@v2
21
+ - uses: actions/setup-ruby@v1
22
+ with:
23
+ ruby-version: ${{ matrix.ruby }}
24
+ - name: Bundler cache
25
+ uses: actions/cache@v2
26
+ with:
27
+ path: vendor/bundle
28
+ key: ${{ runner.os }}-${{ matrix.ruby }}-gems-${{ hashFiles('**/Gemfile.lock') }}
29
+ restore-keys: |
30
+ ${{ runner.os }}-${{ matrix.ruby }}-gems-
31
+ - name: Setup gems
32
+ run: |
33
+ bundle config path vendor/bundle
34
+ bundle install --jobs 4
35
+ - name: Tests
36
+ run: bundle exec rake
37
+
38
+ publish:
39
+ if: contains(github.ref, 'refs/tags/v')
40
+ needs: build
41
+ runs-on: ubuntu-latest
42
+ steps:
43
+ - uses: actions/checkout@v2
44
+ - name: Release Gem
45
+ uses: discourse/publish-rubygems-action@main
46
+ env:
47
+ RUBYGEMS_API_KEY: ${{secrets.RUBYGEMS_API_KEY}}
data/.gitignore CHANGED
@@ -5,5 +5,7 @@ Gemfile.lock
5
5
  /coverage
6
6
  /.bundle
7
7
  /tmp
8
+ /.ruby-gemset
9
+ /.ruby-version
8
10
 
9
11
  .rubocop-https---raw-githubusercontent-com-discourse-discourse-master--rubocop-yml
data/.rubocop.yml CHANGED
@@ -1,4 +1,7 @@
1
- inherit_from: https://raw.githubusercontent.com/discourse/discourse/master/.rubocop.yml
2
-
3
- Layout/AlignHash:
1
+ inherit_gem:
2
+ rubocop-discourse: default.yml
3
+ inherit_mode:
4
+ merge:
5
+ - Exclude
6
+ Layout/HashAlignment:
4
7
  Enabled: false
data/CONTRIBUTING.md CHANGED
@@ -1,5 +1,5 @@
1
1
  * If, heaven forbid, you find a security vulnerability, please e-mail
2
- `matt.palmer@discourse.org`.
2
+ `security@discourse.org`.
3
3
 
4
4
  * If you have found a discrepancy in documented and observed behaviour, that
5
5
  is a bug. Feel free to [report it as an
data/README.md CHANGED
@@ -135,7 +135,7 @@ conduct](CODE_OF_CONDUCT.md).
135
135
  Unless otherwise stated, everything in this repo is covered by the following
136
136
  copyright notice:
137
137
 
138
- Copyright (C) 2018 Civilized Discourse Construction Kit, Inc.
138
+ Copyright (C) 2018-2021 Civilized Discourse Construction Kit, Inc.
139
139
 
140
140
  This program is free software: you can redistribute it and/or modify it
141
141
  under the terms of the GNU General Public License version 3, as
data/lib/loggerstash.rb CHANGED
@@ -157,9 +157,9 @@ class Loggerstash
157
157
  end
158
158
  end
159
159
 
160
- # Mangle the standard sev/time/prog/msg set into a logstash
161
- # event.
160
+ # Mangle the standard sev/time/prog/msg set into a logstash event.
162
161
  #
162
+ # Caller information is a https://www.rubydoc.info/stdlib/core/Thread/Backtrace/Location
163
163
  def default_loggerstash_formatter
164
164
  ->(s, t, p, m) do
165
165
  caller = caller_locations.find { |loc| ! [__FILE__, logger_filename].include? loc.absolute_path }
@@ -168,20 +168,30 @@ class Loggerstash
168
168
  "@timestamp": t.utc.strftime("%FT%T.%NZ"),
169
169
  "@metadata": { event_type: "loggerstash" },
170
170
  message: m,
171
- severity_name: s.downcase,
172
- hostname: Socket.gethostname,
173
- pid: $$,
174
- thread_id: Thread.current.object_id,
175
- caller: {
176
- absolute_path: caller.absolute_path,
177
- base_label: caller.base_label,
178
- label: caller.label,
179
- lineno: caller.lineno,
180
- path: caller.path,
171
+ log: {
172
+ level: s.downcase,
173
+ logger: "Loggerstash",
174
+ origin: {
175
+ base_function: caller.base_label, # not in ECS
176
+ file: {
177
+ line: caller.lineno,
178
+ name: caller.absolute_path,
179
+ },
180
+ function: caller.label,
181
+ },
182
+ },
183
+ host: {
184
+ hostname: Socket.gethostname,
185
+ },
186
+ process: {
187
+ pid: $$,
188
+ thread: {
189
+ id: Thread.current.object_id,
190
+ },
181
191
  },
182
192
  }.tap do |ev|
183
- ev[:progname] = p if p
184
- ev[:thread_name] = Thread.current.name if Thread.current.name
193
+ ev[:process][:name] = p if p
194
+ ev[:process][:thread][:name] = Thread.current.name if Thread.current.name
185
195
  end
186
196
  end
187
197
  end
data/loggerstash.gemspec CHANGED
@@ -1,17 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- begin
4
- require 'git-version-bump'
5
- rescue LoadError
6
- nil
7
- end
8
-
9
3
  Gem::Specification.new do |s|
10
4
  s.name = "loggerstash"
11
5
 
12
- s.version = GVB.version rescue "0.0.0.1.NOGVB"
13
- s.date = GVB.date rescue Time.now.strftime("%Y-%m-%d")
14
-
6
+ s.version = "1.0.1"
15
7
  s.platform = Gem::Platform::RUBY
16
8
 
17
9
  s.summary = "Monkeypatch Logger to send log entries to logstash"
@@ -21,19 +13,17 @@ Gem::Specification.new do |s|
21
13
  however the message would have been handled otherwise.
22
14
  EOF
23
15
 
24
- s.authors = ["Matt Palmer"]
25
- s.email = ["matt.palmer@discourse.org"]
16
+ s.authors = ["Michael Brown"]
17
+ s.email = ["michael.brown@discourse.org"]
26
18
  s.homepage = "https://github.com/discourse/loggerstash"
27
19
 
28
20
  s.files = `git ls-files -z`.split("\0").reject { |f| f =~ /^(G|spec|Rakefile)/ }
29
21
 
30
- s.required_ruby_version = ">= 2.3.0"
22
+ s.required_ruby_version = ">= 2.4.0"
31
23
 
32
24
  s.add_runtime_dependency "logstash_writer", ">= 0.0.11"
33
25
 
34
26
  s.add_development_dependency 'bundler'
35
- s.add_development_dependency 'github-release'
36
- s.add_development_dependency 'git-version-bump'
37
27
  s.add_development_dependency 'guard-rspec'
38
28
  s.add_development_dependency 'guard-rubocop'
39
29
  s.add_development_dependency 'rack-test'
@@ -41,6 +31,7 @@ Gem::Specification.new do |s|
41
31
  s.add_development_dependency 'redcarpet'
42
32
  s.add_development_dependency 'rspec'
43
33
  s.add_development_dependency 'rubocop'
34
+ s.add_development_dependency 'rubocop-discourse'
44
35
  s.add_development_dependency 'simplecov'
45
36
  s.add_development_dependency 'yard'
46
37
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: loggerstash
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
- - Matt Palmer
7
+ - Michael Brown
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-07-10 00:00:00.000000000 Z
11
+ date: 2021-02-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: logstash_writer
@@ -39,7 +39,7 @@ dependencies:
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
- name: github-release
42
+ name: guard-rspec
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - ">="
@@ -53,7 +53,7 @@ dependencies:
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
- name: git-version-bump
56
+ name: guard-rubocop
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - ">="
@@ -67,7 +67,7 @@ dependencies:
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
- name: guard-rspec
70
+ name: rack-test
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - ">="
@@ -81,21 +81,21 @@ dependencies:
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
- name: guard-rubocop
84
+ name: rake
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - ">="
87
+ - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: '0'
89
+ version: '12.0'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - ">="
94
+ - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: '0'
96
+ version: '12.0'
97
97
  - !ruby/object:Gem::Dependency
98
- name: rack-test
98
+ name: redcarpet
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
101
  - - ">="
@@ -109,21 +109,7 @@ dependencies:
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
111
  - !ruby/object:Gem::Dependency
112
- name: rake
113
- requirement: !ruby/object:Gem::Requirement
114
- requirements:
115
- - - "~>"
116
- - !ruby/object:Gem::Version
117
- version: '12.0'
118
- type: :development
119
- prerelease: false
120
- version_requirements: !ruby/object:Gem::Requirement
121
- requirements:
122
- - - "~>"
123
- - !ruby/object:Gem::Version
124
- version: '12.0'
125
- - !ruby/object:Gem::Dependency
126
- name: redcarpet
112
+ name: rspec
127
113
  requirement: !ruby/object:Gem::Requirement
128
114
  requirements:
129
115
  - - ">="
@@ -137,7 +123,7 @@ dependencies:
137
123
  - !ruby/object:Gem::Version
138
124
  version: '0'
139
125
  - !ruby/object:Gem::Dependency
140
- name: rspec
126
+ name: rubocop
141
127
  requirement: !ruby/object:Gem::Requirement
142
128
  requirements:
143
129
  - - ">="
@@ -151,7 +137,7 @@ dependencies:
151
137
  - !ruby/object:Gem::Version
152
138
  version: '0'
153
139
  - !ruby/object:Gem::Dependency
154
- name: rubocop
140
+ name: rubocop-discourse
155
141
  requirement: !ruby/object:Gem::Requirement
156
142
  requirements:
157
143
  - - ">="
@@ -197,15 +183,15 @@ description: |
197
183
  it to send all logged entries to a Logstash server, in addition to
198
184
  however the message would have been handled otherwise.
199
185
  email:
200
- - matt.palmer@discourse.org
186
+ - michael.brown@discourse.org
201
187
  executables: []
202
188
  extensions: []
203
189
  extra_rdoc_files: []
204
190
  files:
205
191
  - ".editorconfig"
192
+ - ".github/workflows/ci.yml"
206
193
  - ".gitignore"
207
194
  - ".rubocop.yml"
208
- - ".travis.yml"
209
195
  - ".yardopts"
210
196
  - CODE_OF_CONDUCT.md
211
197
  - CONTRIBUTING.md
@@ -224,14 +210,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
224
210
  requirements:
225
211
  - - ">="
226
212
  - !ruby/object:Gem::Version
227
- version: 2.3.0
213
+ version: 2.4.0
228
214
  required_rubygems_version: !ruby/object:Gem::Requirement
229
215
  requirements:
230
216
  - - ">="
231
217
  - !ruby/object:Gem::Version
232
218
  version: '0'
233
219
  requirements: []
234
- rubygems_version: 3.0.1
220
+ rubygems_version: 3.0.3
235
221
  signing_key:
236
222
  specification_version: 4
237
223
  summary: Monkeypatch Logger to send log entries to logstash
data/.travis.yml DELETED
@@ -1,11 +0,0 @@
1
- language: ruby
2
- sudo: false
3
- cache: bundler
4
-
5
- rvm:
6
- - 2.5.1
7
- - 2.4.4
8
- - 2.3.7
9
-
10
- gemfile:
11
- - Gemfile