gelf_redux 4.2.0 → 4.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/README.md +53 -13
- data/lib/gelf/transport/tcp_tls.rb +6 -3
- metadata +7 -7
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: '090a1e70d86fb1c1773e85f693561bd0c0c13944c1924464271f93761ca4f1e3'
|
|
4
|
+
data.tar.gz: 6404d9178c8a8383edf2c899e25d76510558d10fe307bb528ca09882dd36d107
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d3674594a4cf394a45cc08381852d8d5a92cef8a1469e4491b57babf11e80472a79a28d569853da8e059c71d6c3d3bcf69a85109a63145ad40ba959e7fdc6ecf
|
|
7
|
+
data.tar.gz: '08553745e14bb61b6c79fd12cc6e2c5dc66462826f58c368038bf743aa6df5698b17380948665c206868ed4ea0f620363981d294cee8bb8ad57af85f5cd3447a'
|
data/README.md
CHANGED
|
@@ -7,37 +7,58 @@ of the original project because we wanted to keep all of the projects and mainta
|
|
|
7
7
|
|
|
8
8
|
## Versioning
|
|
9
9
|
|
|
10
|
-
- 3.1.1 is the latest original gelf-rb version ()
|
|
10
|
+
- 3.1.1 is the latest original gelf-rb version (https://github.com/graylog-labs/gelf-rb)
|
|
11
11
|
- 3.2.1 is the first http(s) supporting version from here https://github.com/christianrolle/gelf-rb
|
|
12
12
|
- 4.0.0 we do start from here with our versioning, improvements and updates
|
|
13
13
|
|
|
14
|
+
See the [CHANGELOG](CHANGELOG) for release details.
|
|
14
15
|
|
|
16
|
+
## Installation
|
|
17
|
+
|
|
18
|
+
Add `gem 'gelf_redux'` to your Gemfile (and run `bundle install`), or run `gem install gelf_redux`.
|
|
19
|
+
Load the library with `require 'gelf_redux'`.
|
|
15
20
|
|
|
16
21
|
## Usage
|
|
17
|
-
###
|
|
22
|
+
### GELF::Notifier
|
|
18
23
|
|
|
19
|
-
This allows you to send
|
|
24
|
+
This allows you to send arbitrary messages via UDP to Graylog.
|
|
20
25
|
|
|
21
26
|
n = GELF::Notifier.new("localhost", 12201)
|
|
22
27
|
|
|
23
28
|
# Send with custom attributes and an additional parameter "foo"
|
|
24
|
-
n.notify!(:
|
|
29
|
+
n.notify!(short_message: "foo", full_message: "something here\n\nbacktrace?!", _foo: "bar")
|
|
25
30
|
|
|
26
31
|
# Pass any object that responds to .to_hash
|
|
27
32
|
n.notify!(Exception.new)
|
|
28
33
|
|
|
29
34
|
The recommended default is to send via UDP but you can choose to send via TCP like this:
|
|
30
35
|
|
|
31
|
-
n = GELF::Notifier.new("127.0.0.1", 12201, "LAN", { :
|
|
36
|
+
n = GELF::Notifier.new("127.0.0.1", 12201, "LAN", { protocol: GELF::Protocol::TCP })
|
|
32
37
|
|
|
33
38
|
Note that the `LAN` or `WAN` option is ignored for TCP because no chunking happens. (Read below for more information.)
|
|
34
39
|
|
|
35
|
-
|
|
40
|
+
For a Graylog GELF HTTP input, select HTTP or HTTPS. The `:path` and `:headers` options are available if your endpoint requires them:
|
|
41
|
+
|
|
42
|
+
n = GELF::Notifier.new("localhost", 12201, "WAN", { protocol: GELF::Protocol::HTTP })
|
|
43
|
+
n.notify!("Hello from HTTP")
|
|
44
|
+
|
|
45
|
+
# For an HTTPS input, use GELF::Protocol::HTTPS and its HTTPS port:
|
|
46
|
+
n = GELF::Notifier.new("graylog.example.com", 443, "WAN", { protocol: GELF::Protocol::HTTPS })
|
|
47
|
+
|
|
48
|
+
For TLS over a GELF TCP input, pass `:tls`. Certificate and hostname verification are enabled by default; specify `"ca"` to trust a custom CA. The host must match the server certificate:
|
|
49
|
+
|
|
50
|
+
n = GELF::Notifier.new("graylog.example.com", 12201, "WAN", {
|
|
51
|
+
protocol: GELF::Protocol::TCP,
|
|
52
|
+
tls: { "ca" => "/path/to/ca.pem" }
|
|
53
|
+
})
|
|
54
|
+
n.notify!("Hello from TLS")
|
|
36
55
|
|
|
37
|
-
|
|
38
|
-
Under the hood it uses Gelf::Notifier to send log messages via UDP to Graylog.
|
|
56
|
+
### GELF::Logger
|
|
39
57
|
|
|
40
|
-
|
|
58
|
+
The GELF::Logger is compatible with the standard Ruby Logger interface and can be used interchangeably.
|
|
59
|
+
Under the hood it uses GELF::Notifier to send log messages via UDP to Graylog.
|
|
60
|
+
|
|
61
|
+
logger = GELF::Logger.new("localhost", 12201, "WAN", { facility: "appname" })
|
|
41
62
|
|
|
42
63
|
logger.debug "foobar"
|
|
43
64
|
logger.info "foobar"
|
|
@@ -47,13 +68,13 @@ Under the hood it uses Gelf::Notifier to send log messages via UDP to Graylog.
|
|
|
47
68
|
|
|
48
69
|
logger << "foobar"
|
|
49
70
|
|
|
50
|
-
|
|
71
|
+
The `WAN` or `LAN` option influences the UDP chunk size depending on whether you send in your own
|
|
51
72
|
network (LAN) or on a longer route (i.e. through the internet) and should be set accordingly.
|
|
52
73
|
|
|
53
74
|
Since it's compatible with the Logger interface, you can also use it in your Rails application:
|
|
54
75
|
|
|
55
76
|
# config/environments/production.rb
|
|
56
|
-
config.logger = GELF::Logger.new("localhost", 12201, "WAN", { :
|
|
77
|
+
config.logger = GELF::Logger.new("localhost", 12201, "WAN", { facility: "appname" })
|
|
57
78
|
|
|
58
79
|
### Note on Patches/Pull Requests
|
|
59
80
|
|
|
@@ -71,7 +92,26 @@ You can either run tests against the ruby versions defined in docker-compose.yml
|
|
|
71
92
|
```bash
|
|
72
93
|
docker compose up
|
|
73
94
|
```
|
|
74
|
-
Or you can run a specific
|
|
95
|
+
Or you can run the tests for a specific Ruby version:
|
|
75
96
|
```bash
|
|
76
97
|
docker compose up ruby26
|
|
77
|
-
```
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### Create a release
|
|
101
|
+
- The VERSION file has to be updated to the new version number because it is used in gelf_redux.gemspec to
|
|
102
|
+
have a generic way of bumping the version
|
|
103
|
+
- CHANGELOG should be updated with a few hints about the release
|
|
104
|
+
- a release tag should be created from main branch after all PRs that will be part of the release have been merged
|
|
105
|
+
- creating a tag for the version is mandatory to be able to come back later for a fix-release if needed, example:
|
|
106
|
+
```shell
|
|
107
|
+
git tag v4.2.0
|
|
108
|
+
git push origin main --tags
|
|
109
|
+
```
|
|
110
|
+
#### For tags < 4.2.0
|
|
111
|
+
There is no automated way of pushing to rubygems, so we have to run these commands on a developers machine:
|
|
112
|
+
```shell
|
|
113
|
+
gem build *.gemspec
|
|
114
|
+
gem push *.gem
|
|
115
|
+
```
|
|
116
|
+
#### For tags >= 4.2.0
|
|
117
|
+
There is a github action for automated releases which will run as soon as a version tag has been pushed
|
|
@@ -35,7 +35,7 @@ module GELF
|
|
|
35
35
|
|
|
36
36
|
def connect(host, port)
|
|
37
37
|
plain_socket = super(host, port)
|
|
38
|
-
start_tls(plain_socket)
|
|
38
|
+
start_tls(plain_socket, host)
|
|
39
39
|
rescue OpenSSL::SSL::SSLError
|
|
40
40
|
plain_socket.close unless plain_socket.closed?
|
|
41
41
|
raise unless rescue_ssl_errors
|
|
@@ -43,10 +43,13 @@ module GELF
|
|
|
43
43
|
end
|
|
44
44
|
|
|
45
45
|
# Initiates TLS communication on the socket
|
|
46
|
-
def start_tls(plain_socket)
|
|
46
|
+
def start_tls(plain_socket, host)
|
|
47
47
|
ssl_socket_class.new(plain_socket, ssl_context).tap do |ssl_socket|
|
|
48
48
|
ssl_socket.sync_close = true
|
|
49
|
+
ssl_socket.hostname = host if ssl_socket.respond_to?(:hostname=) # SNI
|
|
49
50
|
ssl_socket.connect
|
|
51
|
+
# VERIFY_PEER only checks the chain; also check the cert was issued for this host
|
|
52
|
+
ssl_socket.post_connection_check(host) unless @tls_options['no_verify']
|
|
50
53
|
end
|
|
51
54
|
end
|
|
52
55
|
|
|
@@ -88,7 +91,7 @@ module GELF
|
|
|
88
91
|
def restrict_ciphers(ctx)
|
|
89
92
|
# This CipherString is will allow a variety of 'currently' cryptographically secure ciphers,
|
|
90
93
|
# while also retaining a broad level of compatibility
|
|
91
|
-
ctx.ciphers = "
|
|
94
|
+
ctx.ciphers = "TLSv1.2:TLSv1.1:TLSv1:!aNULL:!eNULL:!LOW:!3DES:!MD5:!EXP:!PSK:!DSS:!RC4:!SEED:!ECDSA:!ADH:!IDEA:!3DES"
|
|
92
95
|
end
|
|
93
96
|
|
|
94
97
|
def verify_mode
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: gelf_redux
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 4.
|
|
4
|
+
version: 4.4.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Alexey Palazhchenko
|
|
@@ -14,22 +14,22 @@ authors:
|
|
|
14
14
|
autorequire:
|
|
15
15
|
bindir: bin
|
|
16
16
|
cert_chain: []
|
|
17
|
-
date:
|
|
17
|
+
date: 2026-09-28 00:00:00.000000000 Z
|
|
18
18
|
dependencies:
|
|
19
19
|
- !ruby/object:Gem::Dependency
|
|
20
|
-
name: shoulda
|
|
20
|
+
name: shoulda-context
|
|
21
21
|
requirement: !ruby/object:Gem::Requirement
|
|
22
22
|
requirements:
|
|
23
23
|
- - "~>"
|
|
24
24
|
- !ruby/object:Gem::Version
|
|
25
|
-
version:
|
|
25
|
+
version: '2.0'
|
|
26
26
|
type: :development
|
|
27
27
|
prerelease: false
|
|
28
28
|
version_requirements: !ruby/object:Gem::Requirement
|
|
29
29
|
requirements:
|
|
30
30
|
- - "~>"
|
|
31
31
|
- !ruby/object:Gem::Version
|
|
32
|
-
version:
|
|
32
|
+
version: '2.0'
|
|
33
33
|
- !ruby/object:Gem::Dependency
|
|
34
34
|
name: mocha
|
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -78,14 +78,14 @@ dependencies:
|
|
|
78
78
|
requirements:
|
|
79
79
|
- - "~>"
|
|
80
80
|
- !ruby/object:Gem::Version
|
|
81
|
-
version: 3.18
|
|
81
|
+
version: '3.18'
|
|
82
82
|
type: :development
|
|
83
83
|
prerelease: false
|
|
84
84
|
version_requirements: !ruby/object:Gem::Requirement
|
|
85
85
|
requirements:
|
|
86
86
|
- - "~>"
|
|
87
87
|
- !ruby/object:Gem::Version
|
|
88
|
-
version: 3.18
|
|
88
|
+
version: '3.18'
|
|
89
89
|
- !ruby/object:Gem::Dependency
|
|
90
90
|
name: timecop
|
|
91
91
|
requirement: !ruby/object:Gem::Requirement
|