sherlog-holmes 0.4.0 → 0.4.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
  SHA1:
3
- metadata.gz: 7de344c1bb4ad99a2e4cb1369d9781196242f877
4
- data.tar.gz: d71b629b448d315815dd00d9fcc27cdc56c3b30c
3
+ metadata.gz: cfabfad5c19ca3571ca67c3a4aab466b8018cc0c
4
+ data.tar.gz: a5a3e6f5657835d46abd367894e565e52be653aa
5
5
  SHA512:
6
- metadata.gz: 5e8d2263e831c1f7cb06ae3101465e448594f8c5aa4e44651733a7dc73cefaae0edf35a8cefa89e8a05689f1215490f5c2bb06dde28405e62f775ef29f2f7df9
7
- data.tar.gz: 02a4e999969b868d738056068b52fd67466fa8ed0560c95ce3c1fb0cb6f348fc2469fae1e8be5157eefcf3e7c75475b918de300b3a47ad5b6df1f091571caafe
6
+ metadata.gz: 29626eaaaa8f34cc6c40ea9a7942ce361f134db9c96ddf7915c7505a0c8fa88ac513982a45f07e9f06d22c9fe8f65f9fab9af0b670de08a9f5dcc13c4d3a7e96
7
+ data.tar.gz: 527afcbc462f5b0acf2f77cdadc04a55726f9510308533f8f79101a97c18cbcd19a3fe92ccd946ee52c68f0e76cbcdac7c681792750a08b6c1e4977e46b8d7a4
data/README.md CHANGED
@@ -2,11 +2,19 @@
2
2
 
3
3
  *Less data containing useful information is way better than lots of data containing a mess.*
4
4
 
5
- Don't you hate thousands of lines in a log blowing up with your troubleshooting? Lots of useless data that you have to filter just to turn that 300 MB of madness into a 30 KB of useful information. If you need something that can rip off useless entries so you can have a clue about what is going on with that application, you should give Sherlog Holmes a try.
5
+ Don't you hate those thousands of lines in a log blowing up with your troubleshooting? Lots of useless data that you have to filter just to turn that 300 MB of madness into a 30 KB of useful information? If you need something that can rip off useless entries so you can have a clue about what is going on with that application, you should give Sherlog Holmes a try.
6
+
7
+ If you are a log detective, then Sherlog Holmes is your best companion!
6
8
 
7
9
  ## Installation
8
10
 
9
- Add this line to your application's Gemfile:
11
+ Sherlog can be installed easily through the `gem` command:
12
+
13
+ ```sh
14
+ $ gem install sherlog-holmes
15
+ ```
16
+
17
+ This is the preferable way since Sherlog is basically a console line application. Of course you can add it to your application's Gemfile:
10
18
 
11
19
  ```ruby
12
20
  gem 'sherlog_holmes'
@@ -14,33 +22,28 @@ gem 'sherlog_holmes'
14
22
 
15
23
  And then execute:
16
24
 
17
- $ bundle
18
-
19
- Or install it yourself as:
20
-
21
- $ gem install sherlog-holmes
25
+ ```sh
26
+ $ bundle
27
+ ```
22
28
 
23
- ## Concepts
29
+ ## How it works
24
30
 
25
- Sherlog works by grabbing every line of a log and parsing it into a simple structure containing:
31
+ Sherlog works by grabbing every line of an input and applying a Regular Expression to create an `entry`. This `entry` will be filtered based on a set of given rules and, if it is accepted, will be passed to a set of defined processors so they can do something useful (like printing the output so you can redirect it to a sane log file).
26
32
 
27
- - Time
28
- - Level
29
- - Category
30
- - Origin
31
- - Message
32
- - Exception
33
- - Stacktrace
33
+ The attributes are based on the named capture groups:
34
34
 
35
- You need to supply a regular expression that maps those fields in order to match your log entry. Here is an example:
35
+ - Time: `time`
36
+ - Level: `level`
37
+ - Category: `category`
38
+ - Origin: `origin`
39
+ - Message: `message`
36
40
 
37
41
  ```regexp
38
42
  (<?level>\w+)\s(<?category>\s+)\s(<?message>.+)
