clarity 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +4 -0
- data/Manifest.txt +37 -0
- data/PostInstall.txt +8 -0
- data/README.rdoc +56 -0
- data/Rakefile +27 -0
- data/bin/clarity +10 -0
- data/config/config.yml.sample +7 -0
- data/lib/clarity.rb +20 -0
- data/lib/clarity/cli.rb +80 -0
- data/lib/clarity/commands/command_builder.rb +56 -0
- data/lib/clarity/commands/tail_command_builder.rb +27 -0
- data/lib/clarity/parsers/hostname_parser.rb +43 -0
- data/lib/clarity/parsers/shop_parser.rb +48 -0
- data/lib/clarity/parsers/time_parser.rb +93 -0
- data/lib/clarity/renderers/log_renderer.rb +47 -0
- data/lib/clarity/server.rb +143 -0
- data/lib/clarity/server/basic_auth.rb +24 -0
- data/lib/clarity/server/chunk_http.rb +57 -0
- data/lib/clarity/server/mime_types.rb +23 -0
- data/public/images/spinner_big.gif +0 -0
- data/public/javascripts/app.js +154 -0
- data/public/stylesheets/app.css +54 -0
- data/script/console +10 -0
- data/script/destroy +14 -0
- data/script/generate +14 -0
- data/test/commands/command_builder_test.rb +100 -0
- data/test/commands/tail_command_builder_test.rb +43 -0
- data/test/files/logfile.log +17 -0
- data/test/parsers/hostname_parser_test.rb +40 -0
- data/test/parsers/shop_parser_test.rb +54 -0
- data/test/parsers/time_parser_test.rb +84 -0
- data/test/test_helper.rb +3 -0
- data/test/test_string_scanner.rb +17 -0
- data/views/_header.html.erb +5 -0
- data/views/_toolbar.html.erb +89 -0
- data/views/error.html.erb +11 -0
- data/views/index.html.erb +9 -0
- metadata +134 -0
@@ -0,0 +1,17 @@
|
|
1
|
+
require "test/unit"
|
2
|
+
|
3
|
+
require "strscan"
|
4
|
+
|
5
|
+
class TestLibraryFileName < Test::Unit::TestCase
|
6
|
+
|
7
|
+
NewLine = /\n/
|
8
|
+
def test_case_name
|
9
|
+
s = StringScanner.new('')
|
10
|
+
s << "abc\nd"
|
11
|
+
assert_equal "abc\n", s.scan_until(NewLine)
|
12
|
+
assert_equal nil, s.scan_until(NewLine)
|
13
|
+
s << "ef\ng"
|
14
|
+
assert_equal "def\n", s.scan_until(NewLine)
|
15
|
+
assert_equal nil, s.scan_until(NewLine)
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,5 @@
|
|
1
|
+
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
|
2
|
+
<title>Clarity ~ A Log Search Tool</title>
|
3
|
+
<link rel="stylesheet" href="/stylesheets/app.css" type="text/css" media="screen">
|
4
|
+
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" type="text/javascript"></script>
|
5
|
+
<script src="/javascripts/app.js" type="text/javascript"></script>
|
@@ -0,0 +1,89 @@
|
|
1
|
+
<div id='toolbar'>
|
2
|
+
<div id='header'>
|
3
|
+
<h1><a href="/">Clarity</a> <span class='small' style='color:#aaa'>Log Search Tool</span></h1>
|
4
|
+
</div>
|
5
|
+
|
6
|
+
<form id='search' method='get' action='/perform'>
|
7
|
+
<table class='actions'>
|
8
|
+
<tr>
|
9
|
+
<th>Action</th>
|
10
|
+
<th>Log File</th>
|
11
|
+
<th colspan=5>
|
12
|
+
Search Terms
|
13
|
+
<span class='note'><a href='#' onclick='Search.clear(); return false;'>clear</a></span>
|
14
|
+
</th>
|
15
|
+
<th> </th>
|
16
|
+
</tr>
|
17
|
+
<tr>
|
18
|
+
<td id='tool-selector'>
|
19
|
+
<input type='radio' name='tool' value='grep' id='grep-tool' checked='checked'> <span class='label' id='grep-label'>Search</span> <br/>
|
20
|
+
<input type='radio' name='tool' value='tail' id='tail-tool'> <span class='label' id='tail-label'>Tail</span> <br/>
|
21
|
+
</td>
|
22
|
+
<td id='file-selector'>
|
23
|
+
<select id='file-list' name='file'>
|
24
|
+
<% logfiles.map do |f| %>
|
25
|
+
<%= "<option value='#{f}'>#{f}</option>\n" %>
|
26
|
+
<% end %>
|
27
|
+
</select>
|
28
|
+
</td>
|
29
|
+
<td>
|
30
|
+
<input type='text' id='term1' name='term1' />
|
31
|
+
</td>
|
32
|
+
<td> <span class='and'>AND</span> </td>
|
33
|
+
<td>
|
34
|
+
<input type='text' id='term2' name='term2' />
|
35
|
+
</td>
|
36
|
+
<td> <span class='and'>AND</span> </td>
|
37
|
+
<td>
|
38
|
+
<input type='text' id='term3' name='term3' />
|
39
|
+
</td>
|
40
|
+
<td>
|
41
|
+
<input type='submit' value='Submit' onclick="Search.submit(); return false;"/>
|
42
|
+
</td>
|
43
|
+
<td>
|
44
|
+
</td>
|
45
|
+
</tr>
|
46
|
+
<tr id='advanced-options'>
|
47
|
+
<td></td>
|
48
|
+
<td>
|
49
|
+
<span class='small'>
|
50
|
+
<a href="#" id="enable-advanced" onclick="Search.showAdvanced(); return false;">Enable Advanced Options</a>
|
51
|
+
<a href="#" id="disable-advanced" onclick="Search.hideAdvanced(); return false;" style='display:none'>Disable Advanced Options</a>
|
52
|
+
</span>
|
53
|
+
</td>
|
54
|
+
<td colspan=2 id='start-time' class='advanced-options' style='display:none'>
|
55
|
+
<span class='small'>Start Time</span>
|
56
|
+
<input type='text' name='sh' class='time' id='sh'> :
|
57
|
+
<input type='text' name='sm' class='time' id='sm'> :
|
58
|
+
<input type='text' name='ss' class='time' id='ss'>
|
59
|
+
</td>
|
60
|
+
<td colspan=2 id='end-time' class='advanced-options' style='display:none'>
|
61
|
+
<span class='small'>End Time</span>
|
62
|
+
<input type='text' name='eh' class='time' id='eh'> :
|
63
|
+
<input type='text' name='em' class='time' id='em'> :
|
64
|
+
<input type='text' name='es' class='time' id='es'>
|
65
|
+
</td>
|
66
|
+
<td class='advanced-options' style='display:none'>
|
67
|
+
<span class="small">
|
68
|
+
<a href="#" onclick="Search.clearAdvanced();return false">clear advanced</a>
|
69
|
+
</span>
|
70
|
+
</td>
|
71
|
+
</tr>
|
72
|
+
</table>
|
73
|
+
</form>
|
74
|
+
</div>
|
75
|
+
|
76
|
+
|
77
|
+
<div id="option-ctrl">
|
78
|
+
<ul>
|
79
|
+
<li><input type='checkbox' name='enable_scrolling' id='auto-scroll'/><span> Auto scroll?</span></li>
|
80
|
+
</ul>
|
81
|
+
</div>
|
82
|
+
|
83
|
+
<script>
|
84
|
+
Search.init({ 'grep': <%= logfiles.map {|f| f }.to_json %>,
|
85
|
+
'tail': <%= logfiles.map {|f| f if f =~ /log$/ }.compact.to_json %> },
|
86
|
+
<%= params.empty? ? nil.to_json : params.to_json %> );
|
87
|
+
|
88
|
+
|
89
|
+
</script>
|
@@ -0,0 +1,11 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<%= @content_for_header %>
|
5
|
+
</head>
|
6
|
+
<body>
|
7
|
+
<%= @toolbar %>
|
8
|
+
<h1>Error</h1>
|
9
|
+
<p><%= @error %></p>
|
10
|
+
</body>
|
11
|
+
</html>
|
metadata
ADDED
@@ -0,0 +1,134 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: clarity
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.9.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- "Tobias L\xC3\xBCtke"
|
8
|
+
- John Tajima
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
|
13
|
+
date: 2009-11-04 00:00:00 -05:00
|
14
|
+
default_executable:
|
15
|
+
dependencies:
|
16
|
+
- !ruby/object:Gem::Dependency
|
17
|
+
name: eventmachine
|
18
|
+
type: :runtime
|
19
|
+
version_requirement:
|
20
|
+
version_requirements: !ruby/object:Gem::Requirement
|
21
|
+
requirements:
|
22
|
+
- - ">="
|
23
|
+
- !ruby/object:Gem::Version
|
24
|
+
version: 0.12.10
|
25
|
+
version:
|
26
|
+
- !ruby/object:Gem::Dependency
|
27
|
+
name: eventmachine_httpserver
|
28
|
+
type: :runtime
|
29
|
+
version_requirement:
|
30
|
+
version_requirements: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - ">="
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: 0.2.0
|
35
|
+
version:
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: hoe
|
38
|
+
type: :development
|
39
|
+
version_requirement:
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
requirements:
|
42
|
+
- - ">="
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
version: 2.3.3
|
45
|
+
version:
|
46
|
+
description: "Clarity - a log search tool\n\
|
47
|
+
By John Tajima & Tobi L\xC3\xBCtke\n\n\
|
48
|
+
Clarity is an eventmachine-based web application that is used at Shopify to\n\
|
49
|
+
search log files on production servers.\n\n\
|
50
|
+
We wrote Clarity to allow authorized users to use a simple interface to look\n\
|
51
|
+
through the various log files in our server farm, without requiring access to\n\
|
52
|
+
production servers.\n\n\
|
53
|
+
Clarity requires eventmachine and eventmachine/evma_httpserver.\n\n sudo gem install eventmachine eventmachine_httpserver"
|
54
|
+
email:
|
55
|
+
- tobi@shopify.com
|
56
|
+
- john@shopify.com
|
57
|
+
executables:
|
58
|
+
- clarity
|
59
|
+
extensions: []
|
60
|
+
|
61
|
+
extra_rdoc_files:
|
62
|
+
- History.txt
|
63
|
+
- Manifest.txt
|
64
|
+
- PostInstall.txt
|
65
|
+
files:
|
66
|
+
- History.txt
|
67
|
+
- Manifest.txt
|
68
|
+
- PostInstall.txt
|
69
|
+
- README.rdoc
|
70
|
+
- Rakefile
|
71
|
+
- bin/clarity
|
72
|
+
- config/config.yml.sample
|
73
|
+
- lib/clarity.rb
|
74
|
+
- lib/clarity/cli.rb
|
75
|
+
- lib/clarity/commands/command_builder.rb
|
76
|
+
- lib/clarity/commands/tail_command_builder.rb
|
77
|
+
- lib/clarity/parsers/hostname_parser.rb
|
78
|
+
- lib/clarity/parsers/shop_parser.rb
|
79
|
+
- lib/clarity/parsers/time_parser.rb
|
80
|
+
- lib/clarity/renderers/log_renderer.rb
|
81
|
+
- lib/clarity/server.rb
|
82
|
+
- lib/clarity/server/basic_auth.rb
|
83
|
+
- lib/clarity/server/chunk_http.rb
|
84
|
+
- lib/clarity/server/mime_types.rb
|
85
|
+
- public/images/spinner_big.gif
|
86
|
+
- public/javascripts/app.js
|
87
|
+
- public/stylesheets/app.css
|
88
|
+
- script/console
|
89
|
+
- script/destroy
|
90
|
+
- script/generate
|
91
|
+
- test/commands/command_builder_test.rb
|
92
|
+
- test/commands/tail_command_builder_test.rb
|
93
|
+
- test/files/logfile.log
|
94
|
+
- test/parsers/hostname_parser_test.rb
|
95
|
+
- test/parsers/shop_parser_test.rb
|
96
|
+
- test/parsers/time_parser_test.rb
|
97
|
+
- test/test_helper.rb
|
98
|
+
- test/test_string_scanner.rb
|
99
|
+
- views/_header.html.erb
|
100
|
+
- views/_toolbar.html.erb
|
101
|
+
- views/error.html.erb
|
102
|
+
- views/index.html.erb
|
103
|
+
has_rdoc: true
|
104
|
+
homepage: http://github.com/#{github_username}/#{project_name}
|
105
|
+
licenses: []
|
106
|
+
|
107
|
+
post_install_message: PostInstall.txt
|
108
|
+
rdoc_options:
|
109
|
+
- --main
|
110
|
+
- README.rdoc
|
111
|
+
require_paths:
|
112
|
+
- lib
|
113
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: "0"
|
118
|
+
version:
|
119
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
120
|
+
requirements:
|
121
|
+
- - ">="
|
122
|
+
- !ruby/object:Gem::Version
|
123
|
+
version: "0"
|
124
|
+
version:
|
125
|
+
requirements: []
|
126
|
+
|
127
|
+
rubyforge_project: clarity
|
128
|
+
rubygems_version: 1.3.5
|
129
|
+
signing_key:
|
130
|
+
specification_version: 3
|
131
|
+
summary: "Clarity - a log search tool By John Tajima & Tobi L\xC3\xBCtke Clarity is an eventmachine-based web application that is used at Shopify to search log files on production servers"
|
132
|
+
test_files:
|
133
|
+
- test/test_helper.rb
|
134
|
+
- test/test_string_scanner.rb
|