Uploaded image for project: 'Apache Storm'
  1. Apache Storm
  2. STORM-2827

Logviewer search returns incorrect logviewerUrl

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.0.0
    • Fix Version/s: 2.0.0
    • Component/s: None

      Description

      Code in LogviewerLogSearchHandler

        @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);
          }
      

      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

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                ethanli Ethan Li
                Reporter:
                ethanli Ethan Li
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 3.5h
                  3.5h