sysloggly 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +4 -0
- data/.rspec +3 -0
- data/CHANGELOG.md +23 -0
- data/Gemfile +4 -0
- data/LICENSE +21 -0
- data/README.md +44 -0
- data/Rakefile +5 -0
- data/lib/sysloggly.rb +3 -1
- data/lib/sysloggly/rails.rb +19 -6
- data/lib/sysloggly/version.rb +1 -1
- data/sysloggly.gemspec +34 -0
- metadata +11 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aa71e8a9aa3a703e22d2697f224e7a9a28eae455
|
4
|
+
data.tar.gz: cb7bcaf874692f0da1d854a36e33399bcc59af05
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1010af1fc3672ac6be8622c63de69d5dbb08f245bf65db15d97509882e0b1ec06c7626b44e169c2c2aa4471dd02cecabee944abd5d8665a5b3b065de6bbc9e08
|
7
|
+
data.tar.gz: 2e29f9c69d8a90699094bd3928cd4ed6e81fb3ad078a2c36435fc8253125ce1b5fc2fbc08c442450213267d14a888e7cab91ba8dd463eade5a75ac0c2fe3367d
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/CHANGELOG.md
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
## Changelog
|
2
|
+
|
3
|
+
#### 0.3.2
|
4
|
+
- [new] option `ignore_user_agents` with default "Pingdom.com_bot"
|
5
|
+
|
6
|
+
#### 0.3.1
|
7
|
+
- [fix] Networklog (logging via udp)
|
8
|
+
|
9
|
+
#### 0.3.0
|
10
|
+
- refactoring Filelog client for non-blocking file access
|
11
|
+
- [new] choose between SimpleFormatter and SyslogFormatter
|
12
|
+
|
13
|
+
#### 0.2.1
|
14
|
+
- cleanup
|
15
|
+
|
16
|
+
#### 0.2.0
|
17
|
+
- complete refactoring, removed syslogger gem and added own implementation based
|
18
|
+
on logglier
|
19
|
+
- uses file logger (default)
|
20
|
+
- able to switch to sys logger, which uses udp socket
|
21
|
+
|
22
|
+
#### 0.1.0
|
23
|
+
- initial
|
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2017 Jörgen Dahlke
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
# Sysloggly
|
2
|
+
|
3
|
+
#### Provides a very opinionated Lograge and Syslog integration for Rails apps.
|
4
|
+
|
5
|
+
|
6
|
+
## Installation
|
7
|
+
|
8
|
+
Include **sysloggly** in your Gemfile.
|
9
|
+
|
10
|
+
```ruby
|
11
|
+
gem 'sysloggly'
|
12
|
+
```
|
13
|
+
|
14
|
+
## Configuration
|
15
|
+
|
16
|
+
```ruby
|
17
|
+
Sysloggly.configure do |config|
|
18
|
+
config.env = Rails.env # default
|
19
|
+
|
20
|
+
# for filelog # default
|
21
|
+
config.uri = "file://#{Rails.root.join('log','sysloggly.log')}"
|
22
|
+
|
23
|
+
# for syslog '[udp|tcp]://<hostname>:<port>/<facility>'
|
24
|
+
config.uri = "udp://127.0.0.1:514/23"
|
25
|
+
|
26
|
+
config.ignore_user_agents = ["Pingdom.com_bot"] # default
|
27
|
+
end
|
28
|
+
|
29
|
+
```
|
30
|
+
|
31
|
+
## Usage
|
32
|
+
|
33
|
+
In most cases you have to do nothing else.
|
34
|
+
However you can use `Sysloggly.logger` to log output JSON directly to syslog.
|
35
|
+
|
36
|
+
```ruby
|
37
|
+
Sysloggly.logger.info({ foo: 'foo', bar: 'bar'})
|
38
|
+
```
|
39
|
+
|
40
|
+
|
41
|
+
## Thanks
|
42
|
+
|
43
|
+
Greatly inspired by the [logglier](https://github.com/freeformz/logglier) gem.
|
44
|
+
And thanks to [lograge](https://github.com/roidrage/lograge), one of the most helpful Rails gems out there.
|
data/Rakefile
ADDED
data/lib/sysloggly.rb
CHANGED
@@ -17,7 +17,9 @@ module Sysloggly
|
|
17
17
|
class UnsupportedScheme < ArgumentError; end
|
18
18
|
class UnknownFacility < ArgumentError; end
|
19
19
|
|
20
|
-
mattr_accessor :progname, :env, :uri
|
20
|
+
mattr_accessor :progname, :env, :uri
|
21
|
+
mattr_accessor :logger
|
22
|
+
mattr_accessor :ignore_user_agents
|
21
23
|
|
22
24
|
def self.configure
|
23
25
|
yield self
|
data/lib/sysloggly/rails.rb
CHANGED
@@ -1,8 +1,10 @@
|
|
1
1
|
#
|
2
|
-
# Sysloggly default configuration
|
3
|
-
#
|
4
|
-
#
|
5
|
-
#
|
2
|
+
# Sysloggly default configuration for Rails
|
3
|
+
#
|
4
|
+
# @config [progname] Rails app name
|
5
|
+
# @config [env] Rails env
|
6
|
+
# @config [logger] file log to log/sysloggly.log
|
7
|
+
# @config [ignore_user_agents] ignores Pingdom bot
|
6
8
|
#
|
7
9
|
module Sysloggly
|
8
10
|
# @private
|
@@ -11,7 +13,8 @@ module Sysloggly
|
|
11
13
|
Sysloggly.configure do |config|
|
12
14
|
config.progname ||= app.class.parent_name
|
13
15
|
config.env ||= Rails.env
|
14
|
-
config.uri ||= "file://#{Rails.root.join(
|
16
|
+
config.uri ||= "file://#{Rails.root.join("log","sysloggly.log")}"
|
17
|
+
config.ignore_user_agents ||= ["Pingdom.com_bot"]
|
15
18
|
|
16
19
|
config.logger = Sysloggly.new(config.uri, {
|
17
20
|
env: config.env,
|
@@ -25,10 +28,20 @@ module Sysloggly
|
|
25
28
|
config.lograge.formatter = Lograge::Formatters::Json.new
|
26
29
|
config.lograge.keep_original_rails_log = true
|
27
30
|
config.lograge.logger = Sysloggly.logger
|
31
|
+
config.lograge.custom_payload do |controller|
|
32
|
+
{
|
33
|
+
user_agent: controller.request.user_agent
|
34
|
+
}
|
35
|
+
end
|
36
|
+
config.lograge.ignore_custom = lambda do |event|
|
37
|
+
custom_payload = event.payload[:custom_payload] || {}
|
38
|
+
user_agent = custom_payload[:user_agent] || ""
|
39
|
+
Sysloggly.ignore_user_agents.any? { |pattern| user_agent.include?(pattern) }
|
40
|
+
end
|
28
41
|
end
|
42
|
+
|
29
43
|
Lograge.setup(app)
|
30
44
|
|
31
|
-
# load extensions
|
32
45
|
require 'sysloggly/extensions/honeybadger' if defined?(Honeybadger)
|
33
46
|
end
|
34
47
|
end
|
data/lib/sysloggly/version.rb
CHANGED
data/sysloggly.gemspec
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
lib = File.expand_path("../lib", __FILE__)
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
+
require "sysloggly/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "sysloggly"
|
7
|
+
spec.version = Sysloggly::VERSION
|
8
|
+
spec.licenses = ["MIT"]
|
9
|
+
spec.authors = ["Joergen Dahlke"]
|
10
|
+
spec.email = ["joergen.dahlke@gmail.com"]
|
11
|
+
|
12
|
+
spec.homepage = "https://github.com/jdahlke/sysloggly"
|
13
|
+
spec.summary = %q{Lograge and Syslog integration for Rails apps.}
|
14
|
+
spec.description = %q{Lograge and Syslog integration for Rails apps.}
|
15
|
+
|
16
|
+
spec.rubyforge_project = "sysloggly"
|
17
|
+
|
18
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
19
|
+
f.match(%r{^(test|spec|features)/})
|
20
|
+
end
|
21
|
+
spec.bindir = "exe"
|
22
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
23
|
+
spec.require_paths = ["lib"]
|
24
|
+
|
25
|
+
|
26
|
+
# specify any dependencies here:
|
27
|
+
spec.required_ruby_version = "~> 2.0"
|
28
|
+
spec.add_runtime_dependency "multi_json"
|
29
|
+
spec.add_runtime_dependency "lograge"
|
30
|
+
|
31
|
+
# specify any development dependencies here:
|
32
|
+
spec.add_development_dependency "rspec"
|
33
|
+
spec.add_development_dependency "rake"
|
34
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sysloggly
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joergen Dahlke
|
8
8
|
autorequire:
|
9
|
-
bindir:
|
9
|
+
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-03-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: multi_json
|
@@ -73,6 +73,13 @@ executables: []
|
|
73
73
|
extensions: []
|
74
74
|
extra_rdoc_files: []
|
75
75
|
files:
|
76
|
+
- ".gitignore"
|
77
|
+
- ".rspec"
|
78
|
+
- CHANGELOG.md
|
79
|
+
- Gemfile
|
80
|
+
- LICENSE
|
81
|
+
- README.md
|
82
|
+
- Rakefile
|
76
83
|
- lib/sysloggly.rb
|
77
84
|
- lib/sysloggly/clients/filelog.rb
|
78
85
|
- lib/sysloggly/clients/networklog.rb
|
@@ -81,6 +88,7 @@ files:
|
|
81
88
|
- lib/sysloggly/formatters/syslog_formatter.rb
|
82
89
|
- lib/sysloggly/rails.rb
|
83
90
|
- lib/sysloggly/version.rb
|
91
|
+
- sysloggly.gemspec
|
84
92
|
homepage: https://github.com/jdahlke/sysloggly
|
85
93
|
licenses:
|
86
94
|
- MIT
|