ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mgerg...@apache.org
Subject ambari git commit: AMBARI-19151 New Log Search REST API that returns the log files of the host components
Date Tue, 13 Dec 2016 15:14:45 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk e148cb5a2 -> 2f038b270


AMBARI-19151 New Log Search REST API that returns the log files of the host components

Change-Id: Ie789a0c8c98b6b6b7dd02f32a3acb89039f56de4


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/2f038b27
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/2f038b27
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/2f038b27

Branch: refs/heads/trunk
Commit: 2f038b2709068c0237b80f0b176d39abb434f9b2
Parents: e148cb5
Author: Miklos Gergely <mgergely@hortonworks.com>
Authored: Tue Dec 13 16:14:23 2016 +0100
Committer: Miklos Gergely <mgergely@hortonworks.com>
Committed: Tue Dec 13 16:14:23 2016 +0100

----------------------------------------------------------------------
 .../ambari-logsearch-portal/pom.xml             |   5 +
 .../logsearch/common/ExternalServerClient.java  |   1 -
 .../HostLogFilesRequestQueryConverter.java      |  61 +++
 ...ServiceLogAnyGraphRequestQueryConverter.java |   5 -
 .../ambari/logsearch/doc/DocConstants.java      |   1 +
 .../logsearch/graph/GraphDataGenerator.java     | 425 -----------------
 .../logsearch/manager/AuditLogsManager.java     |  16 +-
 .../logsearch/manager/ServiceLogsManager.java   |  29 +-
 .../request/HostComponentParamDefinition.java   |  38 ++
 .../request/ServiceLogParamDefinition.java      |  14 +-
 .../request/impl/BaseServiceLogRequest.java     |   1 -
 .../model/request/impl/HostLogFilesRequest.java |  56 +++
 .../request/impl/ServiceAnyGraphRequest.java    |   2 -
 .../model/response/HostLogFilesResponse.java    |  39 ++
 .../logsearch/model/response/NodeData.java      |   1 -
 .../logsearch/rest/ServiceLogsResource.java     |  14 +
 .../logsearch/solr/ResponseDataGenerator.java   | 452 +++++++++++++++++++
 .../HostLogFilesRequestQueryConverterTest.java  |  62 +++
 ...ceLogTreeRequestFacetQueryConverterTest.java |   1 -
 .../UserConfigRequestQueryConverterTest.java    |   3 -
 20 files changed, 755 insertions(+), 471 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/2f038b27/ambari-logsearch/ambari-logsearch-portal/pom.xml
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/pom.xml b/ambari-logsearch/ambari-logsearch-portal/pom.xml
index 5096481..3d218b0 100755
--- a/ambari-logsearch/ambari-logsearch-portal/pom.xml
+++ b/ambari-logsearch/ambari-logsearch-portal/pom.xml
@@ -773,5 +773,10 @@
       <artifactId>jjwt</artifactId>
       <version>${jjwt.version}</version>
     </dependency>
+    <dependency>
+      <groupId>org.glassfish.jersey.ext</groupId>
+      <artifactId>jersey-bean-validation</artifactId>
+      <version>2.25</version>
+    </dependency>
   </dependencies>
 </project>

http://git-wip-us.apache.org/repos/asf/ambari/blob/2f038b27/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/common/ExternalServerClient.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/common/ExternalServerClient.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/common/ExternalServerClient.java
index 230ca8c..df00c15 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/common/ExternalServerClient.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/common/ExternalServerClient.java
@@ -22,7 +22,6 @@ import javax.inject.Inject;
 import javax.inject.Named;
 import javax.ws.rs.client.Invocation;
 import javax.ws.rs.client.WebTarget;
-import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
 
 import org.apache.ambari.logsearch.conf.AuthPropsConfig;

