Ethan Li created STORM-2827:
-------------------------------
Summary: Logviewer search returns incorrect logviewerUrl
Key: STORM-2827
URL: https://issues.apache.org/jira/browse/STORM-2827
Project: Apache Storm
Issue Type: Bug
Reporter: Ethan Li
Assignee: Ethan Li
Priority: Minor
Code in LogviewerLogSearchHandler
{code:java}
@VisibleForTesting
String urlToMatchCenteredInLogPage(byte[] needle, Path canonicalPath, int
offset, Integer port) throws UnknownHostException {
final String host = Utils.hostname();
final Path truncatedFilePath =
truncatePathToLastElements(canonicalPath, 3);
Map<String, Object> parameters = new HashMap<>();
parameters.put("file", truncatedFilePath.toString());
parameters.put("start", Math.max(0, offset -
(LogviewerConstant.DEFAULT_BYTES_PER_PAGE / 2) - (needle.length / -2)));
parameters.put("length", LogviewerConstant.DEFAULT_BYTES_PER_PAGE);
return UrlBuilder.build(String.format("http://%s:%d/api/v1/log", host,
port), parameters);
}
@VisibleForTesting
String urlToMatchCenteredInLogPageDaemonFile(byte[] needle, Path
canonicalPath, int offset, Integer port) throws UnknownHostException {
final String host = Utils.hostname();
final Path truncatedFilePath =
truncatePathToLastElements(canonicalPath, 1);
Map<String, Object> parameters = new HashMap<>();
parameters.put("file", truncatedFilePath.toString());
parameters.put("start", Math.max(0, offset -
(LogviewerConstant.DEFAULT_BYTES_PER_PAGE / 2) - (needle.length / -2)));
parameters.put("length", LogviewerConstant.DEFAULT_BYTES_PER_PAGE);
return UrlBuilder.build(String.format("http://%s:%d/api/v1/daemonlog",
host, port), parameters);
}
{code}
only returns http url. This url will be invalid if logviewer https port is
configured, in which case the http url will be not found
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)