logstash-lite 0.2.20110206003603 → 0.2.20110329105411

Sign up to get free protection for your applications and to get access to all the features.
@@ -4,7 +4,7 @@
4
4
  %title= @title || "logstash"
5
5
  %link{ :rel => "stylesheet", :href => "/style.css", :type => "text/css" }
6
6
  %link{ :rel => "stylesheet", :href => "/css/smoothness/jquery-ui-1.8.5.custom.css", :type => "text/css" }
7
- %script{ :src => "https://ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js",
7
+ %script{ :src => "https://ajax.googleapis.com/ajax/libs/jquery/1.5.0/jquery.min.js",
8
8
  :type => "text/javascript" }
9
9
  %body
10
10
  #header
@@ -2,34 +2,39 @@
2
2
  - if (params[:q].strip.length > 0 rescue false)
3
3
  %h1
4
4
  Search results for '#{params[:q]}'
5
- - if @graphpoints
6
- #visual
7
- :javascript
8
- $(function() {
9
- var graphdata = #{@graphpoints.to_json};
10
- window.logstash.plot(graphdata);
11
- });
12
5
  - if @total and @result_start and @result_end
13
6
  %small
14
7
  %strong
15
- Results #{@result_start} - #{@result_end} of #{@total}
8
+ Results #{@result_start} - #{@result_end} of #{@results.total}
16
9
  |
17
10
  - if @first_href
18
11
  %a.pager{ :href => @first_href } first
19
- |
12
+ - else
13
+ %span.unavailable first
14
+ |
20
15
  - if @prev_href
21
16
  %a.pager{ :href => @prev_href }
22
17
  prev
23
- - if @next_href
24
- |
18
+ - else
19
+ %span.unavailable prev
20
+ |
25
21
  - if @next_href
26
22
  %a.pager{ :href => @next_href }
27
23
  next
24
+ - else
25
+ %span.unavailable next
26
+ |
28
27
  - if @last_href
29
- |
30
28
  %a.pager{ :href => @last_href }
31
29
  last
32
- - if @hits.length == 0
30
+ - else
31
+ %span.unavailable last
32
+ |
33
+ %a.pager{ :href => @refresh_href }
34
+ refresh
35
+ |
36
+ %span#querytime= "(%.3f seconds)" % @results.duration
37
+ - if @results.events.length == 0
33
38
  - if !params[:q]
34
39
  / We default to a '+2 days' in the future to capture 'today at 00:00'
35
40
  / plus tomorrow, inclusive, in case you are 23 hours behind the international
@@ -42,8 +47,9 @@
42
47
  %tr
43
48
  %th timestamp
44
49
  %th event
45
- - @hits.reverse.each do |hit|
50
+ - @results.events.reverse.each do |event|
46
51
  %tr.event
47
- %td.timestamp&= hit["_source"]["@timestamp"]
48
- %td.message{ :"data-full" => hit.to_json }
49
- %pre&= hit["_source"]["@message"]
52
+ %td.timestamp&= event.timestamp
53
+ %td.message{ :"data-full" => event.to_json }
54
+ %a{:href => "#"}
55
+ %pre&= event.message
@@ -1,3 +1,3 @@
1
1
  #error
2
2
  %h4 The query '#{params["q"]}' resulted the following error:
3
- %pre&= @results["error"]
3
+ %pre&= @results.error_message
@@ -0,0 +1,4 @@
1
+ An error occured in query '<%= params[:q] %>'
2
+ ERROR:
3
+
4
+ <%= @results.error_message %>
@@ -14,4 +14,7 @@
14
14
  for that event. You can also click on the graph to zoom to that time period.
15
15
  The query language is that of Lucene's string query (<a href="http://lucene.apache.org/java/2_4_0/queryparsersyntax.html">docs</a>).
16
16
 
17
+
18
+ #visual
19
+
17
20
  =haml :"search/ajax", :layout => false
@@ -1,9 +1,8 @@
1
1
  <%
2
2
  # Sinatra currently doesn't do ERB with newline trimming, so we
3
- # have to write this funky mishmosh that is hard to read.
4
- if @error %>Error: <%= @error %><% else
5
- @hits.each do |hit|
6
- event = LogStash::Event.new(hit["_source"])
3
+ # have to write this funky mishmosh on one line that is hard to read.
4
+ if @results.error? %>Error: <%= @results.error_message%><% else
5
+ @results.events.each do |event|
7
6
  %><%= event.message || event.to_hash.to_json %>
8
7
  <% end
9
8
  end
@@ -29,6 +29,9 @@ body
29
29
  pre
30
30
  white-space: pre-wrap
31
31
  margin: 0
32
+ a
33
+ text-decoration: none
34
+ color: black
32
35
  #content td.timestamp
33
36
  white-space: nowrap
34
37
  padding: 1px
@@ -54,8 +57,11 @@ body
54
57
  margin: 0
55
58
  #inspector
56
59
  font-size: 70%
57
- #results #visual
60
+ #visual
58
61
  width: 850px
59
62
  height: 200px
63
+ display: none
60
64
  #results h1
61
65
  font-size: 100%
66
+ img.throbber
67
+ vertical-align: top
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-lite
3
3
  version: !ruby/object:Gem::Version
4
- hash: 40220412007217
4
+ hash: 40220658210833
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 20110206003603
10
- version: 0.2.20110206003603
9
+ - 20110329105411
10
+ version: 0.2.20110329105411
11
11
  platform: ruby
12
12
  authors:
13
13
  - Jordan Sissel
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2011-02-06 00:00:00 -08:00
19
+ date: 2011-03-29 00:00:00 -07:00
20
20
  default_executable:
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
@@ -116,6 +116,14 @@ files:
116
116
  - lib/logstash/outputs/tcp.rb
117
117
  - lib/logstash/namespace.rb
118
118
  - lib/logstash/rubyfixes/regexp_union_takes_array.rb
119
+ - lib/logstash/search/facetresult/entry.rb
120
+ - lib/logstash/search/facetresult/histogram.rb
121
+ - lib/logstash/search/elasticsearch.rb
122
+ - lib/logstash/search/result.rb
123
+ - lib/logstash/search/base.rb
124
+ - lib/logstash/search/facetresult.rb
125
+ - lib/logstash/search/query.rb
126
+ - lib/logstash/search/twitter.rb
119
127
  - lib/logstash/time.rb
120
128
  - lib/logstash/filters.rb
121
129
  - lib/logstash/outputs.rb
@@ -129,7 +137,7 @@ files:
129
137
  - lib/logstash/filters/date.rb
130
138
  - lib/logstash/logging.rb
131
139
  - lib/logstash/event.rb
132
- - lib/logstash/web/lib/elasticsearch.rb
140
+ - lib/logstash/web/helpers/require_param.rb
133
141
  - lib/logstash/web/public/css/smoothness/jquery-ui-1.8.5.custom.css
134
142
  - lib/logstash/web/public/css/smoothness/images/ui-icons_2e83ff_256x240.png
135
143
  - lib/logstash/web/public/css/smoothness/images/ui-icons_cd0a0a_256x240.png
@@ -208,12 +216,16 @@ files:
208
216
  - lib/logstash/web/public/js/flot/jquery.flot.navigate.js
209
217
  - lib/logstash/web/public/js/flot/jquery.min.js
210
218
  - lib/logstash/web/public/js/flot/PLUGINS.txt
219
+ - lib/logstash/web/public/media/construction.gif
220
+ - lib/logstash/web/public/media/throbber.gif
221
+ - lib/logstash/web/public/media/truckconstruction.gif
211
222
  - lib/logstash/web/server.rb
212
223
  - lib/logstash/web/views/style.sass
213
224
  - lib/logstash/web/views/main/index.haml
214
225
  - lib/logstash/web/views/layout.haml
215
226
  - lib/logstash/web/views/search/results.txt.erb
216
227
  - lib/logstash/web/views/search/ajax.haml
228
+ - lib/logstash/web/views/search/error.txt.erb
217
229
  - lib/logstash/web/views/search/results.haml
218
230
  - lib/logstash/web/views/search/error.haml
219
231
  - lib/logstash/web/views/header.haml
@@ -278,7 +290,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
278
290
  requirements: []
279
291
 
280
292
  rubyforge_project:
281
- rubygems_version: 1.4.2
293
+ rubygems_version: 1.5.1
282
294
  signing_key:
283
295
  specification_version: 3
284
296
  summary: logstash - log and event management (lite install, no dependencies)
@@ -1,85 +0,0 @@
1
-
2
- require "em-http-request"
3
- require "logstash/namespace"
4
- require "logstash/logging"
5
- require "logstash/event"
6
-
7
- module LogStash::Web; end
8
-
9
- class LogStash::Web::ElasticSearch
10
- public
11
- def initialize
12
- @logger = LogStash::Logger.new(STDOUT)
13
- end
14
-
15
- public
16
- def search(params)
17
- http = EventMachine::HttpRequest.new("http://localhost:9200/_search")
18
- params[:offset] ||= 0
19
- params[:count] ||= 20
20
-
21
- @logger.info(["Query", params])
22
- esreq = {
23
- "sort" => [
24
- { "@timestamp" => "desc" }
25
- ],
26
- "query" => {
27
- "query_string" => {
28
- "query" => params[:q],
29
- "default_operator" => "AND"
30
- } # query_string
31
- }, # query
32
- "facets" => {
33
- "by_hour" => {
34
- "histogram" => {
35
- "field" => "@timestamp",
36
- "time_interval" => "1h",
37
- }, # histogram
38
- }, # by_hour
39
- }, # facets
40
- "from" => params[:offset],
41
- "size" => params[:count],
42
- }
43
-
44
- @logger.info("ElasticSearch Query: #{esreq.to_json}")
45
- start_time = Time.now
46
- req = http.get :body => esreq.to_json
47
- req.callback do
48
- #headers req.response_header
49
- data = JSON.parse(req.response)
50
- data["duration"] = Time.now - start_time
51
-
52
- # TODO(sissel): Plugin-ify this (Search filters!)
53
- # Search anonymization
54
- #require "digest/md5"
55
- #data["hits"]["hits"].each do |hit|
56
- [].each do |hit|
57
- event = LogStash::Event.new(hit["_source"])
58
- event.to_hash.each do |key, value|
59
- next unless value.is_a?(String)
60
- value.gsub!(/[^ ]+\.loggly\.net/) { |match| "loggly-" + Digest::MD5.hexdigest(match)[0..6] + ".example.com"}
61
- end
62
-
63
- event.fields.each do |key, value|
64
- value = [value] if value.is_a?(String)
65
- next unless value.is_a?(Array)
66
- value.each do |v|
67
- v.gsub!(/[^ ]+\.loggly\.net/) { |match| "loggly-" + Digest::MD5.hexdigest(match)[0..6] + ".example.com"}
68
- end # value.each
69
- end # hit._source.@fields.each
70
- end # data.hits.hits.each
71
-
72
- @logger.info(["Got search results",
73
- { :query => params[:q], :duration => data["duration"]}])
74
- #@logger.info(data)
75
- if req.response_header.status != 200
76
- @error = data["error"] || req.inspect
77
- end
78
- yield data
79
- end
80
- req.errback do
81
- @logger.warn(["Query failed", params, req, req.response])
82
- yield({ "error" => req.response })
83
- end
84
- end # def search
85
- end # class LogStash::Web::ElasticSearch