This repository has been archived by the owner on Jan 8, 2019. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Lennart Koopmann
committed
Apr 27, 2013
1 parent
4717978
commit e1ac407
Showing
24 changed files
with
251 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
The images used as login screen backgrounds are from the Nasa Commons and do not fall under any copyright restrictions. | ||
|
||
* http://www.flickr.com/photos/nasacommons/4858567220 | ||
|
||
Fore more information see http://www.nasa.gov/audience/formedia/features/MP_Photo_Guidelines.html | ||
|
||
Thank you, NASA. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/** | ||
* Copyright 2013 Lennart Koopmann <lennart@torch.sh> | ||
* | ||
* This file is part of Graylog2. | ||
* | ||
* Graylog2 is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* Graylog2 is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with Graylog2. If not, see <http://www.gnu.org/licenses/>. | ||
* | ||
*/ | ||
package lib; | ||
|
||
import java.util.Random; | ||
|
||
/** | ||
* @author Lennart Koopmann <lennart@torch.sh> | ||
*/ | ||
public class Tools { | ||
|
||
private Tools() { /* pure utility class */ } | ||
|
||
public static int random(int min, int max) { | ||
Random rand = new Random(); | ||
return rand.nextInt(max - min + 1) + min; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,29 @@ | ||
package models; | ||
|
||
import java.io.IOException; | ||
import java.net.URL; | ||
|
||
import lib.APIException; | ||
import lib.Api; | ||
import models.api.responses.DateHistogramResponse; | ||
import models.api.results.DateHistogramResult; | ||
import models.api.responses.MessageCountResponse; | ||
import models.api.results.MessageCountResult; | ||
import play.cache.Cache; | ||
|
||
import java.io.IOException; | ||
import java.net.URL; | ||
|
||
public class MessageCount { | ||
|
||
private final String interval; | ||
private final int timerange; | ||
|
||
public MessageCount(String interval, int timerange) { | ||
this.interval = interval; | ||
this.timerange = timerange; | ||
} | ||
|
||
public DateHistogramResult total() throws IOException, APIException { | ||
String i = Api.urlEncode(interval); | ||
URL url = Api.buildTarget("count/total?interval=" + i + "&timerange=" + timerange); | ||
|
||
DateHistogramResponse response = Api.get(url, new DateHistogramResponse()); | ||
return new DateHistogramResult("match_all", response.time, response.interval, response.results); | ||
} | ||
|
||
public static final int TOTAL_CNT_CACHE_TTL = 2; // seconds | ||
public static final String TOTAL_CNT_CACHE_KEY = "counts.total"; | ||
|
||
public MessageCountResult total() throws IOException, APIException { | ||
MessageCountResult cached = (MessageCountResult) Cache.get(TOTAL_CNT_CACHE_KEY); | ||
if (cached != null) { | ||
return cached; | ||
} | ||
|
||
MessageCountResponse response = Api.get(Api.buildTarget("count/total"), new MessageCountResponse()); | ||
MessageCountResult result = new MessageCountResult(response.events); | ||
Cache.set(TOTAL_CNT_CACHE_KEY, result, TOTAL_CNT_CACHE_TTL); | ||
return result; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package models; | ||
|
||
import java.io.IOException; | ||
import java.net.URL; | ||
|
||
import lib.APIException; | ||
import lib.Api; | ||
import models.api.responses.DateHistogramResponse; | ||
import models.api.results.DateHistogramResult; | ||
|
||
public class MessageCountHistogram { | ||
|
||
private final String interval; | ||
private final int timerange; | ||
|
||
public MessageCountHistogram(String interval, int timerange) { | ||
this.interval = interval; | ||
this.timerange = timerange; | ||
} | ||
|
||
public DateHistogramResult histogram() throws IOException, APIException { | ||
String i = Api.urlEncode(interval); | ||
URL url = Api.buildTarget("count/histogram?interval=" + i + "&timerange=" + timerange); | ||
|
||
DateHistogramResponse response = Api.get(url, new DateHistogramResponse()); | ||
return new DateHistogramResult("match_all", response.time, response.interval, response.results); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package models.api.responses; | ||
|
||
public class MessageCountResponse { | ||
|
||
public int events; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package models.api.results; | ||
|
||
public class MessageCountResult { | ||
|
||
private final int eventsCount; | ||
|
||
public MessageCountResult(int eventsCount) { | ||
this.eventsCount = eventsCount; | ||
} | ||
|
||
public int getEventsCount() { | ||
return eventsCount; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<div class="support-sources well well-small"> | ||
<h2>Need help?</h2> | ||
Do not hesitate to consult the Graylog2 community if your questions are not answered in the | ||
<a href="http://support.torch.sh/help/kb" target="_blank">documentation</a>. | ||
|
||
<ul> | ||
<li><i class="icon-group"></i> <a href="http://support.torch.sh/help/kb/general/forums-mailing-list" target="_blank">Forum / Mailing list</a></li> | ||
<li><i class="icon-github-alt"></i> <a href="http://support.torch.sh/help/kb/general/issue-trackers" target="_blank">Issue trackers</a></li> | ||
<li><i class="icon-heart"></i> <a href="http://www.torch.sh/" target="_blank">Commercial support</a></li> | ||
</ul> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
@(currentUser: User, query: String) | ||
|
||
@main("Search results", sidebars.standard(currentUser), query, currentUser) { | ||
<h1> | ||
<i class="icon-search icon-large"></i> | ||
Nothing found | ||
</h1> | ||
|
||
<p> | ||
Your search returned no results. Take a look at the | ||
<a href="http://support.torch.sh/help/kb/graylog2-web-interface/message-search-syntax" target="_blank">documentation</a> | ||
if you need help with the search syntax. | ||
</p> | ||
|
||
@partials.support_sources() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Oops, something went wrong.