You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@storm.apache.org by "Stig Rohde Døssing (JIRA)" <ji...@apache.org> on 2017/11/29 17:46:00 UTC

[jira] [Resolved] (STORM-2827) Logviewer search returns incorrect logviewerUrl

     [ https://issues.apache.org/jira/browse/STORM-2827?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Stig Rohde Døssing resolved STORM-2827.
---------------------------------------
       Resolution: Fixed
    Fix Version/s: 2.0.0

> Logviewer search returns incorrect logviewerUrl
> -----------------------------------------------
>
>                 Key: STORM-2827
>                 URL: https://issues.apache.org/jira/browse/STORM-2827
>             Project: Apache Storm
>          Issue Type: Bug
>    Affects Versions: 2.0.0
>            Reporter: Ethan Li
>            Assignee: Ethan Li
>            Priority: Minor
>              Labels: pull-request-available
>             Fix For: 2.0.0
>
>          Time Spent: 3.5h
>  Remaining Estimate: 0h
>
> 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)