Skip to content

Commit

Permalink
Fixes #2 (stream ID wasn't included in search link)
Browse files Browse the repository at this point in the history
  • Loading branch information
Christiaan van Tienhoven committed Dec 5, 2016
1 parent 91aaa23 commit cbdb8d0
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

<groupId>org.graylog.plugins.aggregates</groupId>
<artifactId>graylog-plugin-aggregates</artifactId>
<version>0.0.12</version>
<version>0.0.13</version>
<packaging>jar</packaging>

<name>${project.artifactId}</name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public URI getURL() {

@Override
public Version getVersion() {
return new Version(0, 0, 12);
return new Version(0, 0, 13);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,13 @@ protected String buildSummary(Rule rule, Map<String, Long> matchedTerms, TimeRan
sb.append("<td " + TD_TR_STYLE + ">").append(entry.getValue()).append("</td>");

try {
String search_uri="/search?rangetype=absolute&fields=message%2Csource%2C"+rule.getField()+"&from="+timeRange.getFrom()+"&to="+timeRange.getTo()+"&q="+URLEncoder.encode(rule.getQuery()+" AND " + rule.getField()+":\""+entry.getKey()+"\"", "UTF-8");
String streamId = rule.getStreamId();
String search_uri = "";

if (streamId != null && streamId != ""){
search_uri+="/streams/"+streamId;
}
search_uri+="/search?rangetype=absolute&fields=message%2Csource%2C"+rule.getField()+"&from="+timeRange.getFrom()+"&to="+timeRange.getTo()+"&q="+URLEncoder.encode(rule.getQuery()+" AND " + rule.getField()+":\""+entry.getKey()+"\"", "UTF-8");
sb.append("<td " + TD_TR_STYLE + ">").append("<a href=\""+configuration.getWebInterfaceUri()+search_uri+"\">Search</a>").append("</td>");
} catch (UnsupportedEncodingException e) {
sb.append("<td " + TD_TR_STYLE + ">").append("Unable to URL encode search URI").append("</td>");
Expand Down

0 comments on commit cbdb8d0

Please sign in to comment.