splunky 0.0.1
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 +7 -0
- data/.document +5 -0
- data/.rspec +2 -0
- data/.travis.yml +7 -0
- data/Gemfile +9 -0
- data/Gemfile.lock +82 -0
- data/LICENSE.txt +20 -0
- data/README.md +22 -0
- data/Rakefile +32 -0
- data/VERSION +1 -0
- data/lib/splunky.rb +10 -0
- data/lib/splunky/formatter.rb +13 -0
- data/lib/splunky/initializer.rb +5 -0
- data/lib/splunky/railtie.rb +5 -0
- data/spec/formatter_spec.rb +13 -0
- data/spec/spec_helper.rb +2 -0
- data/splunky.gemspec +65 -0
- metadata +117 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 50cc059c6361974c3e0c97eb2b361ba742d385c3
|
4
|
+
data.tar.gz: 0973b8a23049e435fc793aebd3df04a9981b9611
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 9586f71b6fdeb9409c03d5602d1f826d7e69b3ca0f60ddf6eb785d33d5ff0db3dedb3d9edd191010d0e747ce72567fc84bc98a6cf2c2bb21f30127ef63bfd795
|
7
|
+
data.tar.gz: c9f567425bbcd14ce1f578de19a601e0b5dd7177332e3f5187f0356c76aacc2c766902f111b03103597c653747388974b0058e71ac1590871ab10117d7778a8e
|
data/.document
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,82 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
activesupport (4.1.1)
|
5
|
+
i18n (~> 0.6, >= 0.6.9)
|
6
|
+
json (~> 1.7, >= 1.7.7)
|
7
|
+
minitest (~> 5.1)
|
8
|
+
thread_safe (~> 0.1)
|
9
|
+
tzinfo (~> 1.1)
|
10
|
+
addressable (2.3.6)
|
11
|
+
builder (3.2.2)
|
12
|
+
descendants_tracker (0.0.4)
|
13
|
+
thread_safe (~> 0.3, >= 0.3.1)
|
14
|
+
diff-lcs (1.2.5)
|
15
|
+
faraday (0.9.0)
|
16
|
+
multipart-post (>= 1.2, < 3)
|
17
|
+
git (1.2.7)
|
18
|
+
github_api (0.11.3)
|
19
|
+
addressable (~> 2.3)
|
20
|
+
descendants_tracker (~> 0.0.1)
|
21
|
+
faraday (~> 0.8, < 0.10)
|
22
|
+
hashie (>= 1.2)
|
23
|
+
multi_json (>= 1.7.5, < 2.0)
|
24
|
+
nokogiri (~> 1.6.0)
|
25
|
+
oauth2
|
26
|
+
hashie (3.0.0)
|
27
|
+
highline (1.6.21)
|
28
|
+
i18n (0.6.9)
|
29
|
+
jeweler (2.0.1)
|
30
|
+
builder
|
31
|
+
bundler (>= 1.0)
|
32
|
+
git (>= 1.2.5)
|
33
|
+
github_api
|
34
|
+
highline (>= 1.6.15)
|
35
|
+
nokogiri (>= 1.5.10)
|
36
|
+
rake
|
37
|
+
rdoc
|
38
|
+
json (1.8.1)
|
39
|
+
jwt (1.0.0)
|
40
|
+
mini_portile (0.6.0)
|
41
|
+
minitest (5.3.5)
|
42
|
+
multi_json (1.10.1)
|
43
|
+
multi_xml (0.5.5)
|
44
|
+
multipart-post (2.0.0)
|
45
|
+
nokogiri (1.6.2.1)
|
46
|
+
mini_portile (= 0.6.0)
|
47
|
+
oauth2 (0.9.4)
|
48
|
+
faraday (>= 0.8, < 0.10)
|
49
|
+
jwt (~> 1.0)
|
50
|
+
multi_json (~> 1.3)
|
51
|
+
multi_xml (~> 0.5)
|
52
|
+
rack (~> 1.2)
|
53
|
+
rack (1.5.2)
|
54
|
+
rails_request_id (0.1.1)
|
55
|
+
activesupport (~> 4.1)
|
56
|
+
rake (10.3.2)
|
57
|
+
rdoc (4.1.1)
|
58
|
+
json (~> 1.4)
|
59
|
+
rspec (3.0.0)
|
60
|
+
rspec-core (~> 3.0.0)
|
61
|
+
rspec-expectations (~> 3.0.0)
|
62
|
+
rspec-mocks (~> 3.0.0)
|
63
|
+
rspec-core (3.0.2)
|
64
|
+
rspec-support (~> 3.0.0)
|
65
|
+
rspec-expectations (3.0.2)
|
66
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
67
|
+
rspec-support (~> 3.0.0)
|
68
|
+
rspec-mocks (3.0.2)
|
69
|
+
rspec-support (~> 3.0.0)
|
70
|
+
rspec-support (3.0.2)
|
71
|
+
thread_safe (0.3.4)
|
72
|
+
tzinfo (1.2.1)
|
73
|
+
thread_safe (~> 0.1)
|
74
|
+
|
75
|
+
PLATFORMS
|
76
|
+
ruby
|
77
|
+
|
78
|
+
DEPENDENCIES
|
79
|
+
bundler (~> 1.0)
|
80
|
+
jeweler (~> 2.0)
|
81
|
+
rails_request_id (~> 0.1)
|
82
|
+
rspec (~> 3.0)
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2014 Kunal Parikh
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
#Splunky [](https://travis-ci.org/techthumb/splunky)
|
2
|
+
|
3
|
+
Splunky defines and changes the standard log formatter to produce output that is splunkable.
|
4
|
+
The log line includes Rails' request id in a key=value format.
|
5
|
+
This allows for easy splunking as you can simply do a ```transaction request_id``` to corelate all log lines associated with a single user request.
|
6
|
+
|
7
|
+
|
8
|
+
```
|
9
|
+
2014-06-22 08:56:46.297 +1000 request_id=4a160cbb-9ddc-45d2-8c16-0c4a2c3f183a the log message
|
10
|
+
```
|
11
|
+
|
12
|
+
## Installation
|
13
|
+
Add this to your Gemfile
|
14
|
+
```ruby
|
15
|
+
gem 'splunky'
|
16
|
+
```
|
17
|
+
|
18
|
+
## Get in touch!
|
19
|
+
If you're using ```splunky```, I'd love to hear from you. Drop me a line and tell me what you think at: ```kunal+splunky@techthumb.in```
|
20
|
+
|
21
|
+
## Contributing
|
22
|
+
It's on GitHub, you know what to do!
|
data/Rakefile
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'bundler'
|
5
|
+
begin
|
6
|
+
Bundler.setup(:default, :development)
|
7
|
+
rescue Bundler::BundlerError => e
|
8
|
+
$stderr.puts e.message
|
9
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
10
|
+
exit e.status_code
|
11
|
+
end
|
12
|
+
require 'rake'
|
13
|
+
|
14
|
+
require 'jeweler'
|
15
|
+
Jeweler::Tasks.new do |gem|
|
16
|
+
gem.name = "splunky"
|
17
|
+
gem.homepage = "http://github.com/techthumb/splunky"
|
18
|
+
gem.license = "MIT"
|
19
|
+
gem.summary = %Q{A splunk friendly log formatter}
|
20
|
+
gem.description = %Q{Generates log lines with request_id=xxx for easy splunking!}
|
21
|
+
gem.email = "kunal@techthumb.in"
|
22
|
+
gem.authors = ["Kunal Parikh"]
|
23
|
+
end
|
24
|
+
Jeweler::RubygemsDotOrgTasks.new
|
25
|
+
|
26
|
+
require 'rspec/core'
|
27
|
+
require 'rspec/core/rake_task'
|
28
|
+
RSpec::Core::RakeTask.new(:spec) do |spec|
|
29
|
+
spec.pattern = FileList['spec/**/*_spec.rb']
|
30
|
+
end
|
31
|
+
|
32
|
+
task :default => :spec
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.0.1
|
data/lib/splunky.rb
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
class Splunky::Formatter < Logger::Formatter
|
2
|
+
|
3
|
+
def initialize
|
4
|
+
@datetime_format = '%Y-%m-%d %H:%M:%S.%L %z'
|
5
|
+
end
|
6
|
+
|
7
|
+
def call(severity, time, progname, msg)
|
8
|
+
"#{format_datetime(time)} request_id=#{RailsRequestId.get} #{msg.strip}\n"
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
|
13
|
+
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Splunky::Formatter do
|
4
|
+
let(:message) { 'the log message' }
|
5
|
+
let(:time) { Time.now }
|
6
|
+
let(:request_id) { SecureRandom.uuid }
|
7
|
+
|
8
|
+
subject { Splunky::Formatter.new.call(Logger::Severity::INFO, time, 'program name', message) }
|
9
|
+
|
10
|
+
before { RailsRequestId::Registry.request_id = request_id }
|
11
|
+
|
12
|
+
it { should == "#{time.strftime('%Y-%m-%d %H:%M:%S.%L %z')} request_id=#{request_id} #{message}\n" }
|
13
|
+
end
|
data/spec/spec_helper.rb
ADDED
data/splunky.gemspec
ADDED
@@ -0,0 +1,65 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
# stub: splunky 0.0.1 ruby lib
|
6
|
+
|
7
|
+
Gem::Specification.new do |s|
|
8
|
+
s.name = "splunky"
|
9
|
+
s.version = "0.0.1"
|
10
|
+
|
11
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
|
+
s.require_paths = ["lib"]
|
13
|
+
s.authors = ["Kunal Parikh"]
|
14
|
+
s.date = "2014-06-21"
|
15
|
+
s.description = "Generates log lines with request_id=xxx for easy splunking!"
|
16
|
+
s.email = "kunal@techthumb.in"
|
17
|
+
s.extra_rdoc_files = [
|
18
|
+
"LICENSE.txt",
|
19
|
+
"README.md"
|
20
|
+
]
|
21
|
+
s.files = [
|
22
|
+
".document",
|
23
|
+
".rspec",
|
24
|
+
".travis.yml",
|
25
|
+
"Gemfile",
|
26
|
+
"Gemfile.lock",
|
27
|
+
"LICENSE.txt",
|
28
|
+
"README.md",
|
29
|
+
"Rakefile",
|
30
|
+
"VERSION",
|
31
|
+
"lib/splunky.rb",
|
32
|
+
"lib/splunky/formatter.rb",
|
33
|
+
"lib/splunky/initializer.rb",
|
34
|
+
"lib/splunky/railtie.rb",
|
35
|
+
"spec/formatter_spec.rb",
|
36
|
+
"spec/spec_helper.rb",
|
37
|
+
"splunky.gemspec"
|
38
|
+
]
|
39
|
+
s.homepage = "http://github.com/techthumb/splunky"
|
40
|
+
s.licenses = ["MIT"]
|
41
|
+
s.rubygems_version = "2.3.0"
|
42
|
+
s.summary = "A splunk friendly log formatter"
|
43
|
+
|
44
|
+
if s.respond_to? :specification_version then
|
45
|
+
s.specification_version = 4
|
46
|
+
|
47
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
48
|
+
s.add_runtime_dependency(%q<rails_request_id>, ["~> 0.1"])
|
49
|
+
s.add_development_dependency(%q<rspec>, ["~> 3.0"])
|
50
|
+
s.add_development_dependency(%q<bundler>, ["~> 1.0"])
|
51
|
+
s.add_development_dependency(%q<jeweler>, ["~> 2.0"])
|
52
|
+
else
|
53
|
+
s.add_dependency(%q<rails_request_id>, ["~> 0.1"])
|
54
|
+
s.add_dependency(%q<rspec>, ["~> 3.0"])
|
55
|
+
s.add_dependency(%q<bundler>, ["~> 1.0"])
|
56
|
+
s.add_dependency(%q<jeweler>, ["~> 2.0"])
|
57
|
+
end
|
58
|
+
else
|
59
|
+
s.add_dependency(%q<rails_request_id>, ["~> 0.1"])
|
60
|
+
s.add_dependency(%q<rspec>, ["~> 3.0"])
|
61
|
+
s.add_dependency(%q<bundler>, ["~> 1.0"])
|
62
|
+
s.add_dependency(%q<jeweler>, ["~> 2.0"])
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
metadata
ADDED
@@ -0,0 +1,117 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: splunky
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Kunal Parikh
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-06-21 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rails_request_id
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0.1'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0.1'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rspec
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '3.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '3.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ~>
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: jeweler
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '2.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ~>
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '2.0'
|
69
|
+
description: Generates log lines with request_id=xxx for easy splunking!
|
70
|
+
email: kunal@techthumb.in
|
71
|
+
executables: []
|
72
|
+
extensions: []
|
73
|
+
extra_rdoc_files:
|
74
|
+
- LICENSE.txt
|
75
|
+
- README.md
|
76
|
+
files:
|
77
|
+
- .document
|
78
|
+
- .rspec
|
79
|
+
- .travis.yml
|
80
|
+
- Gemfile
|
81
|
+
- Gemfile.lock
|
82
|
+
- LICENSE.txt
|
83
|
+
- README.md
|
84
|
+
- Rakefile
|
85
|
+
- VERSION
|
86
|
+
- lib/splunky.rb
|
87
|
+
- lib/splunky/formatter.rb
|
88
|
+
- lib/splunky/initializer.rb
|
89
|
+
- lib/splunky/railtie.rb
|
90
|
+
- spec/formatter_spec.rb
|
91
|
+
- spec/spec_helper.rb
|
92
|
+
- splunky.gemspec
|
93
|
+
homepage: http://github.com/techthumb/splunky
|
94
|
+
licenses:
|
95
|
+
- MIT
|
96
|
+
metadata: {}
|
97
|
+
post_install_message:
|
98
|
+
rdoc_options: []
|
99
|
+
require_paths:
|
100
|
+
- lib
|
101
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
102
|
+
requirements:
|
103
|
+
- - '>='
|
104
|
+
- !ruby/object:Gem::Version
|
105
|
+
version: '0'
|
106
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - '>='
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
requirements: []
|
112
|
+
rubyforge_project:
|
113
|
+
rubygems_version: 2.3.0
|
114
|
+
signing_key:
|
115
|
+
specification_version: 4
|
116
|
+
summary: A splunk friendly log formatter
|
117
|
+
test_files: []
|