http://git-wip-us.apache.org/repos/asf/ambari/blob/2f038b27/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/HostLogFilesRequestQueryConverter.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/HostLogFilesRequestQueryConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/HostLogFilesRequestQueryConverter.java
new file mode 100644
index 0000000..d9d9121
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/HostLogFilesRequestQueryConverter.java
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.ambari.logsearch.converter;
+
+import org.apache.ambari.logsearch.common.LogType;
+import org.apache.ambari.logsearch.model.request.impl.HostLogFilesRequest;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.data.solr.core.query.FacetOptions;
+import org.springframework.data.solr.core.query.FacetOptions.FacetSort;
+import org.springframework.data.solr.core.query.SimpleFacetQuery;
+import org.springframework.data.solr.core.query.SimpleStringCriteria;
+
+import static org.apache.ambari.logsearch.solr.SolrConstants.ServiceLogConstants.HOST;
+import static org.apache.ambari.logsearch.solr.SolrConstants.ServiceLogConstants.COMPONENT;
+import static org.apache.ambari.logsearch.solr.SolrConstants.ServiceLogConstants.PATH;
+
+import javax.inject.Named;
+
+@Named
+public class HostLogFilesRequestQueryConverter extends AbstractOperationHolderConverter<HostLogFilesRequest, SimpleFacetQuery>{
+
+  @Override
+  public SimpleFacetQuery convert(HostLogFilesRequest request) {
+    SimpleFacetQuery facetQuery = new SimpleFacetQuery();
+    facetQuery.addCriteria(new SimpleStringCriteria(String.format("%s:(%s)", HOST, request.getHostName())));
+    if (StringUtils.isNotEmpty(request.getComponentName())) {
+      facetQuery.addCriteria(new SimpleStringCriteria(String.format("%s:(%s)", COMPONENT, request.getComponentName())));
+    }
+    
+    FacetOptions facetOptions = new FacetOptions();
+    facetOptions.setFacetMinCount(1);
+    facetOptions.setFacetLimit(-1);
+    facetOptions.setFacetSort(FacetSort.COUNT);
+    facetOptions.addFacetOnPivot(COMPONENT, PATH);
+    facetQuery.setFacetOptions(facetOptions);
+    
+    facetQuery.setRows(0);
+    return facetQuery;
+  }
+
+  @Override
+  public LogType getLogType() {
+    return LogType.SERVICE;
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/2f038b27/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/ServiceLogAnyGraphRequestQueryConverter.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/ServiceLogAnyGraphRequestQueryConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/ServiceLogAnyGraphRequestQueryConverter.java
index 57bac10..b194df3 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/ServiceLogAnyGraphRequestQueryConverter.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/ServiceLogAnyGraphRequestQueryConverter.java
@@ -20,20 +20,15 @@ package org.apache.ambari.logsearch.converter;
 
 import org.apache.ambari.logsearch.common.LogType;
 import org.apache.ambari.logsearch.model.request.impl.ServiceAnyGraphRequest;
-import org.apache.ambari.logsearch.model.request.impl.ServiceLogLevelCountRequest;
 import org.apache.commons.lang.StringUtils;
-import org.springframework.data.solr.core.query.Criteria;
 import org.springframework.data.solr.core.query.FacetOptions;
 import org.springframework.data.solr.core.query.SimpleFacetQuery;
-import org.springframework.data.solr.core.query.SimpleFilterQuery;
 
 import static org.apache.ambari.logsearch.solr.SolrConstants.ServiceLogConstants.HOST;
 import static org.apache.ambari.logsearch.solr.SolrConstants.ServiceLogConstants.LOGTIME;
 import static org.apache.ambari.logsearch.solr.SolrConstants.ServiceLogConstants.LEVEL;
 
 import javax.inject.Named;
-import java.util.Arrays;
-import java.util.List;
 
 @Named
 public class ServiceLogAnyGraphRequestQueryConverter extends AbstractLogRequestFacetQueryConverter<ServiceAnyGraphRequest>{

http://git-wip-us.apache.org/repos/asf/ambari/blob/2f038b27/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/doc/DocConstants.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/doc/DocConstants.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/doc/DocConstants.java
index 805c5a0..0fc9852 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/doc/DocConstants.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/doc/DocConstants.java
@@ -92,6 +92,7 @@ public class DocConstants {
     public static final String GET_HADOOP_SERVICE_CONFIG_JSON_OD = "Get the json having meta data of services supported by logsearch";
     public static final String GET_AFTER_BEFORE_LOGS_OD = "Preview feature data";
     public static final String REQUEST_CANCEL = "Cancel an ongoing solr request";
+    public static final String GET_HOST_LOGFILES_OD = "Get the log files of the components of a host";
   }
 
   public class PublicOperationDescriptions {

http://git-wip-us.apache.org/repos/asf/ambari/blob/2f038b27/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/graph/GraphDataGenerator.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/graph/GraphDataGenerator.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/graph/GraphDataGenerator.java
deleted file mode 100644
index 75ac819..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/graph/GraphDataGenerator.java
+++ /dev/null
@@ -1,425 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * 
- * http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.ambari.logsearch.graph;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-import java.util.Map;
-
-import com.google.common.collect.Lists;
-import com.google.common.collect.Maps;
-import org.apache.ambari.logsearch.model.response.BarGraphData;
-import org.apache.ambari.logsearch.model.response.BarGraphDataListResponse;
-import org.apache.ambari.logsearch.model.response.CountData;
-import org.apache.ambari.logsearch.model.response.CountDataListResponse;
-import org.apache.ambari.logsearch.model.response.GraphData;
-import org.apache.ambari.logsearch.model.response.GraphDataListResponse;
-import org.apache.ambari.logsearch.model.response.NameValueData;
-import org.apache.ambari.logsearch.model.response.NameValueDataListResponse;
-import org.apache.ambari.logsearch.model.response.NodeData;
-import org.apache.ambari.logsearch.model.response.NodeListResponse;
-import org.apache.commons.collections.CollectionUtils;
-import org.apache.commons.lang.StringUtils;
-import org.apache.solr.client.solrj.response.FacetField;
-import org.apache.solr.client.solrj.response.FacetField.Count;
-import org.apache.solr.client.solrj.response.PivotField;
-import org.apache.solr.client.solrj.response.QueryResponse;
-import org.apache.solr.client.solrj.response.RangeFacet;
-import org.apache.solr.common.util.NamedList;
-
-import javax.inject.Named;
-
-@Named
-public class GraphDataGenerator {
-
-  public BarGraphDataListResponse generateBarGraphDataResponseWithRanges(QueryResponse response, String typeField, boolean typeUppercase) {
-    BarGraphDataListResponse dataList = new BarGraphDataListResponse();
-    if (response == null) {
-      return dataList;
-    }
-    NamedList<List<PivotField>> facetPivotResponse = response.getFacetPivot();
-    if (response.getFacetPivot() == null) {
-      return dataList;
-    }
-    List<PivotField> pivotFields = facetPivotResponse.get(typeField);
-    for (int pivotIndex = 0; pivotIndex < pivotFields.size(); pivotIndex++) {
-      PivotField pivotField = facetPivotResponse.get(typeField).get(pivotIndex);
-      List<NameValueData> nameValues = generateNameValueDataList(pivotField.getFacetRanges());
-      BarGraphData barGraphData = new BarGraphData();
-      barGraphData.setDataCount(nameValues);
-      String typeValue = typeUppercase ? StringUtils.upperCase(pivotField.getValue().toString()) : pivotField.getValue().toString();
-      barGraphData.setName(typeValue);
-      dataList.getGraphData().add(barGraphData);
-    }
-    return dataList;
-  }
-
-  public BarGraphDataListResponse generateSecondLevelBarGraphDataResponse(QueryResponse response, int val) {
-    BarGraphDataListResponse barGraphDataListResponse = new BarGraphDataListResponse();
-    NamedList<List<PivotField>> pivotFieldNameList = response.getFacetPivot();
-    if (pivotFieldNameList == null) {
-      return barGraphDataListResponse;
-    }
-    List<PivotField> pivotFields = pivotFieldNameList.getVal(val);
-    List<BarGraphData> barGraphDataList = new ArrayList<>();
-    for (PivotField pivotField : pivotFields) {
-      BarGraphData barGraphData = new BarGraphData();
-      barGraphData.setName(String.valueOf(pivotField.getValue()));
-      List<PivotField> secondLevelPivotFields = pivotField.getPivot();
-      List<NameValueData> nameValueDataList = new ArrayList<>();
-      for (PivotField sPivotField : secondLevelPivotFields) {
-        NameValueData nvD = new NameValueData();
-        nvD.setName(String.valueOf(sPivotField.getValue()));
-        nvD.setValue(String.valueOf(sPivotField.getCount()));
-        nameValueDataList.add(nvD);
-      }
-      barGraphData.setDataCount(nameValueDataList);
-      barGraphDataList.add(barGraphData);
-    }
-    barGraphDataListResponse.setGraphData(barGraphDataList);
-    return barGraphDataListResponse;
-  }
-
-  public BarGraphDataListResponse generateBarGraphFromFieldFacet(QueryResponse response, String facetField) {
-    BarGraphDataListResponse dataList = new BarGraphDataListResponse();
-    Collection<BarGraphData> vaDatas = new ArrayList<>();
-    dataList.setGraphData(vaDatas);
-    if (response == null) {
-      return dataList;
-    }
-    FacetField facetFieldObj = response.getFacetField(facetField);
-    if (facetFieldObj == null) {
-      return dataList;
-    }
-
-    List<Count> counts = facetFieldObj.getValues();
-    if (counts == null) {
-      return dataList;
-    }
-    for (Count cnt : counts) {
-      List<NameValueData> valueList = new ArrayList<>();
-      BarGraphData vBarGraphData = new BarGraphData();
-      vaDatas.add(vBarGraphData);
-      NameValueData vNameValue = new NameValueData();
-      vNameValue.setName(cnt.getName());
-      vBarGraphData.setName(cnt.getName().toUpperCase());
-      vNameValue.setValue("" + cnt.getCount());
-      valueList.add(vNameValue);
-      vBarGraphData.setDataCount(valueList);
-    }
-    return dataList;
-  }
-
-  public List<NameValueData> generateNameValueDataList(List<RangeFacet> rangeFacet) {
-    List<NameValueData> nameValues = new ArrayList<>();
-    if (rangeFacet == null) {
-      return nameValues;
-    }
-    RangeFacet range = rangeFacet.get(0);
-
-    if (range == null) {
-      return nameValues;
-    }
-    List<RangeFacet.Count> listCount = range.getCounts();
-    for (RangeFacet.Count cnt : listCount) {
-      NameValueData nameValue = new NameValueData();
-      nameValue.setName(String.valueOf(cnt.getValue()));
-      nameValue.setValue(String.valueOf(cnt.getCount()));
-      nameValues.add(nameValue);
-    }
-    return nameValues;
-  }
-
-  public List<Count> generateCount(QueryResponse response) {
-    List<Count> counts = new ArrayList<>();
-    List<FacetField> facetFields = null;
-    FacetField facetField = null;
-    if (response == null) {
-      return counts;
-    }
-
-    facetFields = response.getFacetFields();
-    if (facetFields == null) {
-      return counts;
-    }
-    if (!facetFields.isEmpty()) {
-      facetField = facetFields.get(0);
-    }
-    if (facetField != null) {
-      counts = facetField.getValues();
-    }
-    return counts;
-  }
-
-  public BarGraphDataListResponse getGraphDataWithDefaults(QueryResponse queryResponse, String field, String[] defaults) {
-    BarGraphDataListResponse response = new BarGraphDataListResponse();
-    BarGraphData barGraphData = new BarGraphData();
-    List<NameValueData> nameValues = generateLevelCountData(queryResponse, defaults, true);
-    barGraphData.setName(field);
-    barGraphData.setDataCount(nameValues);
-    response.setGraphData(Lists.newArrayList(barGraphData));
-    return response;
-  }
-
-  public NameValueDataListResponse getNameValueDataListResponseWithDefaults(QueryResponse response, String[] defaults, boolean emptyResponseDisabled) {
-    NameValueDataListResponse result = new NameValueDataListResponse();
-    result.setvNameValues(generateLevelCountData(response, defaults, emptyResponseDisabled));
-    return result;
-  }
-
-  public NodeListResponse generateServiceNodeTreeFromFacetResponse(QueryResponse queryResponse,
-                                                                   String firstHierarchy, String secondHierarchy,
-                                                                   String firstType, String secondType) {
-    NodeListResponse response = new NodeListResponse();
-    if (queryResponse == null) {
-      return response;
-    }
-    NamedList<List<PivotField>> namedPivotFieldList = queryResponse.getFacetPivot();
-    List<PivotField> firstLevelPivots = namedPivotFieldList.get(firstHierarchy);
-    List<PivotField> secondLevelPivots = namedPivotFieldList.get(secondHierarchy);
-    if (!CollectionUtils.isNotEmpty(firstLevelPivots) || !CollectionUtils.isNotEmpty(secondLevelPivots)) {
-      return response;
-    }
-    List<NodeData> nodeDataList = buidTreeData(firstLevelPivots, secondLevelPivots, firstType, secondType);
-    response.setvNodeList(nodeDataList);
-    return response;
-  }
-
-  public NodeListResponse generateOneLevelServiceNodeTree(QueryResponse queryResponse, String componentLevelHirachy) {
-    NodeListResponse response = new NodeListResponse();
-    List<NodeData> datatList = new ArrayList<>();
-    List<List<PivotField>> listPivotField = new ArrayList<>();
-    NamedList<List<PivotField>> namedList = queryResponse.getFacetPivot();
-    if (namedList != null) {
-      listPivotField = namedList.getAll(componentLevelHirachy);
-    }
-    List<PivotField> secondHirarchicalPivotFields = null;
-    if (listPivotField == null || listPivotField.isEmpty()) {
-      return response;
-    } else {
-      secondHirarchicalPivotFields = listPivotField.get(0);
-    }
-    for (PivotField singlePivotField : secondHirarchicalPivotFields) {
-      if (singlePivotField != null) {
-        NodeData comp = new NodeData();
-        comp.setName("" + singlePivotField.getValue());
-        List<PivotField> levelList = singlePivotField.getPivot();
-        List<NameValueData> levelCountList = new ArrayList<>();
-        comp.setLogLevelCount(levelCountList);
-        if (levelList != null) {
-          for (PivotField levelPivot : levelList) {
-            NameValueData level = new NameValueData();
-            level.setName(("" + levelPivot.getValue()).toUpperCase());
-            level.setValue("" + levelPivot.getCount());
-            levelCountList.add(level);
-          }
-        }
-        datatList.add(comp);
-      }
-    }
-    response.setvNodeList(datatList);
-    return response;
-  }
-
-  private List<NodeData> buidTreeData(List<PivotField> firstHirarchicalPivotFields,
-                                      List<PivotField> secondHirarchicalPivotFields,
-                                      String firstPriority, String secondPriority) {
-    List<NodeData> extensionTree = new ArrayList<>();
-    if (firstHirarchicalPivotFields != null) {
-      for (PivotField pivotHost : firstHirarchicalPivotFields) {
-        if (pivotHost != null) {
-          NodeData hostNode = new NodeData();
-          String name = (pivotHost.getValue() == null ? "" : "" + pivotHost.getValue());
-          String value = "" + pivotHost.getCount();
-          if (StringUtils.isNotBlank(name)) {
-            hostNode.setName(name);
-          }
-          if (StringUtils.isNotBlank(value)) {
-            hostNode.setValue(value);
-          }
-          if (StringUtils.isNotBlank(firstPriority)) {
-            hostNode.setType(firstPriority);
-          }
-
-          hostNode.setParent(true);
-          hostNode.setRoot(true);
-          PivotField hostPivot = null;
-          for (PivotField searchHost : secondHirarchicalPivotFields) {
-            if (StringUtils.isNotBlank(hostNode.getName())
-              && hostNode.getName().equals(searchHost.getValue())) {
-              hostPivot = searchHost;
-              break;
-            }
-          }
-          List<PivotField> pivotLevelHost = hostPivot == null? null : hostPivot.getPivot();
-          if (pivotLevelHost != null) {
-            Collection<NameValueData> logLevelCount = new ArrayList<>();
-            for (PivotField pivotLevel : pivotLevelHost) {
-              if (pivotLevel != null) {
-                NameValueData vnameValue = new NameValueData();
-                String levelName = (pivotLevel.getValue() == null ? "" : "" + pivotLevel.getValue());
-                vnameValue.setName(levelName.toUpperCase());
-                vnameValue.setValue("" + pivotLevel.getCount());
-                logLevelCount.add(vnameValue);
-              }
-            }
-            hostNode.setLogLevelCount(logLevelCount);
-          }
-          List<PivotField> pivotComponents = pivotHost.getPivot();
-          if (pivotComponents != null) {
-            Collection<NodeData> componentNodes = new ArrayList<>();
-            for (PivotField pivotComp : pivotComponents) {
-              if (pivotComp != null) {
-                NodeData compNode = new NodeData();
-                String compName = (pivotComp.getValue() == null ? "" : "" + pivotComp.getValue());
-                compNode.setName(compName);
-                if (StringUtils.isNotBlank(secondPriority)) {
-                  compNode.setType(secondPriority);
-                }
-                compNode.setValue("" + pivotComp.getCount());
-                compNode.setParent(false);
-                compNode.setRoot(false);
-                List<PivotField> pivotLevels = pivotComp.getPivot();
-                if (pivotLevels != null) {
-                  Collection<NameValueData> logLevelCount = new ArrayList<>();
-                  for (PivotField pivotLevel : pivotLevels) {
-                    if (pivotLevel != null) {
-                      NameValueData vnameValue = new NameValueData();
-                      String compLevel = pivotLevel.getValue() == null ? "" : "" + pivotLevel.getValue();
-                      vnameValue.setName((compLevel).toUpperCase());
-
-                      vnameValue.setValue("" + pivotLevel.getCount());
-                      logLevelCount.add(vnameValue);
-                    }
-                  }
-                  compNode.setLogLevelCount(logLevelCount);
-                }
-                componentNodes.add(compNode);
-              }
-            }
-            hostNode.setChilds(componentNodes);
-          }
-          extensionTree.add(hostNode);
-        }
-      }
-    }
-
-    return extensionTree;
-  }
-
-  private List<NameValueData> generateLevelCountData(QueryResponse queryResponse, String[] defaults, boolean emptyResponseEnabled) {
-    List<NameValueData> nameValues = Lists.newLinkedList();
-    Map<String, NameValueData> linkedMap = Maps.newLinkedHashMap();
-    List<Count> counts = generateCount(queryResponse);
-    if (!CollectionUtils.isNotEmpty(counts) && emptyResponseEnabled) {
-      return nameValues;
-    }
-    for (String defaultValue : defaults) {
-      NameValueData nameValue = new NameValueData();
-      nameValue.setName(defaultValue);
-      nameValue.setValue("0");
-      linkedMap.put(defaultValue, nameValue);
-    }
-    if (CollectionUtils.isNotEmpty(counts)) {
-      for (Count count : counts) {
-        if (!linkedMap.containsKey(count.getName())) {
-          NameValueData nameValue = new NameValueData();
-          String name = count.getName().toUpperCase();
-          nameValue.setName(name);
-          nameValue.setValue(String.valueOf(count.getCount()));
-          linkedMap.put(name, nameValue);
-        }
-      }
-    }
-
-    for (Map.Entry<String, NameValueData> nameValueDataEntry : linkedMap.entrySet()) {
-      nameValues.add(nameValueDataEntry.getValue());
-    }
-    return nameValues;
-  }
-
-  public CountDataListResponse generateCountResponseByField(QueryResponse response, String field) {
-    CountDataListResponse collection = new CountDataListResponse();
-    List<CountData> vCounts = new ArrayList<>();
-    if (response == null) {
-      return collection;
-    }
-    FacetField facetFields = response.getFacetField(field);
-    if (facetFields == null) {
-      return collection;
-    }
-    List<Count> fieldList = facetFields.getValues();
-
-    if (fieldList == null) {
-      return collection;
-    }
-
-    for (Count cnt : fieldList) {
-      if (cnt != null) {
-        CountData vCount = new CountData();
-        vCount.setName(cnt.getName());
-        vCount.setCount(cnt.getCount());
-        vCounts.add(vCount);
-      }
-    }
-    collection.setvCounts(vCounts);
-    return collection;
-  }
-
-  public GraphDataListResponse generateSimpleGraphResponse(QueryResponse response, String hierarchy) {
-    GraphDataListResponse graphInfo = new GraphDataListResponse();
-    if (response == null) {
-      return graphInfo;
-    }
-    List<List<PivotField>> hirarchicalPivotField = new ArrayList<List<PivotField>>();
-    List<GraphData> dataList = new ArrayList<>();
-    NamedList<List<PivotField>> namedList = response.getFacetPivot();
-    if (namedList != null) {
-      hirarchicalPivotField = namedList.getAll(hierarchy);
-    }
-    if (!hirarchicalPivotField.isEmpty()) {
-      dataList = buidGraphData(hirarchicalPivotField.get(0));
-    }
-    if (!dataList.isEmpty()) {
-      graphInfo.setGraphData(dataList);
-    }
-
-    return graphInfo;
-  }
-
-  private List<GraphData> buidGraphData(List<PivotField> pivotFields) {
-    List<GraphData> logList = new ArrayList<>();
-    if (pivotFields != null) {
-      for (PivotField pivotField : pivotFields) {
-        if (pivotField != null) {
-          GraphData logLevel = new GraphData();
-          logLevel.setName("" + pivotField.getValue());
-          logLevel.setCount(Long.valueOf(pivotField.getCount()));
-          if (pivotField.getPivot() != null) {
-            logLevel.setDataList(buidGraphData(pivotField.getPivot()));
-          }
-          logList.add(logLevel);
-        }
-      }
-    }
-    return logList;
-  }
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/2f038b27/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/manager/AuditLogsManager.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/manager/AuditLogsManager.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/manager/AuditLogsManager.java
index 3ee1d17..2dc0ef7 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/manager/AuditLogsManager.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/manager/AuditLogsManager.java
@@ -41,7 +41,6 @@ import org.apache.ambari.logsearch.common.LogType;
 import org.apache.ambari.logsearch.common.MessageEnums;
 import org.apache.ambari.logsearch.dao.AuditSolrDao;
 import org.apache.ambari.logsearch.dao.SolrSchemaFieldDao;
-import org.apache.ambari.logsearch.graph.GraphDataGenerator;
 import org.apache.ambari.logsearch.model.request.impl.AuditBarGraphRequest;
 import org.apache.ambari.logsearch.model.request.impl.AuditComponentRequest;
 import org.apache.ambari.logsearch.model.request.impl.AuditLogRequest;
@@ -52,6 +51,7 @@ import org.apache.ambari.logsearch.model.response.AuditLogResponse;
 import org.apache.ambari.logsearch.model.response.BarGraphDataListResponse;
 import org.apache.ambari.logsearch.model.response.GroupListResponse;
 import org.apache.ambari.logsearch.model.response.LogData;
+import org.apache.ambari.logsearch.solr.ResponseDataGenerator;
 import org.apache.ambari.logsearch.solr.SolrConstants;
 import org.apache.ambari.logsearch.solr.model.SolrAuditLogData;
 import org.apache.ambari.logsearch.solr.model.SolrComponentTypeLogData;
@@ -77,7 +77,7 @@ public class AuditLogsManager extends ManagerBase<SolrAuditLogData, AuditLogResp
   @Inject
   private AuditSolrDao auditSolrDao;
   @Inject
-  private GraphDataGenerator graphDataGenerator;
+  private ResponseDataGenerator responseDataGenerator;
   @Inject
   private ConversionService conversionService;
   @Inject
@@ -93,7 +93,7 @@ public class AuditLogsManager extends ManagerBase<SolrAuditLogData, AuditLogResp
     SimpleFacetQuery facetQuery = conversionService.convert(request, SimpleFacetQuery.class);
     List<LogData> docList = new ArrayList<>();
     QueryResponse queryResponse = auditSolrDao.process(facetQuery);
-    List<Count> componentsCount = graphDataGenerator.generateCount(queryResponse);
+    List<Count> componentsCount = responseDataGenerator.generateCount(queryResponse);
 
     for (Count component : componentsCount) {
       SolrComponentTypeLogData logData = new SolrComponentTypeLogData();
@@ -113,13 +113,13 @@ public class AuditLogsManager extends ManagerBase<SolrAuditLogData, AuditLogResp
   public BarGraphDataListResponse getAuditBarGraphData(AuditBarGraphRequest request) {
     SolrQuery solrQuery = conversionService.convert(request, SolrQuery.class);
     QueryResponse response = auditSolrDao.process(solrQuery);
-    return graphDataGenerator.generateBarGraphDataResponseWithRanges(response, SolrConstants.AuditLogConstants.AUDIT_COMPONENT, true);
+    return responseDataGenerator.generateBarGraphDataResponseWithRanges(response, SolrConstants.AuditLogConstants.AUDIT_COMPONENT, true);
   }
 
   public BarGraphDataListResponse topResources(FieldAuditLogRequest request) {
     SimpleFacetQuery facetQuery = conversionService.convert(request, SimpleFacetQuery.class);
     QueryResponse queryResponse = auditSolrDao.process(facetQuery);
-    return graphDataGenerator.generateSecondLevelBarGraphDataResponse(queryResponse, 0);
+    return responseDataGenerator.generateSecondLevelBarGraphDataResponse(queryResponse, 0);
   }
 
   public String getAuditLogsSchemaFieldsName() {
@@ -129,7 +129,7 @@ public class AuditLogsManager extends ManagerBase<SolrAuditLogData, AuditLogResp
   public BarGraphDataListResponse getServiceLoad(AuditServiceLoadRequest request) {
     SimpleFacetQuery facetQuery = conversionService.convert(request, SimpleFacetQuery.class);
     QueryResponse response = auditSolrDao.process(facetQuery);
-    return graphDataGenerator.generateBarGraphFromFieldFacet(response, AUDIT_COMPONENT);
+    return responseDataGenerator.generateBarGraphFromFieldFacet(response, AUDIT_COMPONENT);
   }
 
   public Response export(UserExportRequest request) throws TemplateException {
@@ -150,8 +150,8 @@ public class AuditLogsManager extends ManagerBase<SolrAuditLogData, AuditLogResp
         response.setMsgDesc("Query was not able to execute " + facetQuery);
         throw RESTErrorUtil.createRESTException(response);
       }
-      BarGraphDataListResponse vBarUserDataList = graphDataGenerator.generateSecondLevelBarGraphDataResponse(queryResponse, 0);
-      BarGraphDataListResponse vBarResourceDataList = graphDataGenerator.generateSecondLevelBarGraphDataResponse(queryResponse, 1);
+      BarGraphDataListResponse vBarUserDataList = responseDataGenerator.generateSecondLevelBarGraphDataResponse(queryResponse, 0);
+      BarGraphDataListResponse vBarResourceDataList = responseDataGenerator.generateSecondLevelBarGraphDataResponse(queryResponse, 1);
       String data = "";
       if ("text".equals(dataFormat)) {
         StringWriter stringWriter = new StringWriter();

http://git-wip-us.apache.org/repos/asf/ambari/blob/2f038b27/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/manager/ServiceLogsManager.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/manager/ServiceLogsManager.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/manager/ServiceLogsManager.java
index fc2f0f7..f960250 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/manager/ServiceLogsManager.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/manager/ServiceLogsManager.java
@@ -45,7 +45,7 @@ import org.apache.ambari.logsearch.common.LogType;
 import org.apache.ambari.logsearch.common.MessageEnums;
 import org.apache.ambari.logsearch.dao.ServiceLogsSolrDao;
 import org.apache.ambari.logsearch.dao.SolrSchemaFieldDao;
-import org.apache.ambari.logsearch.graph.GraphDataGenerator;
+import org.apache.ambari.logsearch.model.request.impl.HostLogFilesRequest;
 import org.apache.ambari.logsearch.model.request.impl.ServiceAnyGraphRequest;
 import org.apache.ambari.logsearch.model.request.impl.ServiceGraphRequest;
 import org.apache.ambari.logsearch.model.request.impl.ServiceLogAggregatedInfoRequest;
@@ -60,6 +60,7 @@ import org.apache.ambari.logsearch.model.response.BarGraphDataListResponse;
 import org.apache.ambari.logsearch.model.response.CountDataListResponse;
 import org.apache.ambari.logsearch.model.response.GraphDataListResponse;
 import org.apache.ambari.logsearch.model.response.GroupListResponse;
+import org.apache.ambari.logsearch.model.response.HostLogFilesResponse;
 import org.apache.ambari.logsearch.model.response.LogData;
 import org.apache.ambari.logsearch.model.response.LogListResponse;
 import org.apache.ambari.logsearch.model.response.NameValueDataListResponse;
@@ -68,6 +69,7 @@ import org.apache.ambari.logsearch.model.response.ServiceLogData;
 import org.apache.ambari.logsearch.model.response.ServiceLogResponse;
 import org.apache.ambari.logsearch.converter.BaseServiceLogRequestQueryConverter;
 import org.apache.ambari.logsearch.converter.ServiceLogTruncatedRequestQueryConverter;
+import org.apache.ambari.logsearch.solr.ResponseDataGenerator;
 import org.apache.ambari.logsearch.solr.model.SolrComponentTypeLogData;
 import org.apache.ambari.logsearch.solr.model.SolrHostLogData;
 import org.apache.ambari.logsearch.solr.model.SolrServiceLogData;
@@ -111,7 +113,7 @@ public class ServiceLogsManager extends ManagerBase<SolrServiceLogData, ServiceL
   @Inject
   private ServiceLogsSolrDao serviceLogsSolrDao;
   @Inject
-  private GraphDataGenerator graphDataGenerator;
+  private ResponseDataGenerator responseDataGenerator;
   @Inject
   private ConversionService conversionService;
   @Inject
@@ -157,11 +159,11 @@ public class ServiceLogsManager extends ManagerBase<SolrServiceLogData, ServiceL
     solrQuery.setQuery("*:*");
     SolrUtil.setFacetPivot(solrQuery, 1, hierarchy);
     QueryResponse response = serviceLogsSolrDao.process(solrQuery);
-    return graphDataGenerator.generateSimpleGraphResponse(response, hierarchy);
+    return responseDataGenerator.generateSimpleGraphResponse(response, hierarchy);
   }
 
   public CountDataListResponse getFieldCount(String field) {
-    return graphDataGenerator.generateCountResponseByField(serviceLogsSolrDao.process(conversionService.convert(field, SimpleFacetQuery.class)), field);
+    return responseDataGenerator.generateCountResponseByField(serviceLogsSolrDao.process(conversionService.convert(field, SimpleFacetQuery.class)), field);
   }
 
   public CountDataListResponse getComponentsCount() {
@@ -182,7 +184,7 @@ public class ServiceLogsManager extends ManagerBase<SolrServiceLogData, ServiceL
     QueryResponse response = serviceLogsSolrDao.process(solrQuery, "/service/logs/tree");
     String firstHierarchy = String.format("%s,%s,%s", HOST, COMPONENT, LEVEL);
     String secondHierarchy = String.format("%s,%s", HOST, LEVEL);
-    return graphDataGenerator.generateServiceNodeTreeFromFacetResponse(response, firstHierarchy, secondHierarchy,
+    return responseDataGenerator.generateServiceNodeTreeFromFacetResponse(response, firstHierarchy, secondHierarchy,
       LogSearchConstants.HOST, LogSearchConstants.COMPONENT);
   }
 
@@ -199,7 +201,7 @@ public class ServiceLogsManager extends ManagerBase<SolrServiceLogData, ServiceL
       QueryResponse response = serviceLogsSolrDao.process(solrQuery, "/service/logs/hosts/components");
       String firstHierarchy = String.format("%s,%s,%s", COMPONENT, HOST, LEVEL);
       String secondHierarchy = String.format("%s,%s", COMPONENT, LEVEL);
-      return graphDataGenerator.generateServiceNodeTreeFromFacetResponse(response, firstHierarchy, secondHierarchy,
+      return responseDataGenerator.generateServiceNodeTreeFromFacetResponse(response, firstHierarchy, secondHierarchy,
         LogSearchConstants.COMPONENT, LogSearchConstants.HOST);
     } else {
       return list;
@@ -209,16 +211,15 @@ public class ServiceLogsManager extends ManagerBase<SolrServiceLogData, ServiceL
   public NameValueDataListResponse getLogsLevelCount(ServiceLogLevelCountRequest request) {
     SimpleFacetQuery facetQuery = conversionService.convert(request, SimpleFacetQuery.class);
     QueryResponse response = serviceLogsSolrDao.process(facetQuery, "/service/logs/levels/counts");
-    return graphDataGenerator.getNameValueDataListResponseWithDefaults(response, LogSearchConstants.SUPPORTED_LOG_LEVELS, false);
+    return responseDataGenerator.getNameValueDataListResponseWithDefaults(response, LogSearchConstants.SUPPORTED_LOG_LEVELS, false);
   }
 
   public BarGraphDataListResponse getHistogramData(ServiceGraphRequest request) {
     SolrQuery solrQuery = conversionService.convert(request, SolrQuery.class);
     QueryResponse response = serviceLogsSolrDao.process(solrQuery, "/service/logs/histogram");
-    return graphDataGenerator.generateBarGraphDataResponseWithRanges(response, LEVEL, true);
+    return responseDataGenerator.generateBarGraphDataResponseWithRanges(response, LEVEL, true);
   }
 
-
   public LogListResponse getPageByKeyword(ServiceLogRequest request, String event)
     throws SolrServerException {
     String defaultChoice = "0";
@@ -416,7 +417,7 @@ public class ServiceLogsManager extends ManagerBase<SolrServiceLogData, ServiceL
     SolrQuery solrQuery = new DefaultQueryParser().doConstructSolrQuery(facetQuery);
     solrQuery.setFacetSort(StringUtils.isEmpty(request.getSortBy()) ? COMPONENT: request.getSortBy());
     QueryResponse response = serviceLogsSolrDao.process(facetQuery, "/service/logs/components/levels/counts");
-    return graphDataGenerator.generateOneLevelServiceNodeTree(response, String.format("%s,%s", COMPONENT, LEVEL));
+    return responseDataGenerator.generateOneLevelServiceNodeTree(response, String.format("%s,%s", COMPONENT, LEVEL));
   }
 
   public String getServiceLogsSchemaFieldsName() {
@@ -426,7 +427,7 @@ public class ServiceLogsManager extends ManagerBase<SolrServiceLogData, ServiceL
   public BarGraphDataListResponse getAnyGraphCountData(ServiceAnyGraphRequest request) {
     SimpleFacetQuery solrDataQuery = conversionService.convert(request, SimpleFacetQuery.class);
     QueryResponse queryResponse = serviceLogsSolrDao.process(solrDataQuery);
-    return graphDataGenerator.getGraphDataWithDefaults(queryResponse, LEVEL, LogSearchConstants.SUPPORTED_LOG_LEVELS);
+    return responseDataGenerator.getGraphDataWithDefaults(queryResponse, LEVEL, LogSearchConstants.SUPPORTED_LOG_LEVELS);
   }
 
   public ServiceLogResponse getAfterBeforeLogs(ServiceLogTruncatedRequest request) {
@@ -582,4 +583,10 @@ public class ServiceLogsManager extends ManagerBase<SolrServiceLogData, ServiceL
     }
     return hadoopServiceConfigJSON;
   }
+
+  public HostLogFilesResponse getHostLogFileData(HostLogFilesRequest request) {
+    SimpleFacetQuery facetQuery = conversionService.convert(request, SimpleFacetQuery.class);
+    QueryResponse queryResponse = serviceLogsSolrDao.process(facetQuery, "/service/logs/hostlogfiles");
+    return responseDataGenerator.generateHostLogFilesResponse(queryResponse);
+  }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/2f038b27/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/HostComponentParamDefinition.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/HostComponentParamDefinition.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/HostComponentParamDefinition.java
new file mode 100644
index 0000000..914b5f0
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/HostComponentParamDefinition.java
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.ambari.logsearch.model.request;
+
+import io.swagger.annotations.ApiParam;
+import org.apache.ambari.logsearch.common.LogSearchConstants;
+
+import static org.apache.ambari.logsearch.doc.DocConstants.ServiceDescriptions.HOST_NAME_D;
+import static org.apache.ambari.logsearch.doc.DocConstants.ServiceDescriptions.COMPONENT_NAME_D;
+
+public interface HostComponentParamDefinition {
+
+  String getHostName();
+
+  @ApiParam(value = HOST_NAME_D, name = LogSearchConstants.REQUEST_PARAM_HOST_NAME)
+  void setHostName(String hostName);
+
+  String getComponentName();
+
+  @ApiParam(value = COMPONENT_NAME_D, name = LogSearchConstants.REQUEST_PARAM_COMPONENT_NAME)
+  void setComponentName(String componentName);
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/2f038b27/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/ServiceLogParamDefinition.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/ServiceLogParamDefinition.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/ServiceLogParamDefinition.java
index 752f786..9306bb5 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/ServiceLogParamDefinition.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/ServiceLogParamDefinition.java
@@ -23,27 +23,15 @@ import org.apache.ambari.logsearch.common.LogSearchConstants;
 
 import static org.apache.ambari.logsearch.doc.DocConstants.ServiceDescriptions.HOST_PARAMS_D;
 import static org.apache.ambari.logsearch.doc.DocConstants.ServiceDescriptions.LEVEL_D;
-import static org.apache.ambari.logsearch.doc.DocConstants.ServiceDescriptions.HOST_NAME_D;
-import static org.apache.ambari.logsearch.doc.DocConstants.ServiceDescriptions.COMPONENT_NAME_D;
 import static org.apache.ambari.logsearch.doc.DocConstants.ServiceDescriptions.FILE_NAME_D;
 
-public interface ServiceLogParamDefinition {
+public interface ServiceLogParamDefinition extends HostComponentParamDefinition {
 
   String getLevel();
 
   @ApiParam(value = LEVEL_D, name = LogSearchConstants.REQUEST_PARAM_LEVEL)
   void setLevel(String level);
 
-  String getHostName();
-
-  @ApiParam(value = HOST_NAME_D, name = LogSearchConstants.REQUEST_PARAM_HOST_NAME)
-  void setHostName(String hostName);
-
-  String getComponentName();
-
-  @ApiParam(value = COMPONENT_NAME_D, name = LogSearchConstants.REQUEST_PARAM_COMPONENT_NAME)
-  void setComponentName(String componentName);
-
   String getFileName();
 
   @ApiParam(value = FILE_NAME_D, name = LogSearchConstants.REQUEST_PARAM_FILE_NAME)

http://git-wip-us.apache.org/repos/asf/ambari/blob/2f038b27/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/BaseServiceLogRequest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/BaseServiceLogRequest.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/BaseServiceLogRequest.java
index bafca37..cbe3d68 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/BaseServiceLogRequest.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/BaseServiceLogRequest.java
@@ -20,7 +20,6 @@ package org.apache.ambari.logsearch.model.request.impl;
 
 import org.apache.ambari.logsearch.common.LogSearchConstants;
 import org.apache.ambari.logsearch.model.request.BundleIdParamDefinition;
-import org.apache.ambari.logsearch.model.request.DateRangeParamDefinition;
 import org.apache.ambari.logsearch.model.request.ServiceLogParamDefinition;
 
 import javax.ws.rs.QueryParam;

http://git-wip-us.apache.org/repos/asf/ambari/blob/2f038b27/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/HostLogFilesRequest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/HostLogFilesRequest.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/HostLogFilesRequest.java
new file mode 100644
index 0000000..1c0c068
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/HostLogFilesRequest.java
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.ambari.logsearch.model.request.impl;
+
+import javax.validation.constraints.NotNull;
+import javax.ws.rs.QueryParam;
+
+import org.apache.ambari.logsearch.common.LogSearchConstants;
+import org.apache.ambari.logsearch.model.request.HostComponentParamDefinition;
+import org.apache.ambari.logsearch.model.request.SearchRequest;
+
+public class HostLogFilesRequest implements HostComponentParamDefinition, SearchRequest {
+
+  @NotNull
+  @QueryParam(LogSearchConstants.REQUEST_PARAM_HOST_NAME)
+  private String hostName;
+
+  @QueryParam(LogSearchConstants.REQUEST_PARAM_COMPONENT_NAME)
+  private String componentName;
+
+  @Override
+  public String getHostName() {
+    return hostName;
+  }
+
+  @Override
+  public void setHostName(String hostName) {
+    this.hostName = hostName;
+  }
+
+  @Override
+  public String getComponentName() {
+    return componentName;
+  }
+
+  @Override
+  public void setComponentName(String componentName) {
+    this.componentName = componentName;
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/2f038b27/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/ServiceAnyGraphRequest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/ServiceAnyGraphRequest.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/ServiceAnyGraphRequest.java
index 1fb4bf6..09603e3 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/ServiceAnyGraphRequest.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/ServiceAnyGraphRequest.java
@@ -18,10 +18,8 @@
  */
 package org.apache.ambari.logsearch.model.request.impl;
 
-import io.swagger.annotations.ApiParam;
 import org.apache.ambari.logsearch.common.LogSearchConstants;
 import org.apache.ambari.logsearch.model.request.AnyGraphParamDefinition;
-import org.apache.ambari.logsearch.model.request.DateRangeParamDefinition;
 import org.apache.ambari.logsearch.model.request.UnitParamDefinition;
 
 import javax.ws.rs.QueryParam;

http://git-wip-us.apache.org/repos/asf/ambari/blob/2f038b27/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/HostLogFilesResponse.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/HostLogFilesResponse.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/HostLogFilesResponse.java
new file mode 100644
index 0000000..27d3cf7
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/HostLogFilesResponse.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.ambari.logsearch.model.response;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@ApiModel
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class HostLogFilesResponse {
+
+  @ApiModelProperty
+  protected Map<String, List<String>> hostLogFiles = new HashMap<>();
+
+  public Map<String, List<String>> getHostLogFiles() {
+    return hostLogFiles;
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/2f038b27/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/NodeData.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/NodeData.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/NodeData.java
index 41d8a31..b226ef8 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/NodeData.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/NodeData.java
@@ -18,7 +18,6 @@
  */
 package org.apache.ambari.logsearch.model.response;
 
-import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
 import com.fasterxml.jackson.annotation.JsonInclude;
 import com.fasterxml.jackson.annotation.JsonProperty;
 import io.swagger.annotations.ApiModel;

http://git-wip-us.apache.org/repos/asf/ambari/blob/2f038b27/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/ServiceLogsResource.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/ServiceLogsResource.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/ServiceLogsResource.java
index 3e1e120..40247a8 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/ServiceLogsResource.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/ServiceLogsResource.java
@@ -20,6 +20,8 @@ package org.apache.ambari.logsearch.rest;
 
 import javax.inject.Inject;
 import javax.inject.Named;
+import javax.validation.Valid;
+import javax.validation.executable.ValidateOnExecution;
 import javax.ws.rs.BeanParam;
 import javax.ws.rs.GET;
 import javax.ws.rs.Path;
@@ -28,6 +30,8 @@ import javax.ws.rs.core.Response;
 
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
+
+import org.apache.ambari.logsearch.model.request.impl.HostLogFilesRequest;
 import org.apache.ambari.logsearch.model.request.impl.ServiceAnyGraphRequest;
 import org.apache.ambari.logsearch.model.request.impl.ServiceGraphRequest;
 import org.apache.ambari.logsearch.model.request.impl.ServiceLogAggregatedInfoRequest;
@@ -42,6 +46,7 @@ import org.apache.ambari.logsearch.model.response.BarGraphDataListResponse;
 import org.apache.ambari.logsearch.model.response.CountDataListResponse;
 import org.apache.ambari.logsearch.model.response.GraphDataListResponse;
 import org.apache.ambari.logsearch.model.response.GroupListResponse;
+import org.apache.ambari.logsearch.model.response.HostLogFilesResponse;
 import org.apache.ambari.logsearch.model.response.NameValueDataListResponse;
 import org.apache.ambari.logsearch.model.response.NodeListResponse;
 import org.apache.ambari.logsearch.model.response.ServiceLogResponse;
@@ -193,4 +198,13 @@ public class ServiceLogsResource {
     // TODO: create function that cancels an ongoing solr request
     return "{\"endpoint status\": \"not supported yet\"}";
   }
+
+  @GET
+  @Path("/files")
+  @Produces({"application/json"})
+  @ApiOperation(GET_HOST_LOGFILES_OD)
+  @ValidateOnExecution
+  public HostLogFilesResponse getHostLogFiles(@Valid @BeanParam HostLogFilesRequest request) {
+    return serviceLogsManager.getHostLogFileData(request);
+  }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/2f038b27/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/ResponseDataGenerator.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/ResponseDataGenerator.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/ResponseDataGenerator.java
new file mode 100644
index 0000000..74e9c11
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/ResponseDataGenerator.java
@@ -0,0 +1,452 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.ambari.logsearch.solr;
+
+import static org.apache.ambari.logsearch.solr.SolrConstants.ServiceLogConstants.COMPONENT;
+import static org.apache.ambari.logsearch.solr.SolrConstants.ServiceLogConstants.PATH;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+
+import org.apache.ambari.logsearch.model.response.BarGraphData;
+import org.apache.ambari.logsearch.model.response.BarGraphDataListResponse;
+import org.apache.ambari.logsearch.model.response.CountData;
+import org.apache.ambari.logsearch.model.response.CountDataListResponse;
+import org.apache.ambari.logsearch.model.response.GraphData;
+import org.apache.ambari.logsearch.model.response.GraphDataListResponse;
+import org.apache.ambari.logsearch.model.response.HostLogFilesResponse;
+import org.apache.ambari.logsearch.model.response.NameValueData;
+import org.apache.ambari.logsearch.model.response.NameValueDataListResponse;
+import org.apache.ambari.logsearch.model.response.NodeData;
+import org.apache.ambari.logsearch.model.response.NodeListResponse;
+import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.lang.StringUtils;
+import org.apache.solr.client.solrj.response.FacetField;
+import org.apache.solr.client.solrj.response.FacetField.Count;
+import org.apache.solr.client.solrj.response.PivotField;
+import org.apache.solr.client.solrj.response.QueryResponse;
+import org.apache.solr.client.solrj.response.RangeFacet;
+import org.apache.solr.common.util.NamedList;
+
+import javax.inject.Named;
+
+@Named
+public class ResponseDataGenerator {
+
+  public BarGraphDataListResponse generateBarGraphDataResponseWithRanges(QueryResponse response, String typeField, boolean typeUppercase) {
+    BarGraphDataListResponse dataList = new BarGraphDataListResponse();
+    if (response == null) {
+      return dataList;
+    }
+    NamedList<List<PivotField>> facetPivotResponse = response.getFacetPivot();
+    if (response.getFacetPivot() == null) {
+      return dataList;
+    }
+    List<PivotField> pivotFields = facetPivotResponse.get(typeField);
+    for (int pivotIndex = 0; pivotIndex < pivotFields.size(); pivotIndex++) {
+      PivotField pivotField = facetPivotResponse.get(typeField).get(pivotIndex);
+      List<NameValueData> nameValues = generateNameValueDataList(pivotField.getFacetRanges());
+      BarGraphData barGraphData = new BarGraphData();
+      barGraphData.setDataCount(nameValues);
+      String typeValue = typeUppercase ? StringUtils.upperCase(pivotField.getValue().toString()) : pivotField.getValue().toString();
+      barGraphData.setName(typeValue);
+      dataList.getGraphData().add(barGraphData);
+    }
+    return dataList;
+  }
+
+  public BarGraphDataListResponse generateSecondLevelBarGraphDataResponse(QueryResponse response, int val) {
+    BarGraphDataListResponse barGraphDataListResponse = new BarGraphDataListResponse();
+    NamedList<List<PivotField>> pivotFieldNameList = response.getFacetPivot();
+    if (pivotFieldNameList == null) {
+      return barGraphDataListResponse;
+    }
+    List<PivotField> pivotFields = pivotFieldNameList.getVal(val);
+    List<BarGraphData> barGraphDataList = new ArrayList<>();
+    for (PivotField pivotField : pivotFields) {
+      BarGraphData barGraphData = new BarGraphData();
+      barGraphData.setName(String.valueOf(pivotField.getValue()));
+      List<PivotField> secondLevelPivotFields = pivotField.getPivot();
+      List<NameValueData> nameValueDataList = new ArrayList<>();
+      for (PivotField sPivotField : secondLevelPivotFields) {
+        NameValueData nvD = new NameValueData();
+        nvD.setName(String.valueOf(sPivotField.getValue()));
+        nvD.setValue(String.valueOf(sPivotField.getCount()));
+        nameValueDataList.add(nvD);
+      }
+      barGraphData.setDataCount(nameValueDataList);
+      barGraphDataList.add(barGraphData);
+    }
+    barGraphDataListResponse.setGraphData(barGraphDataList);
+    return barGraphDataListResponse;
+  }
+
+  public BarGraphDataListResponse generateBarGraphFromFieldFacet(QueryResponse response, String facetField) {
+    BarGraphDataListResponse dataList = new BarGraphDataListResponse();
+    Collection<BarGraphData> vaDatas = new ArrayList<>();
+    dataList.setGraphData(vaDatas);
+    if (response == null) {
+      return dataList;
+    }
+    FacetField facetFieldObj = response.getFacetField(facetField);
+    if (facetFieldObj == null) {
+      return dataList;
+    }
+
+    List<Count> counts = facetFieldObj.getValues();
+    if (counts == null) {
+      return dataList;
+    }
+    for (Count cnt : counts) {
+      List<NameValueData> valueList = new ArrayList<>();
+      BarGraphData vBarGraphData = new BarGraphData();
+      vaDatas.add(vBarGraphData);
+      NameValueData vNameValue = new NameValueData();
+      vNameValue.setName(cnt.getName());
+      vBarGraphData.setName(cnt.getName().toUpperCase());
+      vNameValue.setValue("" + cnt.getCount());
+      valueList.add(vNameValue);
+      vBarGraphData.setDataCount(valueList);
+    }
+    return dataList;
+  }
+
+  public List<NameValueData> generateNameValueDataList(List<RangeFacet> rangeFacet) {
+    List<NameValueData> nameValues = new ArrayList<>();
+    if (rangeFacet == null) {
+      return nameValues;
+    }
+    RangeFacet range = rangeFacet.get(0);
+
+    if (range == null) {
+      return nameValues;
+    }
+    List<RangeFacet.Count> listCount = range.getCounts();
+    for (RangeFacet.Count cnt : listCount) {
+      NameValueData nameValue = new NameValueData();
+      nameValue.setName(String.valueOf(cnt.getValue()));
+      nameValue.setValue(String.valueOf(cnt.getCount()));
+      nameValues.add(nameValue);
+    }
+    return nameValues;
+  }
+
+  public List<Count> generateCount(QueryResponse response) {
+    List<Count> counts = new ArrayList<>();
+    List<FacetField> facetFields = null;
+    FacetField facetField = null;
+    if (response == null) {
+      return counts;
+    }
+
+    facetFields = response.getFacetFields();
+    if (facetFields == null) {
+      return counts;
+    }
+    if (!facetFields.isEmpty()) {
+      facetField = facetFields.get(0);
+    }
+    if (facetField != null) {
+      counts = facetField.getValues();
+    }
+    return counts;
+  }
+
+  public BarGraphDataListResponse getGraphDataWithDefaults(QueryResponse queryResponse, String field, String[] defaults) {
+    BarGraphDataListResponse response = new BarGraphDataListResponse();
+    BarGraphData barGraphData = new BarGraphData();
+    List<NameValueData> nameValues = generateLevelCountData(queryResponse, defaults, true);
+    barGraphData.setName(field);
+    barGraphData.setDataCount(nameValues);
+    response.setGraphData(Lists.newArrayList(barGraphData));
+    return response;
+  }
+
+  public NameValueDataListResponse getNameValueDataListResponseWithDefaults(QueryResponse response, String[] defaults, boolean emptyResponseDisabled) {
+    NameValueDataListResponse result = new NameValueDataListResponse();
+    result.setvNameValues(generateLevelCountData(response, defaults, emptyResponseDisabled));
+    return result;
+  }
+
+  public NodeListResponse generateServiceNodeTreeFromFacetResponse(QueryResponse queryResponse,
+                                                                   String firstHierarchy, String secondHierarchy,
+                                                                   String firstType, String secondType) {
+    NodeListResponse response = new NodeListResponse();
+    if (queryResponse == null) {
+      return response;
+    }
+    NamedList<List<PivotField>> namedPivotFieldList = queryResponse.getFacetPivot();
+    List<PivotField> firstLevelPivots = namedPivotFieldList.get(firstHierarchy);
+    List<PivotField> secondLevelPivots = namedPivotFieldList.get(secondHierarchy);
+    if (!CollectionUtils.isNotEmpty(firstLevelPivots) || !CollectionUtils.isNotEmpty(secondLevelPivots)) {
+      return response;
+    }
+    List<NodeData> nodeDataList = buidTreeData(firstLevelPivots, secondLevelPivots, firstType, secondType);
+    response.setvNodeList(nodeDataList);
+    return response;
+  }
+
+  public NodeListResponse generateOneLevelServiceNodeTree(QueryResponse queryResponse, String componentLevelHirachy) {
+    NodeListResponse response = new NodeListResponse();
+    List<NodeData> datatList = new ArrayList<>();
+    List<List<PivotField>> listPivotField = new ArrayList<>();
+    NamedList<List<PivotField>> namedList = queryResponse.getFacetPivot();
+    if (namedList != null) {
+      listPivotField = namedList.getAll(componentLevelHirachy);
+    }
+    List<PivotField> secondHirarchicalPivotFields = null;
+    if (listPivotField == null || listPivotField.isEmpty()) {
+      return response;
+    } else {
+      secondHirarchicalPivotFields = listPivotField.get(0);
+    }
+    for (PivotField singlePivotField : secondHirarchicalPivotFields) {
+      if (singlePivotField != null) {
+        NodeData comp = new NodeData();
+        comp.setName("" + singlePivotField.getValue());
+        List<PivotField> levelList = singlePivotField.getPivot();
+        List<NameValueData> levelCountList = new ArrayList<>();
+        comp.setLogLevelCount(levelCountList);
+        if (levelList != null) {
+          for (PivotField levelPivot : levelList) {
+            NameValueData level = new NameValueData();
+            level.setName(("" + levelPivot.getValue()).toUpperCase());
+            level.setValue("" + levelPivot.getCount());
+            levelCountList.add(level);
+          }
+        }
+        datatList.add(comp);
+      }
+    }
+    response.setvNodeList(datatList);
+    return response;
+  }
+
+  private List<NodeData> buidTreeData(List<PivotField> firstHirarchicalPivotFields,
+                                      List<PivotField> secondHirarchicalPivotFields,
+                                      String firstPriority, String secondPriority) {
+    List<NodeData> extensionTree = new ArrayList<>();
+    if (firstHirarchicalPivotFields != null) {
+      for (PivotField pivotHost : firstHirarchicalPivotFields) {
+        if (pivotHost != null) {
+          NodeData hostNode = new NodeData();
+          String name = (pivotHost.getValue() == null ? "" : "" + pivotHost.getValue());
+          String value = "" + pivotHost.getCount();
+          if (StringUtils.isNotBlank(name)) {
+            hostNode.setName(name);
+          }
+          if (StringUtils.isNotBlank(value)) {
+            hostNode.setValue(value);
+          }
+          if (StringUtils.isNotBlank(firstPriority)) {
+            hostNode.setType(firstPriority);
+          }
+
+          hostNode.setParent(true);
+          hostNode.setRoot(true);
+          PivotField hostPivot = null;
+          for (PivotField searchHost : secondHirarchicalPivotFields) {
+            if (StringUtils.isNotBlank(hostNode.getName())
+              && hostNode.getName().equals(searchHost.getValue())) {
+              hostPivot = searchHost;
+              break;
+            }
+          }
+          List<PivotField> pivotLevelHost = hostPivot == null? null : hostPivot.getPivot();
+          if (pivotLevelHost != null) {
+            Collection<NameValueData> logLevelCount = new ArrayList<>();
+            for (PivotField pivotLevel : pivotLevelHost) {
+              if (pivotLevel != null) {
+                NameValueData vnameValue = new NameValueData();
+                String levelName = (pivotLevel.getValue() == null ? "" : "" + pivotLevel.getValue());
+                vnameValue.setName(levelName.toUpperCase());
+                vnameValue.setValue("" + pivotLevel.getCount());
+                logLevelCount.add(vnameValue);
+              }
+            }
+            hostNode.setLogLevelCount(logLevelCount);
+          }
+          List<PivotField> pivotComponents = pivotHost.getPivot();
+          if (pivotComponents != null) {
+            Collection<NodeData> componentNodes = new ArrayList<>();
+            for (PivotField pivotComp : pivotComponents) {
+              if (pivotComp != null) {
+                NodeData compNode = new NodeData();
+                String compName = (pivotComp.getValue() == null ? "" : "" + pivotComp.getValue());
+                compNode.setName(compName);
+                if (StringUtils.isNotBlank(secondPriority)) {
+                  compNode.setType(secondPriority);
+                }
+                compNode.setValue("" + pivotComp.getCount());
+                compNode.setParent(false);
+                compNode.setRoot(false);
+                List<PivotField> pivotLevels = pivotComp.getPivot();
+                if (pivotLevels != null) {
+                  Collection<NameValueData> logLevelCount = new ArrayList<>();
+                  for (PivotField pivotLevel : pivotLevels) {
+                    if (pivotLevel != null) {
+                      NameValueData vnameValue = new NameValueData();
+                      String compLevel = pivotLevel.getValue() == null ? "" : "" + pivotLevel.getValue();
+                      vnameValue.setName((compLevel).toUpperCase());
+
+                      vnameValue.setValue("" + pivotLevel.getCount());
+                      logLevelCount.add(vnameValue);
+                    }
+                  }
+                  compNode.setLogLevelCount(logLevelCount);
+                }
+                componentNodes.add(compNode);
+              }
+            }
+            hostNode.setChilds(componentNodes);
+          }
+          extensionTree.add(hostNode);
+        }
+      }
+    }
+
+    return extensionTree;
+  }
+
+  private List<NameValueData> generateLevelCountData(QueryResponse queryResponse, String[] defaults, boolean emptyResponseEnabled) {
+    List<NameValueData> nameValues = Lists.newLinkedList();
+    Map<String, NameValueData> linkedMap = Maps.newLinkedHashMap();
+    List<Count> counts = generateCount(queryResponse);
+    if (!CollectionUtils.isNotEmpty(counts) && emptyResponseEnabled) {
+      return nameValues;
+    }
+    for (String defaultValue : defaults) {
+      NameValueData nameValue = new NameValueData();
+      nameValue.setName(defaultValue);
+      nameValue.setValue("0");
+      linkedMap.put(defaultValue, nameValue);
+    }
+    if (CollectionUtils.isNotEmpty(counts)) {
+      for (Count count : counts) {
+        if (!linkedMap.containsKey(count.getName())) {
+          NameValueData nameValue = new NameValueData();
+          String name = count.getName().toUpperCase();
+          nameValue.setName(name);
+          nameValue.setValue(String.valueOf(count.getCount()));
+          linkedMap.put(name, nameValue);
+        }
+      }
+    }
+
+    for (Map.Entry<String, NameValueData> nameValueDataEntry : linkedMap.entrySet()) {
+      nameValues.add(nameValueDataEntry.getValue());
+    }
+    return nameValues;
+  }
+
+  public CountDataListResponse generateCountResponseByField(QueryResponse response, String field) {
+    CountDataListResponse collection = new CountDataListResponse();
+    List<CountData> vCounts = new ArrayList<>();
+    if (response == null) {
+      return collection;
+    }
+    FacetField facetFields = response.getFacetField(field);
+    if (facetFields == null) {
+      return collection;
+    }
+    List<Count> fieldList = facetFields.getValues();
+
+    if (fieldList == null) {
+      return collection;
+    }
+
+    for (Count cnt : fieldList) {
+      if (cnt != null) {
+        CountData vCount = new CountData();
+        vCount.setName(cnt.getName());
+        vCount.setCount(cnt.getCount());
+        vCounts.add(vCount);
+      }
+    }
+    collection.setvCounts(vCounts);
+    return collection;
+  }
+
+  public GraphDataListResponse generateSimpleGraphResponse(QueryResponse response, String hierarchy) {
+    GraphDataListResponse graphInfo = new GraphDataListResponse();
+    if (response == null) {
+      return graphInfo;
+    }
+    List<List<PivotField>> hirarchicalPivotField = new ArrayList<List<PivotField>>();
+    List<GraphData> dataList = new ArrayList<>();
+    NamedList<List<PivotField>> namedList = response.getFacetPivot();
+    if (namedList != null) {
+      hirarchicalPivotField = namedList.getAll(hierarchy);
+    }
+    if (!hirarchicalPivotField.isEmpty()) {
+      dataList = buidGraphData(hirarchicalPivotField.get(0));
+    }
+    if (!dataList.isEmpty()) {
+      graphInfo.setGraphData(dataList);
+    }
+
+    return graphInfo;
+  }
+
+  private List<GraphData> buidGraphData(List<PivotField> pivotFields) {
+    List<GraphData> logList = new ArrayList<>();
+    if (pivotFields != null) {
+      for (PivotField pivotField : pivotFields) {
+        if (pivotField != null) {
+          GraphData logLevel = new GraphData();
+          logLevel.setName("" + pivotField.getValue());
+          logLevel.setCount(Long.valueOf(pivotField.getCount()));
+          if (pivotField.getPivot() != null) {
+            logLevel.setDataList(buidGraphData(pivotField.getPivot()));
+          }
+          logList.add(logLevel);
+        }
+      }
+    }
+    return logList;
+  }
+  
+
+  public HostLogFilesResponse generateHostLogFilesResponse(QueryResponse queryResponse) {
+    HostLogFilesResponse response = new HostLogFilesResponse();
+    Map<String, List<String>> componentLogFiles = response.getHostLogFiles();
+    
+    NamedList<List<PivotField>> facetPivot = queryResponse.getFacetPivot();
+    List<PivotField> componentFields = facetPivot.get(COMPONENT + "," + PATH);
+    for (PivotField componentField : componentFields) {
+      String component = (String)componentField.getValue();
+      LinkedList<String> logFileList = new LinkedList<>();
+      componentLogFiles.put(component, logFileList);
+      
+      for (PivotField logField : componentField.getPivot()) {
+        // the log file names are in increasing order of their cardinality, using addFirst reverses the list
+        logFileList.addFirst((String)logField.getValue());
+      }
+    }
+    
+    return response;
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/2f038b27/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/HostLogFilesRequestQueryConverterTest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/HostLogFilesRequestQueryConverterTest.java b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/HostLogFilesRequestQueryConverterTest.java
new file mode 100644
index 0000000..60dba44
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/HostLogFilesRequestQueryConverterTest.java
@@ -0,0 +1,62 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.ambari.logsearch.converter;
+
+import org.apache.ambari.logsearch.model.request.impl.HostLogFilesRequest;
+import org.apache.solr.client.solrj.SolrQuery;
+import org.junit.Before;
+import org.junit.Test;
+import org.springframework.data.solr.core.DefaultQueryParser;
+
+import static org.junit.Assert.assertEquals;
+
+public class HostLogFilesRequestQueryConverterTest extends AbstractRequestConverterTest {
+
+  private HostLogFilesRequestQueryConverter underTest;
+
+  @Before
+  public void setUp() {
+    underTest = new HostLogFilesRequestQueryConverter();
+  }
+
+  @Test
+  public void testConvertHostNameOnly() {
+    // GIVEN
+    HostLogFilesRequest request = new HostLogFilesRequest();
+    request.setHostName("hostName");
+    // WHEN
+    SolrQuery query = new DefaultQueryParser().doConstructSolrQuery(underTest.convert(request));
+    // THEN
+    assertEquals("?q=host%3A%28hostName%29&rows=0&facet=true&facet.mincount=1&facet.limit=-1&facet.pivot=type%2Cpath",
+      query.toQueryString());
+  }
+
+  @Test
+  public void testConvertHostNameAndComponentName() {
+    // GIVEN
+    HostLogFilesRequest request = new HostLogFilesRequest();
+    request.setHostName("hostName");
+    request.setComponentName("componentName");
+    // WHEN
+    SolrQuery query = new DefaultQueryParser().doConstructSolrQuery(underTest.convert(request));
+    // THEN
+    assertEquals("?q=host%3A%28hostName%29+AND+type%3A%28componentName%29&rows=0&facet=true&facet.mincount=1&facet.limit=-1" +
+        "&facet.pivot=type%2Cpath", query.toQueryString());
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/2f038b27/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/ServiceLogTreeRequestFacetQueryConverterTest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/ServiceLogTreeRequestFacetQueryConverterTest.java b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/ServiceLogTreeRequestFacetQueryConverterTest.java
index 107a99d..a140e19 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/ServiceLogTreeRequestFacetQueryConverterTest.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/ServiceLogTreeRequestFacetQueryConverterTest.java
@@ -19,7 +19,6 @@
 package org.apache.ambari.logsearch.converter;
 
 import org.apache.ambari.logsearch.model.request.impl.ServiceLogHostComponentRequest;
-import org.apache.ambari.logsearch.model.request.impl.ServiceLogLevelCountRequest;
 import org.apache.solr.client.solrj.SolrQuery;
 import org.junit.Before;
 import org.junit.Test;

http://git-wip-us.apache.org/repos/asf/ambari/blob/2f038b27/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/UserConfigRequestQueryConverterTest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/UserConfigRequestQueryConverterTest.java b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/UserConfigRequestQueryConverterTest.java
index adeaf5b..66c172a 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/UserConfigRequestQueryConverterTest.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/UserConfigRequestQueryConverterTest.java
@@ -18,13 +18,10 @@
  */
 package org.apache.ambari.logsearch.converter;
 
-import org.apache.ambari.logsearch.model.request.impl.AuditLogRequest;
 import org.apache.ambari.logsearch.model.request.impl.UserConfigRequest;
 import org.apache.solr.client.solrj.SolrQuery;
 import org.junit.Before;
 import org.junit.Test;
-import org.springframework.data.solr.core.DefaultQueryParser;
-import org.springframework.data.solr.core.query.SimpleQuery;
 
 import static org.junit.Assert.assertEquals;
 


Mime
View raw message