clarity 0.9.7 → 0.9.8
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +7 -0
- data/Rakefile +1 -1
- data/bin/clarity +0 -0
- data/lib/clarity.rb +6 -1
- data/lib/clarity/cli.rb +6 -1
- data/lib/clarity/commands/grep_command_builder.rb +2 -1
- data/lib/clarity/server.rb +10 -2
- data/views/_header.html.erb +3 -3
- data/views/_toolbar.html.erb +2 -1
- metadata +4 -25
- data.tar.gz.sig +0 -0
- metadata.gz.sig +0 -1
data/README.rdoc
CHANGED
@@ -17,6 +17,13 @@ We wrote Clarity to allow our support staff to use a simple interface to look
|
|
17
17
|
through the various log files in our server farm. The application was such a
|
18
18
|
big success internally that we decided to release it as open source.
|
19
19
|
|
20
|
+
== SECURITY:
|
21
|
+
|
22
|
+
*Warning*: Clarity takes parameters from URLs and runs them in the shell.
|
23
|
+
This is essentially the most insecure thing imaginable. You have to make absolutley sure
|
24
|
+
that clarity isn't reachable by the outside world. At the very least use --username and
|
25
|
+
--password to put some protection on it.
|
26
|
+
|
20
27
|
== USAGE:
|
21
28
|
|
22
29
|
clarity --username=admin --password=secret --port=8989 /var/log
|
data/Rakefile
CHANGED
@@ -13,7 +13,7 @@ $hoe = Hoe.spec 'clarity' do
|
|
13
13
|
self.developer 'Tobias Lütke', 'tobi@shopify.com'
|
14
14
|
self.developer 'John Tajima', 'john@shopify.com'
|
15
15
|
self.summary = 'Web interface for grep and tail -f'
|
16
|
-
|
16
|
+
self.post_install_message = 'PostInstall.txt'
|
17
17
|
self.readme_file = 'README.rdoc'
|
18
18
|
self.extra_deps = [['eventmachine','>= 0.12.10'], ['eventmachine_httpserver','>= 0.2.0'], ["json", ">= 1.0.0"]]
|
19
19
|
self.test_globs = ['test/**/*_test.rb']
|
data/bin/clarity
CHANGED
File without changes
|
data/lib/clarity.rb
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
$:.unshift(File.dirname(__FILE__)) unless $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
|
2
2
|
|
3
|
+
begin
|
4
|
+
require File.join(File.dirname(__FILE__), *%w[.. vendor gems environment])
|
5
|
+
rescue LoadError
|
6
|
+
end
|
7
|
+
|
3
8
|
require 'eventmachine'
|
4
9
|
require 'evma_httpserver'
|
5
10
|
require 'json'
|
@@ -11,7 +16,7 @@ require 'clarity/commands/tail_command_builder'
|
|
11
16
|
require 'clarity/renderers/log_renderer'
|
12
17
|
|
13
18
|
module Clarity
|
14
|
-
VERSION = '0.9.
|
19
|
+
VERSION = '0.9.8'
|
15
20
|
|
16
21
|
Templates = File.dirname(__FILE__) + '/../views'
|
17
22
|
Public = File.dirname(__FILE__) + '/../public'
|
data/lib/clarity/cli.rb
CHANGED
@@ -11,7 +11,8 @@ module Clarity
|
|
11
11
|
:port => 8080,
|
12
12
|
:address => "0.0.0.0",
|
13
13
|
:user => nil,
|
14
|
-
:group => nil
|
14
|
+
:group => nil,
|
15
|
+
:relative_root => nil
|
15
16
|
}
|
16
17
|
|
17
18
|
mandatory_options = %w( )
|
@@ -37,6 +38,10 @@ module Clarity
|
|
37
38
|
options[:address] = opt
|
38
39
|
end
|
39
40
|
|
41
|
+
opts.on( "-r", "--relative=ROOT", String, "Run under a relative root" ) do |opt|
|
42
|
+
options[:relative_root] = opt
|
43
|
+
end
|
44
|
+
|
40
45
|
opts.on( "--include=MASK", String, "File mask of logs to add (default: **/*.log*)" ) do |opt|
|
41
46
|
options[:log_files] ||= []
|
42
47
|
options[:log_files] += opt
|
@@ -39,7 +39,8 @@ class GrepCommandBuilder
|
|
39
39
|
|
40
40
|
|
41
41
|
def gzip_tools
|
42
|
-
|
42
|
+
cat_tool = (ENV["PATH"].split(":").find{|d| File.exists?(File.join(d, "gzcat"))} ? "zcat" : "gzcat")
|
43
|
+
terms.empty? ? ["#{cat_tool} filename"] : ['zgrep options -e term filename'] + ['grep options -e term'] * (terms.size-1)
|
43
44
|
end
|
44
45
|
|
45
46
|
def bzip_tools
|
data/lib/clarity/server.rb
CHANGED
@@ -15,7 +15,7 @@ module Clarity
|
|
15
15
|
include Clarity::BasicAuth
|
16
16
|
include Clarity::ChunkHttp
|
17
17
|
|
18
|
-
attr_accessor :required_username, :required_password
|
18
|
+
attr_accessor :required_username, :required_password, :relative_root
|
19
19
|
attr_accessor :log_files
|
20
20
|
|
21
21
|
def self.run(options)
|
@@ -26,6 +26,7 @@ module Clarity
|
|
26
26
|
a.log_files = options[:log_files]
|
27
27
|
a.required_username = options[:username]
|
28
28
|
a.required_password = options[:password]
|
29
|
+
a.relative_root = options[:relative_root] || ""
|
29
30
|
end
|
30
31
|
|
31
32
|
STDERR.puts "Clarity #{Clarity::VERSION} starting up."
|
@@ -37,7 +38,14 @@ module Clarity
|
|
37
38
|
end
|
38
39
|
|
39
40
|
STDERR.puts " * Log mask(s): #{options[:log_files].join(', ')}"
|
41
|
+
|
42
|
+
if options[:username].nil? or options[:password].nil?
|
43
|
+
STDERR.puts " * WARNING: No username/password specified. This is VERY insecure."
|
44
|
+
end
|
45
|
+
|
40
46
|
STDERR.puts
|
47
|
+
|
48
|
+
|
41
49
|
end
|
42
50
|
end
|
43
51
|
|
@@ -73,7 +81,7 @@ module Clarity
|
|
73
81
|
end
|
74
82
|
|
75
83
|
when '/test'
|
76
|
-
response =
|
84
|
+
response = respond_with_chunks
|
77
85
|
EventMachine::add_periodic_timer(1) do
|
78
86
|
response.chunk "Lorem ipsum dolor sit amet<br/>"
|
79
87
|
response.send_chunks
|
data/views/_header.html.erb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
|
2
|
-
<title>Clarity ~ A Log Search Tool
|
3
|
-
<link rel="stylesheet" href="
|
2
|
+
<title>Clarity ~ A Log Search Tool<%= relative_root %></title>
|
3
|
+
<link rel="stylesheet" href="<%= relative_root %>/stylesheets/app.css" type="text/css" media="screen">
|
4
4
|
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" type="text/javascript"></script>
|
5
|
-
<script src="
|
5
|
+
<script src="<%= relative_root %>/javascripts/app.js" type="text/javascript"></script>
|
data/views/_toolbar.html.erb
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
<h1><a href="/">Clarity</a> <span class='small' style='color:#aaa'>Log Search Tool</span></h1>
|
4
4
|
</div>
|
5
5
|
|
6
|
-
<form id='search' method='get' action='
|
6
|
+
<form id='search' method='get' action='<%= relative_root %>/perform'>
|
7
7
|
<table class='actions'>
|
8
8
|
<tr>
|
9
9
|
<th>Action</th>
|
@@ -55,6 +55,7 @@
|
|
55
55
|
</div>
|
56
56
|
|
57
57
|
<script>
|
58
|
+
Search.url = "<%= relative_root %>" + Search.url;
|
58
59
|
Search.init({ 'grep': <%= logfiles.map {|f| f }.to_json %>,
|
59
60
|
'tail': <%= logfiles.map {|f| f if f =~ /log$/ }.compact.to_json %> },
|
60
61
|
<%= params.empty? ? 'null' : params.to_json %> );
|
metadata
CHANGED
@@ -1,37 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: clarity
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- "Tobias L\xC3\xBCtke"
|
8
8
|
- John Tajima
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
|
-
cert_chain:
|
12
|
-
- |
|
13
|
-
-----BEGIN CERTIFICATE-----
|
14
|
-
MIIDMDCCAhigAwIBAgIBADANBgkqhkiG9w0BAQUFADA+MQ0wCwYDVQQDDAR0b2Jp
|
15
|
-
MRgwFgYKCZImiZPyLGQBGRYIbGVldHNvZnQxEzARBgoJkiaJk/IsZAEZFgNjb20w
|
16
|
-
HhcNMDkwNjA4MDAyMjE2WhcNMTAwNjA4MDAyMjE2WjA+MQ0wCwYDVQQDDAR0b2Jp
|
17
|
-
MRgwFgYKCZImiZPyLGQBGRYIbGVldHNvZnQxEzARBgoJ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21 00:00:00 -05:00
|
35
14
|
default_executable:
|
36
15
|
dependencies:
|
37
16
|
- !ruby/object:Gem::Dependency
|
@@ -133,7 +112,7 @@ has_rdoc: true
|
|
133
112
|
homepage: http://github.com/tobi/clarity
|
134
113
|
licenses: []
|
135
114
|
|
136
|
-
post_install_message:
|
115
|
+
post_install_message: PostInstall.txt
|
137
116
|
rdoc_options:
|
138
117
|
- --main
|
139
118
|
- README.rdoc
|
data.tar.gz.sig
DELETED
Binary file
|
metadata.gz.sig
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
�#�3��koh���P k0�����u�*ضC�8E��o�tLZJҩ%PՌBh]��C��|8�a�/�LA0�t��\���ơ�HBR~�����Ii֖4#P�t��hw��';�:���Q��ͭz�n�9��jn��\��k��3��:7��&/ޛ 䤆�ވ?d�np��07�F C��;�<���h��Vٟ����Yq��|�vC�<#9��T�\j�����N�����G<��.eCaN�o�ޏ
|