39
43
  ```
44
+ *Any other capture group will be assigned to a set of custom attributes and can be used later.*
40
45
 
41
- Notice that you don't need to define every field, just the ones shown in your log.
42
-
43
- Patterns for exception and stacktrace should be defined separately. The exception pattern is used only in the message field. Here is a complete example of a pattern configuration:
46
+ Patterns for exception and stacktrace should be defined separately. The exception pattern is used only in the message field and stacktraces. Here is a complete example of a pattern configuration:
44
47
 
45
48
  ```yaml
46
49
  jboss:
@@ -51,10 +54,6 @@ jboss:
51
54
 
52
55
  The configuration should contain a unique id and at least a pattern for the log **entry**. Place you configuration file in a `*.yml` file inside your `$HOME/.sherlog/patterns` directory and you're ready to go!
53
56
 
54
- ### Custom Attributes
55
-
56
- Sherlog allows you to define custom attributes by using named capture groups. Any capture group name that differs from the main fields will be stored as a custom attribute in the entry object.
57
-
58
57
  ### Configuration Inheritance
59
58
 
60
59
  You can create a base configuration and then override some values to create another one. In this case, you need to specify the parent configuration with the `from` key:
@@ -84,7 +83,7 @@ This sets the encode to use while reading the log file.
84
83
 
85
84
  `-t, --type TYPE`
86
85
 
87
- This will manually set the patterns definitions. If you don't specify this option, Sherlog will try the mapped ones with the first input line.
86
+ This will manually set the patterns definitions. If you don't specify this option, Sherlog will try to guess the pattern by trying the mapped ones until it finds a match.
88
87
 
89
88
  ### Filter Options
90
89
 
@@ -144,7 +143,7 @@ This is equivalent to:
144
143
 
145
144
  (WARN || ! INFO) && EXCEPTION
146
145
 
147
- *NOTICE: try not to do fuzzy logics with this operators*
146
+ *NOTICE: try not to do fuzzy logics with those operators*
148
147
 
149
148
  ### Operation Options
150
149
 
@@ -167,13 +166,15 @@ Set this and Sherlog will count the number of entries per level, category, origi
167
166
  - `levels`: counts the number of entries per level
168
167
  - `categories`: counts the number of entries per category
169
168
  - `origins`: counts the number of entries per origin
170
- - `exception`: counts the number of entries per exception
169
+ - `exceptions`: counts the number of entries per exception
171
170
  - `all`: counts all groups
172
171
 
173
172
  ```
174
173
  $ sherlog --count levels,categories log-file.log
175
174
  ```
176
175
 
176
+ *Don't forget to set an operation or `sherlog` will not show anything in your console!*
177
+
177
178
  ## Built-in Patterns
178
179
 
179
180
  Currently, Sherlog has the following patterns:
@@ -185,4 +186,3 @@ Currently, Sherlog has the following patterns:
185
186
  ## License
186
187
 
187
188
  The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
188
-
data/bin/sherlog CHANGED
@@ -22,7 +22,7 @@
22
22
  # THE SOFTWARE.
23
23
 
24
24
  require 'yummi'
25
- require 'optionparser'
25
+ require 'optparse'
26
26
 
27
27
  require_relative '../lib/sherlog_holmes'
28
28
 
data/changelog.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## v0.4.1
4
+
5
+ - Use `optparse` instead of `optionparser`
6
+
3
7
  ## v0.4.0
4
8
 
5
9
  - Added support for multiple log files
@@ -21,5 +21,5 @@
21
21
  # THE SOFTWARE.
22
22
 
23
23
  module Sherlog
24
- VERSION = '0.4.0'
24
+ VERSION = '0.4.1'
25
25
  end
@@ -18,6 +18,8 @@ Gem::Specification.new do |spec|
18
18
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
19
19
  spec.require_paths = ['lib']
20
20
 
21
+ spec.required_ruby_version = '>= 2.0'
22
+
21
23
  spec.add_dependency 'yummi', '~> 0.9.5'
22
24
 
23
25
  spec.add_development_dependency 'bundler', '~> 1.10'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sherlog-holmes
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ataxexe
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-29 00:00:00.000000000 Z
11
+ date: 2016-01-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: yummi
@@ -115,7 +115,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
115
115
  requirements:
116
116
  - - ">="
117
117
  - !ruby/object:Gem::Version
118
- version: '0'
118
+ version: '2.0'
119
119
  required_rubygems_version: !ruby/object:Gem::Requirement
120
120
  requirements:
121
121
  - - ">="