ntail 0.0.10 → 0.0.11
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +24 -19
- data/VERSION +1 -1
- data/lib/ntail/http_user_agent.rb +4 -0
- data/ntail.gemspec +4 -3
- metadata +30 -30
data/README.rdoc
CHANGED
@@ -1,16 +1,19 @@
|
|
1
1
|
= ntail
|
2
2
|
|
3
|
-
A tail(1)
|
3
|
+
A <tt>tail(1)</tt>-like utility for nginx log files that supports parsing, filtering and formatting of individual
|
4
|
+
log lines (in nginx's so-called {"combined" log format}[http://wiki.nginx.org/NginxHttpLogModule#log_format]).
|
4
5
|
|
5
|
-
|
6
|
+
== Installation
|
6
7
|
|
7
|
-
|
8
|
+
Installing the gem also installs the <tt>ntail</tt> executable, typically as <tt>/usr/bin/ntail</tt> or <tt>/usr/local/bin/ntail</tt>:
|
8
9
|
|
9
|
-
|
10
|
+
> gem install ntail
|
10
11
|
|
11
|
-
|
12
|
+
To ensure easy execution of the <tt>ntail</tt> script, add the actual installation directory to your shell's <tt>$PATH</tt> variable.
|
13
|
+
|
14
|
+
== Basic Usage
|
12
15
|
|
13
|
-
* process an nginx log file and print each line to STDOUT
|
16
|
+
* process an entire nginx log file and print each parsed and formatted line to STDOUT
|
14
17
|
|
15
18
|
> ntail /var/log/nginx/access.log
|
16
19
|
|
@@ -18,11 +21,17 @@ A tail(1)-like utility for nginx log files that supports parsing, filtering and
|
|
18
21
|
|
19
22
|
> tail -f /var/log/nginx/access.log | ntail
|
20
23
|
|
21
|
-
|
24
|
+
== Advanced Examples
|
25
|
+
|
26
|
+
* read from STDIN and print each line to STDOUT <em>(stop with ^D)</em>
|
27
|
+
|
28
|
+
> ntail
|
29
|
+
|
30
|
+
* read from STDIN and print out the length of each line <em>(to illustrate -e option)</em>
|
22
31
|
|
23
32
|
> ntail -e '{ |line| puts line.size }'
|
24
33
|
|
25
|
-
*
|
34
|
+
* read from STDIN but only print out non-empty lines <em>(to illustrate -f option)</em>
|
26
35
|
|
27
36
|
> ntail -f '{ |line| line.size > 0 }'
|
28
37
|
|
@@ -64,19 +73,15 @@ A tail(1)-like utility for nginx log files that supports parsing, filtering and
|
|
64
73
|
|
65
74
|
== TODO
|
66
75
|
|
67
|
-
* implement a native <tt>"-f"</tt> option for ntail, similar to that of <tt>tail(1)</tt
|
68
|
-
* implement a <tt>"-i"</tt> option ("ignore exceptions"/"continue processing"), if handling a single line
|
69
|
-
|
70
|
-
*
|
71
|
-
* make <tt>OFFICE_IP_ADDRESS</tt> configurable (from command line and/or rc file)
|
72
|
-
* make <tt>KNOWN_SEARCH_BOTS</tt> configurable (from command line and/or rc file)
|
73
|
-
* make <tt>INTERNAL_REFERERS</tt> configurable (from command line and/or rc file)
|
74
|
-
* make <tt>AUTOMATED_REQUESTS</tt> configurable (from command line and/or rc file)
|
75
|
-
* make <tt>STATIC_REPOS</tt> configurable (from command line and/or rc file)
|
76
|
+
* implement a native <tt>"-f"</tt> option for ntail, similar to that of <tt>tail(1)</tt>, using e.g. flori's {file-tail gem}[https://github.com/flori/file-tail]
|
77
|
+
* implement a <tt>"-i"</tt> option ("ignore exceptions"/"continue processing"), if handling a single line raises an exception
|
78
|
+
* or indeed a reverse <tt>"-r"</tt> option ("re-raise exception"), to immediately stop processing and raising the exception for investigation
|
79
|
+
* implement (better) support for custom nginx log formats, in addition to {nginx's default "combined" log format}[http://wiki.nginx.org/NginxHttpLogModule#log_format].
|
76
80
|
|
77
81
|
== Acknowledgements
|
78
82
|
|
79
|
-
ntail's parsing feature is inspired by an nginx log parser written by {Richard Taylor (moomerman)}[https://github.com/moomerman]
|
83
|
+
* ntail's parsing feature is inspired by an nginx log parser written by {Richard Taylor (moomerman)}[https://github.com/moomerman]
|
84
|
+
* parsing and expanding ntail's formatting string is done using nathansobo's quite brilliant {treetop gem}[https://github.com/nathansobo/treetop]
|
80
85
|
|
81
86
|
== Contributing to ntail
|
82
87
|
|
@@ -90,5 +95,5 @@ ntail's parsing feature is inspired by an nginx log parser written by {Richard T
|
|
90
95
|
|
91
96
|
== Copyright
|
92
97
|
|
93
|
-
Copyright (c)
|
98
|
+
Copyright (c) 2011 Peter Vandenberk. See LICENSE.txt for further details.
|
94
99
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.11
|
@@ -25,6 +25,7 @@ class SearchBot < Agent
|
|
25
25
|
# Pingdom.com_bot_version_1.4_(http://www.pingdom.com/)
|
26
26
|
# ia_archiver (+http://www.alexa.com/site/help/webmasters; crawler@alexa.com)
|
27
27
|
# Mozilla/5.0 (compatible; YandexBot/3.0; +http://yandex.com/bots)
|
28
|
+
# Mozilla/5.0 (compatible; bingbot/2.0; +http://www.bing.com/bingbot.htm)
|
28
29
|
#
|
29
30
|
|
30
31
|
KNOWN_SEARCH_BOTS = [
|
@@ -34,6 +35,7 @@ class SearchBot < Agent
|
|
34
35
|
PINGDOM_BOT = Regexp.compile('Pingdom.com_bot_version_'),
|
35
36
|
ALEXA_BOT = Regexp.compile('ia_archiver'),
|
36
37
|
YANDEX_BOT = Regexp.compile('YandexBot\/'),
|
38
|
+
BING_BOT = Regexp.compile('bingbot\/'),
|
37
39
|
]
|
38
40
|
|
39
41
|
def self.search_bot?(http_user_agent)
|
@@ -57,6 +59,7 @@ class SearchBot < Agent
|
|
57
59
|
when ALEXA_BOT then :ia_archiver
|
58
60
|
when PINGDOM_BOT then :pingdom_bot
|
59
61
|
when YANDEX_BOT then :yandex_bot
|
62
|
+
when BING_BOT then :bingbot
|
60
63
|
else super(string)
|
61
64
|
end
|
62
65
|
end
|
@@ -69,6 +72,7 @@ class SearchBot < Agent
|
|
69
72
|
when ALEXA_BOT then :"alexa.com"
|
70
73
|
when PINGDOM_BOT then :"pingdom.com"
|
71
74
|
when YANDEX_BOT then :"yandex.com"
|
75
|
+
when BING_BOT then :"bing.com"
|
72
76
|
else super(string)
|
73
77
|
end
|
74
78
|
end
|
data/ntail.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{ntail}
|
8
|
-
s.version = "0.0.
|
8
|
+
s.version = "0.0.11"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Peter Vandenberk"]
|
12
|
-
s.date = %q{2011-01-
|
12
|
+
s.date = %q{2011-01-19}
|
13
13
|
s.default_executable = %q{ntail}
|
14
14
|
s.description = %q{A tail(1)-like utility for nginx log files. It supports parsing, filtering and formatting individual log lines.}
|
15
15
|
s.email = %q{pvandenberk@mac.com}
|
@@ -66,7 +66,7 @@ Gem::Specification.new do |s|
|
|
66
66
|
s.homepage = %q{http://github.com/pvdb/ntail}
|
67
67
|
s.licenses = ["MIT"]
|
68
68
|
s.require_paths = ["lib"]
|
69
|
-
s.rubygems_version = %q{1.
|
69
|
+
s.rubygems_version = %q{1.3.7}
|
70
70
|
s.summary = %q{A tail(1)-like utility for nginx log files}
|
71
71
|
s.test_files = [
|
72
72
|
"test/helper.rb",
|
@@ -86,6 +86,7 @@ Gem::Specification.new do |s|
|
|
86
86
|
]
|
87
87
|
|
88
88
|
if s.respond_to? :specification_version then
|
89
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
89
90
|
s.specification_version = 3
|
90
91
|
|
91
92
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ntail
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 9
|
5
|
+
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 11
|
10
|
+
version: 0.0.11
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Peter Vandenberk
|
@@ -15,11 +15,12 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-01-
|
18
|
+
date: 2011-01-19 00:00:00 +00:00
|
19
19
|
default_executable: ntail
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
22
|
-
|
22
|
+
prerelease: false
|
23
|
+
name: rainbow
|
23
24
|
version_requirements: &id001 !ruby/object:Gem::Requirement
|
24
25
|
none: false
|
25
26
|
requirements:
|
@@ -30,10 +31,10 @@ dependencies:
|
|
30
31
|
- 0
|
31
32
|
version: "0"
|
32
33
|
requirement: *id001
|
33
|
-
prerelease: false
|
34
|
-
name: rainbow
|
35
|
-
- !ruby/object:Gem::Dependency
|
36
34
|
type: :runtime
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
prerelease: false
|
37
|
+
name: user-agent
|
37
38
|
version_requirements: &id002 !ruby/object:Gem::Requirement
|
38
39
|
none: false
|
39
40
|
requirements:
|
@@ -44,10 +45,10 @@ dependencies:
|
|
44
45
|
- 0
|
45
46
|
version: "0"
|
46
47
|
requirement: *id002
|
47
|
-
prerelease: false
|
48
|
-
name: user-agent
|
49
|
-
- !ruby/object:Gem::Dependency
|
50
48
|
type: :runtime
|
49
|
+
- !ruby/object:Gem::Dependency
|
50
|
+
prerelease: false
|
51
|
+
name: treetop
|
51
52
|
version_requirements: &id003 !ruby/object:Gem::Requirement
|
52
53
|
none: false
|
53
54
|
requirements:
|
@@ -60,10 +61,10 @@ dependencies:
|
|
60
61
|
- 9
|
61
62
|
version: 1.4.9
|
62
63
|
requirement: *id003
|
63
|
-
|
64
|
-
name: treetop
|
64
|
+
type: :runtime
|
65
65
|
- !ruby/object:Gem::Dependency
|
66
|
-
|
66
|
+
prerelease: false
|
67
|
+
name: shoulda
|
67
68
|
version_requirements: &id004 !ruby/object:Gem::Requirement
|
68
69
|
none: false
|
69
70
|
requirements:
|
@@ -74,10 +75,10 @@ dependencies:
|
|
74
75
|
- 0
|
75
76
|
version: "0"
|
76
77
|
requirement: *id004
|
77
|
-
prerelease: false
|
78
|
-
name: shoulda
|
79
|
-
- !ruby/object:Gem::Dependency
|
80
78
|
type: :development
|
79
|
+
- !ruby/object:Gem::Dependency
|
80
|
+
prerelease: false
|
81
|
+
name: bundler
|
81
82
|
version_requirements: &id005 !ruby/object:Gem::Requirement
|
82
83
|
none: false
|
83
84
|
requirements:
|
@@ -90,10 +91,10 @@ dependencies:
|
|
90
91
|
- 0
|
91
92
|
version: 1.0.0
|
92
93
|
requirement: *id005
|
93
|
-
prerelease: false
|
94
|
-
name: bundler
|
95
|
-
- !ruby/object:Gem::Dependency
|
96
94
|
type: :development
|
95
|
+
- !ruby/object:Gem::Dependency
|
96
|
+
prerelease: false
|
97
|
+
name: jeweler
|
97
98
|
version_requirements: &id006 !ruby/object:Gem::Requirement
|
98
99
|
none: false
|
99
100
|
requirements:
|
@@ -106,10 +107,10 @@ dependencies:
|
|
106
107
|
- 1
|
107
108
|
version: 1.5.1
|
108
109
|
requirement: *id006
|
109
|
-
prerelease: false
|
110
|
-
name: jeweler
|
111
|
-
- !ruby/object:Gem::Dependency
|
112
110
|
type: :development
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
prerelease: false
|
113
|
+
name: rcov
|
113
114
|
version_requirements: &id007 !ruby/object:Gem::Requirement
|
114
115
|
none: false
|
115
116
|
requirements:
|
@@ -120,10 +121,10 @@ dependencies:
|
|
120
121
|
- 0
|
121
122
|
version: "0"
|
122
123
|
requirement: *id007
|
123
|
-
prerelease: false
|
124
|
-
name: rcov
|
125
|
-
- !ruby/object:Gem::Dependency
|
126
124
|
type: :development
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
prerelease: false
|
127
|
+
name: geoip
|
127
128
|
version_requirements: &id008 !ruby/object:Gem::Requirement
|
128
129
|
none: false
|
129
130
|
requirements:
|
@@ -134,8 +135,7 @@ dependencies:
|
|
134
135
|
- 0
|
135
136
|
version: "0"
|
136
137
|
requirement: *id008
|
137
|
-
|
138
|
-
name: geoip
|
138
|
+
type: :development
|
139
139
|
description: A tail(1)-like utility for nginx log files. It supports parsing, filtering and formatting individual log lines.
|
140
140
|
email: pvandenberk@mac.com
|
141
141
|
executables:
|
@@ -219,7 +219,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
219
219
|
requirements: []
|
220
220
|
|
221
221
|
rubyforge_project:
|
222
|
-
rubygems_version: 1.
|
222
|
+
rubygems_version: 1.3.7
|
223
223
|
signing_key:
|
224
224
|
specification_version: 3
|
225
225
|
summary: A tail(1)-like utility for nginx log files
|