mongodb_logger 0.2.6-jruby
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +20 -0
- data/.rvmrc +1 -0
- data/.travis.yml +19 -0
- data/CHANGELOG.md +30 -0
- data/Gemfile +10 -0
- data/LICENSE +22 -0
- data/README.md +207 -0
- data/Rakefile +169 -0
- data/SUPPORTED_RAILS_VERSIONS +17 -0
- data/TESTING.md +24 -0
- data/bin/mongodb_logger_web +24 -0
- data/config.ru +17 -0
- data/examples/server_config.yml +5 -0
- data/features/mongodb_logger_web.feature +14 -0
- data/features/rails.feature +12 -0
- data/features/step_definitions/mongodb_logger_web_steps.rb +45 -0
- data/features/step_definitions/rails_application_steps.rb +65 -0
- data/features/support/env.rb +15 -0
- data/features/support/rails.rb +98 -0
- data/features/support/terminal.rb +95 -0
- data/lib/mongodb_logger/initializer_mixin.rb +26 -0
- data/lib/mongodb_logger/logger.rb +239 -0
- data/lib/mongodb_logger/railtie.rb +12 -0
- data/lib/mongodb_logger/replica_set_helper.rb +19 -0
- data/lib/mongodb_logger/server/coffee/logs.coffee +250 -0
- data/lib/mongodb_logger/server/content_for.rb +58 -0
- data/lib/mongodb_logger/server/model/additional_filter.rb +104 -0
- data/lib/mongodb_logger/server/model/analytic.rb +82 -0
- data/lib/mongodb_logger/server/model/filter.rb +84 -0
- data/lib/mongodb_logger/server/partials.rb +24 -0
- data/lib/mongodb_logger/server/public/images/arrow-down.png +0 -0
- data/lib/mongodb_logger/server/public/images/arrow-up.png +0 -0
- data/lib/mongodb_logger/server/public/images/date.png +0 -0
- data/lib/mongodb_logger/server/public/images/external.png +0 -0
- data/lib/mongodb_logger/server/public/images/failure.png +0 -0
- data/lib/mongodb_logger/server/public/images/logo.png +0 -0
- data/lib/mongodb_logger/server/public/images/mongodb.png +0 -0
- data/lib/mongodb_logger/server/public/images/newlog.png +0 -0
- data/lib/mongodb_logger/server/public/images/play-icon.png +0 -0
- data/lib/mongodb_logger/server/public/images/spinner.gif +0 -0
- data/lib/mongodb_logger/server/public/images/spinner2.gif +0 -0
- data/lib/mongodb_logger/server/public/images/stop-icon.png +0 -0
- data/lib/mongodb_logger/server/public/images/success.png +0 -0
- data/lib/mongodb_logger/server/public/javascripts/logs.js +1 -0
- data/lib/mongodb_logger/server/public/javascripts/vendors/highlight.pack.js +1 -0
- data/lib/mongodb_logger/server/public/javascripts/vendors/jquery-1.7.1.min.js +4 -0
- data/lib/mongodb_logger/server/public/javascripts/vendors/jquery-ui-1.8.16.min.js +791 -0
- data/lib/mongodb_logger/server/public/javascripts/vendors/jquery.pjax.min.js +6 -0
- data/lib/mongodb_logger/server/public/stylesheets/all.css +12 -0
- data/lib/mongodb_logger/server/public/stylesheets/grids.css +18 -0
- data/lib/mongodb_logger/server/public/stylesheets/group-buttons.css +81 -0
- data/lib/mongodb_logger/server/public/stylesheets/group-forms.css +59 -0
- data/lib/mongodb_logger/server/public/stylesheets/group-headers.css +8 -0
- data/lib/mongodb_logger/server/public/stylesheets/group-tables.css +87 -0
- data/lib/mongodb_logger/server/public/stylesheets/highlight/zenburn.css +115 -0
- data/lib/mongodb_logger/server/public/stylesheets/humanity/images/ui-bg_flat_75_aaaaaa_40x100.png +0 -0
- data/lib/mongodb_logger/server/public/stylesheets/humanity/images/ui-bg_glass_100_f5f0e5_1x400.png +0 -0
- data/lib/mongodb_logger/server/public/stylesheets/humanity/images/ui-bg_glass_25_cb842e_1x400.png +0 -0
- data/lib/mongodb_logger/server/public/stylesheets/humanity/images/ui-bg_glass_70_ede4d4_1x400.png +0 -0
- data/lib/mongodb_logger/server/public/stylesheets/humanity/images/ui-bg_highlight-hard_100_f4f0ec_1x100.png +0 -0
- data/lib/mongodb_logger/server/public/stylesheets/humanity/images/ui-bg_highlight-hard_65_fee4bd_1x100.png +0 -0
- data/lib/mongodb_logger/server/public/stylesheets/humanity/images/ui-bg_highlight-hard_75_f5f5b5_1x100.png +0 -0
- data/lib/mongodb_logger/server/public/stylesheets/humanity/images/ui-bg_inset-soft_100_f4f0ec_1x100.png +0 -0
- data/lib/mongodb_logger/server/public/stylesheets/humanity/images/ui-icons_c47a23_256x240.png +0 -0
- data/lib/mongodb_logger/server/public/stylesheets/humanity/images/ui-icons_cb672b_256x240.png +0 -0
- data/lib/mongodb_logger/server/public/stylesheets/humanity/images/ui-icons_f08000_256x240.png +0 -0
- data/lib/mongodb_logger/server/public/stylesheets/humanity/images/ui-icons_f35f07_256x240.png +0 -0
- data/lib/mongodb_logger/server/public/stylesheets/humanity/images/ui-icons_ff7519_256x240.png +0 -0
- data/lib/mongodb_logger/server/public/stylesheets/humanity/images/ui-icons_ffffff_256x240.png +0 -0
- data/lib/mongodb_logger/server/public/stylesheets/humanity/jquery-ui-1.8.16.custom.css +568 -0
- data/lib/mongodb_logger/server/public/stylesheets/layout.css +205 -0
- data/lib/mongodb_logger/server/public/stylesheets/library.css +330 -0
- data/lib/mongodb_logger/server/public/stylesheets/reset.css +43 -0
- data/lib/mongodb_logger/server/public/stylesheets/spaces.css +42 -0
- data/lib/mongodb_logger/server/view_helpers.rb +113 -0
- data/lib/mongodb_logger/server/views/analytics.erb +61 -0
- data/lib/mongodb_logger/server/views/error.erb +2 -0
- data/lib/mongodb_logger/server/views/layout.erb +47 -0
- data/lib/mongodb_logger/server/views/overview.erb +119 -0
- data/lib/mongodb_logger/server/views/shared/_collection_stats.erb +14 -0
- data/lib/mongodb_logger/server/views/shared/_dynamic_filter.erb +34 -0
- data/lib/mongodb_logger/server/views/shared/_log.erb +8 -0
- data/lib/mongodb_logger/server/views/shared/_log_info.erb +27 -0
- data/lib/mongodb_logger/server/views/shared/_message_tabs.erb +15 -0
- data/lib/mongodb_logger/server/views/shared/_tabs.erb +4 -0
- data/lib/mongodb_logger/server/views/shared/_tail_panel.erb +13 -0
- data/lib/mongodb_logger/server/views/shared/_top_panel.erb +7 -0
- data/lib/mongodb_logger/server/views/show_log.erb +105 -0
- data/lib/mongodb_logger/server.rb +174 -0
- data/lib/mongodb_logger/server_config.rb +77 -0
- data/lib/mongodb_logger/version.rb +3 -0
- data/lib/mongodb_logger.rb +31 -0
- data/mongodb_logger.gemspec +44 -0
- data/mongodb_logger.java.gemspec +42 -0
- data/spec/javascripts/MongodbLoggerMainSpec.js +13 -0
- data/spec/javascripts/helpers/SpecHelper.js +3 -0
- data/spec/javascripts/support/jasmine.yml +77 -0
- data/spec/javascripts/support/jasmine_config.rb +23 -0
- data/spec/javascripts/support/jasmine_runner.rb +32 -0
- data/test/active_record.rb +13 -0
- data/test/config/samples/database.yml +9 -0
- data/test/config/samples/database_no_file_logging.yml +10 -0
- data/test/config/samples/database_replica_set.yml +12 -0
- data/test/config/samples/database_with_auth.yml +9 -0
- data/test/config/samples/database_with_collection.yml +8 -0
- data/test/config/samples/mongodb_logger.yml +2 -0
- data/test/config/samples/mongoid.yml +30 -0
- data/test/config/samples/server_config.yml +3 -0
- data/test/rails/app/controllers/order_controller.rb +23 -0
- data/test/rails/test/functional/order_controller_test.rb +116 -0
- data/test/rails/test/test_helper.rb +10 -0
- data/test/rails.rb +22 -0
- data/test/shoulda_macros/log_macros.rb +13 -0
- data/test/test.sh +6 -0
- data/test/test_helper.rb +89 -0
- data/test/unit/mongodb_logger_replica_test.rb +56 -0
- data/test/unit/mongodb_logger_test.rb +270 -0
- metadata +383 -0
@@ -0,0 +1,113 @@
|
|
1
|
+
# view helpers
|
2
|
+
module Sinatra::ViewHelpers
|
3
|
+
|
4
|
+
def pretty_hash(hash)
|
5
|
+
begin
|
6
|
+
Marshal::dump(hash)
|
7
|
+
h(hash.to_yaml).gsub(" ", " ")
|
8
|
+
rescue Exception => e # errors from Marshal or YAML
|
9
|
+
# Object couldn't be dumped, perhaps because of singleton methods -- this is the fallback
|
10
|
+
h(object.inspect)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def string_from_log_message(message)
|
15
|
+
message.is_a?(Array) ? message.join("\n") : message.to_s
|
16
|
+
end
|
17
|
+
|
18
|
+
def meta_informations(log)
|
19
|
+
meta_data = Hash.new
|
20
|
+
log.each do |key, val|
|
21
|
+
# predefined fields
|
22
|
+
next if [:_id, :messages, :request_time, :ip, :runtime, :application_name, :is_exception, :params, :method, :controller, :action, :path, :url].include?(key.to_sym)
|
23
|
+
meta_data[key] = val
|
24
|
+
end
|
25
|
+
meta_data
|
26
|
+
end
|
27
|
+
|
28
|
+
# TODO: improve this
|
29
|
+
def number_to_human_size(number, precision = 2)
|
30
|
+
number = begin
|
31
|
+
Float(number)
|
32
|
+
rescue ArgumentError, TypeError
|
33
|
+
return number
|
34
|
+
end
|
35
|
+
case
|
36
|
+
when number.to_i == 1 then
|
37
|
+
"1 Byte"
|
38
|
+
when number < 1024 then
|
39
|
+
"%d Bytes" % number
|
40
|
+
when number < 1048576 then
|
41
|
+
"%.#{precision}f KB" % (number / 1024)
|
42
|
+
when number < 1073741824 then
|
43
|
+
"%.#{precision}f MB" % (number / 1048576)
|
44
|
+
when number < 1099511627776 then
|
45
|
+
"%.#{precision}f GB" % (number / 1073741824)
|
46
|
+
else
|
47
|
+
"%.#{precision}f TB" % (number / 1099511627776)
|
48
|
+
end.sub(/([0-9]\.\d*?)0+ /, '\1 ' ).sub(/\. /,' ')
|
49
|
+
rescue
|
50
|
+
nil
|
51
|
+
end
|
52
|
+
|
53
|
+
def text_field_tag(object, name, options = {})
|
54
|
+
value = ""
|
55
|
+
value = options.delete(:value) if options[:value]
|
56
|
+
value = object.send name if object && object.respond_to?(name)
|
57
|
+
attr = []
|
58
|
+
options.each do |key, val|
|
59
|
+
attr << "#{key}='#{val}'"
|
60
|
+
end
|
61
|
+
"<input type='text' name='#{object.form_name}[#{name.to_s}]' value='#{value}' #{attr.join(" ")} />"
|
62
|
+
end
|
63
|
+
|
64
|
+
def submit_tag(name, value, options = {})
|
65
|
+
attr = []
|
66
|
+
options.each do |key, val|
|
67
|
+
attr << "#{key}='#{val}'"
|
68
|
+
end
|
69
|
+
"<input type='submit' name='#{name.to_s}' value='#{value}' #{attr.join(" ")} />"
|
70
|
+
end
|
71
|
+
|
72
|
+
def check_box_tag(object, name, options = {})
|
73
|
+
value = nil
|
74
|
+
value = options.delete(:value) if options[:value]
|
75
|
+
value = object.send name if object && object.respond_to?(name)
|
76
|
+
attr = []
|
77
|
+
options.each do |key, val|
|
78
|
+
attr << "#{key}='#{val}'"
|
79
|
+
end
|
80
|
+
"<input id='#{object.form_name}_#{name.to_s}' type='checkbox' name='#{object.form_name}[#{name.to_s}]' #{'checked="checked"' if value} value='1' #{attr.join(" ")} />"
|
81
|
+
end
|
82
|
+
|
83
|
+
def label_tag(object, name, label, options = {})
|
84
|
+
attr = []
|
85
|
+
options.each do |key, val|
|
86
|
+
attr << "#{key}='#{val}'"
|
87
|
+
end
|
88
|
+
"<label for='#{object.form_name}_#{name.to_s}' #{attr.join(" ")}>#{label}</label>"
|
89
|
+
end
|
90
|
+
|
91
|
+
def select_tag(object, name, options_array, options = {})
|
92
|
+
value = nil
|
93
|
+
value = options.delete(:value) if options[:value]
|
94
|
+
value = object.send name if object && object.respond_to?(name)
|
95
|
+
attr = []
|
96
|
+
options.each do |key, val|
|
97
|
+
attr << "#{key}='#{val}'"
|
98
|
+
end
|
99
|
+
select_tag = []
|
100
|
+
select_tag << "<select id='#{object.form_name}_#{name.to_s}' name='#{object.form_name}[#{name.to_s}]' #{attr.join(" ")}>"
|
101
|
+
options_array.each do |val|
|
102
|
+
if val.is_a?(Array) && 2 == val.length
|
103
|
+
skey, sval = val[0], val[1]
|
104
|
+
else
|
105
|
+
skey = sval = val
|
106
|
+
end
|
107
|
+
select_tag << "<option value='#{skey}' #{"selected='selected'" if value && skey.to_s == value}>#{sval}</option>"
|
108
|
+
end
|
109
|
+
select_tag << "</select>"
|
110
|
+
select_tag.join("\n")
|
111
|
+
end
|
112
|
+
|
113
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
<%= partial(:"shared/top_panel") %>
|
2
|
+
|
3
|
+
<div class="outer">
|
4
|
+
<div class="unit size3of4">
|
5
|
+
<div class="filter phm pvs">
|
6
|
+
<form id="analyticForm" action="<%=h url_path("analytics") %>" method="post" accept-charset="UTF-8">
|
7
|
+
<div class="outer mvs">
|
8
|
+
<div class="unit size1of2">
|
9
|
+
<div class="unit size1of2">
|
10
|
+
<div class="prm">
|
11
|
+
<%= select_tag @analytic, :type, MongodbLogger::ServerModel::Analytic::ANALYTIC_TYPES %>
|
12
|
+
</div> <!-- prm -->
|
13
|
+
</div>
|
14
|
+
<div class="unit size1of2">
|
15
|
+
<div class="prm">
|
16
|
+
<%#= text_field_tag @filter, :action, :placeholder => "Action" %>
|
17
|
+
</div>
|
18
|
+
</div>
|
19
|
+
</div>
|
20
|
+
<div class="unit size1of2">
|
21
|
+
<div class="unit size1of2">
|
22
|
+
<div class="prm">
|
23
|
+
<%= text_field_tag @analytic, :start_date, :placeholder => "Start date", :class => "datepicker" %>
|
24
|
+
</div> <!-- prm -->
|
25
|
+
</div> <!-- unit -->
|
26
|
+
<div class="unit size1of2">
|
27
|
+
<div class="prm">
|
28
|
+
<%= text_field_tag @analytic, :end_date, :placeholder => "End date", :class => "datepicker" %>
|
29
|
+
</div>
|
30
|
+
</div>
|
31
|
+
</div>
|
32
|
+
</div> <!-- outer -->
|
33
|
+
|
34
|
+
<div class="outer">
|
35
|
+
<%= submit_tag :submit, "Analyze", :class => "button primary mrs" %> <a href="<%=h url_path("analytics") %>">Clear</a>
|
36
|
+
</div> <!-- outer -->
|
37
|
+
|
38
|
+
</form>
|
39
|
+
</div> <!-- filter -->
|
40
|
+
|
41
|
+
<div class="filter-toggle"><span class="arrow-down">Analyze</span></div>
|
42
|
+
|
43
|
+
<div id="analyticData">
|
44
|
+
<div class="pal txtC">
|
45
|
+
Select what to analyze
|
46
|
+
</div>
|
47
|
+
</div>
|
48
|
+
|
49
|
+
</div> <!-- unit size3of4 -->
|
50
|
+
|
51
|
+
<div class="unit size1of4">
|
52
|
+
<div class="details">
|
53
|
+
|
54
|
+
<div id="log_info">
|
55
|
+
<div class="pale h2 pal txtC">
|
56
|
+
Comming soon...
|
57
|
+
</div> <!-- pale h2 -->
|
58
|
+
</div>
|
59
|
+
</div> <!-- details -->
|
60
|
+
</div> <!-- unit size1of4 -->
|
61
|
+
</div> <!-- outer -->
|
@@ -0,0 +1,47 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>MongoDB Logger</title>
|
5
|
+
<link href="<%=u 'stylesheets/all.css' %>" media="screen" rel="stylesheet" type="text/css">
|
6
|
+
</head>
|
7
|
+
<body>
|
8
|
+
<div class="page">
|
9
|
+
<div class="header">
|
10
|
+
<div class="wrapper">
|
11
|
+
<div class="unit-right stats">
|
12
|
+
<div class="unit size2of3">
|
13
|
+
<div class="ptxs pls"><strong>DB:</strong> <%=h @db.name %></div>
|
14
|
+
<div class="pls"><strong>Collection:</strong> <%=h @collection.name %></div>
|
15
|
+
</div> <!-- unit -->
|
16
|
+
<div id="collection_stats">
|
17
|
+
<%= partial(:"shared/collection_stats", :object => @collection_stats) %>
|
18
|
+
</div>
|
19
|
+
</div>
|
20
|
+
<a href="<%=h url_path("overview") %>" class="logo" data-pjax='#main_pjax'><img src="<%=u 'images/logo.png'%>" alt="MongoDB Logger"></a>
|
21
|
+
</div> <!-- wrapper -->
|
22
|
+
</div> <!-- header -->
|
23
|
+
<div class="content">
|
24
|
+
<div class="wrapper">
|
25
|
+
<div id="main_pjax" class="mainbox">
|
26
|
+
<%= yield %>
|
27
|
+
</div> <!-- mainbox -->
|
28
|
+
</div> <!-- wrapper -->
|
29
|
+
</div> <!-- content -->
|
30
|
+
</div>
|
31
|
+
|
32
|
+
<!-- scripts -->
|
33
|
+
<script src="<%=u 'javascripts/vendors/jquery-1.7.1.min.js' %>" type="text/javascript"></script>
|
34
|
+
<script src="<%=u 'javascripts/vendors/jquery-ui-1.8.16.min.js' %>" type="text/javascript"></script>
|
35
|
+
<script src="<%=u 'javascripts/vendors/jquery.pjax.min.js' %>" type="text/javascript"></script>
|
36
|
+
<script src="<%=u 'javascripts/vendors/highlight.pack.js' %>" type="text/javascript"></script>
|
37
|
+
<script src="<%=u 'javascripts/logs.js' %>" type="text/javascript"></script>
|
38
|
+
|
39
|
+
<!-- charts -->
|
40
|
+
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
|
41
|
+
<script type="text/javascript">
|
42
|
+
google.load('visualization', '1', {'packages':['corechart']});
|
43
|
+
google.setOnLoadCallback(MongodbLoggerMain.init_analytic_charts);
|
44
|
+
</script>
|
45
|
+
|
46
|
+
</body>
|
47
|
+
</html>
|
@@ -0,0 +1,119 @@
|
|
1
|
+
<% if @collection_stats["capped"] && 1 == @collection_stats["capped"] %>
|
2
|
+
<% content_for :right_top_panel do %>
|
3
|
+
<%= partial(:"shared/tail_panel") %>
|
4
|
+
<% end %>
|
5
|
+
<% end %>
|
6
|
+
|
7
|
+
<%= partial(:"shared/top_panel") %>
|
8
|
+
|
9
|
+
<div class="outer">
|
10
|
+
<div class="unit size3of4">
|
11
|
+
<div class="filter phm pvs" style="<%= 'display:block;' unless @filter.get_mongo_conditions.blank? %>">
|
12
|
+
<form action="<%=h url_path("overview") %>" method="get" accept-charset="UTF-8">
|
13
|
+
<div class="outer mvs">
|
14
|
+
<div class="unit size1of3">
|
15
|
+
<div class="unit size1of2">
|
16
|
+
<div class="prm">
|
17
|
+
<%= text_field_tag @filter, :controller, :placeholder => "Controller" %>
|
18
|
+
</div> <!-- prm -->
|
19
|
+
</div>
|
20
|
+
<div class="unit size1of2">
|
21
|
+
<div class="prm">
|
22
|
+
<%= text_field_tag @filter, :action, :placeholder => "Action" %>
|
23
|
+
</div>
|
24
|
+
</div>
|
25
|
+
</div>
|
26
|
+
<div class="unit size1of3">
|
27
|
+
<div class="unit size1of2">
|
28
|
+
<div class="prm">
|
29
|
+
<%= select_tag @filter, :limit, [[50, "Limits - 50"], [100, "Limits - 100"], [200, "Limits - 200"], [500, "Limits - 500"], [1000, "Limits - 1000"]] %>
|
30
|
+
</div> <!-- prm -->
|
31
|
+
</div> <!-- unit -->
|
32
|
+
<div class="unit size1of2">
|
33
|
+
<div class="prm">
|
34
|
+
<%= text_field_tag @filter, :application_name, :placeholder => "Application Name" %>
|
35
|
+
</div>
|
36
|
+
</div>
|
37
|
+
</div>
|
38
|
+
<div class="unit size1of3">
|
39
|
+
<div class="unit size1of2">
|
40
|
+
<div class="prm">
|
41
|
+
<%= text_field_tag @filter, :ip, :placeholder => "IP" %>
|
42
|
+
</div>
|
43
|
+
</div>
|
44
|
+
<div class="unit size1of2">
|
45
|
+
<%= check_box_tag @filter, :is_exception %>
|
46
|
+
<%= label_tag @filter, :is_exception, "Exceptions" %>
|
47
|
+
</div> <!-- unit -->
|
48
|
+
</div> <!-- unit -->
|
49
|
+
</div> <!-- outer -->
|
50
|
+
|
51
|
+
<div class="outer">
|
52
|
+
<ul id="more_filter_list">
|
53
|
+
<% @filter.more_filters.each_with_index do |f_filter, index| %>
|
54
|
+
<li>
|
55
|
+
<%= partial(:"shared/dynamic_filter", :object => f_filter) %>
|
56
|
+
</li>
|
57
|
+
<% end %>
|
58
|
+
</ul>
|
59
|
+
<div class="mbs">
|
60
|
+
<a id="add_more_filter" href="<%=h url_path("add_filter") %>" class="add">+ Add Filter</a>
|
61
|
+
</div>
|
62
|
+
|
63
|
+
</div> <!-- outer -->
|
64
|
+
|
65
|
+
<div class="outer">
|
66
|
+
<%= submit_tag :submit, "Filter", :class => "button primary mrs" %> <a href="<%=h url_path("overview") %>">Clear</a>
|
67
|
+
</div> <!-- outer -->
|
68
|
+
|
69
|
+
<div class="outer">
|
70
|
+
<div class="pvs">
|
71
|
+
<hr />
|
72
|
+
</div>
|
73
|
+
</div>
|
74
|
+
|
75
|
+
<div class="outer">
|
76
|
+
<div class="unit size1of1">
|
77
|
+
<div class="pvs">
|
78
|
+
<strong>Mongodb Condition:</strong><br />
|
79
|
+
<%=h @filter.get_mongo_conditions.inspect %>
|
80
|
+
</div>
|
81
|
+
</div>
|
82
|
+
</div>
|
83
|
+
|
84
|
+
</form>
|
85
|
+
</div> <!-- filter -->
|
86
|
+
|
87
|
+
<div class="filter-toggle"><span class="arrow-down <%= 'rotate' unless @filter.get_mongo_conditions.blank? %>">Filter</span></div>
|
88
|
+
|
89
|
+
<% if @logs.count > 0 %>
|
90
|
+
<table id="logs_list">
|
91
|
+
<tr>
|
92
|
+
<th>Received</th>
|
93
|
+
<th>Controller</th>
|
94
|
+
<th>Action</th>
|
95
|
+
<th>Method</th>
|
96
|
+
<th>IP</th>
|
97
|
+
<th>Runtime</th>
|
98
|
+
</tr>
|
99
|
+
|
100
|
+
<% @logs.each do |log| %>
|
101
|
+
<%= partial(:"shared/log", :object => log) %>
|
102
|
+
<% end %>
|
103
|
+
</table>
|
104
|
+
<% else %>
|
105
|
+
<div class="pale pal txtC">No logs found, try to filter out the other parameters</div>
|
106
|
+
<% end %>
|
107
|
+
</div> <!-- unit size3of4 -->
|
108
|
+
|
109
|
+
<div class="unit size1of4">
|
110
|
+
<div class="details">
|
111
|
+
|
112
|
+
<div id="log_info">
|
113
|
+
<div class="pale h2 pal txtC">
|
114
|
+
Please choose log to see details
|
115
|
+
</div> <!-- pale h2 -->
|
116
|
+
</div>
|
117
|
+
</div> <!-- details -->
|
118
|
+
</div> <!-- unit size1of4 -->
|
119
|
+
</div> <!-- outer -->
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<div class="unit size1of3">
|
2
|
+
<div class="pts prs txtR">
|
3
|
+
<span class="log-num" title="count of logs"><%=h collection_stats["count"] %></span></div>
|
4
|
+
</div> <!-- unit -->
|
5
|
+
<% if collection_stats["capped"] && 1 == collection_stats["capped"] %>
|
6
|
+
<div class="progress">
|
7
|
+
<span class="size"><%=h number_to_human_size(collection_stats["size"]) %> of <%=h number_to_human_size(collection_stats["storageSize"]) %></span>
|
8
|
+
<div class="used" style="width: <%=((collection_stats["size"].to_f / collection_stats["storageSize"].to_f) * 100).round%>%"></div>
|
9
|
+
</div> <!-- progress -->
|
10
|
+
<% else %>
|
11
|
+
<div class="warning"><p>You do not use capped collection for logs.
|
12
|
+
<a href="http://www.mongodb.org/display/DOCS/Capped+Collections#CappedCollections-Convertingacollectiontocapped" target="_blank" class="more">More info.</a></p>
|
13
|
+
</div>
|
14
|
+
<% end %>
|
@@ -0,0 +1,34 @@
|
|
1
|
+
<div class="outer mvs filter_block">
|
2
|
+
<div class="unit size1of3">
|
3
|
+
<div class="unit size1of2">
|
4
|
+
<div class="prm">
|
5
|
+
<%= select_tag dynamic_filter, :type, MongodbLogger::ServerModel::AdditionalFilter::VAR_TYPES, :class => "filter_type", :rel => url_path("changed_filter") %>
|
6
|
+
</div> <!-- prm -->
|
7
|
+
</div> <!-- unit -->
|
8
|
+
<div class="unit size1of2">
|
9
|
+
<div class="prm">
|
10
|
+
<%= text_field_tag dynamic_filter, :key, :placeholder => "key" %>
|
11
|
+
</div> <!-- prm -->
|
12
|
+
</div> <!-- unit -->
|
13
|
+
</div>
|
14
|
+
<div class="unit size1of3">
|
15
|
+
<div class="unit size1of2">
|
16
|
+
<div class="prm">
|
17
|
+
<%= select_tag dynamic_filter, :condition, MongodbLogger::ServerModel::AdditionalFilter::VAR_TYPE_CONDITIONS[dynamic_filter.get_type_index], :class => "filter_conditions" %>
|
18
|
+
</div> <!-- prm -->
|
19
|
+
</div>
|
20
|
+
<div class="unit size1of2">
|
21
|
+
<div class="prm filter_values">
|
22
|
+
<% if dynamic_filter.is_selected_values? %>
|
23
|
+
<%= select_tag dynamic_filter, :value, dynamic_filter.selected_values %>
|
24
|
+
<% else %>
|
25
|
+
<%= text_field_tag dynamic_filter, :value, :placeholder => "value", :class => dynamic_filter.type %>
|
26
|
+
<% end %>
|
27
|
+
</div> <!-- prm -->
|
28
|
+
</div>
|
29
|
+
</div>
|
30
|
+
<div class="unit size1of3">
|
31
|
+
<a href="#" class="close_more_filter">Close</a>
|
32
|
+
</div> <!-- unit -->
|
33
|
+
|
34
|
+
</div>
|
@@ -0,0 +1,8 @@
|
|
1
|
+
<tr class="log_info" data-url="<%=h url_path("log_info/#{log['_id']}") %>">
|
2
|
+
<td class="td-time"><span class="<%= log['is_exception'] ? "error" : "notice" %>"></span> <%=h log['request_time']%></td>
|
3
|
+
<td class="td-controller"><%=h log['controller']%></td>
|
4
|
+
<td class="td-action"><%=h log['action']%></td>
|
5
|
+
<td class="url_log"><%=h log['method']%></td>
|
6
|
+
<td class="td-ip"><%=h log['ip']%></td>
|
7
|
+
<td class="td-runtime"><%=h log['runtime']%></td>
|
8
|
+
</tr>
|
@@ -0,0 +1,27 @@
|
|
1
|
+
<div class="pas">
|
2
|
+
<div class="unit-right">
|
3
|
+
<a href="<%=h url_path("log/#{log_info['_id']}") %>" data-pjax='#main_pjax' class="button small grey">More Info</a>
|
4
|
+
</div> <!-- unit-right -->
|
5
|
+
<h2 class="phs mvs"><span class="<%= log_info['is_exception'] ? 'failure' : 'success' %>">Message</span></h2>
|
6
|
+
<div class="phs wrap_text">
|
7
|
+
<% if log_info['is_exception'] && log_info['messages'] && log_info['messages']['error'] %>
|
8
|
+
Error: <%=h string_from_log_message(log_info['messages']['error']).truncate(300, :separator => ' ') %>
|
9
|
+
<% elsif log_info['messages'] && log_info['messages']['info'] %>
|
10
|
+
Info: <%=h string_from_log_message(log_info['messages']['info']).truncate(300, :separator => ' ') %>
|
11
|
+
<% end %>
|
12
|
+
</div> <!-- phs -->
|
13
|
+
<h2 class="phs mtm mbs">URL (method: <%=h log_info['method'] %>)</h2>
|
14
|
+
<div class="phs wrap_text">
|
15
|
+
<a href="<%=h log_info['url']%>" target="_blank"><%=h log_info['url']%></a>
|
16
|
+
</div> <!-- phs -->
|
17
|
+
<h2 class="phs mtm mbs">Received</h2>
|
18
|
+
<div class="phs">
|
19
|
+
<%=h log_info['request_time']%>
|
20
|
+
</div> <!-- phs -->
|
21
|
+
<h2 class="phs mtm mbs">IP</h2>
|
22
|
+
<div class="phs">
|
23
|
+
<a href="http://www.infosniper.net/index.php?ip_address=<%=h log_info['ip']%>&map_source=1&overview_map=1&lang=1&map_type=1&zoom_level=7" target="_blank">
|
24
|
+
<%=h log_info['ip']%>
|
25
|
+
</a>
|
26
|
+
</div> <!-- phs -->
|
27
|
+
</div> <!-- pas -->
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<li class="outer pvs phm">
|
2
|
+
<div class="unit size1of5">
|
3
|
+
<span class="pale">Messages:</span>
|
4
|
+
</div> <!-- unit -->
|
5
|
+
<div class="unit size4of5">
|
6
|
+
<ul class="message_tabs">
|
7
|
+
<% message_tabs.each do |key, val| %>
|
8
|
+
<li class='message_tab <%='active' if key == message_tabs.keys.first %>' data-tab='tab_<%=key %>'><%=key.capitalize %></li>
|
9
|
+
<% end %>
|
10
|
+
</ul>
|
11
|
+
<% message_tabs.each do |key, val| %>
|
12
|
+
<pre class="tab_<%=key %> tab_content <%='hidden' unless key == message_tabs.keys.first %>"><code><%=h string_from_log_message(val) %></code></pre>
|
13
|
+
<% end %>
|
14
|
+
</div> <!-- unit -->
|
15
|
+
</li>
|
@@ -0,0 +1,4 @@
|
|
1
|
+
<ul class="unit">
|
2
|
+
<li <%= class_if_current(url_path("overview")) %>><a href="<%=h url_path("overview") %>" data-pjax='#main_pjax'>Logs</a></li>
|
3
|
+
<li <%= class_if_current(url_path("analytics")) %>><a href="<%=h url_path("analytics") %>" data-pjax='#main_pjax'>Analytics</a></li>
|
4
|
+
</ul>
|
@@ -0,0 +1,13 @@
|
|
1
|
+
<div id="tail_logs_block">
|
2
|
+
<div class="initial">
|
3
|
+
<a id="tail_logs_link" href="#" data-url="<%=h url_path("tail_logs") %>" class="button mts mrs">
|
4
|
+
<span class="start" data-url="<%=h url_path("tail_logs") %>">Tail</span>
|
5
|
+
</a>
|
6
|
+
</div>
|
7
|
+
<div class="info">
|
8
|
+
<span id="tail_logs_time" class="logs-time mrs"></span>
|
9
|
+
<a id="tail_logs_stop_link" href="#" class="button negative mts mrs">
|
10
|
+
<span class="stop">Stop</span>
|
11
|
+
</a>
|
12
|
+
</div>
|
13
|
+
</div>
|
@@ -0,0 +1,105 @@
|
|
1
|
+
<%= partial(:"shared/top_panel") %>
|
2
|
+
|
3
|
+
<div class="unit-right">
|
4
|
+
<div class="pam">
|
5
|
+
<a href="<%=h url_path("overview") %>" data-pjax='#main_pjax' class="button small grey">Back</a>
|
6
|
+
</div> <!-- pam -->
|
7
|
+
</div> <!-- unit-right -->
|
8
|
+
<h1 class="pam">Log #<%=h @log['_id'] %></h1>
|
9
|
+
<ul class="list">
|
10
|
+
<li class="outer pvs phm">
|
11
|
+
<div class="unit size1of5">
|
12
|
+
<span class="pale">Url:</span>
|
13
|
+
</div> <!-- unit -->
|
14
|
+
<div class="unit size4of5">
|
15
|
+
<a href="<%=h @log['url']%>" target="_blank"><%=h @log['url']%></a>
|
16
|
+
</div> <!-- unit -->
|
17
|
+
</li>
|
18
|
+
<li class="outer pvs phm">
|
19
|
+
<div class="unit size1of5">
|
20
|
+
<span class="pale">Controller:</span>
|
21
|
+
</div> <!-- unit -->
|
22
|
+
<div class="unit size4of5">
|
23
|
+
<%=h @log['controller'] %>
|
24
|
+
</div> <!-- unit -->
|
25
|
+
</li>
|
26
|
+
<li class="outer pvs phm">
|
27
|
+
<div class="unit size1of5">
|
28
|
+
<span class="pale">Action:</span>
|
29
|
+
</div> <!-- unit -->
|
30
|
+
<div class="unit size4of5">
|
31
|
+
<%=h @log['action'] %>
|
32
|
+
</div> <!-- unit -->
|
33
|
+
</li>
|
34
|
+
<li class="outer pvs phm">
|
35
|
+
<div class="unit size1of5">
|
36
|
+
<span class="pale">Method:</span>
|
37
|
+
</div> <!-- unit -->
|
38
|
+
<div class="unit size4of5">
|
39
|
+
<%=h @log['method'] %>
|
40
|
+
</div> <!-- unit -->
|
41
|
+
</li>
|
42
|
+
<li class="outer pvs phm">
|
43
|
+
<div class="unit size1of5">
|
44
|
+
<span class="pale">IP:</span>
|
45
|
+
</div> <!-- unit -->
|
46
|
+
<div class="unit size4of5">
|
47
|
+
<a href="http://www.infosniper.net/index.php?ip_address=<%=h @log['ip'] %>&map_source=1&overview_map=1&lang=1&map_type=1&zoom_level=7" target="_blank">
|
48
|
+
<%=h @log['ip'] %>
|
49
|
+
</a>
|
50
|
+
</div> <!-- unit -->
|
51
|
+
</li>
|
52
|
+
<li class="outer pvs phm">
|
53
|
+
<div class="unit size1of5">
|
54
|
+
<span class="pale">Request Time:</span>
|
55
|
+
</div> <!-- unit -->
|
56
|
+
<div class="unit size4of5">
|
57
|
+
<%=h @log['request_time'] %>
|
58
|
+
</div> <!-- unit -->
|
59
|
+
</li>
|
60
|
+
<li class="outer pvs phm">
|
61
|
+
<div class="unit size1of5">
|
62
|
+
<span class="pale">Runtime:</span>
|
63
|
+
</div> <!-- unit -->
|
64
|
+
<div class="unit size4of5">
|
65
|
+
<%=h @log['runtime'] %> ms
|
66
|
+
</div> <!-- unit -->
|
67
|
+
</li>
|
68
|
+
<li class="outer pvs phm">
|
69
|
+
<div class="unit size1of5">
|
70
|
+
<span class="pale">Application Name:</span>
|
71
|
+
</div> <!-- unit -->
|
72
|
+
<div class="unit size4of5">
|
73
|
+
<%=h @log['application_name'] %>
|
74
|
+
</div> <!-- unit -->
|
75
|
+
</li>
|
76
|
+
<li class="outer pvs phm">
|
77
|
+
<div class="unit size1of5">
|
78
|
+
<span class="pale">Path:</span>
|
79
|
+
</div> <!-- unit -->
|
80
|
+
<div class="unit size4of5">
|
81
|
+
<%=h @log['path'] %>
|
82
|
+
</div> <!-- unit -->
|
83
|
+
</li>
|
84
|
+
<li class="outer pvs phm">
|
85
|
+
<div class="unit size1of5">
|
86
|
+
<span class="pale">Params:</span>
|
87
|
+
</div> <!-- unit -->
|
88
|
+
<div class="unit size4of5">
|
89
|
+
<pre><code><%= pretty_hash(@log['params']) %></code></pre>
|
90
|
+
</div> <!-- unit -->
|
91
|
+
</li>
|
92
|
+
<% if @log['messages'] && !@log['messages'].blank? && @log['messages'].is_a?(Hash) %>
|
93
|
+
<%= partial(:"shared/message_tabs", :object => @log['messages']) %>
|
94
|
+
<% end %>
|
95
|
+
<% unless meta_informations(@log).blank? %>
|
96
|
+
<li class="outer pvs phm">
|
97
|
+
<div class="unit size1of5">
|
98
|
+
<span class="pale">Meta informations:</span>
|
99
|
+
</div> <!-- unit -->
|
100
|
+
<div class="unit size4of5">
|
101
|
+
<pre><code><%= pretty_hash(meta_informations(@log)) %></code></pre>
|
102
|
+
</div> <!-- unit -->
|
103
|
+
</li>
|
104
|
+
<% end %>
|
105
|
+
</ul>
|