@Override
  public HostLogFilesResponse sendGetLogFileNamesRequest(String hostName) {
    try {
      // use the Apache builder to create the correct URI
      URIBuilder uriBuilder = createBasicURI(protocol);
      appendUriPath(uriBuilder, LOGSEARCH_GET_LOG_FILES_PATH);
      uriBuilder.addParameter(HOST_QUERY_PARAMETER_NAME, hostName);
      uriBuilder.addParameter(LOGSEARCH_CLUSTERS_QUERY_PARAMETER_NAME, cluster.getClusterName());

      // add any query strings specified
      URI logFileNamesURI = uriBuilder.build();
      LOG.debug("Attempting to connect to LogSearch server at {}", logFileNamesURI);

      HttpURLConnection httpURLConnection  = (HttpURLConnection) logFileNamesURI.toURL().openConnection();
      secure(httpURLConnection, protocol);
      httpURLConnection.setRequestMethod("GET");

      addCookiesFromCookieStore(httpURLConnection);

      setupCredentials(httpURLConnection);

      StringBuffer buffer = networkConnection.readQueryResponseFromServer(httpURLConnection);

      addCookiesToCookieStoreFromResponse(httpURLConnection);

      // setup a reader for the JSON response
      StringReader stringReader =
        new StringReader(buffer.toString());

      ObjectReader hostFilesQueryResponseReader = createObjectReader(HostLogFilesResponse.class);

      HostLogFilesResponse response = hostFilesQueryResponseReader.readValue(stringReader);

      if (LOG.isDebugEnabled() && response != null && MapUtils.isNotEmpty(response.getHostLogFiles())) {
        for (Map.Entry<String, List<String>> componentEntry : response.getHostLogFiles().entrySet()) {
          LOG.debug("Log files for component '{}' : {}", componentEntry.getKey(), StringUtils.join(componentEntry.getValue(), ","));
        }
      }
      return response;
    } catch (Exception e) {
      Utils.logErrorMessageWithThrowableWithCounter(LOG, errorLogCounterForLogSearchConnectionExceptions,
        "Error occurred while trying to connect to the LogSearch service...", e);
    }
    return null;
  }
Convenience class to handle the connection details of a LogSearch query request.
ambari-server/src/main/java/org/apache/ambari/server/controller/logging/LoggingRequestHelperImpl.java