logstasher 2.1.3 → 2.1.5
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/lib/logstasher/railtie.rb +16 -15
- data/lib/logstasher/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7af8fd26cf9b944ead0bf8b8b2df3a75aa405ca1e726529e7cccb1a38ae30e8d
|
4
|
+
data.tar.gz: aec3c7b2e41fefcb6f9c8b378c91d332537387685da9951cf741ab4ff2a0d9e3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b65801d4d765f1f75f8939ee77e0ac88a5831e126f4428741097bce1b01b2c1ffe90a926aee5617bfe3355c9bfc80825299cfefd9666e52da008a22ad43368f7
|
7
|
+
data.tar.gz: 0d9bc2de4e965343f0ab12241d76e62a3e661b9bafa824cb532ee4df9768562ec83055af0c8462277b62efc8a0afdfc154b940bc38919500ec8a693bfce5009d
|
data/lib/logstasher/railtie.rb
CHANGED
@@ -6,6 +6,21 @@ require 'action_controller/log_subscriber'
|
|
6
6
|
require 'socket'
|
7
7
|
|
8
8
|
module LogStasher
|
9
|
+
def default_source
|
10
|
+
case RUBY_PLATFORM
|
11
|
+
when /darwin/
|
12
|
+
# NOTE: MacOS Sierra and later are setting `.local`
|
13
|
+
# hostnames that even as real hostnames without the `.local` part,
|
14
|
+
# are still unresolvable. One reliable way to get an IP is to
|
15
|
+
# get all available IP address lists and use the first one.
|
16
|
+
# This will always be `127.0.0.1`.
|
17
|
+
address_info = Socket.ip_address_list.first
|
18
|
+
address_info&.ip_address
|
19
|
+
else
|
20
|
+
IPSocket.getaddress(Socket.gethostname)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
9
24
|
class Railtie < Rails::Railtie
|
10
25
|
config.logstasher = ::ActiveSupport::OrderedOptions.new
|
11
26
|
config.logstasher.enabled = false
|
@@ -16,6 +31,7 @@ module LogStasher
|
|
16
31
|
config.logstasher.record_enabled = false
|
17
32
|
config.logstasher.view_enabled = true
|
18
33
|
config.logstasher.job_enabled = true
|
34
|
+
config.logstasher.source = LogStasher.default_source
|
19
35
|
|
20
36
|
# Try loading the config/logstasher.yml if present
|
21
37
|
env = Rails.env.to_sym || :development
|
@@ -48,21 +64,6 @@ module LogStasher
|
|
48
64
|
end
|
49
65
|
end
|
50
66
|
|
51
|
-
def default_source
|
52
|
-
case RUBY_PLATFORM
|
53
|
-
when /darwin/
|
54
|
-
# NOTE: MacOS Sierra and later are setting `.local`
|
55
|
-
# hostnames that even as real hostnames without the `.local` part,
|
56
|
-
# are still unresolvable. One reliable way to get an IP is to
|
57
|
-
# get all available IP address lists and use the first one.
|
58
|
-
# This will always be `127.0.0.1`.
|
59
|
-
address_info = Socket.ip_address_list.first
|
60
|
-
address_info&.ip_address
|
61
|
-
else
|
62
|
-
IPSocket.getaddress(Socket.gethostname)
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
67
|
def process_config(config, yml_config)
|
67
68
|
# Enable the logstasher logs for the current environment
|
68
69
|
config.enabled = yml_config[:enabled] if yml_config.key? :enabled
|
data/lib/logstasher/version.rb
CHANGED