You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ol...@apache.org on 2016/11/05 16:29:03 UTC

[01/58] [abbrv] ambari git commit: AMBARI-18310. Refactor logsearch portal side code (oleewere)

Repository: ambari
Updated Branches:
  refs/heads/branch-2.5 aeada8a6d -> 59c839c87


http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/dao/UserDaoTest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/dao/UserDaoTest.java b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/dao/UserDaoTest.java
deleted file mode 100644
index 703d877..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/dao/UserDaoTest.java
+++ /dev/null
@@ -1,58 +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.dao;
-
-import java.util.Collection;
-
-import org.apache.ambari.logsearch.web.model.Role;
-import org.apache.ambari.logsearch.web.model.User;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.security.core.GrantedAuthority;
-import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-
-import static junit.framework.Assert.assertEquals;
-import static junit.framework.Assert.assertTrue;
-
-@RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration(locations = { "/applicationContext.xml" })
-public class UserDaoTest {
-
-  @Autowired
-  private UserDao dao;
-  
-  @Test
-  public void testUserDaoInitAndFindUser() throws Exception {
-    User user = dao.loadUserByUsername("testUserName");
-    assertEquals(user.getUsername(), "testUserName");
-    assertEquals(user.getFirstName(), "Test User Name");
-    assertEquals(user.getLastName(), "Test User Name");
-    
-    Collection<? extends GrantedAuthority> authorities = user.getAuthorities();
-    assertTrue(authorities.size() == 1);
-    
-    Role authority = (Role)authorities.iterator().next();
-    assertEquals(authority.getName(), "ROLE_USER");
-    assertTrue(authority.getPrivileges().size() == 1);
-    assertEquals(authority.getPrivileges().get(0).getName(), "READ_PRIVILEGE");
-  }
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/test/resources/applicationContext.xml
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/test/resources/applicationContext.xml b/ambari-logsearch/ambari-logsearch-portal/src/test/resources/applicationContext.xml
deleted file mode 100644
index 38437a4..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/test/resources/applicationContext.xml
+++ /dev/null
@@ -1,53 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  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.
--->
-<beans xmlns="http://www.springframework.org/schema/beans"
-xmlns:aop="http://www.springframework.org/schema/aop" xmlns:jee="http://www.springframework.org/schema/jee"
-xmlns:tx="http://www.springframework.org/schema/tx" xmlns:context="http://www.springframework.org/schema/context"
-xmlns:task="http://www.springframework.org/schema/task" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-xmlns:util="http://www.springframework.org/schema/util"
-xsi:schemaLocation="http://www.springframework.org/schema/aop
-http://www.springframework.org/schema/aop/spring-aop-4.2.xsd
-http://www.springframework.org/schema/beans
-http://www.springframework.org/schema/beans/spring-beans-4.2.xsd
-http://www.springframework.org/schema/context
-http://www.springframework.org/schema/context/spring-context-4.2.xsd
-http://www.springframework.org/schema/jee
-http://www.springframework.org/schema/jee/spring-jee-4.2.xsd
-http://www.springframework.org/schema/tx
-http://www.springframework.org/schema/tx/spring-tx-4.2.xsd
-http://www.springframework.org/schema/task
-http://www.springframework.org/schema/task/spring-task-4.2.xsd
-http://www.springframework.org/schema/util
-http://www.springframework.org/schema/util/spring-util.xsd">
-
-	<context:component-scan base-package="org.apache.ambari.logsearch" />
-	<task:annotation-driven />
-	<bean id="xmlPropertyConfigurer" class="org.apache.ambari.logsearch.common.XMLPropertiesHelper" />
-	
-	<bean id="propertyConfigurer" class="org.apache.ambari.logsearch.common.PropertiesHelper">
-		<property name="locations">
-			<list>
-				<value>classpath:default.properties</value>
-				<value>classpath:logsearch.properties</value>
-				<value>classpath:logsearch-admin-site.xml</value>
-			</list>
-		</property>
-		<property name="propertiesPersister" ref="xmlPropertyConfigurer" />
-	</bean>
-	
-</beans>


[16/58] [abbrv] ambari git commit: AMBARI-18310. Refactor logsearch portal code - part 3 (oleewere)

Posted by ol...@apache.org.
http://git-wip-us.apache.org/repos/asf/ambari/blob/6fa4abfe/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/dashboard/BubbleGraphTableLayoutView.js
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/dashboard/BubbleGraphTableLayoutView.js b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/dashboard/BubbleGraphTableLayoutView.js
index 4fb9b51..988c593 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/dashboard/BubbleGraphTableLayoutView.js
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/dashboard/BubbleGraphTableLayoutView.js
@@ -57,28 +57,9 @@ define(['require',
 
 		/** ui events hash */
 		events: function() {
-//			var that=this,
 			var events = {};
-//			events["mouseenter .logTime"] = function(e){
-//				$(e.currentTarget).find("a").removeClass("hidden");
-//			};
-//			events["mouseleave .logTime"] = function(e){
-//				$(e.currentTarget).find("a").addClass("hidden");
-//			};
-//			events["click .logTime a[data-type='C']"] = 'onNewTabIconClick';
 			events['click [data-id="refresh-tab"]']  = 'onTabRefresh';
 			events['change ' + this.ui.viewType]  = 'onViewTypeChange';
-//			events["mouseenter .logTime"] = function(e){
-//				var $el = $(e.currentTarget);
-//				$el.append(dropdownMenu);
-//				$el.find('.quickMenu li').click(function(e){
-//					that.onQuickMenuClick(e);
-//				});
-//			};
-//			events["mouseleave .logTime"] = function(e){
-//				var $el = $(e.currentTarget);
-//				//$el.find(".quickMenu").remove();
-//			};
 			events['click .quickMenu li']  = 'onQuickMenuClick';
 			return events;
 		},
@@ -109,11 +90,7 @@ define(['require',
 			this.listenTo(this.collection, "backgrid:refresh",function(){
 				$(".contextMenuBody [data-id='F']").show();
             	$(".contextMenuBody").hide();
-            	//this.$("#loaderGraph").hide();
 				this.$(".loader").hide();
-            	//this.ui.find.trigger("keyup");
-//            	if (this.quickHelp)
-//            		this.initializeContextMenu();
             },this);
 			this.listenTo(this.collection, 'request', function(){
 				this.$("#loader").show();
@@ -126,23 +103,6 @@ define(['require',
             	this.fetchAllTogether(value);
             	this.selectionText="";
             });
-//            this.listenTo(this.vent,"tree:search",function(value){
-//            	this.fetchAllTogether(value);
-//            });
-//            this.listenTo(this.vent,"level:filter",function(value){
-//            	this.fetchAllTogether(value);
-//            });
-//            this.listenTo(this.vent,"type:mustNot",function(value){
-//            	this.fetchAllTogether(value);
-//            });
-//            this.listenTo(this.vent,"type:mustBe",function(value){
-//            	this.fetchAllTogether(value);
-//            });
-//            this.listenTo(this.vent,"logtime:filter",function(value){
-//            	this.fetchAllTogether(value);
-//            });
-//            this.listenTo(this.vent,"search:include:exclude",function(value){
-//            	this.fetchAllTogether(value);
 //            });
             this.listenTo(this.vent,"reinitialize:filter:bubbleTable",function(value){
             	this.reinitializeBubbleTableFilter(value);
@@ -151,12 +111,6 @@ define(['require',
                 this.fetchAllTogether(value);
             }, this);
             this.listenTo(this.vent, "timer:end", function(value) {
-            	//timer should start only after log table fetch is complete.
-//            	var arr = Utils.dateUtil.getRelativeDateFromString(this.params.dateRangeLabel);
-//            	if(_.isArray(arr)){
-//            		this.params.from = arr[0].toJSON();
-//                	this.params.to = arr[1].toJSON();
-//            	}
             	ViewUtils.setLatestTimeParams(this.params);
             	this.vent.trigger("tab:refresh",this.params);
             	var that = this;
@@ -180,30 +134,18 @@ define(['require',
 			var that = this;
 			this.fetchTableData((this.params) ? this.params : {q:"*:*"});
 			this.renderComponentList();
-			this.collection.getServiceLogFields({},{
-				success : function(data){
-					that.serverColumns = data;
-				},
-				complete : function(){
-					that.renderTable();
-				}
-			});
-			//this.renderTable();
-			this.renderHostList();
-			this.renderTimer();
-			if(this.quickHelp){
-				this.initializeContextMenu();
-				this.bindContextMenuClick();
-			}
+      this.renderTable();
+      this.renderHostList();
+      this.renderTimer();
+      if(this.quickHelp){
+        this.initializeContextMenu();
+        this.bindContextMenuClick();
+      }
 		},
 		onShow : function(){
 			//this.fetchGraphData((this.params) ? this.params : {q:"*:*"});
 		},
 		onTabRefresh : function(){
-//			this.fetchAllTogether({});
-//			if(this.RHostList.currentView){
-//				this.RHostList.currentView.fetchHosts({});
-//			}
 			ViewUtils.setLatestTimeParams(this.params);
 			this.vent.trigger("tab:refresh",this.params);
 		},
@@ -215,8 +157,8 @@ define(['require',
 				id = $el.data("id");
 				that.globalVent.trigger("render:tab",{
 					params:_.extend({},{
-						host :  host,
-						component : component,
+						host_name :  host,
+						component_name : component,
 						sourceLogId: id
 					},that.graphParams,{treeParams:null}),
 					globalVent : that.globalVent
@@ -292,16 +234,9 @@ define(['require',
 			var timeZone = moment().zoneAbbr(),
 			 	cols = {},
 			 	that = this;
-			_.each(this.columns,function(value,col){
-				cols[col] = {
-						label:value,
-						cell: "String",
-						sortType: 'toggle',
-						editable: false,
-				}
-			});
 			var columns = {
 					logtime : {
+            name: "logtime",
 						label: "Log Time "+(! _.isEmpty(timeZone) ? "("+timeZone+")":""),
 						cell: "html",
 						editable: false,
@@ -319,9 +254,7 @@ define(['require',
 								if(model.get("type"))
 									str += "<p style='margin-left:20px'>"+(model.get("level") ? "<label class='label label-"+model.get("level")+"'>"+model.get("level")+"</label>" : "")+
 											"<strong>"+model.get("type")+"</strong>" +
-											"</p><!--a  style='width:9%' title='Open logs in new tab' data-type='C' data-host='"+model.get("host")+"' data-node='"+model.get("type")+"' data-id='"+model.get("id")+"' href='javascript:void(0)' class='pull-right hidden'><i class='fa fa-share'></i></a-->";
-//								if(model.get("level"))
-//									str += "<p style='float:left;'><label class='label label-"+model.get("level")+"'>"+model.get("level")+"</label></p>";
+											"</p>";
 								str += '<div class="dropdown quickMenu">' +
 								  '<a class="btn btn-success btn-xs btn-quickMenu" data-toggle="dropdown">' +
 								  '<i class="fa fa-ellipsis-v"></i></span></a>' +
@@ -335,38 +268,13 @@ define(['require',
 							}
 						})
 					},
-					/*type: {
-						label: "Type",
-						cell: "String",
-						editable: false,
-						sortType: 'toggle',
-						sortable : false,
-						orderable : true,
-						displayOrder :2,
-						width : 11
-					},
-					level : {
-						label: "Level",
-						cell: "html",
-						editable: false,
-						sortType: 'toggle',
-						sortable : true,
-						orderable : false,
-						width : "6",
-						displayOrder :3,
-						formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
-							fromRaw: function(rawValue, model){
-								return "<span class='"+rawValue+"'>"+rawValue+"</span>";
-							}
-						})
-					},*/
 					log_message : {
+            name: "log_message",
 						label: "Message",
 						cell: "html",
 						editable: false,
 						sortType: 'toggle',
 						sortable : false,
-						//width : "50",
 						orderable : true,
 						displayOrder :4,
 						className : "logMessage",
@@ -418,15 +326,23 @@ define(['require',
 					}
 
 			};
-			_.each(cols,function(c,k){
-				if(columns[k] == undefined){
-					columns[k] = c;
-				}else{
-					if(columns[k] && columns[k].label){
-						columns[k].label = c.label;
-					}
-				}
-			});
+      _.each(this.columns, function(value){
+        var name = Globals.invertedServiceLogMappings[value];
+        if (columns[name] === undefined) {
+          var columnObj = {
+            name: Globals.invertedServiceLogMappings[value],
+            label:value,
+            cell: "String",
+            sortType: 'toggle',
+            editable: false
+          };
+          columns[name] = columnObj;
+        } else {
+          if (columns[name] && columns[name].label) {
+            columns[name].label = value;
+          }
+        }
+      });
 			return this.collection.constructor.getTableCols(columns, this.collection);
 		},
 		fetchTableData : function(params){
@@ -461,7 +377,6 @@ define(['require',
 		},
 		fetchGraphData : function(params){
 			var that = this;
-			//that.$("#loaderGraph").show();
 			that.$(".loader").show();
 			this.graphModel.fetch({
 				dataType:"json",
@@ -472,7 +387,6 @@ define(['require',
 				error : function(){
 				},
 				complete : function(){
-					//that.$("#loaderGraph").hide();
 					that.$(".loader").hide();
 				}
 			});
@@ -512,14 +426,6 @@ define(['require',
 		},
 		initializeContextMenu : function(){
 			var that = this;
-//			$('body').on("mouseup",function(e){
-//				console.log(e);
-//				if(! $(".contextMenuBody").is(":hidden")){
-//					if(! $(e.target).parents(".contextMenuBody").length > 0){
-//						$(".contextMenuBody").hide();
-//					}
-//				}
-//			})
 			$('body').on("mouseup.contextMenu",function(e){
 				var selection;
 				if (window.getSelection) {
@@ -572,13 +478,6 @@ define(['require',
 		onDropDownMenuClick : function(e){
 			var $el = $(e.currentTarget),type=$el.data("id");
 			if(! _.isEmpty(this.selectionText)){
-//				if(type == "F"){
-////					this.ui.find.val(this.selectionText);
-////					this.ui.find.trigger("keyup");
-//				}else{
-//					//this.vent.trigger("add:include:exclude",{type:type,value:this.selectionText});
-//					this.vent.trigger("toggle:facet",{viewName:((type === "I") ? "include" : "exclude") +"ServiceColumns",key:Globals.serviceLogsColumns["log_message"],value:this.selectionText});
-//				}
 				if(type === "I" || type === "E"){
 					this.vent.trigger("toggle:facet",{viewName:((type === "I") ? "include" : "exclude") +"ServiceColumns",
 						key:Globals.serviceLogsColumns["log_message"],value:this.selectionText});
@@ -637,7 +536,6 @@ define(['require',
             })
             $('body').css('overflow', 'hidden');
 		},
-		/** closing the movable/resizable popup */
         onDialogClosed: function() {
             if (this.dialog) {
                 this.dialog.close && this.dialog.close();
@@ -715,8 +613,8 @@ define(['require',
 				if (d3.event.shiftKey && d.depth == 2) {
 					that.globalVent.trigger("render:tab",/*new LogFileView(*/{
 						params : _.extend({
-							host :  d.parent.name,
-							component : d.name,
+							host_name :  d.parent.name,
+							component_name : d.name,
 //							level : that.collection.queryParams.level,
 //							iMessage : that.collection.queryParams.iMessage,
 //							eMessage : that.collection.queryParams.eMessage,

http://git-wip-us.apache.org/repos/asf/ambari/blob/6fa4abfe/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/dashboard/ComponentListView.js
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/dashboard/ComponentListView.js b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/dashboard/ComponentListView.js
index 2afb4e1..2d3b289 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/dashboard/ComponentListView.js
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/dashboard/ComponentListView.js
@@ -189,8 +189,8 @@ define(['require',
 					component = $el.data("type");
 					that.globalVent.trigger("render:tab",{
 						params:_.extend({},{
-							host :  host,
-							component : component
+							host_name :  host,
+							component_name : component
 						},that.searchParams,{treeParams:null}),
 						globalVent : that.globalVent
 					});

http://git-wip-us.apache.org/repos/asf/ambari/blob/6fa4abfe/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/dashboard/DashboardView.js
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/dashboard/DashboardView.js b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/dashboard/DashboardView.js
index 35814ba..461e132 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/dashboard/DashboardView.js
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/dashboard/DashboardView.js
@@ -95,10 +95,6 @@ define(['require',
 		setupSelect2Fields: function(col, idKey, textKey, selectTagId){
 			var that = this, data = [];
 			data = _.pluck(col.models, 'attributes');
-//			data = data.map(function(obj){
-//				return {id : obj[idKey], text : obj[textKey]}
-//			})
-			//data.unshift({'id': null, 'text': null});
 
 			this.ui[selectTagId].select2({
 				placeholder: 'Select',

http://git-wip-us.apache.org/repos/asf/ambari/blob/6fa4abfe/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/dashboard/HostListView.js
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/dashboard/HostListView.js b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/dashboard/HostListView.js
index 7f169c1..b8c11d8 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/dashboard/HostListView.js
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/dashboard/HostListView.js
@@ -248,8 +248,8 @@ define(['require',
 					component = $el.data("node");
 					that.globalVent.trigger("render:tab",{
 						params:_.extend({},{
-							host :  host,
-							component : component
+							host_name :  host,
+							component_name : component
 						},that.searchParams,{treeParams:null}),
 						globalVent : that.globalVent
 					});

http://git-wip-us.apache.org/repos/asf/ambari/blob/6fa4abfe/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/dashboard/MainLayoutView.js
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/dashboard/MainLayoutView.js b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/dashboard/MainLayoutView.js
index 66593c4..aa79ead 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/dashboard/MainLayoutView.js
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/dashboard/MainLayoutView.js
@@ -87,13 +87,6 @@ define(['require',
 		 */
 		initialize: function(options) {
 			_.extend(this, _.pick(options,'globalVent'));
-//			this.collection = new VLogList([], {
-//                state: {
-//                    firstPage: 0,
-//                    pageSize: 50
-//                }
-//            });
-//			this.collection.url = Globals.baseURL + "service/logs";
 			this.vent = new Backbone.Wreqr.EventAggregator();
 			this.dateUtil = Utils.dateUtil;
 			this.bindEvents();
@@ -137,8 +130,8 @@ define(['require',
 			if(params.host_name && params.component_name){
 				this.globalVent.trigger("render:tab",{
 					params:_.extend({},{
-						host :  params.host_name,
-						component : params.component_name
+						host_name :  params.host_name,
+						component_name : params.component_name
 					},params),
 					globalVent : this.globalVent
 				});
@@ -147,7 +140,7 @@ define(['require',
 		renderLogFileTab : function(view){
 			var that = this;
 			require(['views/tabs/LogFileView'], function(LogFileView){
-				var tabName = (view.params.host + view.params.component).replace(/\./g,"_");
+				var tabName = (view.params.host_name + view.params.component_name).replace(/\./g,"_");
 				if(_.isUndefined(that[tabName])){
 					var region = {};
 					region[tabName] = '#' + tabName;
@@ -160,7 +153,7 @@ define(['require',
 					var region = that.getRegion(tabName);
 					region.show(new LogFileView(view));
 					that.$(".nav.nav-tabs").append('<li data-id="'+tabName+'" role="presentation">'+
-							'<a data-id="'+tabName+'" data-host="'+view.params.host+'" data-component="'+view.params.component+'" href="#'+tabName+'" aria-controls="profile" role="tab" data-toggle="tab" title="'+view.params.host.split(".")[0]+' >> '+view.params.component+' ">'+view.params.host.split(".")[0]+'<b> >> </b>'+view.params.component+'</a>'+
+							'<a data-id="'+tabName+'" data-host="'+view.params.host_name+'" data-component="'+view.params.component_name+'" href="#'+tabName+'" aria-controls="profile" role="tab" data-toggle="tab" title="'+view.params.host_name.split(".")[0]+' >> '+view.params.component_name+' ">'+view.params.host_name.split(".")[0]+'<b> >> </b>'+view.params.component_name+'</a>'+
 	//						'<span class="air air-top-right">'+
 								'<button data-tab-id="'+tabName+'" class="btn-closeTab"><i class="fa fa-times-circle"></i></button>'+
 								'<div class="compareClick" title="Compare"><i class="fa fa-square-o"></i></div>');

http://git-wip-us.apache.org/repos/asf/ambari/blob/6fa4abfe/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/dialog/DetailLogFileView.js
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/dialog/DetailLogFileView.js b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/dialog/DetailLogFileView.js
index 5570a31..689bacd 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/dialog/DetailLogFileView.js
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/dialog/DetailLogFileView.js
@@ -68,8 +68,8 @@ define(['require',
             onRender: function() {
             	var that = this;
             	this.fetchLogs({
-            		host : this.model.get("host"),
-            		component : this.model.get("type"),
+            		host_name : this.model.get("host"),
+            		component_name : this.model.get("type"),
             		numberRows : this.defaultRecords,
             		id : this.model.get("id")
             	},{

http://git-wip-us.apache.org/repos/asf/ambari/blob/6fa4abfe/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/filter/CreateLogfeederFilterView.js
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/filter/CreateLogfeederFilterView.js b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/filter/CreateLogfeederFilterView.js
index 9bdf0fa..2c7f0aa 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/filter/CreateLogfeederFilterView.js
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/filter/CreateLogfeederFilterView.js
@@ -211,10 +211,10 @@ define(['require',
             onEditHost : function(e){
             	var $el = $(e.currentTarget);
             	$el.hide();
-            	if($el.data("type") == "host"){
-            		this.showHostSelect2($el.data("component"));
+            	if($el.data("type") == "host_name"){
+            		this.showHostSelect2($el.data("component_name"));
                 }else{
-            		this.showExpiry($el.data("component"));
+            		this.showExpiry($el.data("component_name"));
                 }
             },
             hideHostSelect2 : function(forComponent){

http://git-wip-us.apache.org/repos/asf/ambari/blob/6fa4abfe/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/tabs/ComparisonView.js
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/tabs/ComparisonView.js b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/tabs/ComparisonView.js
index f922087..7c50cbb 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/tabs/ComparisonView.js
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/tabs/ComparisonView.js
@@ -27,7 +27,6 @@ define(['require',
     'use strict';
 
     return Backbone.Marionette.Layout.extend(
-        /** @lends ComparisonView */
         {
             _viewName: 'ComparisonView',
 
@@ -80,8 +79,8 @@ define(['require',
             onRender: function() {
                 if (this.params) {
                     this.fetchCollection(this.params);
-                    if (this.params.component && this.params.host) {
-                        this.ui.tabTitle.html(this.params.host + ' <i class="fa fa-angle-double-right"></i> ' + this.params.component)
+                    if (this.params.component_name && this.params.host_name) {
+                        this.ui.tabTitle.html(this.params.host_name + ' <i class="fa fa-angle-double-right"></i> ' + this.params.component_name)
                     }
                 } else {
                     this.fetchCollection({
@@ -91,9 +90,6 @@ define(['require',
                 this.renderVisualSearch();
                 this.renderDatePicker();
                 this.renderTable();
-                /* if (this.params.from && this.params.to) {
-                     this.setDateText(this.dateUtil.getMomentObject(this.params.from), this.dateUtil.getMomentObject(this.params.to));
-                 }*/
 
             },
             renderVisualSearch: function() {
@@ -151,7 +147,6 @@ define(['require',
                         },
                         gridOpts: {
                             header: CustomBackgrid,
-                            //row: IdRow,
                             emptyText: 'No records found!'
                         },
                         filterOpts: {},
@@ -179,10 +174,7 @@ define(['require',
                                     str += "<p>" + moment(rawValue).format("YYYY-MM-DD HH:mm:ss,SSS") + "</p>";
                                 if (model.get("type"))
                                     str += "<p style='float:left;width:90%'>" + (model.get("level") ? "<label class='label label-" + (""+model.get("level")).toUpperCase() + "'>" + (""+model.get("level")).toUpperCase() + "</label>" : "") +
-                                    /* "<strong>" + model.get("type") + "</strong>" +*/
                                     "</p><a  style='width:9%' title='Open logs in new tab' data-type='C' data-host='" + model.get("host") + "' data-node='" + model.get("type") + "' href='javascript:void(0)' class='pull-right hidden'><i class='fa fa-share'></i></a>";
-                                //                              if(model.get("level"))
-                                //                                  str += "<p style='float:left;'><label class='label label-"+model.get("level")+"'>"+model.get("level")+"</label></p>";
                                 return str;
                             }
                         })
@@ -193,7 +185,6 @@ define(['require',
                         editable: false,
                         sortType: 'toggle',
                         sortable: false,
-                        //width : "50",
                         orderable: true,
                         displayOrder: 4,
                         className: "logMessage",
@@ -243,7 +234,7 @@ define(['require',
                 this.ui.dateRange.data('daterangepicker').setStartDate(start);
                 this.ui.dateRange.data('daterangepicker').setEndDate(end);
 
-            },
+            }
 
         });
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/6fa4abfe/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/tabs/HierarchyTabLayoutView.js
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/tabs/HierarchyTabLayoutView.js b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/tabs/HierarchyTabLayoutView.js
index e4d327c..43ee5db 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/tabs/HierarchyTabLayoutView.js
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/tabs/HierarchyTabLayoutView.js
@@ -1,488 +1,429 @@
 /**
-* 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.
-*/
+ * 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.
+ */
 define(['require',
-    'backbone',
-    'utils/Globals',
-    'utils/Utils',
-    'moment',
-    'utils/ViewUtils',
-    'collections/VLogList',
-    'collections/VGroupList',
-    'hbs!tmpl/tabs/HierarchyTabLayoutView_tmpl'
-],function(require,Backbone,Globals,Utils,moment,ViewUtils,VLogList,VGroupList,HierarchyTabLayoutViewTmpl){
-    'use strict';
+  'backbone',
+  'utils/Globals',
+  'utils/Utils',
+  'moment',
+  'utils/ViewUtils',
+  'collections/VLogList',
+  'collections/VGroupList',
+  'hbs!tmpl/tabs/HierarchyTabLayoutView_tmpl'
+], function (require, Backbone, Globals, Utils, moment, ViewUtils, VLogList, VGroupList, HierarchyTabLayoutViewTmpl) {
+  'use strict';
 
-	return Backbone.Marionette.Layout.extend(
-	/** @lends LogLevelView */
-	{
-		_viewName : 'HierarchyTabLayoutView',
+  return Backbone.Marionette.Layout.extend(
+    /** @lends LogLevelView */
+    {
+      _viewName: 'HierarchyTabLayoutView',
 
-		template: HierarchyTabLayoutViewTmpl,
+      template: HierarchyTabLayoutViewTmpl,
 
-		/** Layout sub regions */
-		regions: {
-			RTreeView : "#r_TreeView",
-			RBubbleTable : "#r_BubbleTable",
-			RLogLevel	: "#r_LogLevel",
-			RHistogram  : "#r_Histogram",
-			RVisualSearch : "#r_vsSearch",
-			REventHistory : "#r_EventHistory",
-			RVisualSearchIncCol : "#r_vsSearchIncCol",
-			RVisualSearchExCol : "#r_vsSearchExCol",
-			RDatePicker:"#r_DatePicker",
-			RLogSnapShot:"#r_LogSnapShot",
-			RAdvanceSearch:"#r_AdvanceSearch"
-		},
+      /** Layout sub regions */
+      regions: {
+        RTreeView: "#r_TreeView",
+        RBubbleTable: "#r_BubbleTable",
+        RLogLevel: "#r_LogLevel",
+        RHistogram: "#r_Histogram",
+        RVisualSearch: "#r_vsSearch",
+        REventHistory: "#r_EventHistory",
+        RVisualSearchIncCol: "#r_vsSearchIncCol",
+        RVisualSearchExCol: "#r_vsSearchExCol",
+        RDatePicker: "#r_DatePicker",
+        RLogSnapShot: "#r_LogSnapShot",
+        RAdvanceSearch: "#r_AdvanceSearch"
+      },
 
-		/** ui selector cache */
-		ui: {
-			applySearch : '#applySearch',
-			searchBoxBtn : '[data-id="hierarchySearchBtn"]',
-			searchBox : '[data-id="hierarchySearch"]',
-			excludeComponents : "#excludeComponents",
-			includeComponents : "#includeComponents",
-			basicSearch:'[data-id="basicSearch"]',
-			advanceSearch:'[data-id="advanceSearch"]',
-			toggleTableAccessLog:'[data-id="toggleTableAccessLog"]'
-		},
+      /** ui selector cache */
+      ui: {
+        applySearch: '#applySearch',
+        searchBoxBtn: '[data-id="hierarchySearchBtn"]',
+        searchBox: '[data-id="hierarchySearch"]',
+        excludeComponents: "#excludeComponents",
+        includeComponents: "#includeComponents",
+        basicSearch: '[data-id="basicSearch"]',
+        advanceSearch: '[data-id="advanceSearch"]',
+        toggleTableAccessLog: '[data-id="toggleTableAccessLog"]'
+      },
 
-		/** ui events hash */
-		events: function() {
-			var events = {};
-			events["click "+this.ui.applySearch] = 'applySearchBtn';
-			events["click "+this.ui.searchBoxBtn] = 'onSearchLogClick';
-			events["click .server-info a"] = 'onLogLevelClick';
-			events["change "+ this.ui.toggleTableAccessLog] = 'onSearchSwitch';
+      /** ui events hash */
+      events: function () {
+        var events = {};
+        events["click " + this.ui.applySearch] = 'applySearchBtn';
+        events["click " + this.ui.searchBoxBtn] = 'onSearchLogClick';
+        events["click .server-info a"] = 'onLogLevelClick';
+        events["change " + this.ui.toggleTableAccessLog] = 'onSearchSwitch';
 
-			return events;
-		},
+        return events;
+      },
 
-		/**
-		 * intialize a new LogLevelView Layout
-		 * @constructs
-		 */
-		initialize: function(options) {
-			_.extend(this, _.pick(options,'globalVent'));
-//			this.logLevelList = new VLogLevelList();
-//			this.logLevelList.url = Globals.baseURL + "service/logs/levels/counts/namevalues";
-//			this.logLevelList.modelAttrName = "vNameValues";
-			this.columnCollection = new VLogList([],{
-				state: {
-                    firstPage: 0,
-                    pageSize: 99999
-                }
-			});
-			this.componentsList = new VGroupList([],{
-				state: {
-                    firstPage: 0,
-                    pageSize: 99999
-                }
-			});
-			this.componentsList.url = Globals.baseURL + "service/logs/components";
-			this.vent = new Backbone.Wreqr.EventAggregator();
-
-			this.defaultParams = ViewUtils.getDefaultParamsForHierarchy();
-			this.bindEvents();
-		},
-		applyParamsDate:function(date){
-			if (date) {
-				var dateString  = date.split(',');
-				 if(dateString.length){
-				 	var checkDate = Utils.dateUtil.getMomentUTC(dateString[0]);
-				 	if(checkDate.isValid()){
-				 		if(dateString[1]){
-				 			checkDate.millisecond(dateString[1])
-				 		}else{
-				 			checkDate.millisecond('000')
-				 		}
-				 		return  checkDate.toJSON();
-				 	}
-				 }
-			}
-		},
-		bindEvents : function(){
-//			this.listenTo(this.logLevelList,"reset",function(){
-//				this.renderLogLevelCounts();
-//			},this);
-//			this.listenTo(this.vent,"main:search",function(value){
-//				this.fetchLogLevelCounts(value);
-//			},this);
-//			this.listenTo(this.vent,"tree:search",function(value){
-//            	this.fetchLogLevelCounts(value);
-//            });
-//			this.listenTo(this.vent,"type:mustNot",function(value){
-//            	this.fetchLogLevelCounts(value);
-//            });
-			this.listenTo(this.componentsList, "reset", function(col, abc){
-				this.setupSelect2Fields(col,"type", 'type', 'excludeComponents', 'Exclude Components');
-				this.setupSelect2Fields(col,"type", 'type', 'includeComponents', 'Include Components');
-			}, this);
-			this.listenTo(this.vent,"reinitialize:filter:mustBe",function(value){
-            	this.reinitializeFilterMustBe(value);
-            },this);
-			this.listenTo(this.vent,"reinitialize:filter:mustNot",function(value){
-            	this.reinitializeFilterMustNot(value);
-            },this);
-			this.listenTo(this.vent,"add:include:exclude",function(value){
-				//this.$(".vs-box").find(".fa-chevron-down").click();
-			},this);
-			this.listenTo(this.vent,"tab:refresh",function(params){
-				this.reRenderComponents(params);
-			},this);
+      /**
+       * intialize a new LogLevelView Layout
+       * @constructs
+       */
+      initialize: function (options) {
+        _.extend(this, _.pick(options, 'globalVent'));
+        this.columnCollection = new VLogList([], {
+          state: {
+            firstPage: 0,
+            pageSize: 99999
+          }
+        });
+        this.componentsList = new VGroupList([], {
+          state: {
+            firstPage: 0,
+            pageSize: 99999
+          }
+        });
+        this.componentsList.url = Globals.baseURL + "service/logs/components";
+        this.vent = new Backbone.Wreqr.EventAggregator();
 
-			this.listenTo(this.globalVent,"reinitialize:serviceLogs",function(options){
-            	this.vent.trigger("reinitialize:filter:tree reinitialize:filter:include:exclude reinitialize:filter:bubbleTable"+
-            			" reinitialize:filter:mustNot reinitialize:filter:mustBe reinitialize:filter:level reinitialize:filter:logtime",options);
-            },this);
-		},
-		onRender : function(){
-			//this.renderTreeView();
-			this.fetchServiceLogsColumns();
-			this.renderLogLevel();
-			this.renderEventHistory();
-			this.renderHistogram();
-			this.renderDatePicker();
-			//this.renderVSSearch();
-			this.renderLogSnapShot();
-//			this.fetchLogLevelCounts({q:"*:*"});
-			this.componentsList.fetch({reset:true});
-		},
-		onShow:function(){
+        this.defaultParams = ViewUtils.getDefaultParamsForHierarchy();
+        this.bindEvents();
+      },
+      applyParamsDate: function (date) {
+        if (date) {
+          var dateString = date.split(',');
+          if (dateString.length) {
+            var checkDate = Utils.dateUtil.getMomentUTC(dateString[0]);
+            if (checkDate.isValid()) {
+              if (dateString[1]) {
+                checkDate.millisecond(dateString[1])
+              } else {
+                checkDate.millisecond('000')
+              }
+              return checkDate.toJSON();
+            }
+          }
+        }
+      },
+      bindEvents: function () {
+        this.listenTo(this.componentsList, "reset", function (col, abc) {
+          this.setupSelect2Fields(col, "type", 'type', 'excludeComponents', 'Exclude Components');
+          this.setupSelect2Fields(col, "type", 'type', 'includeComponents', 'Include Components');
+        }, this);
+        this.listenTo(this.vent, "reinitialize:filter:mustBe", function (value) {
+          this.reinitializeFilterMustBe(value);
+        }, this);
+        this.listenTo(this.vent, "reinitialize:filter:mustNot", function (value) {
+          this.reinitializeFilterMustNot(value);
+        }, this);
+        this.listenTo(this.vent, "add:include:exclude", function (value) {
+          //this.$(".vs-box").find(".fa-chevron-down").click();
+        }, this);
+        this.listenTo(this.vent, "tab:refresh", function (params) {
+          this.reRenderComponents(params);
+        }, this);
 
-			//this.REventHistory.currentView.genrateTimeline();
+        this.listenTo(this.globalVent, "reinitialize:serviceLogs", function (options) {
+          this.vent.trigger("reinitialize:filter:tree reinitialize:filter:include:exclude reinitialize:filter:bubbleTable" +
+            " reinitialize:filter:mustNot reinitialize:filter:mustBe reinitialize:filter:level reinitialize:filter:logtime", options);
+        }, this);
+      },
+      onRender: function () {
+        this.fetchServiceLogsColumns();
+        this.renderLogLevel();
+        this.renderEventHistory();
+        this.renderHistogram();
+        this.renderDatePicker();
+        this.renderLogSnapShot();
+        this.componentsList.fetch({reset: true});
+      },
+      onShow: function () {
 
-		},
-		fetchServiceLogsColumns : function(){
-			var that = this;
-			this.columnCollection.getServiceLogSchemaFields({},{
-//				beforeSend : function(){
-//					that.$("#loaderAudit").show();
-//				},
-				success : function(data){
-					Globals.serviceLogsColumns = data;
-				},
-				error : function(error,data,status){
-					var obj = JSON.parse(error.responseText);
-					if(obj)
-						Utils.notifyError({content:obj.msgDesc});
-				},
-				complete : function(){
-					that.renderServiceColumnsVSSearch();
-					that.renderBubbleTableView();
-				}
-			});
-		},
-//		fetchLogLevelCounts : function(params){
-//			$.extend(this.logLevelList.queryParams,params);
-//			this.logLevelList.fetch({reset:true});
-//		},
-		renderTreeView : function(){
-			var that = this;
-			require(['views/tabs/TreeView'],function(TreeView){
-    			that.RTreeView.show(new TreeView({
-					vent : that.vent,
-					globalVent:that.globalVent,
-					params : that.defaultParams
-				}));
-            });
-		},
-		renderBubbleTableView : function(){
-			var that = this;
-			require(['views/dashboard/BubbleGraphTableLayoutView'],function(BubbleTableLayoutView){
-    			that.RBubbleTable.show(new BubbleTableLayoutView({
-					vent : that.vent,
-					globalVent:that.globalVent,
-					params : that.defaultParams,
-					columns:Globals.serviceLogsColumns,
-					quickHelp : true
-				}));
-            });
-		},
-		renderLogLevel : function(){
-			var that = this;
-			require(['views/dashboard/LogLevelBoxView'],function(LogLevelBoxView){
-	    		that.RLogLevel.show(new LogLevelBoxView({
-					vent : that.vent,
-					globalVent:that.globalVent,
-					params : that.defaultParams
-				}));
-            });
-		},
-		renderHistogram : function(){
-			var that = this;
-			require(['views/graphs/GraphLayoutView'],function(GraphLayoutView){
-	    		that.RHistogram.show(new GraphLayoutView({
-					vent : that.vent,
-					globalVent:that.globalVent,
-					params : that.defaultParams,
-					showUnit : true,
-					futureDate : true
-				}));
-            });
-		},
-		renderDatePicker:function(){
-			var that = this;
-			require(['views/common/DatePickerLayout'],function(DatePickerLayout){
-	    		that.RDatePicker.show(new DatePickerLayout({
-					vent : that.vent,
-					globalVent:that.globalVent,
-					params : that.defaultParams,
-					datePickerPosition:'left',
-					rangeLabel: true,
-					parentEl: that.$el.find('.topLevelFilter')
-				}));
-            });
-		},
-		renderLogSnapShot:function(){
-			var that = this;
-			require(['views/common/LogSnapShotLayout'],function(LogSnalShopLayout){
-	    		that.RLogSnapShot.show(new LogSnalShopLayout({
-					vent : that.vent,
-					globalVent:that.globalVent,
-					params : that.defaultParams,
-				}));
-            });
-		},
-		renderAdvanceSearch:function(){
-			var that = this;
-			require(['views/common/AdvanceSearchLayout'],function(AdvanceSearchLayout){
-	    		that.RAdvanceSearch.show(new AdvanceSearchLayout({
-					vent : that.vent,
-					globalVent:that.globalVent,
-					params : that.defaultParams,
-				}));
-            });
+      },
+      fetchServiceLogsColumns: function () {
+        var that = this;
+        this.columnCollection.getServiceLogSchemaFields({}, {
+          success: function (data) {
+            Globals.serviceLogsColumns = ViewUtils.getLogSchemaFields(data, Globals.defaultServiceLogMappings, Globals.defaultServiceLogExcludes);
+          },
+          error: function (error, data, status) {
+            var obj = JSON.parse(error.responseText);
+            if (obj)
+              Utils.notifyError({content: obj.msgDesc});
+          },
+          complete: function () {
+            that.renderServiceColumnsVSSearch();
+            that.renderBubbleTableView();
+          }
+        });
+      },
+      renderTreeView: function () {
+        var that = this;
+        require(['views/tabs/TreeView'], function (TreeView) {
+          that.RTreeView.show(new TreeView({
+            vent: that.vent,
+            globalVent: that.globalVent,
+            params: that.defaultParams
+          }));
+        });
+      },
+      renderBubbleTableView: function () {
+        var that = this;
+        require(['views/dashboard/BubbleGraphTableLayoutView'], function (BubbleTableLayoutView) {
+          that.RBubbleTable.show(new BubbleTableLayoutView({
+            vent: that.vent,
+            globalVent: that.globalVent,
+            params: that.defaultParams,
+            columns: Globals.serviceLogsColumns,
+            quickHelp: true
+          }));
+        });
+      },
+      renderLogLevel: function () {
+        var that = this;
+        require(['views/dashboard/LogLevelBoxView'], function (LogLevelBoxView) {
+          that.RLogLevel.show(new LogLevelBoxView({
+            vent: that.vent,
+            globalVent: that.globalVent,
+            params: that.defaultParams
+          }));
+        });
+      },
+      renderHistogram: function () {
+        var that = this;
+        require(['views/graphs/GraphLayoutView'], function (GraphLayoutView) {
+          that.RHistogram.show(new GraphLayoutView({
+            vent: that.vent,
+            globalVent: that.globalVent,
+            params: that.defaultParams,
+            showUnit: true,
+            futureDate: true
+          }));
+        });
+      },
+      renderDatePicker: function () {
+        var that = this;
+        require(['views/common/DatePickerLayout'], function (DatePickerLayout) {
+          that.RDatePicker.show(new DatePickerLayout({
+            vent: that.vent,
+            globalVent: that.globalVent,
+            params: that.defaultParams,
+            datePickerPosition: 'left',
+            rangeLabel: true,
+            parentEl: that.$el.find('.topLevelFilter')
+          }));
+        });
+      },
+      renderLogSnapShot: function () {
+        var that = this;
+        require(['views/common/LogSnapShotLayout'], function (LogSnalShopLayout) {
+          that.RLogSnapShot.show(new LogSnalShopLayout({
+            vent: that.vent,
+            globalVent: that.globalVent,
+            params: that.defaultParams
+          }));
+        });
+      },
+      renderAdvanceSearch: function () {
+        var that = this;
+        require(['views/common/AdvanceSearchLayout'], function (AdvanceSearchLayout) {
+          that.RAdvanceSearch.show(new AdvanceSearchLayout({
+            vent: that.vent,
+            globalVent: that.globalVent,
+            params: that.defaultParams
+          }));
+        });
 
 
-		},
-		renderVSSearch : function(){
-			var that = this;
-			require(['views/tabs/VisualSearchView'],function(VisualSearchView){
-	    		that.RVisualSearch.show(new VisualSearchView({
-					viewName : "includeExclude",
-					vent : that.vent,
-					globalVent:that.globalVent,
-					eventName : "search:include:exclude",
-					myFormatData : function(query,searchCollection){
-						var include = [],exclude=[];
-						searchCollection.each(function(m){
-								if(m.get("category") === "Exclude"){
-									(! _.isEmpty(m.get("value"))) ? exclude.push(m.get("value")):'';
-								}
-								else{
-									(! _.isEmpty(m.get("value"))) ? include.push(m.get("value")):'';
-								}
-							});
-							return {
-								iMessage : Utils.encodeIncludeExcludeStr(include,true),
-								eMessage : Utils.encodeIncludeExcludeStr(exclude,true),
-								query : query
-							};
-						}
+      },
+      renderVSSearch: function () {
+        var that = this;
+        require(['views/tabs/VisualSearchView'], function (VisualSearchView) {
+          that.RVisualSearch.show(new VisualSearchView({
+            viewName: "includeExclude",
+            vent: that.vent,
+            globalVent: that.globalVent,
+            eventName: "search:include:exclude",
+            myFormatData: function (query, searchCollection) {
+              var include = [], exclude = [];
+              searchCollection.each(function (m) {
+                if (m.get("category") === "Exclude") {
+                  (!_.isEmpty(m.get("value"))) ? exclude.push(m.get("value")) : '';
+                }
+                else {
+                  (!_.isEmpty(m.get("value"))) ? include.push(m.get("value")) : '';
+                }
+              });
+              return {
+                iMessage: Utils.encodeIncludeExcludeStr(include, true),
+                eMessage: Utils.encodeIncludeExcludeStr(exclude, true),
+                query: query
+              };
+            }
 
-				}));
-            });
-		},
-		renderServiceColumnsVSSearch : function(){
-			//Columns include exclude
-			var that = this;
-			require(['views/tabs/VisualSearchView'],function(VisualSearchView){
-				var data = _.values(Globals.serviceLogsColumns);
-				var columns = _.without( data, _.findWhere( data, "logtime"));
-				that.RVisualSearchIncCol.show(new VisualSearchView({
-					viewName : "includeServiceColumns",
-					placeholder : "Include Search",
-					vent : that.vent,
-					globalVent:that.globalVent,
-					customOptions : columns,
-					eventName : Globals.eventName.serviceLogsIncludeColumns,
-					myFormatData : function(query,searchCollection){
-						var obj=[];
-						searchCollection.each(function(m){
-							var data = {};
-							data[m.get("category")] = m.get("value");
-							obj.push(data);
-						});
-						return {
-							includeQuery : JSON.stringify(obj),
-							query : query
-						}
-					}
-				}));
-				that.RVisualSearchExCol.show(new VisualSearchView({
-					viewName : "excludeServiceColumns",
-					placeholder : "Exclude Search",
-					vent : that.vent,
-					globalVent:that.globalVent,
-					customOptions :  columns,
-					eventName : Globals.eventName.serviceLogsExcludeColumns,
-					myFormatData : function(query,searchCollection){
-						var obj=[];
-						searchCollection.each(function(m){
-							var data = {};
-							data[m.get("category")] = m.get("value");
-							obj.push(data);
-						});
-						return {
-							excludeQuery : JSON.stringify(obj),
-							query : query
-						}
-					}
-				}));
-			});
-		},
-		renderEventHistory:function(){
-			var that = this;
-			require(['views/common/EventHistoryLayout'],function(EventHistoryLayoutView){
-				that.REventHistory.show(new EventHistoryLayoutView({
-					vent : that.vent,
-					globalVent:that.globalVent,
-					params : that.defaultParams
-				}));
-			});
-		},
-		fetchCollection : function(params){
-			$.extend(this.collection.queryParams, params);
-			this.collection.fetch({reset:true});
-		},
-		onSearchLogClick : function(){
-			var value = this.ui.searchBox.val();
-			if(_.isEmpty(value)){
-				this.ui.searchBox.val("*:*");
-				value = "*:*";
-			}
-			this.vent.trigger("main:search",{q:value});
-		},
-//		renderLogLevelCounts : function(){
-//			var that = this;
-//			this.logLevelList.each(function(model){
-//				that.$("[data-total='"+model.get("name")+"']").text(model.get("value"));
-//			});
-//		},
-//		onLogLevelClick : function(e){
-//			var $el = $(e.currentTarget);
-//			if($el.hasClass("active")){
-//				$el.removeClass("active");
-//			}else{
-//				$el.addClass("active");
-//			}
-//			var params = [];
-//			_.each(this.$(".server-info a.active"),function(e){
-//				params.push($(e).find("strong").data("total"));
-//			});
-//			this.vent.trigger("level:filter",{level:params.toString()});
-//		},
-		setupSelect2Fields : function(col, idKey, textKey, selectTagId, placeHolder){
-			var that = this, data = [];
-			data = _.pluck(col.models, 'attributes');
-//			data = data.map(function(obj){
-//				return {id : obj[idKey], text : obj[textKey]}
-//			})
-			//data.unshift({'id': null, 'text': null});
-			for(var i=0;i < data.length;i++){
-				data[i].id = data[i].type;
-			}
-			this.ui[selectTagId].select2({
-				dropdownParent: that.$el,
-				placeholder: (placeHolder) ? placeHolder :'Select',
-				tags:true,
-				allowClear : true,
-				width: '100%',
-				data: { results: data, text: textKey},
-				formatSelection: function(item){
-					return item[textKey];
-				},
-    			formatResult: function(item){
-    				return item[textKey];
-				}
-			}).off("change").on("change",function(e){
-				var data = that.ui[selectTagId].select2("data").map(function(d){return d.type});
-				if(selectTagId === "excludeComponents"){
-					that.vent.trigger("tree:strike:component",data);
-					that.vent.trigger("type:mustNot",{mustNot:data.toString()});
-				}
-				if(selectTagId === "includeComponents")
-					that.vent.trigger("type:mustBe",{mustBe:data.toString()});
-			});
-		},
-		reinitializeFilterMustBe : function(values){
-			if(values.mustBe)
-				this.ui.includeComponents.select2('val',values.mustBe.split(","));
-			else
-				this.ui.includeComponents.select2('val',[]);
-		},
-		reinitializeFilterMustNot : function(values){
-			if(values.mustNot)
-				this.ui.excludeComponents.select2('val',values.mustNot.split(","));
-			else
-				this.ui.excludeComponents.select2('val',[]);
+          }));
+        });
+      },
+      renderServiceColumnsVSSearch: function () {
+        var that = this;
+        require(['views/tabs/VisualSearchView'], function (VisualSearchView) {
+          var data = _.values(Globals.serviceLogsColumns);
+          var columns = _.without(data, _.findWhere(data, "logtime"));
+          that.RVisualSearchIncCol.show(new VisualSearchView({
+            viewName: "includeServiceColumns",
+            placeholder: "Include Search",
+            vent: that.vent,
+            globalVent: that.globalVent,
+            customOptions: columns,
+            eventName: Globals.eventName.serviceLogsIncludeColumns,
+            myFormatData: function (query, searchCollection) {
+              var obj = ViewUtils.replaceColumnNamesWithKeys(searchCollection, Globals.invertedServiceLogMappings, false);
+              return {
+                includeQuery: JSON.stringify(obj),
+                query: query
+              }
+            }
+          }));
+          that.RVisualSearchExCol.show(new VisualSearchView({
+            viewName: "excludeServiceColumns",
+            placeholder: "Exclude Search",
+            vent: that.vent,
+            globalVent: that.globalVent,
+            customOptions: columns,
+            eventName: Globals.eventName.serviceLogsExcludeColumns,
+            myFormatData: function (query, searchCollection) {
+              var obj = ViewUtils.replaceColumnNamesWithKeys(searchCollection, Globals.invertedServiceLogMappings, false);
+              return {
+                excludeQuery: JSON.stringify(obj),
+                query: query
+              }
+            }
+          }));
+        });
+      },
+      renderEventHistory: function () {
+        var that = this;
+        require(['views/common/EventHistoryLayout'], function (EventHistoryLayoutView) {
+          that.REventHistory.show(new EventHistoryLayoutView({
+            vent: that.vent,
+            globalVent: that.globalVent,
+            params: that.defaultParams
+          }));
+        });
+      },
+      fetchCollection: function (params) {
+        $.extend(this.collection.queryParams, params);
+        this.collection.fetch({reset: true});
+      },
+      onSearchLogClick: function () {
+        var value = this.ui.searchBox.val();
+        if (_.isEmpty(value)) {
+          this.ui.searchBox.val("*:*");
+          value = "*:*";
+        }
+        this.vent.trigger("main:search", {q: value});
+      },
+      setupSelect2Fields: function (col, idKey, textKey, selectTagId, placeHolder) {
+        var that = this, data = [];
+        data = _.pluck(col.models, 'attributes');
+        for (var i = 0; i < data.length; i++) {
+          data[i].id = data[i].type;
+        }
+        this.ui[selectTagId].select2({
+          dropdownParent: that.$el,
+          placeholder: (placeHolder) ? placeHolder : 'Select',
+          tags: true,
+          allowClear: true,
+          width: '100%',
+          data: {results: data, text: textKey},
+          formatSelection: function (item) {
+            return item[textKey];
+          },
+          formatResult: function (item) {
+            return item[textKey];
+          }
+        }).off("change").on("change", function (e) {
+          var data = that.ui[selectTagId].select2("data").map(function (d) {
+            return d.type
+          });
+          if (selectTagId === "excludeComponents") {
+            that.vent.trigger("tree:strike:component", data);
+            that.vent.trigger("type:mustNot", {mustNot: data.toString()});
+          }
+          if (selectTagId === "includeComponents")
+            that.vent.trigger("type:mustBe", {mustBe: data.toString()});
+        });
+      },
+      reinitializeFilterMustBe: function (values) {
+        if (values.mustBe)
+          this.ui.includeComponents.select2('val', values.mustBe.split(","));
+        else
+          this.ui.includeComponents.select2('val', []);
+      },
+      reinitializeFilterMustNot: function (values) {
+        if (values.mustNot)
+          this.ui.excludeComponents.select2('val', values.mustNot.split(","));
+        else
+          this.ui.excludeComponents.select2('val', []);
 
-		},
-		reRenderComponents : function(params){
-			var iComponents = this.ui.includeComponents.val(),eComponents = this.ui.excludeComponents.val(),that=this;
-			this.componentsList.fetch({
-				reset : true,
-				complete : function(){
-					that.ui.includeComponents.select2('val',iComponents.split(","));
-					that.ui.excludeComponents.select2('val',eComponents.split(","));
-				}
-			});
-		},
-		onSearchSwitch:function(e){
-			var obj = {}
-			if(e.target.checked){
-				this.ui.advanceSearch.show();
-				this.ui.applySearch.show();
-				this.ui.basicSearch.hide();
-				obj.advanceSearch = this.RAdvanceSearch.currentView.ui.searchArea.val();
-				obj.includeQuery = null;
-				obj.excludeQuery = null;
-			} else{
-				this.ui.advanceSearch.hide();
-				this.ui.applySearch.hide();
-				this.ui.basicSearch.show();
-				obj = this.getIncludeExcludeColValues();
-				obj.advanceSearch = null;
-			}
+      },
+      reRenderComponents: function (params) {
+        var iComponents = this.ui.includeComponents.val(), eComponents = this.ui.excludeComponents.val(), that = this;
+        this.componentsList.fetch({
+          reset: true,
+          complete: function () {
+            that.ui.includeComponents.select2('val', iComponents.split(","));
+            that.ui.excludeComponents.select2('val', eComponents.split(","));
+          }
+        });
+      },
+      onSearchSwitch: function (e) {
+        var obj = {};
+        if (e.target.checked) {
+          this.ui.advanceSearch.show();
+          this.ui.applySearch.show();
+          this.ui.basicSearch.hide();
+          obj.advanceSearch = this.RAdvanceSearch.currentView.ui.searchArea.val();
+          obj.includeQuery = null;
+          obj.excludeQuery = null;
+        } else {
+          this.ui.advanceSearch.hide();
+          this.ui.applySearch.hide();
+          this.ui.basicSearch.show();
+          obj = this.getIncludeExcludeColValues();
+          obj.advanceSearch = null;
+        }
 
-			this.vent.trigger('main:search',obj);
+        this.vent.trigger('main:search', obj);
 
-		},
-		applySearchBtn : function(){
-			var obj = {}
-			obj.advanceSearch = this.RAdvanceSearch.currentView.ui.searchArea.val();
+      },
+      applySearchBtn: function () {
+        var obj = {};
+        obj.advanceSearch = this.RAdvanceSearch.currentView.ui.searchArea.val();
 
-				this.vent.trigger('main:search',obj);
+        this.vent.trigger('main:search', obj);
 
-		},
-		getIncludeExcludeColValues : function(){
-			return _.extend(this.RVisualSearchIncCol.currentView.formatData(this.RVisualSearchIncCol.currentView.visualSearch.searchBox.value(),this.RVisualSearchIncCol.currentView.visualSearch.searchQuery),
-			           this.RVisualSearchExCol.currentView.formatData(this.RVisualSearchExCol.currentView.visualSearch.searchBox.value(),this.RVisualSearchExCol.currentView.visualSearch.searchQuery));
-		},
-		toggleSearchBackToBasicSearch : function(options){
-			if(! this.ui.advanceSearch.is(":hidden")){
-				this.ui.advanceSearch.hide();
-				this.ui.basicSearch.show();
-				this.ui.toggleTableAccessLog[0].checked = false;
-				_.extend(options,this.getIncludeExcludeColValues(),{advanceSearch:null});
-			}
-		}
-	});
+      },
+      getIncludeExcludeColValues: function () {
+        return _.extend(this.RVisualSearchIncCol.currentView.formatData(this.RVisualSearchIncCol.currentView.visualSearch.searchBox.value(), this.RVisualSearchIncCol.currentView.visualSearch.searchQuery),
+          this.RVisualSearchExCol.currentView.formatData(this.RVisualSearchExCol.currentView.visualSearch.searchBox.value(), this.RVisualSearchExCol.currentView.visualSearch.searchQuery));
+      },
+      toggleSearchBackToBasicSearch: function (options) {
+        if (!this.ui.advanceSearch.is(":hidden")) {
+          this.ui.advanceSearch.hide();
+          this.ui.basicSearch.show();
+          this.ui.toggleTableAccessLog[0].checked = false;
+          _.extend(options, this.getIncludeExcludeColValues(), {advanceSearch: null});
+        }
+      }
+    });
 
 
 });

http://git-wip-us.apache.org/repos/asf/ambari/blob/6fa4abfe/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/tabs/LogFileView.js
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/tabs/LogFileView.js b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/tabs/LogFileView.js
index 0b32237..3740716 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/tabs/LogFileView.js
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/tabs/LogFileView.js
@@ -478,14 +478,6 @@ define(['require',
                 var timeZone = moment().zoneAbbr(),
                     that = this,
                     cols = {};
-                _.each(Globals.serviceLogsColumns, function(value, col) {
-                    cols[col] = {
-                        label: value,
-                        cell: "String",
-                        sortType: 'toggle',
-                        editable: false,
-                    }
-                });
                 this.cols = {
                     logtime: {
                         label: "Log Time " + (!_.isEmpty(timeZone) ? "(" + timeZone + ")" : ""),
@@ -509,30 +501,6 @@ define(['require',
                             }
                         })
                     },
-                    /*type: {
-                    	//label: "Type",
-                    	cell: "String",
-                    	editable: false,
-                    	sortType: 'toggle',
-                    	orderable : true,
-                    	displayOrder :2
-                    },*/
-                    /*level : {
-                    	label: "Level",
-                    	cell: "html",
-                    	editable: false,
-                    	sortType: 'toggle',
-                    	sortable : true,
-                    	orderable : true,
-                    	width : "5",
-                    	displayOrder :3,
-                    	formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
-                    		fromRaw: function(rawValue, model){
-                    			if(rawValue)
-                    				return "<span class='"+rawValue+"'>"+rawValue+"</span>";
-                    		}
-                    	})
-                    },*/
                     log_message: {
                         label: "Message",
                         cell: "html",
@@ -569,31 +537,24 @@ define(['require',
                         displayOrder: 6,
                         width: 6
                     }
-                    /*host : {
-                    	label: "Host",
-                    	cell: "String",
-                    	editable: false,
-                    	sortType: 'toggle',
-                    	orderable : true,
-                    	displayOrder :5
-                    },
-                    logger_name : {
-                    	cell: "String",
-                    	editable: false,
-                    	sortType: 'toggle',
-                    	orderable : true,
-                    	displayOrder :6
-                    }*/
 
                 };
-                _.each(cols, function(c, k) {
-                    if (that.cols[k] == undefined) {
-                        that.cols[k] = c;
-                    } else {
-                        if (that.cols[k] && that.cols[k].label) {
-                            that.cols[k].label = c.label;
-                        }
+                _.each(this.columns, function(value){
+                  var name = Globals.invertedServiceLogMappings[value];
+                  if (columns[name] === undefined) {
+                    var columnObj = {
+                      name: Globals.invertedServiceLogMappings[value],
+                      label:value,
+                      cell: "String",
+                      sortType: 'toggle',
+                      editable: false
+                    };
+                    columns[name] = columnObj;
+                  } else {
+                    if (columns[name] && columns[name].label) {
+                      columns[name].label = value;
                     }
+                  }
                 });
                 return this.logFileCollection.constructor.getTableCols(this.cols, this.logFileCollection);
             },
@@ -666,8 +627,8 @@ define(['require',
                 }
             },
             setHostName: function() {
-                this.$("[data-id='hostName']").text(this.params.host);
-                this.$("[data-id='componentName']").text(this.params.component);
+                this.$("[data-id='hostName']").text(this.params.host_name);
+                this.$("[data-id='componentName']").text(this.params.component_name);
             },
             getFindValue: function() {
                 return this.ui.find.val();

http://git-wip-us.apache.org/repos/asf/ambari/blob/6fa4abfe/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/tabs/TreeView.js
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/tabs/TreeView.js b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/tabs/TreeView.js
index bcd2c80..c395495 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/tabs/TreeView.js
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/tabs/TreeView.js
@@ -79,8 +79,6 @@ define(['require',
 		 */
 		initialize: function(options) {
 			_.extend(this, _.pick(options,'vent','globalVent','params'));
-//			this.collection = new VLogLevel();
-//			this.collection.url = Globals.baseURL+"service/logs/components/count";
 			this.treeModel = new VCommonModel();
 			this.searchParams = (this.params)? this.params :{};
 			this.bindEvents();
@@ -311,8 +309,8 @@ define(['require',
 				component = $el.data("node");
 				that.globalVent.trigger("render:tab",/*new LogFileView(*/{
 					params:_.extend({},{
-						host :  host,
-						component : component
+						host_name :  host,
+						component_name : component
 					},that.searchParams,{treeParams:null}),
 					globalVent : that.globalVent
 				}/*)*/);

http://git-wip-us.apache.org/repos/asf/ambari/blob/6fa4abfe/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/tabs/VisualSearchView.js
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/tabs/VisualSearchView.js b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/tabs/VisualSearchView.js
index 24e0211..8bfb85f 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/tabs/VisualSearchView.js
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/tabs/VisualSearchView.js
@@ -1,255 +1,202 @@
 /**
-* 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.
-*/
+ * 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.
+ */
 define(['require',
-    'backbone',
-    'utils/Globals',
-    'utils/Utils',
-    'collections/VLogLevelList',
-    'hbs!tmpl/tabs/VisualSearchView_tmpl',
-    'select2'
-],function(require,Backbone,Globals,Utils,VLogLevel,LogLevelTmpl){
-    'use strict';
+  'backbone',
+  'utils/Globals',
+  'utils/Utils',
+  'collections/VLogLevelList',
+  'hbs!tmpl/tabs/VisualSearchView_tmpl',
+  'select2'
+], function (require, Backbone, Globals, Utils, VLogLevel, LogLevelTmpl) {
+  'use strict';
 
-	return Backbone.Marionette.Layout.extend(
-	/** @lends VisualSearchView */
-	{
-		_viewName : 'VisualSearchView',
+  return Backbone.Marionette.Layout.extend(
+    {
+      _viewName: 'VisualSearchView',
 
-		template: LogLevelTmpl,
+      template: LogLevelTmpl,
 
-		/** Layout sub regions */
-		regions: {
-		},
+      /** Layout sub regions */
+      regions: {},
 
-		/** ui selector cache */
-		ui: {
-			vsContainer : "#vs_container",
-		},
+      /** ui selector cache */
+      ui: {
+        vsContainer: "#vs_container",
+      },
 
-		/** ui events hash */
-		events: function() {
-			var events = {};
-			events['click #searchLog'] = 'onSearchLogClick';
-			return events;
-		},
+      /** ui events hash */
+      events: function () {
+        var events = {};
+        events['click #searchLog'] = 'onSearchLogClick';
+        return events;
+      },
 
-		/**
-		 * intialize a new VisualSearchView Layout
-		 * @constructs
-		 */
-		initialize: function(options) {
-			_.extend(this, _.pick(options,'vent','globalVent','params','customOptions','eventName','myFormatData','placeholder', 'viewName'));
-			this.bindEvents();
-		},
-		onRender : function(){
-			var query="";
-//			if(this.customOptions){
-//				
-//			}
-//			if(this.params && this.params.query){
-//				query = this.params.query;
-//			}
-			this.initializeSearch(this.formQueryDataFromParams(this.params));
-		},
-		bindEvents : function(){
-			this.listenTo(this.vent,"reinitialize:filter:include:exclude",function(value){
-            	this.reinitializeFilter(value);
-            });
-			this.listenTo(this.vent,"add:include:exclude",function(value){
-            	this.addIncludeExclude(value);
-            });
-			this.listenTo(this.vent,"toggle:facet",function(obj){
-            	this.toggleFacet(obj);
+      initialize: function (options) {
+        _.extend(this, _.pick(options, 'vent', 'globalVent', 'params', 'customOptions', 'eventName', 'myFormatData', 'placeholder', 'viewName'));
+        this.bindEvents();
+      },
+      onRender: function () {
+        this.initializeSearch(this.formQueryDataFromParams(this.params));
+      },
+      bindEvents: function () {
+        this.listenTo(this.vent, "reinitialize:filter:include:exclude", function (value) {
+          this.reinitializeFilter(value);
+        });
+        this.listenTo(this.vent, "add:include:exclude", function (value) {
+          this.addIncludeExclude(value);
+        });
+        this.listenTo(this.vent, "toggle:facet", function (obj) {
+          this.toggleFacet(obj);
+        });
+      },
+      initializeSearch: function (query) {
+        var opts = (this.customOptions) ? this.customOptions : ["Include", "Exclude"], that = this;
+        this.visualSearch = VS.init({
+          placeholder: (!this.placeholder) ? "Search String" : this.placeholder,
+          container: this.ui.vsContainer,
+          query: query,
+          remainder: false,
+          callbacks: {
+            search: function (query, searchCollection) {
+              var eventName = (!that.eventName) ? "search:include:exclude" : that.eventName;
+              that.vent.trigger(eventName, that.formatData(query, searchCollection));
+            },
+            facetMatches: function (callback) {
+              callback(opts, {preserveOrder: true});
+            },
+            valueMatches: function (facet, searchTerm, callback) {
+            }
+          }
+        });
+      },
+      formatData: function (query, searchCollection) {
+        if (_.isFunction(this.myFormatData)) {
+          return this.myFormatData(query, searchCollection);
+        }
+        var include = [], exclude = [], obj = [], that = this;
+        searchCollection.each(function (m) {
+          if (!that.customOptions) {
+            if (m.get("category") === "Exclude") {
+              (!_.isEmpty(m.get("value"))) ? exclude.push(m.get("value")) : '';
+            }
+            else {
+              (!_.isEmpty(m.get("value"))) ? include.push(m.get("value")) : '';
+            }
+          } else {
+            var data = {};
+            data[m.get("category")] = m.get("value");
+            obj.push(data);
+          }
+
+        });
+        if (!this.customOptions) {
+          return {
+            iMessage: Utils.encodeIncludeExcludeStr(include, true),
+            eMessage: Utils.encodeIncludeExcludeStr(exclude, true),
+            query: query
+          };
+        } else {
+          return {
+            columnQuery: JSON.stringify(obj),
+            query: query
+          }
+        }
+
+
+      },
+      reinitializeFilter: function (values) {
+        var query = "";
+        if (this.viewName) {
+          query = this.formQueryDataFromParams(values);
+        }
+        if (!_.isUndefined(query)) {
+          this.initializeSearch(query);
+        }
+      },
+      addIncludeExclude: function (value) {
+        if (this.customOptions)
+          return;
+        if (value) {
+          var e = $.Event("keydown");
+          e.keyCode = 13;
+          this.visualSearch.searchBox.addFacet((value.type == "I") ? "Include" : "Exclude", value.value);
+          this.visualSearch.options.callbacks.search(this.visualSearch.searchBox.value(), this.visualSearch.searchQuery);
+        }
+      },
+      toggleFacet: function (obj) {
+        if (_.isObject(obj)) {
+          if (obj.viewName == this.viewName) {
+            var view = _.find(this.visualSearch.searchBox.facetViews, function (v) {
+              return v.model.get("category") === obj.key && v.model.get("value") === obj.value;
             });
-		},
-		initializeSearch : function(query) {
-			var that = this;
-			var opts = (this.customOptions) ? this.customOptions : [ "Include", "Exclude" ],that=this;
-			this.visualSearch = VS.init({
-				placeholder : (!this.placeholder) ? "Search String" : this.placeholder,
-				container : this.ui.vsContainer,
-				query : query,
-				remainder : false,
-				callbacks : {
-					search : function(query, searchCollection) {
-						var eventName = (! that.eventName) ? "search:include:exclude" : that.eventName;  
-//						if(! that.customOptions)
-//							that.vent.trigger("search:include:exclude",that.formatData(query,searchCollection));
-//						else
-//							that.vent.trigger("search:audit:query",that.formatData(query,searchCollection));
-						that.vent.trigger(eventName,that.formatData(query,searchCollection));
-					},
-					facetMatches : function(callback) {
-//						var searchOptTemp = $.extend(true, [], opts);
-//						that.visualSearch.searchQuery.each(function(m) {
-//							if ($.inArray(m.get('category'), searchOptTemp) >= 0) {
-//								searchOptTemp.splice($.inArray(m.get('category'),
-//										searchOptTemp), 1);
-//							}
-//						});
-//						callback(searchOptTemp,{preserveOrder: true});
-						callback(opts,{preserveOrder: true});
-					},
-					valueMatches : function(facet, searchTerm, callback) {
-//						that.$('vsLoader').show();
-//						$.ajax({
-//							url: '/service/dashboard/getSuggestoins?fieldName='+facet+'&valueToSuggest='+searchTerm+'',
-//							type: 'GET',
-//							success: function(result){
-//								console.log(result);
-//								callback(result,{preserveOrder: false});
-//							},
-//							error:function(){},
-//							complete:function(){
-//								//that.$('vsLoader').hide();
-//							}
-//						});
-					}
-				}
-			});
-		},
-		formatData : function(query,searchCollection){
-			if(_.isFunction(this.myFormatData)){
-				return this.myFormatData(query,searchCollection);
-			}
-			var include = [],exclude=[],obj=[],that=this;
-			searchCollection.each(function(m){
-				if(! that.customOptions){
-					if(m.get("category") === "Exclude"){
-						(! _.isEmpty(m.get("value"))) ? exclude.push(m.get("value")):'';
-					}
-					else{
-						(! _.isEmpty(m.get("value"))) ? include.push(m.get("value")):'';
-					}
-				}else{
-					var data = {};
-					data[m.get("category")] = m.get("value");
-					obj.push(data);
-				}
-				
-			});
-			if(! this.customOptions){
-				return {
-					iMessage : Utils.encodeIncludeExcludeStr(include,true),
-					eMessage : Utils.encodeIncludeExcludeStr(exclude,true),
-					query : query
-				};
-			}else{
-				return {
-					columnQuery : JSON.stringify(obj),
-					query : query
-				}
-			}
-				
-					
-		},
-		reinitializeFilter : function(values){
-			var query = "";
-			if(this.viewName){
-				query = this.formQueryDataFromParams(values);
-			}
-			if(! _.isUndefined(query)){
-				this.initializeSearch(query);
-				//this.vent.trigger("search:include:exclude",values);
-			}
-		},
-		addIncludeExclude : function(value){
-			//If this view is running for options other then Include/Exclude than return
-			if(this.customOptions)
-				return
-			if(value){
-				var e = $.Event("keydown");
-				e.keyCode = 13;
-				this.visualSearch.searchBox.addFacet((value.type == "I") ? "Include" : "Exclude",value.value);
-				this.visualSearch.options.callbacks.search(this.visualSearch.searchBox.value(), this.visualSearch.searchQuery);
-//				this.visualSearch.searchBox.searchEvent(e);
-//				this.visualSearch.searchBox.removeFocus();
-			}
-		},
-		toggleFacet : function(obj){
-			if(_.isObject(obj)){
-				if(obj.viewName == this.viewName){
-//					var e = $.Event("click");
-//					e.keyCode = 13;
-//					var model = _.find(this.visualSearch.searchQuery.models,function(m){
-//							return m.get("category") === obj.key && m.get("value") === obj.value;
-//					});
-					//obj.value = obj.value.replace(/:/, '\\\\:').replace(/\"/g, '\\"').replace(/\n/g, "\\n");
-					var view = _.find(this.visualSearch.searchBox.facetViews,function(v){
-						return v.model.get("category") === obj.key && v.model.get("value") === obj.value;
-					});
-					if(view){
-						var e = $.Event("click");
-						e.keyCode = 13;
-						view.model.set("value",undefined);
-						view.remove(e);
-					}else
-						this.visualSearch.searchBox.addFacet(obj.key,obj.value);
-//					var keypress = $.Event("keydown");
-//					keypress.keyCode = 13;
-//					this.visualSearch.searchBox.searchEvent(keypress);
-//					this.visualSearch.searchBox.removeFocus();
-					this.visualSearch.options.callbacks.search(this.visualSearch.searchBox.value(), this.visualSearch.searchQuery);
-				}
-			}
-		},
-		formQueryDataFromParams : function(values){
-			if(!values)
-				return
-			var query = "";
-			try{
-				var arr;
-				if(this.viewName == "includeServiceColumns" && values.includeQuery){
-					arr = JSON.parse(values.includeQuery);
-				}else if(this.viewName == "excludeServiceColumns" && values.excludeQuery){
-					arr = JSON.parse(values.excludeQuery);
-				}
-				if(_.isArray(arr)){
-					for(var i=0; i<arr.length; i++){
-						var key = _.keys(arr[i])[0]; 
-						query += "'"+key+ "':'" +arr[i][key] +"' ";
-					}
-				}
-				if(this.viewName === "includeExclude" && (values.iMessage || values.eMessage)){
-					var valuesArr,key;
-					if(values.iMessage){
-						valuesArr = values.iMessage.split(Globals.splitToken);
-						key = "Include: ";
-						for(var i=0; i<valuesArr.length; i++){
-							query += key+ '"'+valuesArr[i]+'" ';
-						}
-					}
-					if(values.eMessage){
-						valuesArr = values.eMessage.split(Globals.splitToken);
-						key = "Exclude: ";
-						for(var i=0; i<valuesArr.length; i++){
-							query += key+ '"'+valuesArr[i]+'" ';
-						}
-					}
-					
-					
-				}
-			}catch(e){
-				console.log("Error",e);
-			}
-			return query;
-		}
-	});
-	
-	
+            if (view) {
+              var e = $.Event("click");
+              e.keyCode = 13;
+              view.model.set("value", undefined);
+              view.remove(e);
+            } else
+              this.visualSearch.searchBox.addFacet(obj.key, obj.value);
+            this.visualSearch.options.callbacks.search(this.visualSearch.searchBox.value(), this.visualSearch.searchQuery);
+          }
+        }
+      },
+      formQueryDataFromParams: function (values) {
+        if (!values)
+          return;
+        var query = "";
+        try {
+          var arr;
+          if (this.viewName == "includeServiceColumns" && values.includeQuery) {
+            arr = JSON.parse(values.includeQuery);
+          } else if (this.viewName == "excludeServiceColumns" && values.excludeQuery) {
+            arr = JSON.parse(values.excludeQuery);
+          }
+          if (_.isArray(arr)) {
+            for (var i = 0; i < arr.length; i++) {
+              var key = _.keys(arr[i])[0];
+              query += "'" + key + "':'" + arr[i][key] + "' ";
+            }
+          }
+          if (this.viewName === "includeExclude" && (values.iMessage || values.eMessage)) {
+            var valuesArr, key;
+            if (values.iMessage) {
+              valuesArr = values.iMessage.split(Globals.splitToken);
+              key = "Include: ";
+              for (var i = 0; i < valuesArr.length; i++) {
+                query += key + '"' + valuesArr[i] + '" ';
+              }
+            }
+            if (values.eMessage) {
+              valuesArr = values.eMessage.split(Globals.splitToken);
+              key = "Exclude: ";
+              for (var i = 0; i < valuesArr.length; i++) {
+                query += key + '"' + valuesArr[i] + '" ';
+              }
+            }
+          }
+        } catch (e) {
+          console.log("Error", e);
+        }
+        return query;
+      }
+
+
+    });
+
+
 });
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/6fa4abfe/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/static/schema_fields.json
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/static/schema_fields.json b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/static/schema_fields.json
new file mode 100644
index 0000000..8620c11
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/static/schema_fields.json
@@ -0,0 +1,71 @@
+{
+  "serviceLogMappings": {
+    "log_message": "Message",
+    "bundle_id": "Bundle Id",
+    "case_id": "Case Id",
+    "cluster": "Cluster",
+    "event_count": "Event Count",
+    "file": "File",
+    "host": "Host",
+    "id": "Id",
+    "ip": "Ip",
+    "level": "Level",
+    "line_number": "Line Number",
+    "logtype": "Log Type",
+    "logfile_line_number": "Logfile Line Number",
+    "logger_name": "Logger Name",
+    "logtime": "logtime",
+    "method": "Method",
+    "path": "Path",
+    "rowtype": "Row Type",
+    "thread_name": "Thread",
+    "type": "Type"
+  },
+  "serviceLogExcludes": ["tags", "text", "message", "seq_num"],
+  "auditLogMappings": {
+    "enforcer": "Access Enforcer",
+    "access": "Access Type",
+    "action": "Action",
+    "agent": "Agent",
+    "agentHost": "Agent Host",
+    "authType": "Auth Type",
+    "bundle_id": "Bundle Id",
+    "case_id": "Case Id",
+    "cliIP": "Client Ip",
+    "cliType": "Client Type",
+    "cluster": "Cluster",
+    "dst": "DST",
+    "event_count": "Event Count",
+    "evtTime": "Event Time",
+    "file": "File",
+    "host": "Host",
+    "id": "Id",
+    "ip": "IP",
+    "level": "Level",
+    "log_message": "Log Message",
+    "logType": "Log Type",
+    "logfile_line_number": "Logfile Line Number",
+    "logger_name": "Logger Name",
+    "logtime": "logtime",
+    "path": "Path",
+    "perm": "Perm",
+    "policy": "Policy",
+    "proxyUsers": "Proxy Users",
+    "reason": "Reason",
+    "repo": "Repo",
+    "repoType": "Repo Type",
+    "req_caller_id": "Req Caller Id",
+    "reqContext": "Req Context",
+    "reqData": "Req Data",
+    "req_self_id": "Req Self Id",
+    "resType": "Res Type",
+    "resource": "Resource",
+    "result": "Result",
+    "sess": "Sess",
+    "text": "Text",
+    "type": "Type",
+    "ugi": "UGI",
+    "reqUser": "User"
+  },
+  "auditLogExcludes": ["tags","tags_str", "seq_num"]
+}
\ No newline at end of file


[17/58] [abbrv] ambari git commit: AMBARI-18310. Refactor logsearch portal code - part 3 (oleewere)

Posted by ol...@apache.org.
http://git-wip-us.apache.org/repos/asf/ambari/blob/6fa4abfe/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/AuditLogsResource.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/AuditLogsResource.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/AuditLogsResource.java
index ff185f8..0bd326e 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/AuditLogsResource.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/AuditLogsResource.java
@@ -45,7 +45,6 @@ import org.apache.ambari.logsearch.query.model.AuditBarGraphSearchCriteria;
 import org.apache.ambari.logsearch.query.model.CommonSearchCriteria;
 import org.apache.ambari.logsearch.query.model.FieldAuditLogSearchCriteria;
 import org.apache.ambari.logsearch.query.model.FieldAuditBarGraphSearchCriteria;
-import org.apache.ambari.logsearch.query.model.SearchCriteria;
 import org.apache.ambari.logsearch.model.request.impl.AuditLogRequest;
 import org.apache.ambari.logsearch.manager.AuditLogsManager;
 import org.apache.ambari.logsearch.query.model.UserExportSearchCriteria;

http://git-wip-us.apache.org/repos/asf/ambari/blob/6fa4abfe/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/LogFileResource.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/LogFileResource.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/LogFileResource.java
deleted file mode 100644
index c23f457..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/LogFileResource.java
+++ /dev/null
@@ -1,69 +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.rest;
-
-import javax.inject.Inject;
-import javax.ws.rs.BeanParam;
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
-import javax.ws.rs.Produces;
-
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import org.apache.ambari.logsearch.model.request.impl.LogFileRequest;
-import org.apache.ambari.logsearch.model.request.impl.LogFileTailRequest;
-import org.apache.ambari.logsearch.model.response.LogFileDataListResponse;
-import org.apache.ambari.logsearch.model.response.LogListResponse;
-import org.apache.ambari.logsearch.query.model.LogFileSearchCriteria;
-import org.apache.ambari.logsearch.query.model.LogFileTailSearchCriteria;
-import org.apache.ambari.logsearch.manager.LogFileManager;
-import org.springframework.context.annotation.Scope;
-import org.springframework.core.convert.ConversionService;
-import org.springframework.stereotype.Component;
-
-import static org.apache.ambari.logsearch.doc.DocConstants.LogFileOperationDescriptions.*;
-
-@Api(value = "logfile", description = "Logfile operations")
-@Path("logfile")
-@Component
-@Scope("request")
-public class LogFileResource {
-
-  @Inject
-  private LogFileManager logFileManager;
-
-  @Inject
-  private ConversionService conversionService;
-
-  @GET
-  @Produces({"application/json"})
-  @ApiOperation(SEARCH_LOG_FILES_OD)
-  public LogFileDataListResponse searchLogFiles(@BeanParam LogFileRequest request) {
-    return logFileManager.searchLogFiles(conversionService.convert(request, LogFileSearchCriteria.class));
-  }
-
-  @GET
-  @Path("/tail")
-  @Produces({"application/json"})
-  @ApiOperation(GET_LOG_FILE_TAIL_OD)
-  public LogListResponse getLogFileTail(@BeanParam LogFileTailRequest request) {
-    return logFileManager.getLogFileTail(conversionService.convert(request, LogFileTailSearchCriteria.class));
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/6fa4abfe/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 6cc69d4..5a17147 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
@@ -34,7 +34,6 @@ import org.apache.ambari.logsearch.model.request.impl.ServiceAnyGraphRequest;
 import org.apache.ambari.logsearch.model.request.impl.ServiceExtremeDatesRequest;
 import org.apache.ambari.logsearch.model.request.impl.ServiceGraphRequest;
 import org.apache.ambari.logsearch.model.request.impl.ServiceLogExportRequest;
-import org.apache.ambari.logsearch.model.request.impl.ServiceLogFileRequest;
 import org.apache.ambari.logsearch.model.request.impl.ServiceLogRequest;
 import org.apache.ambari.logsearch.model.request.impl.ServiceLogTruncatedRequest;
 import org.apache.ambari.logsearch.model.response.BarGraphDataListResponse;
@@ -44,15 +43,12 @@ import org.apache.ambari.logsearch.model.response.GroupListResponse;
 import org.apache.ambari.logsearch.model.response.NameValueDataListResponse;
 import org.apache.ambari.logsearch.model.response.NodeListResponse;
 import org.apache.ambari.logsearch.model.response.ServiceLogResponse;
-import org.apache.ambari.logsearch.query.model.CommonSearchCriteria;
 import org.apache.ambari.logsearch.query.model.CommonServiceLogSearchCriteria;
-import org.apache.ambari.logsearch.query.model.SearchCriteria;
 import org.apache.ambari.logsearch.manager.ServiceLogsManager;
 import org.apache.ambari.logsearch.query.model.ServiceAnyGraphSearchCriteria;
 import org.apache.ambari.logsearch.query.model.ServiceExtremeDatesCriteria;
 import org.apache.ambari.logsearch.query.model.ServiceGraphSearchCriteria;
 import org.apache.ambari.logsearch.query.model.ServiceLogExportSearchCriteria;
-import org.apache.ambari.logsearch.query.model.ServiceLogFileSearchCriteria;
 import org.apache.ambari.logsearch.query.model.ServiceLogSearchCriteria;
 import org.apache.ambari.logsearch.query.model.ServiceLogTruncatedSearchCriteria;
 import org.springframework.context.annotation.Scope;
@@ -132,8 +128,8 @@ public class ServiceLogsResource {
   @Path("/tree")
   @Produces({"application/json"})
   @ApiOperation(GET_TREE_EXTENSION_OD)
-  public NodeListResponse getTreeExtension(@QueryParam("hostName") @ApiParam String hostName, @BeanParam ServiceLogFileRequest request) {
-    ServiceLogFileSearchCriteria searchCriteria = conversionService.convert(request, ServiceLogFileSearchCriteria.class);
+  public NodeListResponse getTreeExtension(@QueryParam("hostName") @ApiParam String hostName, @BeanParam ServiceLogRequest request) {
+    ServiceLogSearchCriteria searchCriteria = conversionService.convert(request, ServiceLogSearchCriteria.class);
     searchCriteria.addParam("hostName", hostName); // TODO: use host_name instead - needs UI change
     return serviceLogsManager.getTreeExtension(searchCriteria);
   }
@@ -142,8 +138,8 @@ public class ServiceLogsResource {
   @Path("/levels/counts/namevalues")
   @Produces({"application/json"})
   @ApiOperation(GET_LOG_LEVELS_COUNT_OD)
-  public NameValueDataListResponse getLogsLevelCount(@BeanParam ServiceLogFileRequest request) {
-    return serviceLogsManager.getLogsLevelCount(conversionService.convert(request, ServiceLogFileSearchCriteria.class));
+  public NameValueDataListResponse getLogsLevelCount(@BeanParam ServiceLogRequest request) {
+    return serviceLogsManager.getLogsLevelCount(conversionService.convert(request, ServiceLogSearchCriteria.class));
   }
 
   @GET
@@ -175,8 +171,8 @@ public class ServiceLogsResource {
   @Path("/hosts/components")
   @Produces({"application/json"})
   @ApiOperation(GET_HOST_LIST_BY_COMPONENT_OD)
-  public NodeListResponse getHostListByComponent(@BeanParam ServiceLogFileRequest request, @QueryParam("componentName") @ApiParam String componentName) {
-    ServiceLogFileSearchCriteria searchCriteria = conversionService.convert(request, ServiceLogFileSearchCriteria.class);
+  public NodeListResponse getHostListByComponent(@BeanParam ServiceLogRequest request, @QueryParam("componentName") @ApiParam String componentName) {
+    ServiceLogSearchCriteria searchCriteria = conversionService.convert(request, ServiceLogSearchCriteria.class);
     searchCriteria.addParam("componentName", componentName); // TODO: use component_name instead - needs UI change
     return serviceLogsManager.getHostListByComponent(searchCriteria);
   }
@@ -185,8 +181,8 @@ public class ServiceLogsResource {
   @Path("/components/levels/counts")
   @Produces({"application/json"})
   @ApiOperation(GET_COMPONENT_LIST_WITH_LEVEL_COUNT_OD)
-  public NodeListResponse getComponentListWithLevelCounts(@BeanParam ServiceLogFileRequest request) {
-    return serviceLogsManager.getComponentListWithLevelCounts(conversionService.convert(request, ServiceLogFileSearchCriteria.class));
+  public NodeListResponse getComponentListWithLevelCounts(@BeanParam ServiceLogRequest request) {
+    return serviceLogsManager.getComponentListWithLevelCounts(conversionService.convert(request, ServiceLogSearchCriteria.class));
   }
 
   @GET
@@ -198,14 +194,6 @@ public class ServiceLogsResource {
   }
 
   @GET
-  @Path("/fields")
-  @Produces({"application/json"})
-  @ApiOperation(GET_SERVICE_LOGS_FIELD_NAME_OD)
-  public String getServiceLogsFieldsName() {
-    return serviceLogsManager.getServiceLogsFieldsName();
-  }
-
-  @GET
   @Path("/schema/fields")
   @Produces({"application/json"})
   @ApiOperation(GET_SERVICE_LOGS_SCHEMA_FIELD_NAME_OD)

http://git-wip-us.apache.org/repos/asf/ambari/blob/6fa4abfe/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchExternalServerAuthenticationProvider.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchExternalServerAuthenticationProvider.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchExternalServerAuthenticationProvider.java
index d398bdc..a89b5dd 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchExternalServerAuthenticationProvider.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchExternalServerAuthenticationProvider.java
@@ -25,7 +25,7 @@ import javax.inject.Inject;
 
 import org.apache.ambari.logsearch.common.ExternalServerClient;
 import org.apache.ambari.logsearch.common.PropertiesHelper;
-import org.apache.ambari.logsearch.conf.AuthConfig;
+import org.apache.ambari.logsearch.conf.AuthPropsConfig;
 import org.apache.ambari.logsearch.util.JSONUtil;
 import org.apache.commons.lang.StringEscapeUtils;
 import org.apache.commons.lang.StringUtils;
@@ -99,7 +99,7 @@ public class LogsearchExternalServerAuthenticationProvider extends
   private ExternalServerClient externalServerClient;
 
   @Inject
-  private AuthConfig authConfig;
+  private AuthPropsConfig authPropsConfig;
 
   /**
    * Authenticating user from external-server using REST call
@@ -113,7 +113,7 @@ public class LogsearchExternalServerAuthenticationProvider extends
   @Override
   public Authentication authenticate(Authentication authentication)
       throws AuthenticationException {
-    if (!authConfig.isAuthExternalEnabled()) {
+    if (!authPropsConfig.isAuthExternalEnabled()) {
       LOG.debug("external server auth is disabled.");
       return authentication;
     }
@@ -129,7 +129,7 @@ public class LogsearchExternalServerAuthenticationProvider extends
     password = StringEscapeUtils.unescapeHtml(password);
     username = StringEscapeUtils.unescapeHtml(username);
     try {
-      String finalLoginUrl = authConfig.getExternalAuthLoginUrl().replace("$USERNAME", username);
+      String finalLoginUrl = authPropsConfig.getExternalAuthLoginUrl().replace("$USERNAME", username);
       String responseObj = (String) externalServerClient.sendGETRequest(
           finalLoginUrl, String.class, null, username, password);
       if (!isAllowedRole(responseObj)) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/6fa4abfe/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchFileAuthenticationProvider.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchFileAuthenticationProvider.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchFileAuthenticationProvider.java
index 9662266..dc70b82 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchFileAuthenticationProvider.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchFileAuthenticationProvider.java
@@ -20,7 +20,7 @@ package org.apache.ambari.logsearch.web.security;
 
 import java.util.Collection;
 
-import org.apache.ambari.logsearch.conf.AuthConfig;
+import org.apache.ambari.logsearch.conf.AuthPropsConfig;
 import org.apache.ambari.logsearch.util.CommonUtil;
 import org.apache.commons.lang.StringEscapeUtils;
 import org.apache.commons.lang.StringUtils;
@@ -42,14 +42,14 @@ public class LogsearchFileAuthenticationProvider extends LogsearchAbstractAuthen
   private static Logger logger = Logger.getLogger(LogsearchFileAuthenticationProvider.class);
 
   @Inject
-  private AuthConfig authConfig;
+  private AuthPropsConfig authPropsConfig;
 
   @Inject
   private UserDetailsService userDetailsService;
 
   @Override
   public Authentication authenticate(Authentication authentication) throws AuthenticationException {
-    if (!authConfig.isAuthFileEnabled()) {
+    if (!authPropsConfig.isAuthFileEnabled()) {
       logger.debug("File auth is disabled.");
       return authentication;
     }

http://git-wip-us.apache.org/repos/asf/ambari/blob/6fa4abfe/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchLdapAuthenticationProvider.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchLdapAuthenticationProvider.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchLdapAuthenticationProvider.java
index f6c7df0..52dd66e 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchLdapAuthenticationProvider.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchLdapAuthenticationProvider.java
@@ -20,7 +20,7 @@ package org.apache.ambari.logsearch.web.security;
 
 import java.util.List;
 
-import org.apache.ambari.logsearch.conf.AuthConfig;
+import org.apache.ambari.logsearch.conf.AuthPropsConfig;
 import org.apache.log4j.Logger;
 import org.springframework.ldap.CommunicationException;
 import org.springframework.ldap.core.support.LdapContextSource;
@@ -47,7 +47,7 @@ public class LogsearchLdapAuthenticationProvider extends
   private String logStatement = "";
 
   @Inject
-  private AuthConfig authConfig;
+  private AuthPropsConfig authPropsConfig;
 
   public LogsearchLdapAuthenticationProvider() {
   }
@@ -55,7 +55,7 @@ public class LogsearchLdapAuthenticationProvider extends
   @PostConstruct
   public void postConstruct() {
     logger.debug("Creating object of ldap auth provider ");
-    if (authConfig.isAuthLdapEnabled()) {
+    if (authPropsConfig.isAuthLdapEnabled()) {
       ldapAuthProvider = loadLdapAuthenticationProvider();
     } else {
       logger.info("Ldap auth is disabled");
@@ -65,7 +65,7 @@ public class LogsearchLdapAuthenticationProvider extends
   @Override
   public Authentication authenticate(Authentication authentication)
     throws AuthenticationException {
-    if (!authConfig.isAuthLdapEnabled()) {
+    if (!authPropsConfig.isAuthLdapEnabled()) {
       logger.debug("Ldap auth is disabled");
       return authentication;
     }

http://git-wip-us.apache.org/repos/asf/ambari/blob/6fa4abfe/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchSimpleAuthenticationProvider.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchSimpleAuthenticationProvider.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchSimpleAuthenticationProvider.java
index 5dc1c1f..17d099b 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchSimpleAuthenticationProvider.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchSimpleAuthenticationProvider.java
@@ -18,7 +18,7 @@
  */
 package org.apache.ambari.logsearch.web.security;
 
-import org.apache.ambari.logsearch.conf.AuthConfig;
+import org.apache.ambari.logsearch.conf.AuthPropsConfig;
 import org.apache.ambari.logsearch.web.model.User;
 import org.apache.commons.lang.StringEscapeUtils;
 import org.apache.commons.lang.StringUtils;
@@ -37,11 +37,11 @@ public class LogsearchSimpleAuthenticationProvider extends LogsearchAbstractAuth
   private static Logger logger = Logger.getLogger(LogsearchSimpleAuthenticationProvider.class);
 
   @Inject
-  private AuthConfig authConfig;
+  private AuthPropsConfig authPropsConfig;
 
   @Override
   public Authentication authenticate(Authentication authentication) throws AuthenticationException {
-    if (!authConfig.isAuthSimpleEnabled()) {
+    if (!authPropsConfig.isAuthSimpleEnabled()) {
       logger.debug("Simple auth is disabled");
       return authentication;
     }

http://git-wip-us.apache.org/repos/asf/ambari/blob/6fa4abfe/ambari-logsearch/ambari-logsearch-portal/src/main/resources/default.properties
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/resources/default.properties b/ambari-logsearch/ambari-logsearch-portal/src/main/resources/default.properties
index d89a6c9..9a44761 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/resources/default.properties
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/resources/default.properties
@@ -13,28 +13,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-#Service Logs Field Names
-logsearch.service.logs.fields=logtime,level,event_count,ip,type,path,file,line_number,host,log_message,method,id
 
-#Exclude Column List for Service Logs
-logsearch.solr.service.logs.exclude.columnlist=tags,text,message,seq_num
-
-#Exclude Column List for Ranger Audits
-logsearch.solr.audit.logs.exclude.columnlist=tags,tags_str,seq_num
-
-#Value Mapping for Audit Fields
-#Example FieldName=ValueOfUI:ValueOfSolr
-result=Allowed:1,Denied:0
-
-#Column Mapping
-#Example  CoulumnInSolr:ColumnInUI
-#For Service Logs
-logsearch.solr.service.logs.column.mapping=bundle_id:Bundle Id,thread_name:Thread,log_message:Message,case_id:Case Id,cluster:Cluster,event_count:Event Count,file:File,host:Host,id:Id,ip:Ip,level:Level,line_number:Line Number,logfile_line_number:Logfile Line Number,logger_name:Logger Name,logtype:Log Type,method:Method,path:Path,rowtype:Row Type,type:Type
-
-#For Audit Logs
-logsearch.solr.audit.logs.column.mapping=access:Access Type,reqUser:User,enforcer:Access Enforcer,ip:IP,action:Action,agent:Agent,agentHost:Agent Host,authType:Auth Type,bundle_id:Bundle Id,case_id:Case Id,cliIP:Client Ip,cliType:Client Type,cluster:Cluster,dst:DST,event_count:Event Count,file:File,host:Host,id:Id,level:Level,log_message:Log Message,logfile_line_number:Logfile Line Number,logger_name:Logger Name,logType:Log Type,path:Path,perm:Perm,policy:Policy,proxyAuthType:Proxy Auth Type,proxyUsers:Proxy Users,reason:Reason,repo:Repo,repoType:Repo Type,req_caller_id:Req Caller Id,req_self_id:Req Self Id,reqContext:Req Context,reqData:Req Data,resource:Resource,resType:Res Type,result:Result,seq_num:Seq Num,sess:Sess,text:Text,type:Type,ugi:UGI 	
-
-#login method
 #Note: Simple will be supported only if both file and ldap is disabled.
 logsearch.auth.file.enable=true
 logsearch.auth.ldap.enable=false

http://git-wip-us.apache.org/repos/asf/ambari/blob/6fa4abfe/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/App.js
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/App.js b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/App.js
index 24cbd5a..664f55f 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/App.js
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/App.js
@@ -18,15 +18,13 @@
 
 define(['backbone','utils/LangSupport', 'backbone.marionette'],function(Backbone,localization) {
     'use strict';
-
-	//var SessionMgr		= require('mgrs/SessionMgr');
+  
     /*
      * Localization initialization
      */
     localization.setDefaultCulture(); // will take default that is en
     
 	var App = new Backbone.Marionette.Application();
-	//App.userProfile = SessionMgr.getUserProfile();
 
 	/* Add application regions here */
 	App.addRegions({

http://git-wip-us.apache.org/repos/asf/ambari/blob/6fa4abfe/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/collection_bases/VAuditLogListBase.js
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/collection_bases/VAuditLogListBase.js b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/collection_bases/VAuditLogListBase.js
index 0f72697..53ec922 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/collection_bases/VAuditLogListBase.js
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/collection_bases/VAuditLogListBase.js
@@ -58,7 +58,7 @@ define(['require',
 			}, options);
 
 			return this.constructor.nonCrudOperation.call(this, url, 'GET', options);
-		},
+		}
 	},{
 	/**
 	* Table Cols to be passed to Backgrid

http://git-wip-us.apache.org/repos/asf/ambari/blob/6fa4abfe/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/collection_bases/VLogListBase.js
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/collection_bases/VLogListBase.js b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/collection_bases/VLogListBase.js
index 72ab530..08a8271 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/collection_bases/VLogListBase.js
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/collection_bases/VLogListBase.js
@@ -76,19 +76,18 @@ define(['require',
 				contentType : 'application/json',
 				dataType : 'json'
 			}, options);
-
 			return this.constructor.nonCrudOperation.call(this, url, 'GET', options);
 		},
-		getServiceLogSchemaFields : function(token, options){
-			var url = Globals.baseURL  + 'service/logs/schema/fields';
-			
-			options = _.extend({
-				data : $.param(token),
-				contentType : 'application/json',
-				dataType : 'json'
-			}, options);
+    getServiceLogSchemaFields : function(token, options){
+      var url = Globals.baseURL  + 'service/logs/schema/fields';
 
-			return this.constructor.nonCrudOperation.call(this, url, 'GET', options);
+      options = _.extend({
+        data: $.param(token),
+        contentType: 'application/json',
+        dataType: 'json'
+      }, options);
+
+      return this.constructor.nonCrudOperation.call(this, url, 'GET', options);
 		},
 		getTruncatedLogs : function(token, options){
 			var url = Globals.baseURL  + 'service/logs/truncated';

http://git-wip-us.apache.org/repos/asf/ambari/blob/6fa4abfe/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/collections/BaseCollection.js
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/collections/BaseCollection.js b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/collections/BaseCollection.js
index ac82708..c175397 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/collections/BaseCollection.js
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/collections/BaseCollection.js
@@ -152,7 +152,6 @@ define(['require',
 			var retCols = _.map(cols, function(v, k, l){
 				var defaults = collection.constructor.tableCols[k];
 				if(! defaults){
-					//console.log("Error!! " + k + " not found in collection: " , collection);
 					defaults = {};
 				}
 				return _.extend({ 'name' : k }, defaults, v );

http://git-wip-us.apache.org/repos/asf/ambari/blob/6fa4abfe/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/collections/SchemaFieldList.js
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/collections/SchemaFieldList.js b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/collections/SchemaFieldList.js
new file mode 100644
index 0000000..a1c2799
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/collections/SchemaFieldList.js
@@ -0,0 +1,29 @@
+/**
+ * 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.
+ */
+
+define(['require', 'backbone'], function(require, Backbone) {
+  'use strict';
+
+  var SchemaField = Backbone.Model.extend({
+  });
+
+  return Backbone.Collection.extend({
+    model: SchemaField,
+    url: '../static/schema_fields.json'
+  });
+});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/6fa4abfe/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/mgrs/SessionMgr.js
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/mgrs/SessionMgr.js b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/mgrs/SessionMgr.js
deleted file mode 100644
index 0809ce0..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/mgrs/SessionMgr.js
+++ /dev/null
@@ -1,137 +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.
- */
-
- 
-// Manages the user session
-define(function(require){
-	'use strict';
-
-	// var VXPortalUser		= require('models/VXPortalUser');
-
-	// // Private properties
-	// var vXPortalUser = null;
-	// var vSessionSettings = null;
-
-	// // Public methods
-	// var SessionMgr = {};
-
-	// /**
-	//  * Gets the user profile for the given session
-	//  * 
-	//  * @returns VXPortalUser
-	//  */
-
-	// SessionMgr.getUserProfile = function() {
-	// 	if ( vXPortalUser){
-	// 		return vXPortalUser;
-	// 	}
-
-	// 	vXPortalUser = new VXPortalUser();
-	// 	vXPortalUser.getUserProfile({async : false,cache:false}).done(function(data){
-	// 		vXPortalUser.set(data);
-	// 	});
-	// 	return vXPortalUser;
-	// };
-
-
-	// SessionMgr.getLoginId = function() {
-	// 	if (vXPortalUser) {
-	// 		return vXPortalUser.get('loginId');
-	// 	}
-	// };
-
-	// SessionMgr.userInRole = function(role) {
-	// 	var vXPortalUser = SessionMgr.getUserProfile();
-	// 	var userRoles = vXPortalUser.get('userRoleList');
-	// 	if (!userRoles || !role) {
-	// 		return false;
-	// 	}
-	// 	if (userRoles.constructor != Array) {
-	// 		userRoles = [ userRoles ];
-	// 	}
-
-	// 	return (userRoles.indexOf(role) > -1);
-	// };
-
-	// SessionMgr.getUserRoles = function() {
-	// 	var vXPortalUser = SessionMgr.getUserProfile();
-	// 	var userRoles = vXPortalUser.get('userRoleList');
-	// 	if (!userRoles) {
-	// 		return [];
-	// 	}
-	// 	if (userRoles.constructor != Array) {
-	// 		userRoles = [ userRoles ];
-	// 	}
-
-	// 	return userRoles;
-	// };
-
-	// SessionMgr.getSetting = function(key) {
-	// 	if (!vSessionSettings) {
-	// 		var msResponse = GeneralMgr.getSessionSettings();
-	// 		if (msResponse.isSuccess()) {
-	// 			vSessionSettings = msResponse.response;
-	// 		}
-	// 	}
-	// 	var value = null;
-	// 	if (vSessionSettings && key) {
-	// 		vSessionSettings.each(function(vNameValue) {
-	// 			if (vNameValue.get('name') == key) {
-	// 				value = vNameValue.get('value');
-	// 			}
-	// 		});
-	// 	}
-	// 	return value;
-	// };
-
-	// SessionMgr.resetSession = function() {
-	// 	vXPortalUser = null;
-	// 	vSessionSettings = null;
-	// 	MSCacheMgr.resetAll();
-	// };
-
-	// /**
-	//  * Logs out the user and resets all session variables
-	//  */
-	// SessionMgr.logout = function(reDirectUser) {
-	// 	SessionMgr.resetSession();
-	// 	MSCacheMgr.resetAll();
-	// 	if (reDirectUser) {
-	// 		// This will ask the browser to redirect
-	// 		window.location.replace("logout.html");
-	// 	} else {
-	// 		// We will do an implicit logout
-	// 		$.ajax({
-	// 			url : 'logout.html',
-	// 			type : 'GET',
-	// 			async : false
-	// 		});
-	// 	}
-	// };
-
-	// SessionMgr.isSystemAdmin = function(){
-	// 	return this.userInRole('ROLE_SYS_ADMIN') ? true : false;
-	// };
-	
-	// SessionMgr.isUser = function(){
-	// 	var roles = this.getRoleInUserSchool();
-	// 	return  $.inArray('ROLE_USER',roles) != -1  ? true  : false ;
-	// };
-	// return SessionMgr;
-});	

http://git-wip-us.apache.org/repos/asf/ambari/blob/6fa4abfe/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/utils/Globals.js
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/utils/Globals.js b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/utils/Globals.js
index b6e8d7d..8356b9c 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/utils/Globals.js
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/utils/Globals.js
@@ -1,85 +1,91 @@
 /**
-* 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.
-*/
+ * 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.
+ */
 
-define(['require','App'], function(require, App){
-	'use strict';
-	
-	var Globals = {};
-	
-	Globals.settings = {};
-	Globals.settings.PAGE_SIZE = 25;
-	Globals.settings.uploadDefaultOpts = {
-		disableImageResize: false,
-		maxFileSize: 5000000,
-		autoUpload : false
-		//maxNumberOfFiles : 2
-	};
-	Globals.settings.MAX_VALUE = 2147483647;
+define(['require', 'collections/SchemaFieldList'], function (require, SchemaFieldList) {
+  'use strict';
 
-	Globals.keys = {};
-	Globals.keys.ENTER_KEY = 13;
-	Globals.keys.ESC_KEY = 27;
-	
-	Globals.EventHistory = {
-			totalCount : 50
-	};
+  var Globals = {};
 
-	Globals.baseURL = '../api/v1/';
-	//Globals.baseURL = App.baseUrl;
+  Globals.settings = {};
+  Globals.settings.PAGE_SIZE = 25;
+  Globals.settings.uploadDefaultOpts = {
+    disableImageResize: false,
+    maxFileSize: 5000000,
+    autoUpload: false
+  };
+  Globals.settings.MAX_VALUE = 2147483647;
 
-	Globals.AppTabs = {
-			DASHBOARD 			: { value:1, valStr: 'Dashboard'},
-			MAINVIEW 			: { value:2, valStr: 'Main View'}
-		};
+  Globals.keys = {};
+  Globals.keys.ENTER_KEY = 13;
+  Globals.keys.ESC_KEY = 27;
 
-	Globals.BooleanValue = {
-		BOOL_TRUE:{value:"true", label:'True'},
-		BOOL_FALSE:{value:"false", label:'False'}
-	};
-	Globals.paramsNameMapping = {
-		q:{label:'Query'},
-		from:{label:'From'},
-		to:{label:'To'},
-		unit:{label:'Unit'},
-		level:{label:'Level'},
-		mustNot:{label:'Exclude Component'},
-		mustBe:{label:'Include Component'},
-		iMessage:{label:'Include Message'},
-		eMessage:{label:'Exclude Message'},
-		time:{label:''},
-		includeQuery : {label:"Include Column"},
-		excludeQuery : {label:"Exclude Column"},
-		dateRangeLabel : {label : "Date Range"}
-	};
+  Globals.EventHistory = {
+    totalCount: 50
+  };
 
-	Globals.graphType =  {
-		MULTILINE:{value:1},
-		HISTOGRAM:{value:2},
-		PIE:{value:3},
-		TABLE:{value:4}
-	};
+  Globals.baseURL = '../api/v1/';
 
-	Globals.dateFormat = "YYYY-MM-DD HH:mm:ss.SSS";
-	Globals.splitToken = "|i::e|";
-	Globals.eventName = {
-			serviceLogsIncludeColumns : "search:serviceLogs:include",
-			serviceLogsExcludeColumns : "search:serviceLogs:exclude"
-	};
-	Globals.serviceLogsColumns = [];
-	return Globals;
+  Globals.AppTabs = {
+    DASHBOARD: {value: 1, valStr: 'Dashboard'},
+    MAINVIEW: {value: 2, valStr: 'Main View'}
+  };
+
+  Globals.BooleanValue = {
+    BOOL_TRUE: {value: "true", label: 'True'},
+    BOOL_FALSE: {value: "false", label: 'False'}
+  };
+  Globals.paramsNameMapping = {
+    q: {label: 'Query'},
+    from: {label: 'From'},
+    to: {label: 'To'},
+    unit: {label: 'Unit'},
+    level: {label: 'Level'},
+    mustNot: {label: 'Exclude Component'},
+    mustBe: {label: 'Include Component'},
+    iMessage: {label: 'Include Message'},
+    eMessage: {label: 'Exclude Message'},
+    time: {label: ''},
+    includeQuery: {label: "Include Column"},
+    excludeQuery: {label: "Exclude Column"},
+    dateRangeLabel: {label: "Date Range"}
+  };
+
+  Globals.graphType = {
+    MULTILINE: {value: 1},
+    HISTOGRAM: {value: 2},
+    PIE: {value: 3},
+    TABLE: {value: 4}
+  };
+
+  Globals.dateFormat = "YYYY-MM-DD HH:mm:ss.SSS";
+  Globals.splitToken = "|i::e|";
+  Globals.eventName = {
+    serviceLogsIncludeColumns: "search:serviceLogs:include",
+    serviceLogsExcludeColumns: "search:serviceLogs:exclude"
+  };
+  Globals.serviceLogsColumns = [];
+  Globals.schemaFields = new SchemaFieldList().fetch({async: false}).responseJSON;
+  Globals.defaultServiceLogMappings = Globals.schemaFields.serviceLogMappings;
+  Globals.defaultServiceLogExcludes = Globals.schemaFields.serviceLogExcludes;
+  Globals.defaultAuditLogMappings = Globals.schemaFields.auditLogMappings;
+  Globals.defaultAuditLogExcludes = Globals.schemaFields.auditLogExcludes;
+  Globals.invertedServiceLogMappings = _.invert(Globals.defaultServiceLogMappings);
+  Globals.invertedAuditLogMappings = _.invert(Globals.defaultAuditLogMappings);
+
+  return Globals;
 });

http://git-wip-us.apache.org/repos/asf/ambari/blob/6fa4abfe/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/utils/ViewUtils.js
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/utils/ViewUtils.js b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/utils/ViewUtils.js
index 62d785b..4c23290 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/utils/ViewUtils.js
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/utils/ViewUtils.js
@@ -18,214 +18,249 @@
  */
 
 
-
 define(['require',
-    'utils/Utils',
-    'moment',
-    'collections/VNameValueList',
-    'utils/Globals'
-], function(require, Utils, moment, VNameValueList, Globals) {
-    'use strict';
-
-    var ViewUtil = {};
-
-    ViewUtil.setdefaultParams = function() {
-        var fromSolr, toSolr,that=this;
-        var params = Utils.getQueryParams(window.location.search);
-        this.defaultParams = {
-            q: "*:*",
-            from: moment().hours("00").minutes("00").seconds("01").milliseconds("000").toJSON(),
-            to: moment().hours("23").minutes("59").seconds("59").milliseconds("999").toJSON(),
-            unit: "+1HOUR",
-            level: "FATAL,ERROR,WARN"
-        };
-        var applyParamsDate = function(date) {
-            if (date) {
-                var dateString = date.split(',');
-                if (dateString.length) {
-                    var checkDate = Utils.dateUtil.getMomentUTC(dateString[0]);
-                    if (checkDate.isValid()) {
-                        if (dateString[1]) {
-                            checkDate.millisecond(dateString[1])
-                        } else {
-                            checkDate.millisecond('000')
-                        }
-                        return checkDate.toJSON();
-                    }
-                }
+  'utils/Utils',
+  'moment',
+  'collections/VNameValueList',
+  'utils/Globals'
+], function (require, Utils, moment, VNameValueList, Globals) {
+  'use strict';
+
+  var ViewUtil = {};
+
+  ViewUtil.setdefaultParams = function () {
+    var fromSolr, toSolr, that = this;
+    var params = Utils.getQueryParams(window.location.search);
+    this.defaultParams = {
+      q: "*:*",
+      from: moment().hours("00").minutes("00").seconds("01").milliseconds("000").toJSON(),
+      to: moment().hours("23").minutes("59").seconds("59").milliseconds("999").toJSON(),
+      unit: "+1HOUR",
+      level: "FATAL,ERROR,WARN"
+    };
+    var applyParamsDate = function (date) {
+      if (date) {
+        var dateString = date.split(',');
+        if (dateString.length) {
+          var checkDate = Utils.dateUtil.getMomentUTC(dateString[0]);
+          if (checkDate.isValid()) {
+            if (dateString[1]) {
+              checkDate.millisecond(dateString[1])
+            } else {
+              checkDate.millisecond('000')
             }
+            return checkDate.toJSON();
+          }
         }
-        if (params.bundle_id && !params.start_time && !params.end_time) {
-            var collection = new VNameValueList();
-
-            collection.url = Globals.baseURL + "service/logs/solr/boundarydates";
-            collection.modelAttrName = "vNameValues";
-            _.extend(collection.queryParams, {
-                "bundle_id": params.bundle_id
-            });
-            collection.fetch({
-                reset: true,
-                async: false,
-                success: function(data) {
-                    collection.each(function(model) {
-                        if (model.get('name') == "From") {
-                            fromSolr = moment(parseInt(model.get('value'))).toJSON();
-                        }
-                        if (model.get('name') == "To") {
-                            toSolr = moment(parseInt(model.get('value'))).toJSON();
-                        }
-                        if(fromSolr && toSolr){
-                            that.defaultParams['dateRangeLabel'] = "Custom Range";
-                        }
-                    })
-
-                }
-            });
-        }
-        if (params.bundle_id) {
-            this.defaultParams['bundle_id'] = params.bundle_id;
-        }
-        if (params.start_time) {
-            var startDateString = applyParamsDate(params.start_time);
-        }
-        if (params.end_time) {
-            var endDateString = applyParamsDate(params.end_time);
-        }
-        if (params.host_name) {
-            this.defaultParams['host_name'] = params.host_name;
-        }
-        if (params.component_name) {
-            this.defaultParams['component_name'] = params.component_name;
-        }
-        if (params.file_name) {
-            this.defaultParams['file_name'] = params.file_name;
-        }
-        if (startDateString && endDateString) {
-            if (params.timezone) {
-                var timeZoneObject = worldMapTime.getTimeZoneObject(params.timezone)
-                if (timeZoneObject.length) {
-                    var timeZoneName = timeZoneObject[0].timezone
-                }
-                if (timeZoneName) {
-                    var startEncodeDate = params.start_time.replace(",", ".")
-                    var endEncodeDate = params.end_time.replace(",", ".")
-                    startDateString = moment.tz(startEncodeDate, timeZoneName).toJSON();
-                    endDateString = moment.tz(endEncodeDate, timeZoneName).toJSON();
-                    var timeZoneString = timeZoneName + "," + timeZoneObject[0].zoneName + "," + timeZoneObject.length;
-                    Utils.localStorage.setLocalStorage('timezone', timeZoneString);
-                    moment.tz.setDefault(timeZoneName);
-                }
+      }
+    }
+    if (params.bundle_id && !params.start_time && !params.end_time) {
+      var collection = new VNameValueList();
+
+      collection.url = Globals.baseURL + "service/logs/solr/boundarydates";
+      collection.modelAttrName = "vNameValues";
+      _.extend(collection.queryParams, {
+        "bundle_id": params.bundle_id
+      });
+      collection.fetch({
+        reset: true,
+        async: false,
+        success: function (data) {
+          collection.each(function (model) {
+            if (model.get('name') == "From") {
+              fromSolr = moment(parseInt(model.get('value'))).toJSON();
             }
-            this.defaultParams['end_time'] = endDateString
-            this.defaultParams['start_time'] = startDateString;
-            this.defaultParams['from'] = startDateString;
-            this.defaultParams['to'] = endDateString;
-            this.defaultParams['dateRangeLabel'] = "Custom Range";
-        }
-        if (fromSolr && toSolr) {
-            this.defaultParams['from'] = fromSolr;
-            this.defaultParams['to'] = toSolr;
-            this.defaultParams['dateRangeLabel'] = "Custom Range";
+            if (model.get('name') == "To") {
+              toSolr = moment(parseInt(model.get('value'))).toJSON();
+            }
+            if (fromSolr && toSolr) {
+              that.defaultParams['dateRangeLabel'] = "Custom Range";
+            }
+          })
+
         }
+      });
     }
-    ViewUtil.getDefaultParams = function() {
-        return $.extend(true, {}, this.defaultParams);
+    if (params.bundle_id) {
+      this.defaultParams['bundle_id'] = params.bundle_id;
     }
-    ViewUtil.getCountDistributionHTML = function(node) {
-        if (!node.logLevelCount)
-            return "";
-        return '<div data-node = "' + node.name + '" class="nodebar">' + ViewUtil.getLevelDistributionHTML(node) + '</div>';
-    };
-    ViewUtil.getLevelDistributionHTML = function(node) {
-        var html = "";
-        if (!_.isUndefined(node.logLevelCount) && !_.isArray(node.logLevelCount))
-            node.logLevelCount = [node.logLevelCount];
-        var toPct = ViewUtil.calculatePercentge(node.logLevelCount);
-        _.each(node.logLevelCount, function(data) {
-            //html += '<div class="node '+data.name+'" style="width:'+toPct(data)+'%;" data-toggle="tooltip" title="'+data.value+'" data-original-title="'+data.value+'"></div>';
-            html += '<div class="node ' + data.name + '" style="width:' + toPct(data) + '%;"></div>';
-        });
-        return html;
-    };
-    ViewUtil.calculatePercentge = function(values) {
-        var sum = 0;
-        for (var i = 0; i != values.length; ++i) {
-            sum = sum + parseInt(values[i].value, 10);
+    if (params.start_time) {
+      var startDateString = applyParamsDate(params.start_time);
+    }
+    if (params.end_time) {
+      var endDateString = applyParamsDate(params.end_time);
+    }
+    if (params.host_name) {
+      this.defaultParams['host_name'] = params.host_name;
+    }
+    if (params.component_name) {
+      this.defaultParams['component_name'] = params.component_name;
+    }
+    if (params.file_name) {
+      this.defaultParams['file_name'] = params.file_name;
+    }
+    if (startDateString && endDateString) {
+      if (params.timezone) {
+        var timeZoneObject = worldMapTime.getTimeZoneObject(params.timezone)
+        if (timeZoneObject.length) {
+          var timeZoneName = timeZoneObject[0].timezone
         }
-        var scale = 100 / sum;
-        return function(x) {
-            return (parseInt(x.value, 10) * scale) /*.toFixed(5)*/ ;
-        };
+        if (timeZoneName) {
+          var startEncodeDate = params.start_time.replace(",", ".")
+          var endEncodeDate = params.end_time.replace(",", ".")
+          startDateString = moment.tz(startEncodeDate, timeZoneName).toJSON();
+          endDateString = moment.tz(endEncodeDate, timeZoneName).toJSON();
+          var timeZoneString = timeZoneName + "," + timeZoneObject[0].zoneName + "," + timeZoneObject.length;
+          Utils.localStorage.setLocalStorage('timezone', timeZoneString);
+          moment.tz.setDefault(timeZoneName);
+        }
+      }
+      this.defaultParams['end_time'] = endDateString
+      this.defaultParams['start_time'] = startDateString;
+      this.defaultParams['from'] = startDateString;
+      this.defaultParams['to'] = endDateString;
+      this.defaultParams['dateRangeLabel'] = "Custom Range";
+    }
+    if (fromSolr && toSolr) {
+      this.defaultParams['from'] = fromSolr;
+      this.defaultParams['to'] = toSolr;
+      this.defaultParams['dateRangeLabel'] = "Custom Range";
+    }
+  }
+  ViewUtil.getDefaultParams = function () {
+    return $.extend(true, {}, this.defaultParams);
+  }
+  ViewUtil.getCountDistributionHTML = function (node) {
+    if (!node.logLevelCount)
+      return "";
+    return '<div data-node = "' + node.name + '" class="nodebar">' + ViewUtil.getLevelDistributionHTML(node) + '</div>';
+  };
+  ViewUtil.getLevelDistributionHTML = function (node) {
+    var html = "";
+    if (!_.isUndefined(node.logLevelCount) && !_.isArray(node.logLevelCount))
+      node.logLevelCount = [node.logLevelCount];
+    var toPct = ViewUtil.calculatePercentge(node.logLevelCount);
+    _.each(node.logLevelCount, function (data) {
+      //html += '<div class="node '+data.name+'" style="width:'+toPct(data)+'%;" data-toggle="tooltip" title="'+data.value+'" data-original-title="'+data.value+'"></div>';
+      html += '<div class="node ' + data.name + '" style="width:' + toPct(data) + '%;"></div>';
+    });
+    return html;
+  };
+  ViewUtil.calculatePercentge = function (values) {
+    var sum = 0;
+    for (var i = 0; i != values.length; ++i) {
+      sum = sum + parseInt(values[i].value, 10);
+    }
+    var scale = 100 / sum;
+    return function (x) {
+      return (parseInt(x.value, 10) * scale) /*.toFixed(5)*/;
     };
+  };
 
-    ViewUtil.getDefaultParamsForHierarchy = function() {
-        return ViewUtil.getDefaultParams();
-    };
+  ViewUtil.getDefaultParamsForHierarchy = function () {
+    return ViewUtil.getDefaultParams();
+  };
 
-    ViewUtil.setLatestTimeParams = function(params) {
-        if (params && params.dateRangeLabel) {
-            var arr = Utils.dateUtil.getRelativeDateFromString(params.dateRangeLabel);
-            if (_.isArray(arr)) {
-                params.from = arr[0].toJSON();
-                params.to = arr[1].toJSON();
-            };
-        }
+  ViewUtil.setLatestTimeParams = function (params) {
+    if (params && params.dateRangeLabel) {
+      var arr = Utils.dateUtil.getRelativeDateFromString(params.dateRangeLabel);
+      if (_.isArray(arr)) {
+        params.from = arr[0].toJSON();
+        params.to = arr[1].toJSON();
+      }
+      ;
+    }
 
-    };
-    
-    ViewUtil.foramtLogMessageAsLogFile = function(model, logMessageHtmlClass){
-    	var attrs = model.attributes;
-		var str="";
-		if(attrs.logtime)
-			str += moment(attrs.logtime).format("YYYY-MM-DD HH:mm:ss,SSS")+" "; 
-		if(attrs.level)
-			str += "<span class='"+(""+attrs.level).toUpperCase()+"'>"+(""+attrs.level).toUpperCase()+"</span> ";
-		if(attrs.thread_name)
-			str += $.trim(attrs.thread_name)+" ";
-		if(attrs.logger_name)
-			str += $.trim(attrs.logger_name)+" ";
-		if(attrs.file && attrs.line_number)
-			str += attrs.file+":"+attrs.line_number+" ";
-//		if(attrs.cluster)
-//			str += attrs.cluster+" ";
-		if(attrs.log_message)
-			str += "<span class='"+(logMessageHtmlClass ? logMessageHtmlClass : "logMessage")+"'>- "+Utils.escapeHtmlChar(attrs.log_message)+" </span>";
-		return str;
+  };
+
+  ViewUtil.foramtLogMessageAsLogFile = function (model, logMessageHtmlClass) {
+    var attrs = model.attributes;
+    var str = "";
+    if (attrs.logtime)
+      str += moment(attrs.logtime).format("YYYY-MM-DD HH:mm:ss,SSS") + " ";
+    if (attrs.level)
+      str += "<span class='" + ("" + attrs.level).toUpperCase() + "'>" + ("" + attrs.level).toUpperCase() + "</span> ";
+    if (attrs.thread_name)
+      str += $.trim(attrs.thread_name) + " ";
+    if (attrs.logger_name)
+      str += $.trim(attrs.logger_name) + " ";
+    if (attrs.file && attrs.line_number)
+      str += attrs.file + ":" + attrs.line_number + " ";
+    if (attrs.log_message)
+      str += "<span class='" + (logMessageHtmlClass ? logMessageHtmlClass : "logMessage") + "'>- " + Utils.escapeHtmlChar(attrs.log_message) + " </span>";
+    return str;
+  }
+
+  ViewUtil.scrollToElement = function (top, speed) {
+    if (!top)
+      return;
+    $("html, body").animate({scrollTop: (top - 200)}, (speed) ? speed : 300);
+  };
+
+  ViewUtil.formatAuditGraphData = function (collection) {
+    var mainObj = [], len = 0, that = this;
+    collection.each(function (m, index) {
+      var userName = m.get("name");
+      if (len < userName.length)
+        len = userName.length;
+      var compo = m.get("dataCount");
+      for (var i = 0; i < compo.length; i++) {
+        var b = {label: userName, value: parseInt(compo[i].value, 10)}
+        var ret = _.findWhere(mainObj, {key: compo[i].name});
+        if (ret) {
+          ret.values.push(b);
+        } else {
+          mainObj.push({
+            key: compo[i].name,
+            values: [b],
+            color: Utils.getRandomColor(compo[i].name)
+          });
+        }
+      }
+    });
+    return {
+      max: len,
+      arr: mainObj
     }
-    
-    ViewUtil.scrollToElement = function(top, speed){
-    	if(!top)
-    		return;
-    	$("html, body").animate({ scrollTop : (top -200) }, (speed) ? speed : 300);
-    };
-    
-    ViewUtil.formatAuditGraphData = function(collection){
-    	var mainObj = [],len=0,that=this;
-		collection.each(function(m,index){
-			var userName = m.get("name");
-			if(len < userName.length )
-				len = userName.length;
-			var compo = m.get("dataCount");
-			for(var i=0;i < compo.length; i++){
-				var b = {label:userName,value:parseInt(compo[i].value,10)}
-				var ret = _.findWhere(mainObj,{key:compo[i].name});
-				if(ret){
-					ret.values.push(b);
-				}else{
-					mainObj.push({
-						key : compo[i].name,
-						values : [b],
-						color : Utils.getRandomColor(compo[i].name) 
-					});
-				}
-			}
-		});
-		return {
-			max : len,
-			arr : mainObj
-		}
+  };
+
+  /**
+   * Generate sorted named schema field list for service/audit logs
+   * @param data Response data
+   * @param fieldMappings Solr field - UI field mapping
+   * @param excludes Array of fields that needs to be filtered out on UI
+   * @returns sorted schema field list (human readable format)
+   */
+  ViewUtil.getLogSchemaFields = function(data, fieldMappings, excludes) {
+    var jsonData = {};
+    for (var key in data) {
+      if ($.inArray(key.toString(), excludes) == -1) {
+        if (fieldMappings.hasOwnProperty(key)) {
+          jsonData[key] = fieldMappings[key];
+        } else {
+          jsonData[key] = key;
+        }
+      }
     }
+    return _.sortBy(jsonData, function(k, v){return k});
+  };
+
+
+  ViewUtil.replaceColumnNamesWithKeys = function (collection, nameKeyMap, addingAstrik) {
+    var result = [];
+    collection.each(function (m) {
+      var data = {};
+      var value = addingAstrik == true ? Utils.manipulateValueForAddingAstrik(m.get("value")) : m.get("value");
+      if (nameKeyMap[m.get("category")] === undefined) {
+        data[m.get("category")] = m.get("value");
+      } else {
+        data[nameKeyMap[m.get("category")]] = m.get("value");
+      }
+      result.push(data);
+    });
+    return result;
+  };
 
-    return ViewUtil;
+  return ViewUtil;
 
 });

http://git-wip-us.apache.org/repos/asf/ambari/blob/6fa4abfe/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/audit/AuditTabLayoutView.js
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/audit/AuditTabLayoutView.js b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/audit/AuditTabLayoutView.js
index a399cbf..4e09e88 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/audit/AuditTabLayoutView.js
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/audit/AuditTabLayoutView.js
@@ -1,459 +1,429 @@
 /**
-* 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.
-*/
+ * 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.
+ */
 
 define(['require',
-	'backbone',
-	'utils/Globals',
-	'utils/Utils',
-	'utils/ViewUtils',
-	'collections/VGroupList',
-	'collections/VAuditLogList',
-	'models/VAuditLog',
-	'hbs!tmpl/audit/AuditTabLayoutView_tmpl',
-	'moment'
-],function(require,Backbone,Globals,Utils,ViewUtils,VGroupList,VAuditLogList,VAuditLog,AuditTabLayoutViewTmpl,moment){
+  'backbone',
+  'utils/Globals',
+  'utils/Utils',
+  'utils/ViewUtils',
+  'collections/VGroupList',
+  'collections/VAuditLogList',
+  'models/VAuditLog',
+  'hbs!tmpl/audit/AuditTabLayoutView_tmpl',
+  'moment'
+], function (require, Backbone, Globals, Utils, ViewUtils, VGroupList, VAuditLogList, VAuditLog, AuditTabLayoutViewTmpl, moment) {
 
-    'use strict';
+  'use strict';
 
-    return Backbone.Marionette.Layout.extend(
-	/** @lends LogLevelView */
-	{
-		_viewName : 'AuditTabLayoutView',
+  return Backbone.Marionette.Layout.extend(
+    {
+      _viewName: 'AuditTabLayoutView',
 
-		template: AuditTabLayoutViewTmpl,
+      template: AuditTabLayoutViewTmpl,
 
-		/** Layout sub regions */
-		regions: {
-			RAuditTable : "[data-id='auditTable']",
-			RVisualSearch : "#r_vsSearch",
-			RVisualSearchInc : "#r_vsSearchInc",
-			RVisualSearchEx : "#r_vsSearchEx",
-			RAuditLine  : "#r_AuditLine",
-			RAuditAggregated  : "[data-id='auditAggregated']",
-		},
+      /** Layout sub regions */
+      regions: {
+        RAuditTable: "[data-id='auditTable']",
+        RVisualSearch: "#r_vsSearch",
+        RVisualSearchInc: "#r_vsSearchInc",
+        RVisualSearchEx: "#r_vsSearchEx",
+        RAuditLine: "#r_AuditLine",
+        RAuditAggregated: "[data-id='auditAggregated']",
+      },
 
-		/** ui selector cache */
-		ui: {
-			viewType: "input[name='viewTypeAudit']",
-			excludeComponents : "#excludeComponents",
-			includeComponents : "#includeComponents",
-			collapseArrowClick : "a.collapse-link.chkArrow"
-		},
+      /** ui selector cache */
+      ui: {
+        viewType: "input[name='viewTypeAudit']",
+        excludeComponents: "#excludeComponents",
+        includeComponents: "#includeComponents",
+        collapseArrowClick: "a.collapse-link.chkArrow"
+      },
 
-		/** ui events hash */
-		events: function() {
-			var events = {};
-			events['click [data-id="refresh-tab-audit"]']  = 'onAuditTabRefresh';
-			events['change ' + this.ui.viewType]  = 'onViewTypeChange';
-			events['click ' +this.ui.collapseArrowClick] = function(e){
-				if($(e.currentTarget).find('i').hasClass('fa-chevron-down')){
-					if(this.RAuditAggregated.currentView){
-						this.RAuditAggregated.currentView.trigger("button:min:max");
-					}
-				}
-			}
-			return events;
-		},
+      /** ui events hash */
+      events: function () {
+        var events = {};
+        events['click [data-id="refresh-tab-audit"]'] = 'onAuditTabRefresh';
+        events['change ' + this.ui.viewType] = 'onViewTypeChange';
+        events['click ' + this.ui.collapseArrowClick] = function (e) {
+          if ($(e.currentTarget).find('i').hasClass('fa-chevron-down')) {
+            if (this.RAuditAggregated.currentView) {
+              this.RAuditAggregated.currentView.trigger("button:min:max");
+            }
+          }
+        };
+        return events;
+      },
+      initialize: function (options) {
+        _.extend(this, _.pick(options, 'globalVent'));
+        this.defaultParams = ViewUtils.getDefaultParamsForHierarchy();
+        delete this.defaultParams.level;
+        this.vent = new Backbone.Wreqr.EventAggregator();
+        this.initializeCollections();
+        this.columns = [];
+        this.bindEvents();
+      },
+      initializeCollections: function () {
+        this.auditModel = new VAuditLog();
+        this.collection = new VAuditLogList([], {
+          state: {
+            firstPage: 0,
+            pageSize: 25
+          }
+        });
 
-		/**
-		 * intialize a new LogLevelView Layout
-		 * @constructs
-		 */
-		initialize: function(options) {
-			_.extend(this, _.pick(options,'globalVent'));
-			this.defaultParams = ViewUtils.getDefaultParamsForHierarchy();
-			delete this.defaultParams.level;
-			this.vent = new Backbone.Wreqr.EventAggregator();
-			this.initializeCollections();
-			this.columns = [];
-			this.bindEvents();
-		},
-		initializeCollections : function(){
-			this.auditModel = new VAuditLog();
-			this.collection = new VAuditLogList([],{
-				state: {
-                    firstPage: 0,
-                    pageSize: 25
-                }
-			});
+        this.componentsList = new VGroupList([], {
+          state: {
+            firstPage: 0,
+            pageSize: 99999
+          }
+        });
+        this.componentsList.url = Globals.baseURL + "audit/logs/components";
+      },
+      bindEvents: function () {
+        this.listenTo(this.componentsList, "reset", function (col, abc) {
+          this.setupSelect2Fields(col, "type", 'type', 'excludeComponents', 'Exclude Components');
+          this.setupSelect2Fields(col, "type", 'type', 'includeComponents', 'Include Components');
+        }, this);
+        this.listenTo(this.vent, "search:audit:query auditComponents:include auditComponents:exclude search:audit:include search:audit:exclude logtime:filter", function (value) {
+          _.extend(this.defaultParams, value);
+          this.fetchAuditLogs(value);
+        }, this);
+        this.listenTo(this.vent, "reinitialize:filter:mustBe", function (value) {
+          this.reinitializeFilterMustBe(value);
+        }, this);
+        this.listenTo(this.vent, "reinitialize:filter:mustNot", function (value) {
+          this.reinitializeFilterMustNot(value);
+        }, this);
 
-			this.componentsList = new VGroupList([],{
-				state: {
-                    firstPage: 0,
-                    pageSize: 99999
-                }
-			});
-			this.componentsList.url = Globals.baseURL + "audit/logs/components";
-		},
-		bindEvents : function(){
-			this.listenTo(this.componentsList, "reset", function(col, abc){
-				this.setupSelect2Fields(col,"type", 'type', 'excludeComponents', 'Exclude Components');
-				this.setupSelect2Fields(col,"type", 'type', 'includeComponents', 'Include Components');
-			}, this);
-			this.listenTo(this.vent,"search:audit:query auditComponents:include auditComponents:exclude search:audit:include search:audit:exclude logtime:filter",function(value){
-				_.extend(this.defaultParams,value);
-            	this.fetchAuditLogs(value);
-            }, this);
-			this.listenTo(this.vent,"reinitialize:filter:mustBe",function(value){
-            	this.reinitializeFilterMustBe(value);
-            },this);
-			this.listenTo(this.vent,"reinitialize:filter:mustNot",function(value){
-            	this.reinitializeFilterMustNot(value);
-            },this);
+        this.listenTo(this.globalVent, "reinitialize:auditLogs", function (options) {
+          this.vent.trigger("reinitialize:filter:mustNot reinitialize:filter:mustBe reinitialize:filter:logtime " +
+            "reinitialize:TopTenGraph", options);
+          this.fetchAuditLogs(options);
+        }, this);
 
-			this.listenTo(this.globalVent,"reinitialize:auditLogs",function(options){
-            	this.vent.trigger("reinitialize:filter:mustNot reinitialize:filter:mustBe reinitialize:filter:logtime "+
-            			"reinitialize:TopTenGraph",options);
-            	this.fetchAuditLogs(options);
-            },this);
+      },
+      onRender: function () {
+        this.renderHistogram();
+        this.renderAuditAggregatedInfo();
+        this.fetchAuditColumns();
+        this.fetchAuditLogs((this.defaultParams) ? this.defaultParams : {q: "*:*"});
+        this.componentsList.fetch({reset: true});
+      },
+      renderHistogram: function () {
+        var that = this;
+        require(['views/graphs/GraphLayoutView'], function (GraphLayoutView) {
+          that.RAuditLine.show(new GraphLayoutView({
+            vent: that.vent,
+            globalVent: that.globalVent,
+            params: that.defaultParams,
+            viewType: Globals.graphType.MULTILINE.value,
+            showDatePicker: true,
+            futureDate: false
+          }));
+        })
+      },
+      renderAuditAggregatedInfo: function () {
+        var that = this;
+        require(['views/audit/AuditAggregatedView'], function (AuditAggregatedView) {
+          that.RAuditAggregated.show(new AuditAggregatedView({
+            vent: that.vent,
+            globalVent: that.globalVent,
+            params: that.defaultParams
+          }));
+        })
 
-		},
-		onRender : function(){
-			this.renderHistogram();
-			this.renderAuditAggregatedInfo();
-			this.fetchAuditColumns();
-			this.fetchAuditLogs((this.defaultParams) ? this.defaultParams : {q:"*:*"});
-			this.componentsList.fetch({reset:true});
-			//this.startPoll();
-		},
-		renderHistogram : function(){
-			var that = this;
-			require(['views/graphs/GraphLayoutView'],function(GraphLayoutView){
-				that.RAuditLine.show(new GraphLayoutView({
-					vent : that.vent,
-					globalVent:that.globalVent,
-					params : that.defaultParams,
-					//parentView : this,
-					viewType : Globals.graphType.MULTILINE.value,
-					showDatePicker:true,
-					futureDate : false
-				}));
-			})
-		},
-		renderAuditAggregatedInfo : function(){
-			var that = this;
-			require(['views/audit/AuditAggregatedView'],function(AuditAggregatedView){
-				that.RAuditAggregated.show(new AuditAggregatedView({
-					vent : that.vent,
-					globalVent:that.globalVent,
-					params : that.defaultParams
-				}));
-			})
+      },
+      fetchAuditColumns: function () {
+        var that = this;
+        this.collection.getAuditSchemaFieldsName({}, {
+          beforeSend: function () {
+            that.$("#loaderAudit").show();
+          },
+          success: function (data) {
+            that.columns = ViewUtils.getLogSchemaFields(data, Globals.defaultAuditLogMappings, Globals.defaultAuditLogExcludes);
+          },
+          error: function (error, data, status) {
+            var obj = JSON.parse(error.responseText);
+            if (obj)
+              Utils.notifyError({content: obj.msgDesc});
+          },
+          complete: function () {
+            that.renderAuditTable();
+            that.renderVSSearch();
+            that.$("#loaderAudit").hide();
+          }
+        });
+      },
+      fetchAuditLogs: function (params) {
+        $.extend(this.collection.queryParams, params);
+        this.collection.getFirstPage({reset: true});
+      },
+      renderVSSearch: function () {
+        var that = this;
+        require(['views/tabs/VisualSearchView'], function (VisualSearchView) {
 
-		},
-		fetchAuditColumns : function(){
-			var that =this;
-			this.collection.getAuditSchemaFieldsName({},{
-				beforeSend : function(){
-					that.$("#loaderAudit").show();
-				},
-				success : function(data){
-					that.columns = data;
-				},
-				error : function(error,data,status){
-					var obj = JSON.parse(error.responseText);
-					if(obj)
-						Utils.notifyError({content:obj.msgDesc});
-				},
-				complete : function(){
-					that.renderAuditTable();
-					that.renderVSSearch();
-					that.$("#loaderAudit").hide();
-				}
-			});
-		},
-		fetchAuditLogs : function(params){
-			$.extend(this.collection.queryParams,params);
-			this.collection.getFirstPage({reset:true});
-		},
-		renderVSSearch : function(){
-			var that = this;
-			require(['views/tabs/VisualSearchView'], function(VisualSearchView){
-
-				_.each(that.columns,function(v,i){
-					if(v.toLowerCase().indexOf("time") > 0 ){
-						//that.columns.splice(i, 1);
-						delete that.columns[v]
-					}
-				});
-				that.RVisualSearchInc.show(new VisualSearchView({
-					viewName : "includeColumns",
-					placeholder : "Include Search",
-					vent : that.vent,
-					globalVent:that.globalVent,
-					customOptions : _.values(that.columns),
-					eventName : "search:audit:include",
-					myFormatData : function(query,searchCollection){
-						var obj=[];
-						searchCollection.each(function(m){
-							var data = {};
-							data[m.get("category")] = Utils.manipulateValueForAddingAstrik(m.get("value"));
-							obj.push(data);
-						});
-						return {
-							includeQuery : JSON.stringify(obj),
-							query : query
-						}
-					}
-				}));
-				that.RVisualSearchEx.show(new VisualSearchView({
-					placeholder : "Exclude Search",
-					vent : that.vent,
-					globalVent:that.globalVent,
-					customOptions : _.values(that.columns),
-					eventName : "search:audit:exclude",
-					myFormatData : function(query,searchCollection){
-						var obj=[];
-						searchCollection.each(function(m){
-							var data = {};
-							data[m.get("category")] = Utils.manipulateValueForAddingAstrik(m.get("value"));
-							obj.push(data);
-						});
-						return {
-							excludeQuery : JSON.stringify(obj),
-							query : query
-						}
-					}
-				}));
-			});
-		},
-		renderAuditTable : function(){
-			var that = this;
-			require(['views/common/TableLayout'], function(TableLayout){
-				var cols = new Backgrid.Columns(that.getColumns());
-				that.RAuditTable.show(new TableLayout({
-					columns: cols,
-					collection: that.collection,
-					includeFilter : false,
-					includePagination : true,
-					includePageSize : true,
-					includeFooterRecords : true,
-					includeColumnManager : true,
-					columnOpts : {
-				    	initialColumnsVisible: 9,
-				    	saveState : false
-					},
-					gridOpts : {
-						className : "table table-bordered table-hover table-condensed backgrid",
-						emptyText : 'No records found!'
-					},
-					filterOpts : {},
-					paginatorOpts : {}
-				}));
-			});
-		},
-		getColumns : function(){
-			var cols = {};
-			var that = this;
-			_.each(this.columns,function(value,col){
-				cols[col] = {
-						label:value,
-						cell: "String",
-						sortType: 'toggle',
-						editable: false,
-				}
-			});
-			var columns = {
-					evtTime : {
-						label : "Event Time",
-						cell: "String",
-						sortType: 'toggle',
-						editable: false,
-						formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
-							fromRaw: function(rawValue, model){
-								return moment(rawValue).format("YYYY-MM-DD HH:mm:ss,SSS");
-							}
-						})
-					},
-					reqUser : {
-						label : "User",
-						cell: "String",
-						sortType: 'toggle',
-						editable: false
-					},
-					repo : {
-						label : 'Repo',
-						cell: "String",
-						sortType: 'toggle',
-						editable:false
-					},
-					resource : {
-						label : 'Resource',
-						cell: "String",
-						sortType: 'toggle',
-						editable:false
-					},
-					access : {
-						label : 'Access Type',
-						cell: "String",
-						sortType: 'toggle',
-						editable:false
-					},
-					result : {
-						label : 'Result',
-						cell: "String",
-						sortType: 'toggle',
-						editable:false,
-						formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
-							fromRaw: function(rawValue, model){
-								return (rawValue === 1) ? "Allowed" : "Denied";
-							}
-						})
-					},
-					enforcer : {
-						label : 'Access Enforcer',
-						cell: "String",
-						sortType: 'toggle',
-						editable:false
-					},
-					cliIP : {
-						label : 'Client IP',
-						cell: "String",
-						sortType: 'toggle',
-						editable:false
-					},
-					event_count : {
-						label : 'Event Count',
-						cell: "String",
-						sortType: 'toggle',
-						editable:false
-					}
-			};
-			_.each(cols,function(c,k){
-				if(columns[k] == undefined && k != "_version_"){
-					columns[k] = c;
-				}else{
-					if(columns[k] && columns[k].label){
-						columns[k].label = c.label;
-					}
-				}
-			})
-			/*_.each(columns,function(c,k){
-				if(columns[k] == undefined && k != "_version_"){
-					columns[k] = c;
-				}
-			})*/
-			return this.collection.constructor.getTableCols(columns, this.collection);
-		},
-		onAuditTabRefresh : function(e){
-			ViewUtils.setLatestTimeParams(this.defaultParams);
-			//this.fetchAuditColumns();
-			$.extend(this.collection.queryParams,this.defaultParams);
-			this.collection.fetch({reset:true});
-			this.vent.trigger("tab:refresh",this.defaultParams);
-		},
-		onViewTypeChange: function(e){
-			var that = this;
-			var val = that.$("[name='viewTypeAudit']:checked").val();
-			this.toggleViewType(val);
-		},
-		toggleViewType : function(val){
-			if(val === "A"){
-				this.$("[data-id='auditTable']").show();
-				this.$('[data-id="auditAggregated"]').hide();
-			}else{
-				this.$('[data-id="auditAggregated"]').show();
-				this.$("[data-id='auditTable']").hide();
-				if(this.RAuditAggregated.currentView)
-					this.RAuditAggregated.currentView.$el.resize();
-			}
-		},
-		setupSelect2Fields : function(col, idKey, textKey, selectTagId, placeHolder){
-			var that = this, data = [];
-			data = _.pluck(col.models, 'attributes');
-//			data = data.map(function(obj){
-//				return {id : obj[idKey], text : obj[textKey]}
-//			})
-			//data.unshift({'id': null, 'text': null});
-			for(var i=0;i < data.length;i++){
-				data[i].id = data[i].type;
-			}
-			this.ui[selectTagId].select2({
-				placeholder: (placeHolder) ? placeHolder :'Select',
-				tags:true,
-				allowClear : true,
-				width: '100%',
-				data: { results: data, text: textKey},
-				formatSelection: function(item){
-					return item[textKey];
-				},
-    			formatResult: function(item){
-    				return item[textKey];
-				}
-			}).on("change",function(e){
-				var data = that.ui[selectTagId].select2("data").map(function(d){return d.type});
-				if(selectTagId === "excludeComponents"){
-					that.vent.trigger("auditComponents:exclude",{mustNot:data.toString()});
-				}
-				if(selectTagId === "includeComponents")
-					that.vent.trigger("auditComponents:include",{mustBe:data.toString()});
-			});
-		},
-		startPoll : function(){
-			var that = this;
-			setInterval(function(){
-				that.pollLiveFeed();
-			},5000);
-		},
-		pollLiveFeed : function(){
-			var that = this;
-			if(this.pollXhr){
-				if(this.pollXhr.readyState > 0 && this.pollXhr.readyState < 4)
-					return
-			}
-			this.pollXhr = this.auditModel.auditLiveFeed({},{
-				beforeSend : function(){
-					that.$("#loaderFeed").show();
-				},
-				success : function(data){
-					var dd=[];
-					that.$("#spark").parent().show();
-					_.each(data.vnameValues,function(d){
-						dd.push(d.value);
-					});
-					that.$("#spark").sparkline(dd, {lineColor: '#5A8DB6',width:"100px",
-						/*tooltipFormatter : function(){
-							console.log(arguments)
-						}*/});
-				},
-				error : function(){
-					that.$("#spark").parent().hide();
-				},
-				complete : function(){
-					setTimeout(function(){
-						that.$("#loaderFeed").hide();
-					},1000);
-				}
-			});
-		},
-		reinitializeFilterMustBe : function(values){
-			if(values.mustBe){
-				this.ui.includeComponents.select2('val',values.mustBe.split(","));
-			}else{
-				this.ui.includeComponents.select2('val',[]);
-			}
-		},
-		reinitializeFilterMustNot : function(values){
-			if(values.mustNot){
-				this.ui.excludeComponents.select2('val',values.mustNot.split(","));
-			}else{
-				this.ui.excludeComponents.select2('val',[]);
-			}
-		}
-	});
+          _.each(that.columns, function (v, i) {
+            if (v.toLowerCase().indexOf("time") > 0) {
+              delete that.columns[v]
+            }
+          });
+          that.RVisualSearchInc.show(new VisualSearchView({
+            viewName: "includeColumns",
+            placeholder: "Include Search",
+            vent: that.vent,
+            globalVent: that.globalVent,
+            customOptions: _.values(that.columns),
+            eventName: "search:audit:include",
+            myFormatData: function (query, searchCollection) {
+              var obj = ViewUtils.replaceColumnNamesWithKeys(searchCollection, Globals.invertedAuditLogMappings, true);
+              return {
+                includeQuery: JSON.stringify(obj),
+                query: query
+              }
+            }
+          }));
+          that.RVisualSearchEx.show(new VisualSearchView({
+            placeholder: "Exclude Search",
+            vent: that.vent,
+            globalVent: that.globalVent,
+            customOptions: _.values(that.columns),
+            eventName: "search:audit:exclude",
+            myFormatData: function (query, searchCollection) {
+              var obj = ViewUtils.replaceColumnNamesWithKeys(searchCollection, Globals.invertedAuditLogMappings, true);
+              return {
+                excludeQuery: JSON.stringify(obj),
+                query: query
+              }
+            }
+          }));
+        });
+      },
+      renderAuditTable: function () {
+        var that = this;
+        require(['views/common/TableLayout'], function (TableLayout) {
+          var cols = new Backgrid.Columns(that.getColumns());
+          that.RAuditTable.show(new TableLayout({
+            columns: cols,
+            collection: that.collection,
+            includeFilter: false,
+            includePagination: true,
+            includePageSize: true,
+            includeFooterRecords: true,
+            includeColumnManager: true,
+            columnOpts: {
+              initialColumnsVisible: 9,
+              saveState: false
+            },
+            gridOpts: {
+              className: "table table-bordered table-hover table-condensed backgrid",
+              emptyText: 'No records found!'
+            },
+            filterOpts: {},
+            paginatorOpts: {}
+          }));
+        });
+      },
+      getColumns: function () {
+        var cols = {};
+        var that = this;
+        var columns = {
+          evtTime: {
+            label: "Event Time",
+            cell: "String",
+            sortType: 'toggle',
+            editable: false,
+            formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
+              fromRaw: function (rawValue, model) {
+                return moment(rawValue).format("YYYY-MM-DD HH:mm:ss,SSS");
+              }
+            })
+          },
+          reqUser: {
+            label: "User",
+            cell: "String",
+            sortType: 'toggle',
+            editable: false
+          },
+          repo: {
+            label: 'Repo',
+            cell: "String",
+            sortType: 'toggle',
+            editable: false
+          },
+          resource: {
+            label: 'Resource',
+            cell: "String",
+            sortType: 'toggle',
+            editable: false
+          },
+          access: {
+            label: 'Access Type',
+            cell: "String",
+            sortType: 'toggle',
+            editable: false
+          },
+          result: {
+            label: 'Result',
+            cell: "String",
+            sortType: 'toggle',
+            editable: false,
+            formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
+              fromRaw: function (rawValue, model) {
+                return (rawValue === 1) ? "Allowed" : "Denied";
+              }
+            })
+          },
+          enforcer: {
+            label: 'Access Enforcer',
+            cell: "String",
+            sortType: 'toggle',
+            editable: false
+          },
+          cliIP: {
+            label: 'Client IP',
+            cell: "String",
+            sortType: 'toggle',
+            editable: false
+          },
+          event_count: {
+            label: 'Event Count',
+            cell: "String",
+            sortType: 'toggle',
+            editable: false
+          }
+        };
+        _.each(this.columns, function(value){
+          var name = Globals.invertedAuditLogMappings[value];
+          if (columns[name] === undefined && value != "_version_") {
+            var columnObj = {
+              name: Globals.invertedAuditLogMappings[value],
+              label:value,
+              cell: "String",
+              sortType: 'toggle',
+              editable: false
+            };
+            columns[name] = columnObj;
+          } else {
+            if (columns[name] && columns[name].label) {
+              columns[name].label = value;
+            }
+          }
+        });
+        return this.collection.constructor.getTableCols(columns, this.collection);
+      },
+      onAuditTabRefresh: function (e) {
+        ViewUtils.setLatestTimeParams(this.defaultParams);
+        $.extend(this.collection.queryParams, this.defaultParams);
+        this.collection.fetch({reset: true});
+        this.vent.trigger("tab:refresh", this.defaultParams);
+      },
+      onViewTypeChange: function (e) {
+        var that = this;
+        var val = that.$("[name='viewTypeAudit']:checked").val();
+        this.toggleViewType(val);
+      },
+      toggleViewType: function (val) {
+        if (val === "A") {
+          this.$("[data-id='auditTable']").show();
+          this.$('[data-id="auditAggregated"]').hide();
+        } else {
+          this.$('[data-id="auditAggregated"]').show();
+          this.$("[data-id='auditTable']").hide();
+          if (this.RAuditAggregated.currentView)
+            this.RAuditAggregated.currentView.$el.resize();
+        }
+      },
+      setupSelect2Fields: function (col, idKey, textKey, selectTagId, placeHolder) {
+        var that = this, data = [];
+        data = _.pluck(col.models, 'attributes');
+        for (var i = 0; i < data.length; i++) {
+          data[i].id = data[i].type;
+        }
+        this.ui[selectTagId].select2({
+          placeholder: (placeHolder) ? placeHolder : 'Select',
+          tags: true,
+          allowClear: true,
+          width: '100%',
+          data: {results: data, text: textKey},
+          formatSelection: function (item) {
+            return item[textKey];
+          },
+          formatResult: function (item) {
+            return item[textKey];
+          }
+        }).on("change", function (e) {
+          var data = that.ui[selectTagId].select2("data").map(function (d) {
+            return d.type
+          });
+          if (selectTagId === "excludeComponents") {
+            that.vent.trigger("auditComponents:exclude", {mustNot: data.toString()});
+          }
+          if (selectTagId === "includeComponents")
+            that.vent.trigger("auditComponents:include", {mustBe: data.toString()});
+        });
+      },
+      startPoll: function () {
+        var that = this;
+        setInterval(function () {
+          that.pollLiveFeed();
+        }, 5000);
+      },
+      pollLiveFeed: function () {
+        var that = this;
+        if (this.pollXhr) {
+          if (this.pollXhr.readyState > 0 && this.pollXhr.readyState < 4)
+            return
+        }
+        this.pollXhr = this.auditModel.auditLiveFeed({}, {
+          beforeSend: function () {
+            that.$("#loaderFeed").show();
+          },
+          success: function (data) {
+            var dd = [];
+            that.$("#spark").parent().show();
+            _.each(data.vnameValues, function (d) {
+              dd.push(d.value);
+            });
+            that.$("#spark").sparkline(dd, {lineColor: '#5A8DB6', width: "100px"});
+          },
+          error: function () {
+            that.$("#spark").parent().hide();
+          },
+          complete: function () {
+            setTimeout(function () {
+              that.$("#loaderFeed").hide();
+            }, 1000);
+          }
+        });
+      },
+      reinitializeFilterMustBe: function (values) {
+        if (values.mustBe) {
+          this.ui.includeComponents.select2('val', values.mustBe.split(","));
+        } else {
+          this.ui.includeComponents.select2('val', []);
+        }
+      },
+      reinitializeFilterMustNot: function (values) {
+        if (values.mustNot) {
+          this.ui.excludeComponents.select2('val', values.mustNot.split(","));
+        } else {
+          this.ui.excludeComponents.select2('val', []);
+        }
+      }
+    });
 });

http://git-wip-us.apache.org/repos/asf/ambari/blob/6fa4abfe/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/common/CustomBackgrid.js
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/common/CustomBackgrid.js b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/common/CustomBackgrid.js
index e43f239..83b756b 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/common/CustomBackgrid.js
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/common/CustomBackgrid.js
@@ -252,7 +252,6 @@ define(['require',
 		initialize: function (options) {
 			var args = Array.prototype.slice.apply(arguments);
 			Backgrid.Header.prototype.initialize.apply(this, args);
-
 			this.searchRow = new HeaderRow({
 				columns: this.columns,
 				collection: this.collection

http://git-wip-us.apache.org/repos/asf/ambari/blob/6fa4abfe/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/common/Header.js
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/common/Header.js b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/common/Header.js
index e88afea..1e469d5 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/common/Header.js
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/common/Header.js
@@ -339,12 +339,8 @@ define(['require',
 
                 var gMessage = logMessagesList.map(function(e) {
                     return e.message
-                })
-                this.setNotificationCount(componentList.length, gMessage.length);
-                this.globalVent.trigger("globalExclusion:component:message", {
-                    gMustNot: (componentList.length != 0) ? (componentList.join()) : (""),
-                    gEMessage: (gMessage.length != 0) ? (gMessage.join(Globals.splitToken)) : ("")
                 });
+                this.setNotificationCount(componentList.length, gMessage.length);
             },
             /** closing the movable/resizable popup */
             onDialogClosed: function() {

http://git-wip-us.apache.org/repos/asf/ambari/blob/6fa4abfe/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/common/ProfileBar.js
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/common/ProfileBar.js b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/common/ProfileBar.js
index f46d94b..0cdef28 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/common/ProfileBar.js
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/common/ProfileBar.js
@@ -22,9 +22,8 @@ define(['require',
 	'backbone',
 	'App',
 	'communicator',
-	'mgrs/SessionMgr',
 	'hbs!tmpl/common/ProfileBar_tmpl'
-],function(require,Backbone,App,Communicator,SessionMgr,ProfileBar_tmpl){
+],function(require,Backbone,App,Communicator,ProfileBar_tmpl){
     'use strict';
 	
 	var ProfileBar = Backbone.Marionette.ItemView.extend(


[57/58] [abbrv] ambari git commit: AMBARI-18529. Custom properties are now overriding default proplerties (Miklos Gergely via oleewere)

Posted by ol...@apache.org.
AMBARI-18529. Custom properties are now overriding default proplerties (Miklos Gergely via oleewere)

Change-Id: I28b8d74836df85dc2e7538686563df5de9b0eada


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

Branch: refs/heads/branch-2.5
Commit: 0e852c140cbebdfafa690eaf24e7614cc76c5a3e
Parents: c9d3b59
Author: Miklos Gergely <mg...@hortonworks.com>
Authored: Fri Oct 7 01:49:44 2016 +0200
Committer: oleewere <ol...@gmail.com>
Committed: Sat Nov 5 14:46:47 2016 +0100

----------------------------------------------------------------------
 .../apache/ambari/logsearch/dao/UserDao.java    | 17 ++++----
 ...LogsearchAbstractAuthenticationProvider.java | 14 -------
 .../LogsearchSimpleAuthenticationProvider.java  | 11 ------
 .../LOGSEARCH/0.5.0/package/scripts/params.py   | 41 +++++++++++++++-----
 4 files changed, 40 insertions(+), 43 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/0e852c14/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/UserDao.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/UserDao.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/UserDao.java
index 0810571..912442d 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/UserDao.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/UserDao.java
@@ -88,17 +88,18 @@ public class UserDao {
     }
   }
 
-  public User loadUserByUsername(final String username) {
+  public User loadUserByUsername(String username) {
     logger.debug(" loadUserByUsername username" + username);
     HashMap<String, String> userInfo = findByusername(username);
-    User user = new User();
-
-    if (userInfo != null) {
-      user.setFirstName(userInfo.get(NAME) != null ? userInfo.get(NAME) : "Unknown");
-      user.setLastName(userInfo.get(NAME) != null ? userInfo.get(NAME) : "Unknown");
-      user.setUsername(userInfo.get(USER_NAME) != null ? userInfo.get(USER_NAME) : "");
-      user.setPassword(userInfo.get(ENC_PASSWORD) != null ? userInfo.get(ENC_PASSWORD) : "");
+    if (userInfo == null) {
+      return null;
     }
+    
+    User user = new User();
+    user.setFirstName(StringUtils.defaultString(userInfo.get(NAME), "Unknown"));
+    user.setLastName(StringUtils.defaultString(userInfo.get(NAME), "Unknown"));
+    user.setUsername(StringUtils.defaultString(userInfo.get(USER_NAME), ""));
+    user.setPassword(StringUtils.defaultString(userInfo.get(ENC_PASSWORD), ""));
 
     Role r = new Role();
     r.setName("ROLE_USER");

http://git-wip-us.apache.org/repos/asf/ambari/blob/0e852c14/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchAbstractAuthenticationProvider.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchAbstractAuthenticationProvider.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchAbstractAuthenticationProvider.java
index eb6c9f1..1c7bf3b 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchAbstractAuthenticationProvider.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchAbstractAuthenticationProvider.java
@@ -21,7 +21,6 @@ package org.apache.ambari.logsearch.web.security;
 import java.util.ArrayList;
 import java.util.List;
 
-import org.apache.ambari.logsearch.common.PropertiesHelper;
 import org.springframework.security.authentication.AuthenticationProvider;
 import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
 import org.springframework.security.core.GrantedAuthority;
@@ -29,8 +28,6 @@ import org.springframework.security.core.authority.SimpleGrantedAuthority;
 
 abstract class LogsearchAbstractAuthenticationProvider implements AuthenticationProvider {
 
-  private static final String AUTH_METHOD_PROPERTY_PREFIX = "logsearch.auth.";
-
   protected enum AuthMethod {
     LDAP, FILE, EXTERNAL_AUTH, SIMPLE
   };
@@ -48,15 +45,4 @@ abstract class LogsearchAbstractAuthenticationProvider implements Authentication
     grantedAuths.add(new SimpleGrantedAuthority("ROLE_USER"));
     return grantedAuths;
   }
-
-  /**
-   * Check authentication provider is enable or disable for specified method
-   */
-  public boolean isEnable(AuthMethod method) {
-    String methodName = method.name().toLowerCase();
-    String property = AUTH_METHOD_PROPERTY_PREFIX + methodName + ".enable";
-    boolean isEnable = PropertiesHelper.getBooleanProperty(property, false);
-    return isEnable;
-  }
-
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/0e852c14/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchSimpleAuthenticationProvider.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchSimpleAuthenticationProvider.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchSimpleAuthenticationProvider.java
index 92a7aaa..3506264 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchSimpleAuthenticationProvider.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchSimpleAuthenticationProvider.java
@@ -58,15 +58,4 @@ public class LogsearchSimpleAuthenticationProvider extends LogsearchAbstractAuth
     authentication = new UsernamePasswordAuthenticationToken(username, password, getAuthorities());
     return authentication;
   }
-
-  @Override
-  public boolean isEnable(AuthMethod method) {
-    boolean ldapEnabled = super.isEnable(AuthMethod.LDAP);
-    boolean fileEnabled = super.isEnable(AuthMethod.FILE);
-    boolean externalAuthEnabled = super.isEnable(AuthMethod.EXTERNAL_AUTH);
-    boolean simpleEnabled = super.isEnable(method);
-    
-    // simple is enabled only when rest three are disabled and simple is enable
-    return !ldapEnabled && !fileEnabled && !externalAuthEnabled && simpleEnabled;
-  }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/0e852c14/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/params.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/params.py b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/params.py
index e55653f..4526640 100644
--- a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/params.py
+++ b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/params.py
@@ -196,7 +196,9 @@ else:
 
 # Logsearch propreties
 
-logsearch_properties = dict(config['configurations']['logsearch-properties'])
+logsearch_properties = {}
+
+# default values
 
 logsearch_properties['logsearch.solr.zk_connect_string'] = zookeeper_quorum + infra_solr_znode
 logsearch_properties['logsearch.solr.audit.logs.zk_connect_string'] = logsearch_solr_audit_logs_zk_quorum + logsearch_solr_audit_logs_zk_node
@@ -205,13 +207,6 @@ logsearch_properties['logsearch.solr.collection.history'] = 'history'
 logsearch_properties['logsearch.solr.history.config.name'] = 'history'
 logsearch_properties['logsearch.collection.history.replication.factor'] = '1'
 
-if logsearch_properties['logsearch.solr.audit.logs.use.ranger'] == 'false':
-  del logsearch_properties['logsearch.ranger.audit.logs.collection.name']
-
-del logsearch_properties['logsearch.solr.audit.logs.use.ranger']
-
-logsearch_properties['logsearch.solr.metrics.collector.hosts'] = format(logsearch_properties['logsearch.solr.metrics.collector.hosts'])
-
 logsearch_properties['logsearch.solr.jmx.port'] = infra_solr_jmx_port
 
 logsearch_properties['logsearch.login.credentials.file'] = logsearch_admin_credential_file
@@ -219,10 +214,23 @@ logsearch_properties['logsearch.auth.file.enabled'] = 'true'
 logsearch_properties['logsearch.auth.ldap.enabled'] = 'false'
 logsearch_properties['logsearch.auth.simple.enabled'] = 'false'
 logsearch_properties['logsearch.roles.allowed'] = 'AMBARI.ADMINISTRATOR'
-logsearch_properties['logsearch.auth.external_auth.host_url'] = format(logsearch_properties['logsearch.auth.external_auth.host_url'])
 
 logsearch_properties['logsearch.protocol'] = logsearch_ui_protocol
 
+# load config values
+
+logsearch_properties = dict(logsearch_properties.items() + dict(config['configurations']['logsearch-properties']).items())
+
+# load derivated values
+
+if logsearch_properties['logsearch.solr.audit.logs.use.ranger'] == 'false':
+  del logsearch_properties['logsearch.ranger.audit.logs.collection.name']
+
+del logsearch_properties['logsearch.solr.audit.logs.use.ranger']
+
+logsearch_properties['logsearch.solr.metrics.collector.hosts'] = format(logsearch_properties['logsearch.solr.metrics.collector.hosts'])
+logsearch_properties['logsearch.auth.external_auth.host_url'] = format(logsearch_properties['logsearch.auth.external_auth.host_url'])
+
 if security_enabled:
   logsearch_properties['logsearch.solr.kerberos.enable'] = 'true'
   logsearch_properties['logsearch.solr.jaas.file'] = logsearch_jaas_file
@@ -286,9 +294,22 @@ if config['configurations']['logfeeder-grok']['custom_grok_patterns'].strip():
 
 logfeeder_properties = dict(config['configurations']['logfeeder-properties'])
 
+# logfeeder properties
+
+# load default values
+
+logfeeder_properties = {}
+
+logfeeder_properties['logfeeder.solr.core.config.name'] = 'history'
+
+# load config values
+
+logfeeder_properties = dict(logfeeder_properties.items() + dict(config['configurations']['logfeeder-properties']).items())
+
+# load derivated values
+
 logfeeder_properties['logfeeder.metrics.collector.hosts'] = format(logfeeder_properties['logfeeder.metrics.collector.hosts'])
 logfeeder_properties['logfeeder.config.files'] = format(logfeeder_properties['logfeeder.config.files'])
-logfeeder_properties['logfeeder.solr.core.config.name'] = 'history'
 logfeeder_properties['logfeeder.solr.zk_connect_string'] = zookeeper_quorum + infra_solr_znode
 
 if security_enabled:


[37/58] [abbrv] ambari git commit: AMBARI-18310. Logsearch - Refactor solr query layer (oleewere)

Posted by ol...@apache.org.
http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/CommonSearchCriteria.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/CommonSearchCriteria.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/CommonSearchCriteria.java
deleted file mode 100644
index ffdb2c7..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/CommonSearchCriteria.java
+++ /dev/null
@@ -1,95 +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.query.model;
-
-import static org.apache.ambari.logsearch.query.SearchCriteriaConstants.PARAM_END_TIME;
-import static org.apache.ambari.logsearch.query.SearchCriteriaConstants.PARAM_EXCLUDE_MESSAGE;
-import static org.apache.ambari.logsearch.query.SearchCriteriaConstants.PARAM_EXCLUDE_QUERY;
-import static org.apache.ambari.logsearch.query.SearchCriteriaConstants.PARAM_INCLUDE_MESSAGE;
-import static org.apache.ambari.logsearch.query.SearchCriteriaConstants.PARAM_INCLUDE_QUERY;
-import static org.apache.ambari.logsearch.query.SearchCriteriaConstants.PARAM_MUST_BE_STRING;
-import static org.apache.ambari.logsearch.query.SearchCriteriaConstants.PARAM_MUST_NOT_STRING;
-import static org.apache.ambari.logsearch.query.SearchCriteriaConstants.PARAM_START_TIME;
-
-public class CommonSearchCriteria extends SearchCriteria {
-
-  public String getIncludeMessage() {
-    return getParam(PARAM_INCLUDE_MESSAGE, String.class);
-  }
-
-  public void setIncludeMessage(String includeMessage) {
-    addParam(PARAM_INCLUDE_MESSAGE, includeMessage);
-  }
-
-  public String getExcludeMessage() {
-    return getParam(PARAM_EXCLUDE_MESSAGE, String.class);
-  }
-
-  public void setExcludeMessage(String excludeMessage) {
-    addParam(PARAM_EXCLUDE_MESSAGE, excludeMessage);
-  }
-
-  public String getMustBe() {
-    return getParam(PARAM_MUST_BE_STRING, String.class);
-  }
-
-  public void setMustBe(String mustHave) {
-    addParam(PARAM_MUST_BE_STRING, mustHave);
-  }
-
-  public String getMustNot() {
-    return getParam(PARAM_MUST_NOT_STRING, String.class);
-  }
-
-  public void setMustNot(String mustNot) {
-    addParam(PARAM_MUST_NOT_STRING, mustNot);
-  }
-
-  public String getIncludeQuery() {
-    return getParam(PARAM_INCLUDE_QUERY, String.class);
-  }
-
-  public void setIncludeQuery(String includeQuery) {
-    addParam(PARAM_INCLUDE_QUERY, includeQuery);
-  }
-
-  public String getExcludeQuery() {
-    return getParam(PARAM_EXCLUDE_QUERY, String.class);
-  }
-
-  public void setExcludeQuery(String excludeQuery) {
-    addParam(PARAM_EXCLUDE_QUERY, excludeQuery);
-  }
-
-  public String getStartTime() {
-    return getParam(PARAM_START_TIME, String.class);
-  }
-
-  public void setStartTime(String startTime) {
-    addParam(PARAM_START_TIME, startTime);
-  }
-
-  public String getEndTime() {
-    return getParam(PARAM_END_TIME, String.class);
-  }
-
-  public void setEndTime(String endTime) {
-    addParam(PARAM_END_TIME, endTime);
-  }
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/CommonServiceLogSearchCriteria.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/CommonServiceLogSearchCriteria.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/CommonServiceLogSearchCriteria.java
deleted file mode 100644
index b02c234..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/CommonServiceLogSearchCriteria.java
+++ /dev/null
@@ -1,88 +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.query.model;
-
-import org.apache.ambari.logsearch.query.SearchCriteriaConstants;
-
-public class CommonServiceLogSearchCriteria extends CommonSearchCriteria {
-
-  public String getLevel() {
-    return getParam(SearchCriteriaConstants.PARAM_LEVEL, String.class);
-  }
-
-  public void setLevel(String level) {
-    addParam(SearchCriteriaConstants.PARAM_LEVEL, level);
-  }
-
-  public String getSelectComp() {
-    return getParam(SearchCriteriaConstants.PARAM_SELECT_COMP, String.class);
-  }
-
-  public void setSelectComp(String selectComp) {
-    addParam(SearchCriteriaConstants.PARAM_SELECT_COMP, selectComp);
-  }
-
-  public String getBundleId() {
-    return getParam(SearchCriteriaConstants.PARAM_BUNDLE_ID, String.class);
-  }
-
-  public void setBundleId(String bunldeId) {
-    addParam(SearchCriteriaConstants.PARAM_BUNDLE_ID, bunldeId);
-  }
-
-  public String getFrom() {
-    return getParam(SearchCriteriaConstants.PARAM_FROM ,String.class);
-  }
-
-  public void setFrom(String from) {
-    addParam(SearchCriteriaConstants.PARAM_FROM, from);
-  }
-
-  public String getTo() {
-    return getParam(SearchCriteriaConstants.PARAM_TO ,String.class);
-  }
-
-  public void setTo(String to) {
-    addParam(SearchCriteriaConstants.PARAM_TO, to);
-  }
-
-  public String getHostName() {
-    return getParam(SearchCriteriaConstants.PARAM_HOST_NAME ,String.class);
-  }
-
-  public void setHostName(String hostName) {
-    addParam(SearchCriteriaConstants.PARAM_HOST_NAME, hostName);
-  }
-
-  public String getComponentName() {
-    return getParam(SearchCriteriaConstants.PARAM_COMPONENT_NAME ,String.class);
-  }
-
-  public void setComponentName(String componentName) {
-    addParam(SearchCriteriaConstants.PARAM_COMPONENT_NAME, componentName);
-  }
-
-  public String getFileName() {
-    return getParam(SearchCriteriaConstants.PARAM_FILE_NAME ,String.class);
-  }
-
-  public void setFileName(String fileName) {
-    addParam(SearchCriteriaConstants.PARAM_FILE_NAME, fileName);
-  }
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/FieldAuditBarGraphSearchCriteria.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/FieldAuditBarGraphSearchCriteria.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/FieldAuditBarGraphSearchCriteria.java
deleted file mode 100644
index 381b3c2..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/FieldAuditBarGraphSearchCriteria.java
+++ /dev/null
@@ -1,32 +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.query.model;
-
-import static org.apache.ambari.logsearch.query.SearchCriteriaConstants.PARAM_FIELD;
-
-public class FieldAuditBarGraphSearchCriteria extends AuditBarGraphSearchCriteria {
-
-  public String getField() {
-    return getParam(PARAM_FIELD, String.class);
-  }
-
-  public void setField(String field) {
-    addParam(PARAM_FIELD, field);
-  }
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/FieldAuditLogSearchCriteria.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/FieldAuditLogSearchCriteria.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/FieldAuditLogSearchCriteria.java
deleted file mode 100644
index 9d5d225..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/FieldAuditLogSearchCriteria.java
+++ /dev/null
@@ -1,32 +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.query.model;
-
-import static org.apache.ambari.logsearch.query.SearchCriteriaConstants.PARAM_FIELD;
-
-public class FieldAuditLogSearchCriteria extends CommonSearchCriteria {
-
-  public String getField() {
-    return getParam(PARAM_FIELD, String.class);
-  }
-
-  public void setField(String field) {
-    addParam(PARAM_FIELD, field);
-  }
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/SearchCriteria.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/SearchCriteria.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/SearchCriteria.java
deleted file mode 100644
index 8e397ac..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/SearchCriteria.java
+++ /dev/null
@@ -1,135 +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.query.model;
-
-import java.util.HashMap;
-import java.util.Locale;
-import java.util.Map;
-
-import org.apache.ambari.logsearch.common.PropertiesHelper;
-
-public class SearchCriteria {
-
-  private int startIndex = 0;
-  private int maxRows = Integer.MAX_VALUE;
-  private String sortBy = null;
-  private String sortType = null;
-  private int page = 0;
-
-  private String globalStartTime = null;
-  private String globalEndTime = null;
-
-  private HashMap<String, Object> paramList = new HashMap<String, Object>();
-
-  private Map<String, Object> urlParamMap = new HashMap<String, Object>();
-
-  public SearchCriteria() {
-    // Auto-generated constructor stub
-  }
-
-
-  public void addParam(String name, Object value) {
-    paramList.put(name, value);
-  }
-
-  public Object getParamValue(String name) {
-    return paramList.get(name);
-  }
-
-  public <T> T getParam(String key, Class<T> type) {
-    if (getParamValue(key) != null) {
-      return (T) getParamValue(key);
-    }
-    return null;
-  }
-
-  public Map<String, Object> getUrlParamMap() {
-    return urlParamMap;
-  }
-
-  public void setUrlParamMap(Map<String, Object> urlParamMap) {
-    this.urlParamMap = urlParamMap;
-  }
-
-  public int getStartIndex() {
-    return startIndex;
-  }
-
-  public void setStartIndex(int startIndex) {
-    this.startIndex = startIndex;
-  }
-
-  public int getMaxRows() {
-    return maxRows;
-  }
-
-  public void setMaxRows(int maxRows) {
-    this.maxRows = maxRows;
-  }
-
-  public String getSortType() {
-    return sortType;
-  }
-
-  public String getSortBy() {
-    return sortBy;
-  }
-
-  public void setSortBy(String sortBy) {
-    this.sortBy = sortBy;
-  }
-
-  public void setSortType(String sortType) {
-    this.sortType = sortType;
-  }
-
-  public int getPage() {
-    return page;
-  }
-
-  public void setPage(int page) {
-    this.page = page;
-  }
-
-  public String getGlobalStartTime() {
-    return globalStartTime;
-  }
-
-  public void setGlobalStartTime(String globalStartTime) {
-    this.globalStartTime = globalStartTime;
-  }
-
-  public String getGlobalEndTime() {
-    return globalEndTime;
-  }
-
-  public void setGlobalEndTime(String globalEndTime) {
-    this.globalEndTime = globalEndTime;
-  }
-
-  @Override
-  public String toString() {
-    StringBuilder sb = new StringBuilder();
-    for (Map.Entry<String, Object> entry : paramList.entrySet()) {
-      sb.append(entry.getKey() + " : " + entry.getValue() + ";");
-    }
-    return sb.toString();
-  }
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceAnyGraphSearchCriteria.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceAnyGraphSearchCriteria.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceAnyGraphSearchCriteria.java
deleted file mode 100644
index 0f4bb5a..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceAnyGraphSearchCriteria.java
+++ /dev/null
@@ -1,60 +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.query.model;
-
-import org.apache.ambari.logsearch.common.Marker;
-
-import static org.apache.ambari.logsearch.query.SearchCriteriaConstants.PARAM_STACK_BY;
-import static org.apache.ambari.logsearch.query.SearchCriteriaConstants.PARAM_UNIT;
-import static org.apache.ambari.logsearch.query.SearchCriteriaConstants.PARAM_X_AXIS;
-import static org.apache.ambari.logsearch.query.SearchCriteriaConstants.PARAM_Y_AXIS;
-
-public class ServiceAnyGraphSearchCriteria extends ServiceLogSearchCriteria {
-  public String getxAxis() {
-    return getParam(PARAM_X_AXIS, String.class);
-  }
-
-  public void setxAxis(String xAxis) {
-    addParam(PARAM_X_AXIS, xAxis);
-  }
-
-  public String getyAxis() {
-    return getParam(PARAM_Y_AXIS, String.class);
-  }
-
-  public void setyAxis(String yAxis) {
-    addParam(PARAM_Y_AXIS, yAxis);
-  }
-
-  public String getStackBy() {
-    return getParam(PARAM_STACK_BY, String.class);
-  }
-
-  public void setStackBy(String stackBy) {
-    addParam(PARAM_STACK_BY, stackBy);
-  }
-
-  public String getUnit() {
-    return getParam(PARAM_UNIT, String.class);
-  }
-
-  public void setUnit(String unit) {
-    addParam(PARAM_UNIT, unit);
-  }
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceExtremeDatesCriteria.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceExtremeDatesCriteria.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceExtremeDatesCriteria.java
deleted file mode 100644
index d89ab3b..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceExtremeDatesCriteria.java
+++ /dev/null
@@ -1,32 +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.query.model;
-
-import org.apache.ambari.logsearch.query.SearchCriteriaConstants;
-
-public class ServiceExtremeDatesCriteria extends CommonSearchCriteria {
-
-  public String getBundleId() {
-    return getParam(SearchCriteriaConstants.PARAM_BUNDLE_ID, String.class);
-  }
-
-  public void setBundleId(String bunldeId) {
-    addParam(SearchCriteriaConstants.PARAM_BUNDLE_ID, bunldeId);
-  }
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceGraphSearchCriteria.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceGraphSearchCriteria.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceGraphSearchCriteria.java
deleted file mode 100644
index 4173bac..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceGraphSearchCriteria.java
+++ /dev/null
@@ -1,32 +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.query.model;
-
-import org.apache.ambari.logsearch.query.SearchCriteriaConstants;
-
-public class ServiceGraphSearchCriteria extends ServiceLogSearchCriteria {
-
-  public String getUnit() {
-    return getParam(SearchCriteriaConstants.PARAM_UNIT, String.class);
-  }
-
-  public void setUnit(String unit) {
-    addParam(SearchCriteriaConstants.PARAM_UNIT, unit);
-  }
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceLogExportSearchCriteria.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceLogExportSearchCriteria.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceLogExportSearchCriteria.java
deleted file mode 100644
index 6c757af..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceLogExportSearchCriteria.java
+++ /dev/null
@@ -1,40 +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.query.model;
-
-import org.apache.ambari.logsearch.query.SearchCriteriaConstants;
-
-public class ServiceLogExportSearchCriteria extends ServiceLogSearchCriteria {
-
-  public void setFormat(String format) {
-    addParam(SearchCriteriaConstants.PARAM_FORMAT, format);
-  }
-
-  public String getFormat() {
-    return getParam(SearchCriteriaConstants.PARAM_FORMAT, String.class);
-  }
-
-  public void setUtcOffset(String utcOffset) {
-    addParam(SearchCriteriaConstants.PARAM_UTC_OFFSET, utcOffset);
-  }
-
-  public String getUtcOffset() {
-    return getParam(SearchCriteriaConstants.PARAM_UTC_OFFSET, String.class);
-  }
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceLogSearchCriteria.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceLogSearchCriteria.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceLogSearchCriteria.java
deleted file mode 100644
index e469367..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceLogSearchCriteria.java
+++ /dev/null
@@ -1,65 +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.query.model;
-
-import org.apache.ambari.logsearch.query.SearchCriteriaConstants;
-
-public class ServiceLogSearchCriteria extends CommonServiceLogSearchCriteria {
-
-  public void setKeyword(String keyword) {
-    addParam(SearchCriteriaConstants.PARAM_KEYWORD, keyword);
-  }
-
-  public String getKeyword() {
-    return getParam(SearchCriteriaConstants.PARAM_KEYWORD, String.class);
-  }
-
-  public void setKeywordType(String keywordType) {
-    addParam(SearchCriteriaConstants.PARAM_KEYWORD_TYPE, keywordType);
-  }
-
-  public String getKeywordType() {
-    return getParam(SearchCriteriaConstants.PARAM_KEYWORD_TYPE, String.class);
-  }
-
-  public void setSourceLogId(String sourceLogId) {
-    addParam(SearchCriteriaConstants.PARAM_SOURCE_LOG_ID, sourceLogId);
-  }
-
-  public String getSourceLogId() {
-    return getParam(SearchCriteriaConstants.PARAM_SOURCE_LOG_ID, String.class);
-  }
-
-  public void setToken(String token) {
-    addParam(SearchCriteriaConstants.PARAM_TOKEN, token);
-  }
-
-  public String getToken() {
-    return getParam(SearchCriteriaConstants.PARAM_TOKEN, String.class);
-  }
-
-  public void setLastPage(boolean lastPage) {
-    addParam(SearchCriteriaConstants.PARAM_IS_LAST_PAGE, lastPage);
-  }
-
-  public boolean isLastPage() {
-    return getParam(SearchCriteriaConstants.PARAM_IS_LAST_PAGE, Boolean.class);
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceLogTruncatedSearchCriteria.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceLogTruncatedSearchCriteria.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceLogTruncatedSearchCriteria.java
deleted file mode 100644
index 277aeb9..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceLogTruncatedSearchCriteria.java
+++ /dev/null
@@ -1,48 +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.query.model;
-
-import org.apache.ambari.logsearch.query.SearchCriteriaConstants;
-
-public class ServiceLogTruncatedSearchCriteria extends ServiceLogSearchCriteria {
-
-  public String getId() {
-    return getParam(SearchCriteriaConstants.PARAM_ID, String.class);
-  }
-
-  public void setId(String id) {
-    addParam(SearchCriteriaConstants.PARAM_ID, id);
-  }
-
-  public String getScrollType() {
-    return getParam(SearchCriteriaConstants.PARAM_SCROLL_TYPE, String.class);
-  }
-
-  public void setScrollType(String scrollType) {
-    addParam(SearchCriteriaConstants.PARAM_SCROLL_TYPE, scrollType);
-  }
-
-  public String getNumberRows() {
-    return getParam(SearchCriteriaConstants.PARAM_NUMBER_ROWS, String.class);
-  }
-
-  public void setNumberRows(String numberRows) {
-    addParam(SearchCriteriaConstants.PARAM_NUMBER_ROWS, numberRows);
-  }
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/UserConfigSearchCriteria.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/UserConfigSearchCriteria.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/UserConfigSearchCriteria.java
deleted file mode 100644
index eafff69..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/UserConfigSearchCriteria.java
+++ /dev/null
@@ -1,48 +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.query.model;
-
-import org.apache.ambari.logsearch.query.SearchCriteriaConstants;
-
-public class UserConfigSearchCriteria extends CommonSearchCriteria {
-
-  public String getUserName() {
-    return getParam(SearchCriteriaConstants.PARAM_USER_NAME, String.class);
-  }
-
-  public void setUserName(String userName) {
-    addParam(SearchCriteriaConstants.PARAM_USER_NAME, userName);
-  }
-
-  public String getFilterName() {
-    return getParam(SearchCriteriaConstants.PARAM_FILTER_NAME, String.class);
-  }
-
-  public void setFilterName(String filterName) {
-    addParam(SearchCriteriaConstants.PARAM_FILTER_NAME, filterName);
-  }
-
-  public String getRowType() {
-    return getParam(SearchCriteriaConstants.PARAM_ROW_TYPE, String.class);
-  }
-
-  public void setRowType(String rowType) {
-    addParam(SearchCriteriaConstants.PARAM_ROW_TYPE, rowType);
-  }
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/UserExportSearchCriteria.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/UserExportSearchCriteria.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/UserExportSearchCriteria.java
deleted file mode 100644
index 46d13cc..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/UserExportSearchCriteria.java
+++ /dev/null
@@ -1,31 +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.query.model;
-
-import org.apache.ambari.logsearch.query.SearchCriteriaConstants;
-
-public class UserExportSearchCriteria extends FieldAuditLogSearchCriteria {
-  public void setFormat(String format) {
-    addParam(SearchCriteriaConstants.PARAM_FORMAT, format);
-  }
-
-  public String getFormat() {
-    return getParam(SearchCriteriaConstants.PARAM_FORMAT, String.class);
-  }
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/AuditLogsResource.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/AuditLogsResource.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/AuditLogsResource.java
index 0bd326e..d5b6525 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/AuditLogsResource.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/AuditLogsResource.java
@@ -20,52 +20,39 @@
 package org.apache.ambari.logsearch.rest;
 
 import javax.inject.Inject;
+import javax.inject.Named;
 import javax.ws.rs.BeanParam;
 import javax.ws.rs.GET;
 import javax.ws.rs.Path;
 import javax.ws.rs.Produces;
 import javax.ws.rs.core.Response;
 
+import freemarker.template.TemplateException;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
-import org.apache.ambari.logsearch.model.request.impl.AnyGraphRequest;
 import org.apache.ambari.logsearch.model.request.impl.AuditBarGraphRequest;
-import org.apache.ambari.logsearch.model.request.impl.BaseAuditLogRequest;
-import org.apache.ambari.logsearch.model.request.impl.FieldAuditBarGraphRequest;
+import org.apache.ambari.logsearch.model.request.impl.AuditComponentRequest;
+import org.apache.ambari.logsearch.model.request.impl.AuditServiceLoadRequest;
 import org.apache.ambari.logsearch.model.request.impl.FieldAuditLogRequest;
-import org.apache.ambari.logsearch.model.request.impl.SimpleQueryRequest;
 import org.apache.ambari.logsearch.model.request.impl.UserExportRequest;
 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.NameValueDataListResponse;
-import org.apache.ambari.logsearch.query.model.AnyGraphSearchCriteria;
-import org.apache.ambari.logsearch.query.model.AuditLogSearchCriteria;
-import org.apache.ambari.logsearch.query.model.AuditBarGraphSearchCriteria;
-import org.apache.ambari.logsearch.query.model.CommonSearchCriteria;
-import org.apache.ambari.logsearch.query.model.FieldAuditLogSearchCriteria;
-import org.apache.ambari.logsearch.query.model.FieldAuditBarGraphSearchCriteria;
 import org.apache.ambari.logsearch.model.request.impl.AuditLogRequest;
 import org.apache.ambari.logsearch.manager.AuditLogsManager;
-import org.apache.ambari.logsearch.query.model.UserExportSearchCriteria;
 import org.springframework.context.annotation.Scope;
-import org.springframework.core.convert.ConversionService;
-import org.springframework.stereotype.Component;
 
 import static org.apache.ambari.logsearch.doc.DocConstants.AuditOperationDescriptions.*;
 
 @Api(value = "audit/logs", description = "Audit log operations")
 @Path("audit/logs")
-@Component
+@Named
 @Scope("request")
 public class AuditLogsResource {
 
   @Inject
   private AuditLogsManager auditLogsManager;
 
-  @Inject
-  private ConversionService conversionService;
-
   @GET
   @Path("/schema/fields")
   @Produces({"application/json"})
@@ -78,15 +65,15 @@ public class AuditLogsResource {
   @Produces({"application/json"})
   @ApiOperation(GET_AUDIT_LOGS_OD)
   public AuditLogResponse getAuditLogs(@BeanParam AuditLogRequest auditLogRequest) {
-    return auditLogsManager.getLogs(conversionService.convert(auditLogRequest, AuditLogSearchCriteria.class));
+    return auditLogsManager.getLogs(auditLogRequest);
   }
 
   @GET
   @Path("/components")
   @Produces({"application/json"})
   @ApiOperation(GET_AUDIT_COMPONENTS_OD)
-  public GroupListResponse getAuditComponents(@BeanParam SimpleQueryRequest request) {
-    return auditLogsManager.getAuditComponents(conversionService.convert(request, CommonSearchCriteria.class));
+  public GroupListResponse getAuditComponents(@BeanParam AuditComponentRequest request) {
+    return auditLogsManager.getAuditComponents(request);
   }
 
   @GET
@@ -94,63 +81,31 @@ public class AuditLogsResource {
   @Produces({"application/json"})
   @ApiOperation(GET_AUDIT_LINE_GRAPH_DATA_OD)
   public BarGraphDataListResponse getAuditBarGraphData(@BeanParam AuditBarGraphRequest request) {
-    return auditLogsManager.getAuditBarGraphData(conversionService.convert(request, AuditBarGraphSearchCriteria.class));
+    return auditLogsManager.getAuditBarGraphData(request);
   }
 
   @GET
-  @Path("/users")
-  @Produces({"application/json"})
-  @ApiOperation(GET_TOP_AUDIT_USERS_OD)
-  public BarGraphDataListResponse getTopAuditUsers(@BeanParam FieldAuditBarGraphRequest request) {
-    return auditLogsManager.topTenUsers(conversionService.convert(request, FieldAuditBarGraphSearchCriteria.class));
-  }
-
-  @GET
-  @Path("/resources")
+  @Path("/resources/{top}")
   @Produces({"application/json"})
   @ApiOperation(GET_TOP_AUDIT_RESOURCES_OD)
-  public BarGraphDataListResponse getTopAuditResources(@BeanParam FieldAuditLogRequest request) {
-    return auditLogsManager.topTenResources(conversionService.convert(request, FieldAuditLogSearchCriteria.class));
-  }
-
-  @GET
-  @Path("/live/count")
-  @Produces({"application/json"})
-  @ApiOperation(GET_LIVE_LOGS_COUNT_OD)
-  public NameValueDataListResponse getLiveLogsCount() {
-    return auditLogsManager.getLiveLogCounts();
-  }
-
-  @GET
-  @Path("/request/user/bargraph")
-  @Produces({"application/json"})
-  @ApiOperation(GET_REQUEST_USER_LINE_GRAPH_OD)
-  public BarGraphDataListResponse getRequestUserBarGraph(@BeanParam FieldAuditBarGraphRequest request) {
-    return auditLogsManager.getRequestUserLineGraph(conversionService.convert(request, FieldAuditBarGraphSearchCriteria.class));
-  }
-
-  @GET
-  @Path("/anygraph")
-  @Produces({"application/json"})
-  @ApiOperation(GET_ANY_GRAPH_DATA_OD)
-  public BarGraphDataListResponse getAnyGraphData(@BeanParam AnyGraphRequest request) {
-    return auditLogsManager.getAnyGraphData(conversionService.convert(request, AnyGraphSearchCriteria.class));
+  public BarGraphDataListResponse getResources(@BeanParam FieldAuditLogRequest request) {
+    return auditLogsManager.topResources(request);
   }
 
   @GET
-  @Path("/users/export")
+  @Path("/export")
   @Produces({"application/json"})
   @ApiOperation(EXPORT_USER_TALBE_TO_TEXT_FILE_OD)
-  public Response exportUserTableToTextFile(@BeanParam UserExportRequest request) {
-    return auditLogsManager.exportUserTableToTextFile(conversionService.convert(request, UserExportSearchCriteria.class));
+  public Response exportUserTableToTextFile(@BeanParam UserExportRequest request) throws TemplateException {
+    return auditLogsManager.export(request);
   }
 
   @GET
   @Path("/serviceload")
   @Produces({"application/json"})
   @ApiOperation(GET_SERVICE_LOAD_OD)
-  public BarGraphDataListResponse getServiceLoad(@BeanParam BaseAuditLogRequest request) {
-    return auditLogsManager.getServiceLoad(conversionService.convert(request, CommonSearchCriteria.class));
+  public BarGraphDataListResponse getServiceLoad(@BeanParam AuditServiceLoadRequest request) {
+    return auditLogsManager.getServiceLoad(request);
   }
 
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/PublicResource.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/PublicResource.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/PublicResource.java
index 94bf059..df83d44 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/PublicResource.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/PublicResource.java
@@ -19,6 +19,7 @@
 package org.apache.ambari.logsearch.rest;
 
 import javax.inject.Inject;
+import javax.inject.Named;
 import javax.ws.rs.GET;
 import javax.ws.rs.Path;
 
@@ -26,13 +27,12 @@ import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.apache.ambari.logsearch.manager.PublicManager;
 import org.springframework.context.annotation.Scope;
-import org.springframework.stereotype.Component;
 
 import static org.apache.ambari.logsearch.doc.DocConstants.PublicOperationDescriptions.OBTAIN_GENERAL_CONFIG_OD;
 
 @Api(value = "public", description = "Public operations")
 @Path("public")
-@Component
+@Named
 @Scope("request")
 public class PublicResource {
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/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 5a17147..d6ceca5 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
@@ -19,21 +19,23 @@
 package org.apache.ambari.logsearch.rest;
 
 import javax.inject.Inject;
+import javax.inject.Named;
 import javax.ws.rs.BeanParam;
 import javax.ws.rs.GET;
 import javax.ws.rs.Path;
 import javax.ws.rs.Produces;
-import javax.ws.rs.QueryParam;
 import javax.ws.rs.core.Response;
 
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
-import io.swagger.annotations.ApiParam;
-import org.apache.ambari.logsearch.model.request.impl.BaseServiceLogRequest;
 import org.apache.ambari.logsearch.model.request.impl.ServiceAnyGraphRequest;
-import org.apache.ambari.logsearch.model.request.impl.ServiceExtremeDatesRequest;
 import org.apache.ambari.logsearch.model.request.impl.ServiceGraphRequest;
+import org.apache.ambari.logsearch.model.request.impl.ServiceLogAggregatedInfoRequest;
+import org.apache.ambari.logsearch.model.request.impl.ServiceLogComponentHostRequest;
+import org.apache.ambari.logsearch.model.request.impl.ServiceLogComponentLevelRequest;
 import org.apache.ambari.logsearch.model.request.impl.ServiceLogExportRequest;
+import org.apache.ambari.logsearch.model.request.impl.ServiceLogHostComponentRequest;
+import org.apache.ambari.logsearch.model.request.impl.ServiceLogLevelCountRequest;
 import org.apache.ambari.logsearch.model.request.impl.ServiceLogRequest;
 import org.apache.ambari.logsearch.model.request.impl.ServiceLogTruncatedRequest;
 import org.apache.ambari.logsearch.model.response.BarGraphDataListResponse;
@@ -43,23 +45,15 @@ import org.apache.ambari.logsearch.model.response.GroupListResponse;
 import org.apache.ambari.logsearch.model.response.NameValueDataListResponse;
 import org.apache.ambari.logsearch.model.response.NodeListResponse;
 import org.apache.ambari.logsearch.model.response.ServiceLogResponse;
-import org.apache.ambari.logsearch.query.model.CommonServiceLogSearchCriteria;
 import org.apache.ambari.logsearch.manager.ServiceLogsManager;
-import org.apache.ambari.logsearch.query.model.ServiceAnyGraphSearchCriteria;
-import org.apache.ambari.logsearch.query.model.ServiceExtremeDatesCriteria;
-import org.apache.ambari.logsearch.query.model.ServiceGraphSearchCriteria;
-import org.apache.ambari.logsearch.query.model.ServiceLogExportSearchCriteria;
-import org.apache.ambari.logsearch.query.model.ServiceLogSearchCriteria;
-import org.apache.ambari.logsearch.query.model.ServiceLogTruncatedSearchCriteria;
 import org.springframework.context.annotation.Scope;
 import org.springframework.core.convert.ConversionService;
-import org.springframework.stereotype.Component;
 
 import static org.apache.ambari.logsearch.doc.DocConstants.ServiceOperationDescriptions.*;
 
 @Api(value = "service/logs", description = "Service log operations")
 @Path("service/logs")
-@Component
+@Named
 @Scope("request")
 public class ServiceLogsResource {
 
@@ -73,7 +67,7 @@ public class ServiceLogsResource {
   @Produces({"application/json"})
   @ApiOperation(SEARCH_LOGS_OD)
   public ServiceLogResponse searchSolrData(@BeanParam ServiceLogRequest request) {
-    return serviceLogsManager.searchLogs(conversionService.convert(request, ServiceLogSearchCriteria.class));
+    return serviceLogsManager.searchLogs(request);
   }
 
   @GET
@@ -96,16 +90,8 @@ public class ServiceLogsResource {
   @Path("/aggregated")
   @Produces({"application/json"})
   @ApiOperation(GET_AGGREGATED_INFO_OD)
-  public GraphDataListResponse getAggregatedInfo(@BeanParam BaseServiceLogRequest request) {
-    return serviceLogsManager.getAggregatedInfo(conversionService.convert(request, CommonServiceLogSearchCriteria.class));
-  }
-
-  @GET
-  @Path("/levels/count")
-  @Produces({"application/json"})
-  @ApiOperation(GET_LOG_LEVELS_COUNT_OD)
-  public CountDataListResponse getLogLevelsCount() {
-    return serviceLogsManager.getLogLevelCount();
+  public GraphDataListResponse getAggregatedInfo(@BeanParam ServiceLogAggregatedInfoRequest request) {
+    return serviceLogsManager.getAggregatedInfo(request);
   }
 
   @GET
@@ -128,18 +114,16 @@ public class ServiceLogsResource {
   @Path("/tree")
   @Produces({"application/json"})
   @ApiOperation(GET_TREE_EXTENSION_OD)
-  public NodeListResponse getTreeExtension(@QueryParam("hostName") @ApiParam String hostName, @BeanParam ServiceLogRequest request) {
-    ServiceLogSearchCriteria searchCriteria = conversionService.convert(request, ServiceLogSearchCriteria.class);
-    searchCriteria.addParam("hostName", hostName); // TODO: use host_name instead - needs UI change
-    return serviceLogsManager.getTreeExtension(searchCriteria);
+  public NodeListResponse getTreeExtension(@BeanParam ServiceLogHostComponentRequest request) {
+    return serviceLogsManager.getTreeExtension(request);
   }
 
   @GET
-  @Path("/levels/counts/namevalues")
+  @Path("/levels/counts")
   @Produces({"application/json"})
   @ApiOperation(GET_LOG_LEVELS_COUNT_OD)
-  public NameValueDataListResponse getLogsLevelCount(@BeanParam ServiceLogRequest request) {
-    return serviceLogsManager.getLogsLevelCount(conversionService.convert(request, ServiceLogSearchCriteria.class));
+  public NameValueDataListResponse getLogsLevelCount(@BeanParam ServiceLogLevelCountRequest request) {
+    return serviceLogsManager.getLogsLevelCount(request);
   }
 
   @GET
@@ -147,15 +131,7 @@ public class ServiceLogsResource {
   @Produces({"application/json"})
   @ApiOperation(GET_HISTOGRAM_DATA_OD)
   public BarGraphDataListResponse getHistogramData(@BeanParam ServiceGraphRequest request) {
-    return serviceLogsManager.getHistogramData(conversionService.convert(request, ServiceGraphSearchCriteria.class));
-  }
-
-  @GET
-  @Path("/request/cancel")
-  @Produces({"application/json"})
-  @ApiOperation(CANCEL_FIND_REQUEST_OD)
-  public String cancelFindRequest(@QueryParam("token") @ApiParam String token) {
-    return serviceLogsManager.cancelFindRequestByDate(token);
+    return serviceLogsManager.getHistogramData(request);
   }
 
   @GET
@@ -163,36 +139,24 @@ public class ServiceLogsResource {
   @Produces({"application/json"})
   @ApiOperation(EXPORT_TO_TEXT_FILE_OD)
   public Response exportToTextFile(@BeanParam ServiceLogExportRequest request) {
-    return serviceLogsManager.exportToTextFile(conversionService.convert(request, ServiceLogExportSearchCriteria.class));
-
+    return serviceLogsManager.export(request);
   }
 
   @GET
   @Path("/hosts/components")
   @Produces({"application/json"})
   @ApiOperation(GET_HOST_LIST_BY_COMPONENT_OD)
-  public NodeListResponse getHostListByComponent(@BeanParam ServiceLogRequest request, @QueryParam("componentName") @ApiParam String componentName) {
-    ServiceLogSearchCriteria searchCriteria = conversionService.convert(request, ServiceLogSearchCriteria.class);
-    searchCriteria.addParam("componentName", componentName); // TODO: use component_name instead - needs UI change
-    return serviceLogsManager.getHostListByComponent(searchCriteria);
+  public NodeListResponse getHostListByComponent(@BeanParam ServiceLogComponentHostRequest request) {
+    return serviceLogsManager.getHostListByComponent(request);
   }
 
   @GET
   @Path("/components/levels/counts")
   @Produces({"application/json"})
   @ApiOperation(GET_COMPONENT_LIST_WITH_LEVEL_COUNT_OD)
-  public NodeListResponse getComponentListWithLevelCounts(@BeanParam ServiceLogRequest request) {
-    return serviceLogsManager.getComponentListWithLevelCounts(conversionService.convert(request, ServiceLogSearchCriteria.class));
+  public NodeListResponse getComponentListWithLevelCounts(@BeanParam ServiceLogComponentLevelRequest request) {
+    return serviceLogsManager.getComponentListWithLevelCounts(request);
   }
-
-  @GET
-  @Path("/solr/boundarydates")
-  @Produces({"application/json"})
-  @ApiOperation(GET_EXTREME_DATES_FOR_BUNDLE_ID_OD)
-  public NameValueDataListResponse getExtremeDatesForBundelId(@BeanParam ServiceExtremeDatesRequest request) {
-    return serviceLogsManager.getExtremeDatesForBundelId(conversionService.convert(request, ServiceExtremeDatesCriteria.class));
-  }
-
   @GET
   @Path("/schema/fields")
   @Produces({"application/json"})
@@ -202,11 +166,11 @@ public class ServiceLogsResource {
   }
 
   @GET
-  @Path("/anygraph")
+  @Path("/count/anygraph")
   @Produces({"application/json"})
-  @ApiOperation(GET_ANY_GRAPH_DATA_OD)
-  public BarGraphDataListResponse getAnyGraphData(@BeanParam ServiceAnyGraphRequest request) {
-    return serviceLogsManager.getAnyGraphData(conversionService.convert(request, ServiceAnyGraphSearchCriteria.class));
+  @ApiOperation(GET_ANY_GRAPH_COUNT_DATA_OD)
+  public BarGraphDataListResponse getAnyGraphCountData(@BeanParam ServiceAnyGraphRequest request) {
+    return serviceLogsManager.getAnyGraphCountData(request);
   }
 
   @GET
@@ -214,7 +178,7 @@ public class ServiceLogsResource {
   @Produces({"application/json"})
   @ApiOperation(GET_AFTER_BEFORE_LOGS_OD)
   public ServiceLogResponse getAfterBeforeLogs(@BeanParam ServiceLogTruncatedRequest request) {
-    return serviceLogsManager.getAfterBeforeLogs(conversionService.convert(request, ServiceLogTruncatedSearchCriteria.class));
+    return serviceLogsManager.getAfterBeforeLogs(request);
   }
 
   @GET

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/UserConfigResource.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/UserConfigResource.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/UserConfigResource.java
index fd36978..31f584d 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/UserConfigResource.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/UserConfigResource.java
@@ -20,6 +20,7 @@
 package org.apache.ambari.logsearch.rest;
 
 import javax.inject.Inject;
+import javax.inject.Named;
 import javax.ws.rs.BeanParam;
 import javax.ws.rs.DELETE;
 import javax.ws.rs.GET;
@@ -32,39 +33,37 @@ import javax.ws.rs.Produces;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.apache.ambari.logsearch.manager.UserConfigManager;
+import org.apache.ambari.logsearch.model.common.LogFeederDataMap;
 import org.apache.ambari.logsearch.model.request.impl.UserConfigRequest;
-import org.apache.ambari.logsearch.query.model.UserConfigSearchCriteria;
-import org.apache.ambari.logsearch.view.VUserConfig;
+import org.apache.ambari.logsearch.model.response.UserConfigData;
+import org.apache.ambari.logsearch.model.response.UserConfigDataListResponse;
 import org.springframework.context.annotation.Scope;
-import org.springframework.core.convert.ConversionService;
-import org.springframework.stereotype.Component;
+
+import java.util.List;
 
 import static org.apache.ambari.logsearch.doc.DocConstants.UserConfigOperationDescriptions.*;
 
 @Api(value = "userconfig", description = "User config operations")
 @Path("userconfig")
-@Component
+@Named
 @Scope("request")
 public class UserConfigResource {
 
   @Inject
   private UserConfigManager userConfigManager;
 
-  @Inject
-  private ConversionService conversionService;
-
   @POST
   @Produces({"application/json"})
   @ApiOperation(SAVE_USER_CONFIG_OD)
-  public String saveUserConfig(VUserConfig vhist) {
-    return userConfigManager.saveUserConfig(vhist);
+  public String saveUserConfig(UserConfigData userConfig) {
+    return userConfigManager.saveUserConfig(userConfig);
   }
 
   @PUT
   @Produces({"application/json"})
   @ApiOperation(UPDATE_USER_CONFIG_OD)
-  public String updateUserConfig(VUserConfig vhist) {
-    return userConfigManager.updateUserConfig(vhist);
+  public String updateUserConfig(UserConfigData userConfig) {
+    return userConfigManager.updateUserConfig(userConfig);
   }
 
   @DELETE
@@ -77,15 +76,15 @@ public class UserConfigResource {
   @GET
   @Produces({"application/json"})
   @ApiOperation(GET_USER_CONFIG_OD)
-  public String getUserConfig(@BeanParam UserConfigRequest request) {
-    return userConfigManager.getUserConfig(conversionService.convert(request, UserConfigSearchCriteria.class));
+  public UserConfigDataListResponse getUserConfig(@BeanParam UserConfigRequest request) {
+    return userConfigManager.getUserConfig(request);
   }
 
   @GET
   @Path("/filters")
   @Produces({"application/json"})
   @ApiOperation(GET_USER_FILTER_OD)
-  public String getUserFilter() {
+  public LogFeederDataMap getUserFilter() {
     return userConfigManager.getUserFilter();
   }
 
@@ -93,23 +92,23 @@ public class UserConfigResource {
   @Path("/filters")
   @Produces({"application/json"})
   @ApiOperation(UPDATE_USER_FILTER_OD)
-  public String createUserFilter(String json) {
-    return userConfigManager.saveUserFiter(json);
+  public LogFeederDataMap createUserFilter(LogFeederDataMap request) {
+    return userConfigManager.saveUserFiter(request);
   }
 
   @PUT
   @Path("/filters/{id}")
   @Produces({"application/json"})
   @ApiOperation(GET_USER_FILTER_BY_ID_OD)
-  public String updateUserFilter(String json) {
-    return userConfigManager.saveUserFiter(json);
+  public LogFeederDataMap updateUserFilter(LogFeederDataMap request) {
+    return userConfigManager.saveUserFiter(request);
   }
 
   @GET
   @Path("/names")
   @Produces({"application/json"})
   @ApiOperation(GET_ALL_USER_NAMES_OD)
-  public String getAllUserName() {
+  public List<String> getAllUserName() {
     return userConfigManager.getAllUserName();
   }
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/SolrConstants.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/SolrConstants.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/SolrConstants.java
new file mode 100644
index 0000000..85554bc
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/SolrConstants.java
@@ -0,0 +1,113 @@
+/*
+ * 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;
+
+public class SolrConstants {
+
+  private SolrConstants() {
+  }
+
+  public class CommonLogConstants {
+    private CommonLogConstants() {
+    }
+
+    public static final String ID = "id";
+    public static final String SEQUENCE_ID = "seq_num";
+    public static final String BUNDLE_ID = "bundle_id";
+    public static final String CASE_ID = "case_id";
+    public static final String CLUSTER = "cluster";
+    public static final String LOG_MESSAGE = "log_message";
+    public static final String LOGFILE_LINE_NUMBER = "logfile_line_number";
+    public static final String EVENT_DURATION_MD5 = "event_dur_m5";
+    public static final String FILE = "file";
+    public static final String EVENT_COUNT = "event_count";
+    public static final String EVENT_MD5 = "event_md5";
+    public static final String MESSAGE_MD5= "message_md5";
+    public static final String TTL = "_ttl_";
+    public static final String EXPIRE_AT = "_expire_at_";
+    public static final String VERSION = "_version_";
+    public static final String ROUTER_FIELD = "_router_field_";
+    public static final String TYPE = "type";
+  }
+
+  public class ServiceLogConstants {
+
+    private ServiceLogConstants() {
+    }
+
+    public static final String BUNDLE_ID = "bundle_id";
+    public static final String LOGTIME = "logtime";
+    public static final String COMPONENT = "type";
+    public static final String LOG_MESSAGE = "log_message";
+    public static final String KEY_LOG_MESSAGE = "key_log_message";
+    public static final String HOST = "host";
+    public static final String LEVEL = "level";
+    public static final String THREAD_NAME = "thread_name";
+    public static final String LOGGER_NAME = "logger_name";
+    public static final String LINE_NUMBER = "line_number";
+    public static final String PATH = "path";
+    public static final String IP = "ip";
+    public static final String STORED_TOKEN_DYNAMIC_FIELDS = "std_*";
+    public static final String KEY_DYNAMIC_FIELDS = "key_*";
+    public static final String WS_DYNAMIC_FIELDS = "ws_*";
+  }
+
+  public class AuditLogConstants {
+    private AuditLogConstants() {
+    }
+
+    public static final String AUDIT_LOG_TYPE = "logType";
+    public static final String AUDIT_POLICY = "policy";
+    public static final String AUDIT_ACCESS = "access";
+    public static final String AUDIT_ACTION = "action";
+    public static final String AUDIT_AGENT = "agent";
+    public static final String AUDIT_AGENT_HOST = "agentHost";
+    public static final String AUDIT_CLIENT_IP = "cliIP";
+    public static final String AUDIT_CLIENT_TYPE = "cliType";
+    public static final String AUDIT_REQEST_CONTEXT = "reqContext";
+    public static final String AUDIT_ENFORCER = "enforcer";
+    public static final String AUDIT_REASON = "reason";
+    public static final String AUDIT_PROXY_USERS = "proxyUsers";
+    public static final String AUDIT_REPO_TYPE = "repoType";
+    public static final String AUDIT_REQEST_DATA = "reqData";
+    public static final String AUDIT_RESPONSE_TYPE = "resType";
+    public static final String AUDIT_SESSION = "sess";
+    public static final String AUDIT_TEXT = "text";
+    public static final String AUDIT_RESULT = "result";
+    public static final String AUDIT_COMPONENT = "repo";
+    public static final String AUDIT_EVTTIME = "evtTime";
+    public static final String AUDIT_REQUEST_USER = "reqUser";
+    public static final String AUDIT_RESOURCE = "resource";
+    public static final String AUDIT_TAGS = "tags";
+    public static final String AUDIT_TAGS_STR = "tags_str";
+  }
+
+  public class UserConfigConstants {
+    private UserConfigConstants() {
+    }
+
+    public static final String ID = "id";
+    public static final String USER_NAME = "username";
+    public static final String VALUES = "jsons";
+    public static final String FILTER_NAME = "filtername";
+    public static final String ROW_TYPE = "rowtype";
+    public static final String COMPOSITE_KEY = "composite_filtername-username";
+    public static final String SHARE_NAME_LIST = "share_username_list";
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/model/SolrAuditLogData.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/model/SolrAuditLogData.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/model/SolrAuditLogData.java
index 0cf05a6..0fd65a3 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/model/SolrAuditLogData.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/model/SolrAuditLogData.java
@@ -23,79 +23,82 @@ import org.apache.solr.client.solrj.beans.Field;
 
 import java.util.Date;
 import java.util.List;
+import java.util.Map;
+
+import static org.apache.ambari.logsearch.solr.SolrConstants.AuditLogConstants.*;
 
 public class SolrAuditLogData extends SolrCommonLogData implements AuditLogData {
 
-  @Field("logType")
+  @Field(AUDIT_LOG_TYPE)
   private String logType;
 
-  @Field("policy")
+  @Field(AUDIT_POLICY)
   private String policy;
 
-  @Field("access")
+  @Field(AUDIT_ACCESS)
   private String access;
 
-  @Field("action")
+  @Field(AUDIT_ACTION)
   private String action;
 
-  @Field("agent")
+  @Field(AUDIT_AGENT)
   private String agent;
 
-  @Field("agentHost")
+  @Field(AUDIT_AGENT_HOST)
   private String agentHost;
 
-  @Field("cliIP")
+  @Field(AUDIT_CLIENT_IP)
   private String clientIp;
 
-  @Field("cliType")
+  @Field(AUDIT_CLIENT_TYPE)
   private String clientType;
 
-  @Field("reqContext")
+  @Field(AUDIT_REQEST_CONTEXT)
   private String requestContext;
 
-  @Field("enforcer")
+  @Field(AUDIT_ENFORCER)
   private String enforcer;
 
-  @Field("evtTime")
+  @Field(AUDIT_EVTTIME)
   private Date eventTime;
 
-  @Field("reason")
+  @Field(AUDIT_REASON)
   private String reason;
 
-  @Field("proxyUsers")
+  @Field(AUDIT_PROXY_USERS)
   private List<String> proxyUsers;
 
-  @Field("repo")
+  @Field(AUDIT_COMPONENT)
   private String repo;
 
-  @Field("repoType")
+  @Field(AUDIT_REPO_TYPE)
   private Integer repoType;
 
-  @Field("reqData")
+  @Field(AUDIT_REQEST_DATA)
   private String requestData;
 
-  @Field("reqUser")
+  @Field(AUDIT_REQUEST_USER)
   private String requestUser;
 
-  @Field("resType")
+  @Field(AUDIT_RESPONSE_TYPE)
   private String responseType;
 
-  @Field("resource")
+  @Field(AUDIT_RESOURCE)
   private String resource;
 
-  @Field("result")
+  @Field(AUDIT_RESULT)
   private Integer result;
 
-  @Field("sess")
+  @Field(AUDIT_SESSION)
   private String session;
 
-  @Field("tags")
+  @Field(AUDIT_TAGS)
   private List<String> tags;
 
-  @Field("tags_str")
+  @Field(AUDIT_TAGS_STR)
   private String tagsStr;
 
-  @Field("text")
+  @Field(AUDIT_TEXT)
   private String text;
 
   @Override

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/model/SolrCommonLogData.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/model/SolrCommonLogData.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/model/SolrCommonLogData.java
index d68279d..bac5080 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/model/SolrCommonLogData.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/model/SolrCommonLogData.java
@@ -23,57 +23,59 @@ import org.apache.solr.client.solrj.beans.Field;
 
 import java.util.Date;
 
+import static org.apache.ambari.logsearch.solr.SolrConstants.CommonLogConstants.*;
+
 public class SolrCommonLogData implements CommonLogData {
 
-  @Field("id")
+  @Field(ID)
   private String id;
 
-  @Field("bundle_id")
+  @Field(BUNDLE_ID)
   private String bundleId;
 
-  @Field("case_id")
+  @Field(CASE_ID)
   private String caseId;
 
-  @Field("cluster")
+  @Field(CLUSTER)
   private String cluster;
 
-  @Field("seq_num")
+  @Field(SEQUENCE_ID)
   private Long seqNum;
 
-  @Field("log_message")
+  @Field(LOG_MESSAGE)
   private String logMessage;
 
-  @Field("logfile_line_number")
+  @Field(LOGFILE_LINE_NUMBER)
   private Integer logFileLineNumber;
 
-  @Field("event_dur_m5")
+  @Field(EVENT_DURATION_MD5)
   private Long eventDurationMs;
 
-  @Field("file")
+  @Field(FILE)
   private String file;
 
-  @Field("type")
+  @Field(TYPE)
   private String type;
 
-  @Field("event_count")
+  @Field(EVENT_COUNT)
   private Long eventCount;
 
-  @Field("event_md5")
+  @Field(EVENT_MD5)
   private String eventMd5;
 
-  @Field("message_md5")
+  @Field(MESSAGE_MD5)
   private String messageMd5;
 
-  @Field("_ttl_")
+  @Field(TTL)
   private String ttl;
 
-  @Field("_expire_at_")
+  @Field(EXPIRE_AT)
   private Date expire;
 
-  @Field("_version_")
+  @Field(VERSION)
   private Long version;
 
-  @Field("_router_field_")
+  @Field(ROUTER_FIELD)
   private Integer routerField;
 
   @Override

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/model/SolrComponentTypeLogData.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/model/SolrComponentTypeLogData.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/model/SolrComponentTypeLogData.java
index 988c878..1a63700 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/model/SolrComponentTypeLogData.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/model/SolrComponentTypeLogData.java
@@ -21,9 +21,11 @@ package org.apache.ambari.logsearch.solr.model;
 import org.apache.ambari.logsearch.model.response.ComponentTypeLogData;
 import org.apache.solr.client.solrj.beans.Field;
 
+import static org.apache.ambari.logsearch.solr.SolrConstants.ServiceLogConstants.COMPONENT;
+
 public class SolrComponentTypeLogData implements ComponentTypeLogData {
 
-  @Field("type")
+  @Field(COMPONENT)
   private String type;
 
   @Override

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/model/SolrHostLogData.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/model/SolrHostLogData.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/model/SolrHostLogData.java
index 215b22c..8391815 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/model/SolrHostLogData.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/model/SolrHostLogData.java
@@ -21,9 +21,11 @@ package org.apache.ambari.logsearch.solr.model;
 import org.apache.ambari.logsearch.model.response.HostLogData;
 import org.apache.solr.client.solrj.beans.Field;
 
+import static org.apache.ambari.logsearch.solr.SolrConstants.ServiceLogConstants.HOST;
+
 public class SolrHostLogData implements HostLogData {
 
-  @Field("host")
+  @Field(HOST)
   private String host;
 
   @Override

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/model/SolrServiceLogData.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/model/SolrServiceLogData.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/model/SolrServiceLogData.java
index 890dc7d..1d4cecf 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/model/SolrServiceLogData.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/model/SolrServiceLogData.java
@@ -22,30 +22,42 @@ import org.apache.ambari.logsearch.model.response.ServiceLogData;
 import org.apache.solr.client.solrj.beans.Field;
 
 import java.util.Date;
+import java.util.Map;
+
+import static org.apache.ambari.logsearch.solr.SolrConstants.ServiceLogConstants.*;
 
 public class SolrServiceLogData extends SolrCommonLogData implements ServiceLogData {
 
-  @Field("level")
+  @Field(LEVEL)
   private String level;
 
-  @Field("line_number")
+  @Field(LINE_NUMBER)
   private Integer lineNumber;
 
-  @Field("logtime")
+  @Field(LOGTIME)
   private Date logTime;
 
-  @Field("type")
+  @Field(COMPONENT)
   private String type;
 
-  @Field("ip")
+  @Field(IP)
   private String ip;
 
-  @Field("path")
+  @Field(PATH)
   private String path;
 
-  @Field("host")
+  @Field(HOST)
   private String host;
 
+  @Field(STORED_TOKEN_DYNAMIC_FIELDS)
+  private Map<String, Object> stdDynamicFields;
+
+  @Field(KEY_DYNAMIC_FIELDS)
+  private Map<String, Object> keyDynamicFields;
+
+  @Field(WS_DYNAMIC_FIELDS)
+  private Map<String, Object> wsDynamicFields;
+
   @Override
   public String getPath() {
     return path;
@@ -115,4 +127,28 @@ public class SolrServiceLogData extends SolrCommonLogData implements ServiceLogD
   public void setLevel(String level) {
     this.level = level;
   }
+
+  public Map<String, Object> getStdDynamicFields() {
+    return stdDynamicFields;
+  }
+
+  public void setStdDynamicFields(Map<String, Object> stdDynamicFields) {
+    this.stdDynamicFields = stdDynamicFields;
+  }
+
+  public Map<String, Object> getKeyDynamicFields() {
+    return keyDynamicFields;
+  }
+
+  public void setKeyDynamicFields(Map<String, Object> keyDynamicFields) {
+    this.keyDynamicFields = keyDynamicFields;
+  }
+
+  public Map<String, Object> getWsDynamicFields() {
+    return wsDynamicFields;
+  }
+
+  public void setWsDynamicFields(Map<String, Object> wsDynamicFields) {
+    this.wsDynamicFields = wsDynamicFields;
+  }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/util/BizUtil.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/util/BizUtil.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/util/BizUtil.java
deleted file mode 100644
index 637a4d7..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/util/BizUtil.java
+++ /dev/null
@@ -1,261 +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.util;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.LinkedHashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Set;
-
-import org.apache.ambari.logsearch.common.LogSearchConstants;
-import org.apache.ambari.logsearch.model.response.BarGraphData;
-import org.apache.ambari.logsearch.model.response.BarGraphDataListResponse;
-import org.apache.ambari.logsearch.model.response.NameValueData;
-import org.apache.ambari.logsearch.view.VHost;
-import org.apache.ambari.logsearch.view.VSummary;
-import org.apache.commons.collections.CollectionUtils;
-import org.apache.commons.lang.StringUtils;
-import org.apache.log4j.Logger;
-import org.apache.solr.common.SolrDocument;
-import org.apache.solr.common.SolrDocumentList;
-import org.apache.solr.common.util.SimpleOrderedMap;
-
-public class BizUtil {
-  private static final Logger logger = Logger.getLogger(BizUtil.class);
-
-  private BizUtil() {
-    throw new UnsupportedOperationException();
-  }
-  
-  public static String convertObjectToNormalText(SolrDocumentList docList) {
-    String textToSave = "";
-    HashMap<String, String> blankFieldsMap = new HashMap<String, String>();
-    if (docList == null){
-      return "no data";
-    }
-    if (docList.isEmpty()) {
-      return "no data";
-    }
-    SolrDocument docForBlankCaculation = docList.get(0);
-    if(docForBlankCaculation == null){
-      return "no data";
-    }
-    Collection<String> fieldsForBlankCaculation = docForBlankCaculation.getFieldNames();
-
-    int maxLengthOfField = 0;
-    if (fieldsForBlankCaculation == null) {
-      return "no data";
-    }
-    for (String field : fieldsForBlankCaculation) {
-      if (!StringUtils.isBlank(field) && field.length() > maxLengthOfField) {
-        maxLengthOfField = field.length();
-      }
-    }
-
-    for (String field : fieldsForBlankCaculation) {
-      if (!StringUtils.isBlank(field)) {
-        blankFieldsMap.put(field, StringUtils.rightPad(field, maxLengthOfField - field.length()));
-      }
-    }
-
-    for (SolrDocument doc : docList) {
-      if (doc != null) {
-        StringBuffer textTowrite = new StringBuffer();
-
-        if (doc.getFieldValue(LogSearchConstants.LOGTIME) != null) {
-          textTowrite.append(doc.getFieldValue(LogSearchConstants.LOGTIME).toString() + " ");
-        }
-        if (doc.getFieldValue(LogSearchConstants.SOLR_LEVEL) != null) {
-          textTowrite.append(doc.getFieldValue(LogSearchConstants.SOLR_LEVEL).toString()).append(" ");
-        }
-        if (doc.getFieldValue(LogSearchConstants.SOLR_THREAD_NAME) != null) {
-          textTowrite.append(doc.getFieldValue(LogSearchConstants.SOLR_THREAD_NAME).toString().trim()).append(" ");
-        }
-        if (doc.getFieldValue(LogSearchConstants.SOLR_LOGGER_NAME) != null) {
-          textTowrite.append(doc.getFieldValue(LogSearchConstants.SOLR_LOGGER_NAME).toString().trim()).append(" ");
-        }
-        if (doc.getFieldValue(LogSearchConstants.SOLR_FILE) != null && doc.getFieldValue(LogSearchConstants.SOLR_LINE_NUMBER) != null) {
-          textTowrite
-              .append(doc.getFieldValue(LogSearchConstants.SOLR_FILE).toString())
-              .append(":")
-              .append(doc.getFieldValue(LogSearchConstants.SOLR_LINE_NUMBER).toString())
-              .append(" ");
-        }
-        if (doc.getFieldValue(LogSearchConstants.SOLR_LOG_MESSAGE) != null) {
-          textTowrite.append("- ")
-              .append(doc.getFieldValue(LogSearchConstants.SOLR_LOG_MESSAGE).toString());
-        }
-        textTowrite.append("\n");
-        textToSave += textTowrite.toString();
-      }
-    }
-    return textToSave;
-  }
-
-  public static VSummary buildSummaryForLogFile(SolrDocumentList docList) {
-    VSummary vsummary = new VSummary();
-    if (CollectionUtils.isEmpty(docList)) {
-      return vsummary;
-    }
-    int numLogs = 0;
-    List<VHost> vHosts = new ArrayList<VHost>();
-    vsummary.setHosts(vHosts);
-    String levels = "";
-    for (SolrDocument doc : docList) {
-      if (doc != null) {
-        // adding Host and Component appropriately
-        String hostname = (String) doc.getFieldValue("host");
-        String comp = (String) doc.getFieldValue("type");
-        String level = (String) doc.getFieldValue("level");
-        if (StringUtils.isBlank(level)) {
-          level = "";
-        }
-        boolean newHost = true;
-        for (VHost host : vHosts) {
-          if (host != null && host.getName().equals(hostname)) {
-            newHost = false;
-            if (StringUtils.isBlank(comp)) {
-              Set<String> compList = host.getComponents();
-              if (compList != null) {
-                compList.add(comp);
-              }
-            }
-            break;
-          }
-        }
-        if (newHost) {
-          VHost vHost = new VHost();
-          if (!StringUtils.isBlank(hostname)) {
-            vHost.setName(hostname);
-          }
-          Set<String> component = new LinkedHashSet<String>();
-          if (StringUtils.isBlank(comp)) {
-            component.add(comp);
-          }
-          vHost.setComponents(component);
-          vHosts.add(vHost);
-        }
-        // getting levels
-        if (!levels.contains(level)) {
-          levels = levels + ", " + level;
-        }
-        numLogs += 1;
-      }
-  }
-    levels = levels.replaceFirst(", ", "");
-    vsummary.setLevels(levels);
-    vsummary.setNumberLogs("" + numLogs);
-    return vsummary;
-  }
-
-  @SuppressWarnings({"unchecked", "rawtypes"})
-  public static BarGraphDataListResponse buildSummaryForTopCounts(SimpleOrderedMap<Object> jsonFacetResponse, String innerJsonKey, String outerJsonKey) {
-
-    BarGraphDataListResponse barGraphDataListResponse = new BarGraphDataListResponse();
-
-    Collection<BarGraphData> dataList = new ArrayList<>();
-    if (jsonFacetResponse == null) {
-      logger.info("Solr document list in null");
-      return barGraphDataListResponse;
-    }
-    List<Object> userList = jsonFacetResponse.getAll(outerJsonKey);
-    if (userList.isEmpty()) {
-      return barGraphDataListResponse;
-    }
-    SimpleOrderedMap<Map<String, Object>> userMap = (SimpleOrderedMap<Map<String, Object>>) userList.get(0);
-    if (userMap == null) {
-      logger.info("No top user details found");
-      return barGraphDataListResponse;
-    }
-    List<SimpleOrderedMap> userUsageList = (List<SimpleOrderedMap>) userMap.get("buckets");
-    if(userUsageList == null){
-      return barGraphDataListResponse;
-    }
-    for (SimpleOrderedMap usageMap : userUsageList) {
-      if (usageMap != null) {
-        BarGraphData barGraphData = new BarGraphData();
-        String userName = (String) usageMap.get("val");
-        if (!StringUtils.isBlank(userName)) {
-          barGraphData.setName(userName);
-        }
-        SimpleOrderedMap repoMap = (SimpleOrderedMap) usageMap.get(innerJsonKey);
-        List<NameValueData> componetCountList = new ArrayList<NameValueData>();
-        if (repoMap != null) {
-          List<SimpleOrderedMap> repoUsageList = (List<SimpleOrderedMap>) repoMap.get("buckets");
-          for (SimpleOrderedMap repoUsageMap : repoUsageList) {
-            NameValueData componetCount = new NameValueData();
-            if (repoUsageMap.get("val") != null) {
-              componetCount.setName(repoUsageMap.get("val").toString());
-            }
-            String eventCount = "";
-            if (repoUsageMap.get("eventCount") != null) {
-              eventCount = repoUsageMap.get("eventCount").toString();
-            }
-            eventCount = eventCount.replace(".0", "");
-            eventCount = eventCount.replace(".00", "");
-
-            componetCount.setValue(eventCount);
-            componetCountList.add(componetCount);
-          }
-          barGraphData.setDataCount(componetCountList);
-          dataList.add(barGraphData);
-        }
-      }}
-    barGraphDataListResponse.setGraphData(dataList);
-    logger.info("getting graph data");
-
-    return barGraphDataListResponse;
-  }
-  
-  public static HashMap<String, String> sortHashMapByValues(HashMap<String, String> passedMap) {
-    if (passedMap == null ) {
-      return null;
-    }
-    HashMap<String, String> sortedMap = new LinkedHashMap<String, String>();
-    List<String> mapValues = new ArrayList<String>(passedMap.values());
-    HashMap<String, String> invertedKeyValue = new HashMap<String, String>();
-    Collections.sort(mapValues, new Comparator<String>() {
-      @Override
-      public int compare(String s1, String s2) {
-        return s1.compareToIgnoreCase(s2);
-      }
-    });
-    Iterator<Entry<String, String>> it = passedMap.entrySet().iterator();
-    while (it.hasNext()) {
-      @SuppressWarnings("rawtypes")
-      Map.Entry pair = (Map.Entry) it.next();
-      invertedKeyValue.put("" + pair.getValue(), "" + pair.getKey());
-    }
-
-    for (String valueOfKey : mapValues) {
-      sortedMap.put(invertedKeyValue.get(valueOfKey), valueOfKey);
-    }
-
-    return sortedMap;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/util/DateUtil.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/util/DateUtil.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/util/DateUtil.java
index 0de0dbc..9b4f553 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/util/DateUtil.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/util/DateUtil.java
@@ -114,6 +114,15 @@ public class DateUtil {
 
   }
 
+  public static Date convertStringToSolrDate(String dateStr) {
+    try {
+      SimpleDateFormat formatter = new SimpleDateFormat(LogSearchConstants.SOLR_DATE_FORMAT_PREFIX_Z);
+      return formatter.parse(dateStr);
+    } catch (Exception e){
+      throw new RuntimeException("Cannot parse date from request", e.getCause());
+    }
+  }
+
   public static boolean isDateValid(String value) {
     if (StringUtils.isBlank(value)) {
       return false;


[55/58] [abbrv] ambari git commit: AMBARI-18606. Improve Audit Log processing by Logfeeder (Miklos Gergely via oleewere)

Posted by ol...@apache.org.
http://git-wip-us.apache.org/repos/asf/ambari/blob/a9094ab8/ambari-logsearch/docker/test-logs/ambari-server/ambari-audit.log
----------------------------------------------------------------------
diff --git a/ambari-logsearch/docker/test-logs/ambari-server/ambari-audit.log b/ambari-logsearch/docker/test-logs/ambari-server/ambari-audit.log
new file mode 100644
index 0000000..90e24e3
--- /dev/null
+++ b/ambari-logsearch/docker/test-logs/ambari-server/ambari-audit.log
@@ -0,0 +1,390 @@
+2016-10-03T16:26:13.333Z, User(admin), RemoteIp(192.168.64.1), Operation(User login), Roles(
+    Ambari: Ambari Administrator
+), Status(Success)
+2016-10-03T16:26:54.834Z, User(admin), RemoteIp(192.168.64.1), Operation(Repository update), RequestType(PUT), url(http://c6401.ambari.apache.org:8080/api/v1/stacks/HDP/versions/2.5/operating_systems/redhat6/repositories/HDP-UTILS-1.1.0.21), ResultStatus(200 OK), Stack(HDP), Stack version(2.5), OS(redhat6), Repo id(HDP-UTILS-1.1.0.21), Base URL(http://public-repo-1.hortonworks.com/HDP-UTILS-1.1.0.21/repos/centos6)
+2016-10-03T16:26:54.845Z, User(admin), RemoteIp(192.168.64.1), Operation(Repository update), RequestType(PUT), url(http://c6401.ambari.apache.org:8080/api/v1/stacks/HDP/versions/2.5/operating_systems/redhat7/repositories/HDP-2.5), ResultStatus(200 OK), Stack(HDP), Stack version(2.5), OS(redhat7), Repo id(HDP-2.5), Base URL(http://public-repo-1.hortonworks.com/HDP/centos7/2.x/updates/2.5.0.0/)
+2016-10-03T16:26:54.847Z, User(admin), RemoteIp(192.168.64.1), Operation(Repository update), RequestType(PUT), url(http://c6401.ambari.apache.org:8080/api/v1/stacks/HDP/versions/2.5/operating_systems/redhat6/repositories/HDP-2.5), ResultStatus(200 OK), Stack(HDP), Stack version(2.5), OS(redhat6), Repo id(HDP-2.5), Base URL(http://public-repo-1.hortonworks.com/HDP/centos6/2.x/updates/2.5.0.0/)
+2016-10-03T16:26:54.857Z, User(admin), RemoteIp(192.168.64.1), Operation(Repository update), RequestType(PUT), url(http://c6401.ambari.apache.org:8080/api/v1/stacks/HDP/versions/2.5/operating_systems/debian7/repositories/HDP-UTILS-1.1.0.21), ResultStatus(200 OK), Stack(HDP), Stack version(2.5), OS(debian7), Repo id(HDP-UTILS-1.1.0.21), Base URL(http://public-repo-1.hortonworks.com/HDP-UTILS-1.1.0.21/repos/debian7)
+2016-10-03T16:26:54.857Z, User(admin), RemoteIp(192.168.64.1), Operation(Repository update), RequestType(PUT), url(http://c6401.ambari.apache.org:8080/api/v1/stacks/HDP/versions/2.5/operating_systems/redhat7/repositories/HDP-UTILS-1.1.0.21), ResultStatus(200 OK), Stack(HDP), Stack version(2.5), OS(redhat7), Repo id(HDP-UTILS-1.1.0.21), Base URL(http://public-repo-1.hortonworks.com/HDP-UTILS-1.1.0.21/repos/centos7)
+2016-10-03T16:26:54.860Z, User(admin), RemoteIp(192.168.64.1), Operation(Repository update), RequestType(PUT), url(http://c6401.ambari.apache.org:8080/api/v1/stacks/HDP/versions/2.5/operating_systems/debian7/repositories/HDP-2.5), ResultStatus(200 OK), Stack(HDP), Stack version(2.5), OS(debian7), Repo id(HDP-2.5), Base URL(http://public-repo-1.hortonworks.com/HDP/debian7/2.x/updates/2.5.0.0)
+2016-10-03T16:26:54.935Z, User(admin), RemoteIp(192.168.64.1), Operation(Repository update), RequestType(PUT), url(http://c6401.ambari.apache.org:8080/api/v1/stacks/HDP/versions/2.5/operating_systems/suse12/repositories/HDP-UTILS-1.1.0.21), ResultStatus(200 OK), Stack(HDP), Stack version(2.5), OS(suse12), Repo id(HDP-UTILS-1.1.0.21), Base URL(http://public-repo-1.hortonworks.com/HDP-UTILS-1.1.0.21/repos/sles12)
+2016-10-03T16:26:54.943Z, User(admin), RemoteIp(192.168.64.1), Operation(Repository update), RequestType(PUT), url(http://c6401.ambari.apache.org:8080/api/v1/stacks/HDP/versions/2.5/operating_systems/suse11/repositories/HDP-2.5), ResultStatus(200 OK), Stack(HDP), Stack version(2.5), OS(suse11), Repo id(HDP-2.5), Base URL(http://public-repo-1.hortonworks.com/HDP/suse11sp3/2.x/updates/2.5.0.0)
+2016-10-03T16:26:54.945Z, User(admin), RemoteIp(192.168.64.1), Operation(Repository update), RequestType(PUT), url(http://c6401.ambari.apache.org:8080/api/v1/stacks/HDP/versions/2.5/operating_systems/ubuntu12/repositories/HDP-2.5), ResultStatus(200 OK), Stack(HDP), Stack version(2.5), OS(ubuntu12), Repo id(HDP-2.5), Base URL(http://public-repo-1.hortonworks.com/HDP/ubuntu12/2.x/updates/2.5.0.0)
+2016-10-03T16:26:54.951Z, User(admin), RemoteIp(192.168.64.1), Operation(Repository update), RequestType(PUT), url(http://c6401.ambari.apache.org:8080/api/v1/stacks/HDP/versions/2.5/operating_systems/suse12/repositories/HDP-2.5), ResultStatus(200 OK), Stack(HDP), Stack version(2.5), OS(suse12), Repo id(HDP-2.5), Base URL(http://public-repo-1.hortonworks.com/HDP/sles12/2.x/updates/2.5.0.0)
+2016-10-03T16:26:54.954Z, User(admin), RemoteIp(192.168.64.1), Operation(Repository update), RequestType(PUT), url(http://c6401.ambari.apache.org:8080/api/v1/stacks/HDP/versions/2.5/operating_systems/suse11/repositories/HDP-UTILS-1.1.0.21), ResultStatus(200 OK), Stack(HDP), Stack version(2.5), OS(suse11), Repo id(HDP-UTILS-1.1.0.21), Base URL(http://public-repo-1.hortonworks.com/HDP-UTILS-1.1.0.21/repos/suse11sp3)
+2016-10-03T16:26:54.959Z, User(admin), RemoteIp(192.168.64.1), Operation(Repository update), RequestType(PUT), url(http://c6401.ambari.apache.org:8080/api/v1/stacks/HDP/versions/2.5/operating_systems/ubuntu12/repositories/HDP-UTILS-1.1.0.21), ResultStatus(200 OK), Stack(HDP), Stack version(2.5), OS(ubuntu12), Repo id(HDP-UTILS-1.1.0.21), Base URL(http://public-repo-1.hortonworks.com/HDP-UTILS-1.1.0.21/repos/ubuntu12)
+2016-10-03T16:26:54.997Z, User(admin), RemoteIp(192.168.64.1), Operation(Repository update), RequestType(PUT), url(http://c6401.ambari.apache.org:8080/api/v1/stacks/HDP/versions/2.5/operating_systems/ubuntu14/repositories/HDP-2.5), ResultStatus(200 OK), Stack(HDP), Stack version(2.5), OS(ubuntu14), Repo id(HDP-2.5), Base URL(http://public-repo-1.hortonworks.com/HDP/ubuntu14/2.x/updates/2.5.0.0)
+2016-10-03T16:26:55.003Z, User(admin), RemoteIp(192.168.64.1), Operation(Repository update), RequestType(PUT), url(http://c6401.ambari.apache.org:8080/api/v1/stacks/HDP/versions/2.5/operating_systems/ubuntu14/repositories/HDP-UTILS-1.1.0.21), ResultStatus(200 OK), Stack(HDP), Stack version(2.5), OS(ubuntu14), Repo id(HDP-UTILS-1.1.0.21), Base URL(http://public-repo-1.hortonworks.com/HDP-UTILS-1.1.0.21/repos/ubuntu14)
+2016-10-03T16:26:58.669Z, User(admin), RemoteIp(192.168.64.1), RequestType(POST), url(http://c6401.ambari.apache.org:8080/api/v1/version_definitions?dry_run=true), ResultStatus(201 Created)
+2016-10-03T16:27:20.063Z, User(admin), RemoteIp(192.168.64.1), RequestType(POST), url(http://c6401.ambari.apache.org:8080/api/v1/version_definitions?dry_run=true), ResultStatus(201 Created)
+2016-10-03T16:27:24.185Z, User(admin), RemoteIp(192.168.64.1), Operation(Request from server), RequestType(POST), url(http://c6401.ambari.apache.org:8080/api/v1/requests), ResultStatus(202 Accepted), Command(null), Cluster name(null)
+2016-10-03T16:27:24.206Z, User(admin), Operation(Check host), Status(IN_PROGRESS), RequestId(1)
+2016-10-03T16:27:24.207Z, User(admin), Operation(ACTIONEXECUTE check_host), Status(QUEUED), RequestId(1), TaskId(2), Hostname(c6401.ambari.apache.org)
+2016-10-03T16:27:24.211Z, User(admin), Operation(ACTIONEXECUTE check_host), Status(QUEUED), RequestId(1), TaskId(3), Hostname(c6402.ambari.apache.org)
+2016-10-03T16:27:24.213Z, User(admin), Operation(ACTIONEXECUTE check_host), Status(QUEUED), RequestId(1), TaskId(4), Hostname(c6403.ambari.apache.org)
+2016-10-03T16:27:24.214Z, User(admin), Operation(ACTIONEXECUTE check_host), Status(QUEUED), RequestId(1), TaskId(5), Hostname(c6404.ambari.apache.org)
+2016-10-03T16:27:25.836Z, User(admin), Operation(ACTIONEXECUTE check_host), Status(COMPLETED), RequestId(1), TaskId(2), Hostname(c6401.ambari.apache.org)
+2016-10-03T16:27:26.824Z, User(admin), Operation(ACTIONEXECUTE check_host), Status(COMPLETED), RequestId(1), TaskId(3), Hostname(c6402.ambari.apache.org)
+2016-10-03T16:27:27.830Z, User(admin), Operation(ACTIONEXECUTE check_host), Status(COMPLETED), RequestId(1), TaskId(5), Hostname(c6404.ambari.apache.org)
+2016-10-03T16:27:28.831Z, User(admin), Operation(Check host), Status(COMPLETED), RequestId(1)
+2016-10-03T16:27:28.833Z, User(admin), Operation(ACTIONEXECUTE check_host), Status(COMPLETED), RequestId(1), TaskId(4), Hostname(c6403.ambari.apache.org)
+2016-10-03T16:27:29.428Z, User(admin), RemoteIp(192.168.64.1), Operation(Request from server), RequestType(POST), url(http://c6401.ambari.apache.org:8080/api/v1/requests), ResultStatus(202 Accepted), Command(null), Cluster name(null)
+2016-10-03T16:27:29.440Z, User(admin), Operation(Check host), Status(IN_PROGRESS), RequestId(2)
+2016-10-03T16:27:29.443Z, User(admin), Operation(ACTIONEXECUTE check_host), Status(QUEUED), RequestId(2), TaskId(6), Hostname(c6401.ambari.apache.org)
+2016-10-03T16:27:29.443Z, User(admin), Operation(ACTIONEXECUTE check_host), Status(QUEUED), RequestId(2), TaskId(7), Hostname(c6402.ambari.apache.org)
+2016-10-03T16:27:29.444Z, User(admin), Operation(ACTIONEXECUTE check_host), Status(QUEUED), RequestId(2), TaskId(8), Hostname(c6403.ambari.apache.org)
+2016-10-03T16:27:29.444Z, User(admin), Operation(ACTIONEXECUTE check_host), Status(QUEUED), RequestId(2), TaskId(9), Hostname(c6404.ambari.apache.org)
+2016-10-03T16:27:38.816Z, User(admin), Operation(ACTIONEXECUTE check_host), Status(COMPLETED), RequestId(2), TaskId(7), Hostname(c6402.ambari.apache.org)
+2016-10-03T16:27:39.818Z, User(admin), Operation(ACTIONEXECUTE check_host), Status(COMPLETED), RequestId(2), TaskId(9), Hostname(c6404.ambari.apache.org)
+2016-10-03T16:27:40.822Z, User(admin), Operation(ACTIONEXECUTE check_host), Status(COMPLETED), RequestId(2), TaskId(8), Hostname(c6403.ambari.apache.org)
+2016-10-03T16:27:42.817Z, User(admin), Operation(Check host), Status(COMPLETED), RequestId(2)
+2016-10-03T16:27:42.818Z, User(admin), Operation(ACTIONEXECUTE check_host), Status(COMPLETED), RequestId(2), TaskId(6), Hostname(c6401.ambari.apache.org)
+2016-10-03T16:28:19.410Z, User(admin), RemoteIp(192.168.64.1), RequestType(POST), url(http://c6401.ambari.apache.org:8080/api/v1/version_definitions?dry_run=true), ResultStatus(201 Created)
+2016-10-03T16:28:49.829Z, User(admin), RemoteIp(192.168.64.1), RequestType(POST), url(http://c6401.ambari.apache.org:8080/api/v1/version_definitions?dry_run=true), ResultStatus(201 Created)
+2016-10-03T16:28:56.413Z, User(admin), RemoteIp(192.168.64.1), RequestType(POST), url(http://c6401.ambari.apache.org:8080/api/v1/version_definitions?dry_run=true), ResultStatus(201 Created)
+2016-10-03T16:29:02.762Z, User(admin), RemoteIp(192.168.64.1), RequestType(POST), url(http://c6401.ambari.apache.org:8080/api/v1/version_definitions?dry_run=true), ResultStatus(201 Created)
+2016-10-03T16:29:20.084Z, User(admin), RemoteIp(192.168.64.1), RequestType(POST), url(http://c6401.ambari.apache.org:8080/api/v1/version_definitions?dry_run=true), ResultStatus(201 Created)
+2016-10-03T16:29:30.390Z, User(admin), RemoteIp(192.168.64.1), RequestType(POST), url(http://c6401.ambari.apache.org:8080/api/v1/version_definitions), ResultStatus(201 Created)
+2016-10-03T16:29:30.430Z, User(admin), RemoteIp(192.168.64.1), Operation(Repository version change), RequestType(PUT), url(http://c6401.ambari.apache.org:8080/api/v1/stacks/HDP/versions/2.5/repository_versions/1), ResultStatus(200 OK), Stack(HDP), Stack version(2.5), Display name(null), Repo version(null), Repositories(
+Operating system: debian7
+    Repository ID(HDP-2.5), Repository name(HDP), Base url(http://public-repo-1.hortonworks.com/HDP/debian7/2.x/updates/2.5.0.0)
+    Repository ID(HDP-UTILS-1.1.0.21), Repository name(HDP-UTILS), Base url(http://public-repo-1.hortonworks.com/HDP-UTILS-1.1.0.21/repos/debian7)
+Operating system: redhat6
+    Repository ID(HDP-2.5), Repository name(HDP), Base url(http://public-repo-1.hortonworks.com/HDP/centos6/2.x/updates/2.5.0.0/)
+    Repository ID(HDP-UTILS-1.1.0.21), Repository name(HDP-UTILS), Base url(http://public-repo-1.hortonworks.com/HDP-UTILS-1.1.0.21/repos/centos6)
+Operating system: redhat7
+    Repository ID(HDP-2.5), Repository name(HDP), Base url(http://public-repo-1.hortonworks.com/HDP/centos7/2.x/updates/2.5.0.0/)
+    Repository ID(HDP-UTILS-1.1.0.21), Repository name(HDP-UTILS), Base url(http://public-repo-1.hortonworks.com/HDP-UTILS-1.1.0.21/repos/centos7)
+Operating system: suse11
+    Repository ID(HDP-2.5), Repository name(HDP), Base url(http://public-repo-1.hortonworks.com/HDP/suse11sp3/2.x/updates/2.5.0.0)
+    Repository ID(HDP-UTILS-1.1.0.21), Repository name(HDP-UTILS), Base url(http://public-repo-1.hortonworks.com/HDP-UTILS-1.1.0.21/repos/suse11sp3)
+Operating system: suse12
+    Repository ID(HDP-2.5), Repository name(HDP), Base url(http://public-repo-1.hortonworks.com/HDP/sles12/2.x/updates/2.5.0.0)
+    Repository ID(HDP-UTILS-1.1.0.21), Repository name(HDP-UTILS), Base url(http://public-repo-1.hortonworks.com/HDP-UTILS-1.1.0.21/repos/sles12)
+Operating system: ubuntu12
+    Repository ID(HDP-2.5), Repository name(HDP), Base url(http://public-repo-1.hortonworks.com/HDP/ubuntu12/2.x/updates/2.5.0.0)
+    Repository ID(HDP-UTILS-1.1.0.21), Repository name(HDP-UTILS), Base url(http://public-repo-1.hortonworks.com/HDP-UTILS-1.1.0.21/repos/ubuntu12)
+Operating system: ubuntu14
+    Repository ID(HDP-2.5), Repository name(HDP), Base url(http://public-repo-1.hortonworks.com/HDP/ubuntu14/2.x/updates/2.5.0.0)
+    Repository ID(HDP-UTILS-1.1.0.21), Repository name(HDP-UTILS), Base url(http://public-repo-1.hortonworks.com/HDP-UTILS-1.1.0.21/repos/ubuntu14)
+)
+2016-10-03T16:29:30.578Z, User(admin), RemoteIp(192.168.64.1), Operation(Configuration change), RequestType(POST), url(http://c6401.ambari.apache.org:8080/api/v1/clusters/myCluster), ResultStatus(201 Created), VersionNumber(Vnull), VersionNote(null)
+2016-10-03T16:29:30.828Z, User(admin), RemoteIp(192.168.64.1), Operation(null), RequestId(null), Status(Successfully queued)
+2016-10-03T16:29:32.696Z, User(admin), RemoteIp(192.168.64.1), Operation(Configuration change), RequestType(PUT), url(http://c6401.ambari.apache.org:8080/api/v1/clusters/myCluster), ResultStatus(200 OK), VersionNumber(V1), VersionNote(Initial configurations for HDFS)
+2016-10-03T16:29:32.890Z, User(admin), RemoteIp(192.168.64.1), RequestType(QUERY_POST), url(http://c6401.ambari.apache.org:8080/api/v1/clusters/myCluster/services?ServiceInfo/service_name=HDFS), ResultStatus(201 Created)
+2016-10-03T16:29:32.996Z, User(admin), RemoteIp(192.168.64.1), RequestType(QUERY_POST), url(http://c6401.ambari.apache.org:8080/api/v1/clusters/myCluster/services?ServiceInfo/service_name=ZOOKEEPER), ResultStatus(201 Created)
+2016-10-03T16:29:33.044Z, User(admin), RemoteIp(192.168.64.1), RequestType(QUERY_POST), url(http://c6401.ambari.apache.org:8080/api/v1/clusters/myCluster/services?ServiceInfo/service_name=AMBARI_INFRA), ResultStatus(201 Created)
+2016-10-03T16:29:33.099Z, User(admin), RemoteIp(192.168.64.1), RequestType(QUERY_POST), url(http://c6401.ambari.apache.org:8080/api/v1/clusters/myCluster/services?ServiceInfo/service_name=AMBARI_METRICS), ResultStatus(201 Created)
+2016-10-03T16:29:33.239Z, User(admin), RemoteIp(192.168.64.1), Operation(Host addition), RequestType(POST), url(http://c6401.ambari.apache.org:8080/api/v1/clusters/myCluster/hosts), ResultStatus(201 Created), Hostname(c6402.ambari.apache.org)
+2016-10-03T16:29:33.359Z, User(admin), RemoteIp(192.168.64.1), Operation(Component addition to host), RequestType(QUERY_POST), url(http://c6401.ambari.apache.org:8080/api/v1/clusters/myCluster/hosts), ResultStatus(201 Created), Hostname(null), Component(NAMENODE)
+2016-10-03T16:29:33.428Z, User(admin), RemoteIp(192.168.64.1), Operation(Component addition to host), RequestType(QUERY_POST), url(http://c6401.ambari.apache.org:8080/api/v1/clusters/myCluster/hosts), ResultStatus(201 Created), Hostname(null), Component(SECONDARY_NAMENODE)
+2016-10-03T16:29:33.516Z, User(admin), RemoteIp(192.168.64.1), Operation(Component addition to host), RequestType(QUERY_POST), url(http://c6401.ambari.apache.org:8080/api/v1/clusters/myCluster/hosts), ResultStatus(201 Created), Hostname(null), Component(ZOOKEEPER_SERVER)
+2016-10-03T16:29:33.562Z, User(admin), RemoteIp(192.168.64.1), Operation(Component addition to host), RequestType(QUERY_POST), url(http://c6401.ambari.apache.org:8080/api/v1/clusters/myCluster/hosts), ResultStatus(201 Created), Hostname(null), Component(INFRA_SOLR)
+2016-10-03T16:29:33.629Z, User(admin), RemoteIp(192.168.64.1), Operation(Component addition to host), RequestType(QUERY_POST), url(http://c6401.ambari.apache.org:8080/api/v1/clusters/myCluster/hosts), ResultStatus(201 Created), Hostname(null), Component(METRICS_GRAFANA)
+2016-10-03T16:29:33.672Z, User(admin), RemoteIp(192.168.64.1), Operation(Component addition to host), RequestType(QUERY_POST), url(http://c6401.ambari.apache.org:8080/api/v1/clusters/myCluster/hosts), ResultStatus(201 Created), Hostname(null), Component(METRICS_COLLECTOR)
+2016-10-03T16:29:33.780Z, User(admin), RemoteIp(192.168.64.1), Operation(Component addition to host), RequestType(QUERY_POST), url(http://c6401.ambari.apache.org:8080/api/v1/clusters/myCluster/hosts), ResultStatus(201 Created), Hostname(null), Component(DATANODE)
+2016-10-03T16:29:33.851Z, User(admin), RemoteIp(192.168.64.1), Operation(Component addition to host), RequestType(QUERY_POST), url(http://c6401.ambari.apache.org:8080/api/v1/clusters/myCluster/hosts), ResultStatus(201 Created), Hostname(null), Component(HDFS_CLIENT)
+2016-10-03T16:29:33.926Z, User(admin), RemoteIp(192.168.64.1), Operation(Component addition to host), RequestType(QUERY_POST), url(http://c6401.ambari.apache.org:8080/api/v1/clusters/myCluster/hosts), ResultStatus(201 Created), Hostname(null), Component(ZOOKEEPER_CLIENT)
+2016-10-03T16:29:33.988Z, User(admin), RemoteIp(192.168.64.1), Operation(Component addition to host), RequestType(QUERY_POST), url(http://c6401.ambari.apache.org:8080/api/v1/clusters/myCluster/hosts), ResultStatus(201 Created), Hostname(null), Component(INFRA_SOLR_CLIENT)
+2016-10-03T16:29:34.107Z, User(admin), RemoteIp(192.168.64.1), Operation(Component addition to host), RequestType(QUERY_POST), url(http://c6401.ambari.apache.org:8080/api/v1/clusters/myCluster/hosts), ResultStatus(201 Created), Hostname(null), Component(METRICS_MONITOR)
+2016-10-03T16:29:34.814Z, User(admin), RemoteIp(192.168.64.1), Operation(INSTALLED: all services (myCluster)), RequestId(3), Status(Successfully queued)
+2016-10-03T16:29:35.035Z, User(admin), Operation(Install Services), Status(IN_PROGRESS), RequestId(3)
+2016-10-03T16:29:35.035Z, User(admin), Operation(INSTALL DATANODE), Status(QUEUED), RequestId(3), TaskId(10), Hostname(c6401.ambari.apache.org)
+2016-10-03T16:29:35.036Z, User(admin), Operation(INSTALL HDFS_CLIENT), Status(QUEUED), RequestId(3), TaskId(11), Hostname(c6401.ambari.apache.org)
+2016-10-03T16:29:35.036Z, User(admin), Operation(INSTALL INFRA_SOLR), Status(QUEUED), RequestId(3), TaskId(12), Hostname(c6401.ambari.apache.org)
+2016-10-03T16:29:35.036Z, User(admin), Operation(INSTALL INFRA_SOLR_CLIENT), Status(QUEUED), RequestId(3), TaskId(13), Hostname(c6401.ambari.apache.org)
+2016-10-03T16:29:35.037Z, User(admin), Operation(INSTALL METRICS_GRAFANA), Status(QUEUED), RequestId(3), TaskId(14), Hostname(c6401.ambari.apache.org)
+2016-10-03T16:29:35.043Z, User(admin), Operation(INSTALL METRICS_MONITOR), Status(QUEUED), RequestId(3), TaskId(15), Hostname(c6401.ambari.apache.org)
+2016-10-03T16:29:35.043Z, User(admin), Operation(INSTALL NAMENODE), Status(QUEUED), RequestId(3), TaskId(16), Hostname(c6401.ambari.apache.org)
+2016-10-03T16:29:35.043Z, User(admin), Operation(INSTALL ZOOKEEPER_CLIENT), Status(QUEUED), RequestId(3), TaskId(17), Hostname(c6401.ambari.apache.org)
+2016-10-03T16:29:35.045Z, User(admin), Operation(INSTALL ZOOKEEPER_SERVER), Status(QUEUED), RequestId(3), TaskId(18), Hostname(c6401.ambari.apache.org)
+2016-10-03T16:29:35.046Z, User(admin), Operation(INSTALL DATANODE), Status(QUEUED), RequestId(3), TaskId(19), Hostname(c6402.ambari.apache.org)
+2016-10-03T16:29:35.047Z, User(admin), Operation(INSTALL METRICS_MONITOR), Status(QUEUED), RequestId(3), TaskId(20), Hostname(c6402.ambari.apache.org)
+2016-10-03T16:29:35.047Z, User(admin), Operation(INSTALL SECONDARY_NAMENODE), Status(QUEUED), RequestId(3), TaskId(21), Hostname(c6402.ambari.apache.org)
+2016-10-03T16:29:35.047Z, User(admin), Operation(INSTALL ZOOKEEPER_SERVER), Status(QUEUED), RequestId(3), TaskId(22), Hostname(c6402.ambari.apache.org)
+2016-10-03T16:29:35.048Z, User(admin), Operation(INSTALL DATANODE), Status(QUEUED), RequestId(3), TaskId(23), Hostname(c6403.ambari.apache.org)
+2016-10-03T16:29:35.051Z, User(admin), Operation(INSTALL METRICS_COLLECTOR), Status(QUEUED), RequestId(3), TaskId(24), Hostname(c6403.ambari.apache.org)
+2016-10-03T16:29:35.052Z, User(admin), Operation(INSTALL METRICS_MONITOR), Status(QUEUED), RequestId(3), TaskId(25), Hostname(c6403.ambari.apache.org)
+2016-10-03T16:29:35.052Z, User(admin), Operation(INSTALL ZOOKEEPER_SERVER), Status(QUEUED), RequestId(3), TaskId(26), Hostname(c6403.ambari.apache.org)
+2016-10-03T16:29:35.052Z, User(admin), Operation(INSTALL DATANODE), Status(QUEUED), RequestId(3), TaskId(27), Hostname(c6404.ambari.apache.org)
+2016-10-03T16:29:35.053Z, User(admin), Operation(INSTALL HDFS_CLIENT), Status(QUEUED), RequestId(3), TaskId(28), Hostname(c6404.ambari.apache.org)
+2016-10-03T16:29:35.053Z, User(admin), Operation(INSTALL INFRA_SOLR_CLIENT), Status(QUEUED), RequestId(3), TaskId(29), Hostname(c6404.ambari.apache.org)
+2016-10-03T16:29:35.057Z, User(admin), Operation(INSTALL METRICS_MONITOR), Status(QUEUED), RequestId(3), TaskId(30), Hostname(c6404.ambari.apache.org)
+2016-10-03T16:29:35.059Z, User(admin), Operation(INSTALL ZOOKEEPER_CLIENT), Status(QUEUED), RequestId(3), TaskId(31), Hostname(c6404.ambari.apache.org)
+2016-10-03T16:29:35.629Z, User(admin), RemoteIp(192.168.64.1), RequestType(POST), url(http://c6401.ambari.apache.org:8080/api/v1/version_definitions?dry_run=true), ResultStatus(201 Created)
+2016-10-03T16:53:55.860Z, User(admin), Operation(INSTALL DATANODE), Status(COMPLETED), RequestId(3), TaskId(10), Hostname(c6401.ambari.apache.org)
+2016-10-03T16:53:56.837Z, User(admin), Operation(INSTALL HDFS_CLIENT), Status(COMPLETED), RequestId(3), TaskId(11), Hostname(c6401.ambari.apache.org)
+2016-10-03T16:58:35.834Z, User(admin), Operation(INSTALL DATANODE), Status(COMPLETED), RequestId(3), TaskId(19), Hostname(c6402.ambari.apache.org)
+2016-10-03T17:00:08.822Z, User(admin), Operation(INSTALL METRICS_MONITOR), Status(COMPLETED), RequestId(3), TaskId(20), Hostname(c6402.ambari.apache.org)
+2016-10-03T17:00:09.827Z, User(admin), Operation(INSTALL SECONDARY_NAMENODE), Status(COMPLETED), RequestId(3), TaskId(21), Hostname(c6402.ambari.apache.org)
+2016-10-03T17:00:10.831Z, User(admin), Operation(INSTALL ZOOKEEPER_SERVER), Status(COMPLETED), RequestId(3), TaskId(22), Hostname(c6402.ambari.apache.org)
+2016-10-03T17:00:15.818Z, User(admin), Operation(Install Services), Status(FAILED), RequestId(3)
+2016-10-03T17:00:15.818Z, User(admin), Operation(INSTALL DATANODE), Status(FAILED), RequestId(3), TaskId(23), Hostname(c6403.ambari.apache.org)
+2016-10-03T17:00:16.820Z, User(admin), Operation(INSTALL DATANODE), Status(FAILED), RequestId(3), TaskId(27), Hostname(c6404.ambari.apache.org)
+2016-10-03T17:00:23.828Z, User(admin), Operation(INSTALL HDFS_CLIENT), Status(COMPLETED), RequestId(3), TaskId(28), Hostname(c6404.ambari.apache.org)
+2016-10-03T17:00:54.818Z, User(admin), Operation(INSTALL INFRA_SOLR_CLIENT), Status(COMPLETED), RequestId(3), TaskId(29), Hostname(c6404.ambari.apache.org)
+2016-10-03T17:01:39.826Z, User(admin), Operation(INSTALL METRICS_MONITOR), Status(COMPLETED), RequestId(3), TaskId(30), Hostname(c6404.ambari.apache.org)
+2016-10-03T17:01:41.825Z, User(admin), Operation(INSTALL ZOOKEEPER_CLIENT), Status(COMPLETED), RequestId(3), TaskId(31), Hostname(c6404.ambari.apache.org)
+2016-10-03T17:02:31.822Z, User(admin), Operation(INSTALL INFRA_SOLR), Status(FAILED), RequestId(3), TaskId(12), Hostname(c6401.ambari.apache.org)
+2016-10-03T17:02:31.839Z, User(admin), Operation(INSTALL METRICS_COLLECTOR), Status(FAILED), RequestId(3), TaskId(24), Hostname(c6403.ambari.apache.org)
+2016-10-03T17:02:32.252Z, User(admin), Operation(INSTALL INFRA_SOLR_CLIENT), Status(ABORTED), RequestId(3), TaskId(13), Hostname(c6401.ambari.apache.org)
+2016-10-03T17:02:32.253Z, User(admin), Operation(INSTALL METRICS_GRAFANA), Status(ABORTED), RequestId(3), TaskId(14), Hostname(c6401.ambari.apache.org)
+2016-10-03T17:02:32.253Z, User(admin), Operation(INSTALL METRICS_MONITOR), Status(ABORTED), RequestId(3), TaskId(15), Hostname(c6401.ambari.apache.org)
+2016-10-03T17:02:32.253Z, User(admin), Operation(INSTALL NAMENODE), Status(ABORTED), RequestId(3), TaskId(16), Hostname(c6401.ambari.apache.org)
+2016-10-03T17:02:32.253Z, User(admin), Operation(INSTALL ZOOKEEPER_CLIENT), Status(ABORTED), RequestId(3), TaskId(17), Hostname(c6401.ambari.apache.org)
+2016-10-03T17:02:32.257Z, User(admin), Operation(INSTALL ZOOKEEPER_SERVER), Status(ABORTED), RequestId(3), TaskId(18), Hostname(c6401.ambari.apache.org)
+2016-10-03T17:02:32.257Z, User(admin), Operation(INSTALL METRICS_MONITOR), Status(ABORTED), RequestId(3), TaskId(25), Hostname(c6403.ambari.apache.org)
+2016-10-03T17:02:32.257Z, User(admin), Operation(INSTALL ZOOKEEPER_SERVER), Status(ABORTED), RequestId(3), TaskId(26), Hostname(c6403.ambari.apache.org)
+2016-10-03T17:02:48.818Z, User(admin), RemoteIp(192.168.64.1), Operation(INSTALLED: all services on all hosts (myCluster)), RequestId(4), Status(Successfully queued)
+2016-10-03T17:02:48.875Z, User(admin), Operation(Install Components), Status(IN_PROGRESS), RequestId(4)
+2016-10-03T17:02:48.875Z, User(admin), Operation(INSTALL HDFS_CLIENT), Status(QUEUED), RequestId(4), TaskId(32), Hostname(c6401.ambari.apache.org)
+2016-10-03T17:02:48.875Z, User(admin), Operation(INSTALL INFRA_SOLR), Status(QUEUED), RequestId(4), TaskId(33), Hostname(c6401.ambari.apache.org)
+2016-10-03T17:02:48.875Z, User(admin), Operation(INSTALL INFRA_SOLR_CLIENT), Status(QUEUED), RequestId(4), TaskId(34), Hostname(c6401.ambari.apache.org)
+2016-10-03T17:02:48.875Z, User(admin), Operation(INSTALL METRICS_GRAFANA), Status(QUEUED), RequestId(4), TaskId(35), Hostname(c6401.ambari.apache.org)
+2016-10-03T17:02:48.875Z, User(admin), Operation(INSTALL METRICS_MONITOR), Status(QUEUED), RequestId(4), TaskId(36), Hostname(c6401.ambari.apache.org)
+2016-10-03T17:02:48.875Z, User(admin), Operation(INSTALL NAMENODE), Status(QUEUED), RequestId(4), TaskId(37), Hostname(c6401.ambari.apache.org)
+2016-10-03T17:02:48.875Z, User(admin), Operation(INSTALL ZOOKEEPER_CLIENT), Status(QUEUED), RequestId(4), TaskId(38), Hostname(c6401.ambari.apache.org)
+2016-10-03T17:02:48.875Z, User(admin), Operation(INSTALL ZOOKEEPER_SERVER), Status(QUEUED), RequestId(4), TaskId(39), Hostname(c6401.ambari.apache.org)
+2016-10-03T17:02:48.876Z, User(admin), Operation(INSTALL DATANODE), Status(QUEUED), RequestId(4), TaskId(40), Hostname(c6403.ambari.apache.org)
+2016-10-03T17:02:48.876Z, User(admin), Operation(INSTALL METRICS_COLLECTOR), Status(QUEUED), RequestId(4), TaskId(41), Hostname(c6403.ambari.apache.org)
+2016-10-03T17:02:48.876Z, User(admin), Operation(INSTALL METRICS_MONITOR), Status(QUEUED), RequestId(4), TaskId(42), Hostname(c6403.ambari.apache.org)
+2016-10-03T17:02:48.876Z, User(admin), Operation(INSTALL ZOOKEEPER_SERVER), Status(QUEUED), RequestId(4), TaskId(43), Hostname(c6403.ambari.apache.org)
+2016-10-03T17:02:48.876Z, User(admin), Operation(INSTALL DATANODE), Status(QUEUED), RequestId(4), TaskId(44), Hostname(c6404.ambari.apache.org)
+2016-10-03T17:02:48.878Z, User(admin), Operation(INSTALL HDFS_CLIENT), Status(QUEUED), RequestId(4), TaskId(45), Hostname(c6404.ambari.apache.org)
+2016-10-03T17:02:48.878Z, User(admin), Operation(INSTALL INFRA_SOLR_CLIENT), Status(QUEUED), RequestId(4), TaskId(46), Hostname(c6404.ambari.apache.org)
+2016-10-03T17:02:48.878Z, User(admin), Operation(INSTALL ZOOKEEPER_CLIENT), Status(QUEUED), RequestId(4), TaskId(47), Hostname(c6404.ambari.apache.org)
+2016-10-03T17:02:50.836Z, User(admin), Operation(INSTALL DATANODE), Status(COMPLETED), RequestId(4), TaskId(44), Hostname(c6404.ambari.apache.org)
+2016-10-03T17:02:51.825Z, User(admin), Operation(INSTALL HDFS_CLIENT), Status(COMPLETED), RequestId(4), TaskId(32), Hostname(c6401.ambari.apache.org)
+2016-10-03T17:02:51.836Z, User(admin), Operation(INSTALL HDFS_CLIENT), Status(COMPLETED), RequestId(4), TaskId(45), Hostname(c6404.ambari.apache.org)
+2016-10-03T17:02:52.821Z, User(admin), Operation(INSTALL INFRA_SOLR_CLIENT), Status(COMPLETED), RequestId(4), TaskId(46), Hostname(c6404.ambari.apache.org)
+2016-10-03T17:02:52.855Z, User(admin), Operation(INSTALL DATANODE), Status(COMPLETED), RequestId(4), TaskId(40), Hostname(c6403.ambari.apache.org)
+2016-10-03T17:02:53.817Z, User(admin), Operation(INSTALL ZOOKEEPER_CLIENT), Status(COMPLETED), RequestId(4), TaskId(47), Hostname(c6404.ambari.apache.org)
+2016-10-03T17:03:38.840Z, User(admin), Operation(INSTALL INFRA_SOLR), Status(COMPLETED), RequestId(4), TaskId(33), Hostname(c6401.ambari.apache.org)
+2016-10-03T17:03:39.821Z, User(admin), Operation(INSTALL INFRA_SOLR_CLIENT), Status(COMPLETED), RequestId(4), TaskId(34), Hostname(c6401.ambari.apache.org)
+2016-10-03T17:04:32.819Z, User(admin), Operation(INSTALL METRICS_GRAFANA), Status(COMPLETED), RequestId(4), TaskId(35), Hostname(c6401.ambari.apache.org)
+2016-10-03T17:04:34.827Z, User(admin), Operation(INSTALL METRICS_MONITOR), Status(COMPLETED), RequestId(4), TaskId(36), Hostname(c6401.ambari.apache.org)
+2016-10-03T17:04:35.841Z, User(admin), Operation(INSTALL NAMENODE), Status(COMPLETED), RequestId(4), TaskId(37), Hostname(c6401.ambari.apache.org)
+2016-10-03T17:04:37.835Z, User(admin), Operation(INSTALL ZOOKEEPER_CLIENT), Status(COMPLETED), RequestId(4), TaskId(38), Hostname(c6401.ambari.apache.org)
+2016-10-03T17:04:37.836Z, User(admin), Operation(INSTALL ZOOKEEPER_SERVER), Status(COMPLETED), RequestId(4), TaskId(39), Hostname(c6401.ambari.apache.org)
+2016-10-03T17:07:09.821Z, User(admin), Operation(INSTALL METRICS_COLLECTOR), Status(COMPLETED), RequestId(4), TaskId(41), Hostname(c6403.ambari.apache.org)
+2016-10-03T17:07:09.844Z, User(admin), Operation(INSTALL METRICS_MONITOR), Status(COMPLETED), RequestId(4), TaskId(42), Hostname(c6403.ambari.apache.org)
+2016-10-03T17:07:11.839Z, User(admin), Operation(Install Components), Status(COMPLETED), RequestId(4)
+2016-10-03T17:07:11.839Z, User(admin), Operation(INSTALL ZOOKEEPER_SERVER), Status(COMPLETED), RequestId(4), TaskId(43), Hostname(c6403.ambari.apache.org)
+2016-10-03T17:07:14.709Z, User(admin), RemoteIp(192.168.64.1), Operation(STARTED: all services (myCluster)), RequestId(5), Status(Successfully queued)
+2016-10-03T17:07:14.751Z, User(admin), Operation(Start Services), Status(IN_PROGRESS), RequestId(5)
+2016-10-03T17:07:14.751Z, User(admin), Operation(START METRICS_MONITOR), Status(QUEUED), RequestId(5), TaskId(48), Hostname(c6401.ambari.apache.org)
+2016-10-03T17:07:14.751Z, User(admin), Operation(START ZOOKEEPER_SERVER), Status(QUEUED), RequestId(5), TaskId(49), Hostname(c6401.ambari.apache.org)
+2016-10-03T17:07:14.751Z, User(admin), Operation(START METRICS_MONITOR), Status(QUEUED), RequestId(5), TaskId(50), Hostname(c6402.ambari.apache.org)
+2016-10-03T17:07:14.751Z, User(admin), Operation(START ZOOKEEPER_SERVER), Status(QUEUED), RequestId(5), TaskId(51), Hostname(c6402.ambari.apache.org)
+2016-10-03T17:07:14.751Z, User(admin), Operation(START METRICS_MONITOR), Status(QUEUED), RequestId(5), TaskId(52), Hostname(c6403.ambari.apache.org)
+2016-10-03T17:07:14.751Z, User(admin), Operation(START ZOOKEEPER_SERVER), Status(QUEUED), RequestId(5), TaskId(53), Hostname(c6403.ambari.apache.org)
+2016-10-03T17:07:14.751Z, User(admin), Operation(START METRICS_MONITOR), Status(QUEUED), RequestId(5), TaskId(54), Hostname(c6404.ambari.apache.org)
+2016-10-03T17:07:18.817Z, User(admin), Operation(START METRICS_MONITOR), Status(COMPLETED), RequestId(5), TaskId(52), Hostname(c6403.ambari.apache.org)
+2016-10-03T17:07:18.823Z, User(admin), Operation(START METRICS_MONITOR), Status(COMPLETED), RequestId(5), TaskId(50), Hostname(c6402.ambari.apache.org)
+2016-10-03T17:07:18.830Z, User(admin), Operation(START METRICS_MONITOR), Status(COMPLETED), RequestId(5), TaskId(54), Hostname(c6404.ambari.apache.org)
+2016-10-03T17:07:19.900Z, User(admin), Operation(START METRICS_MONITOR), Status(COMPLETED), RequestId(5), TaskId(48), Hostname(c6401.ambari.apache.org)
+2016-10-03T17:07:19.918Z, User(admin), Operation(START ZOOKEEPER_SERVER), Status(COMPLETED), RequestId(5), TaskId(53), Hostname(c6403.ambari.apache.org)
+2016-10-03T17:07:19.935Z, User(admin), Operation(START ZOOKEEPER_SERVER), Status(COMPLETED), RequestId(5), TaskId(51), Hostname(c6402.ambari.apache.org)
+2016-10-03T17:07:21.820Z, User(admin), Operation(START ZOOKEEPER_SERVER), Status(COMPLETED), RequestId(5), TaskId(49), Hostname(c6401.ambari.apache.org)
+2016-10-03T17:07:22.836Z, User(admin), Operation(START INFRA_SOLR), Status(QUEUED), RequestId(5), TaskId(55), Hostname(c6401.ambari.apache.org)
+2016-10-03T17:07:22.836Z, User(admin), Operation(SERVICE_CHECK ZOOKEEPER_QUORUM_SERVICE_CHECK), Details(SERVICE_CHECK ZOOKEEPER), Status(QUEUED), RequestId(5), TaskId(56), Hostname(c6401.ambari.apache.org)
+2016-10-03T17:07:37.819Z, User(admin), Operation(START INFRA_SOLR), Status(COMPLETED), RequestId(5), TaskId(55), Hostname(c6401.ambari.apache.org)
+2016-10-03T17:07:46.825Z, User(admin), Operation(SERVICE_CHECK ZOOKEEPER_QUORUM_SERVICE_CHECK), Details(SERVICE_CHECK ZOOKEEPER), Status(COMPLETED), RequestId(5), TaskId(56), Hostname(c6401.ambari.apache.org)
+2016-10-03T17:07:47.041Z, User(admin), Operation(SERVICE_CHECK AMBARI_INFRA_SERVICE_CHECK), Details(SERVICE_CHECK AMBARI_INFRA), Status(QUEUED), RequestId(5), TaskId(57), Hostname(c6401.ambari.apache.org)
+2016-10-03T17:07:47.041Z, User(admin), Operation(START DATANODE), Status(QUEUED), RequestId(5), TaskId(58), Hostname(c6401.ambari.apache.org)
+2016-10-03T17:07:47.041Z, User(admin), Operation(START NAMENODE), Status(QUEUED), RequestId(5), TaskId(59), Hostname(c6401.ambari.apache.org)
+2016-10-03T17:07:47.041Z, User(admin), Operation(START DATANODE), Status(QUEUED), RequestId(5), TaskId(60), Hostname(c6402.ambari.apache.org)
+2016-10-03T17:07:47.041Z, User(admin), Operation(START DATANODE), Status(QUEUED), RequestId(5), TaskId(61), Hostname(c6403.ambari.apache.org)
+2016-10-03T17:07:47.042Z, User(admin), Operation(START DATANODE), Status(QUEUED), RequestId(5), TaskId(62), Hostname(c6404.ambari.apache.org)
+2016-10-03T17:07:48.823Z, User(admin), Operation(SERVICE_CHECK AMBARI_INFRA_SERVICE_CHECK), Details(SERVICE_CHECK AMBARI_INFRA), Status(COMPLETED), RequestId(5), TaskId(57), Hostname(c6401.ambari.apache.org)
+2016-10-03T17:07:52.828Z, User(admin), Operation(START DATANODE), Status(COMPLETED), RequestId(5), TaskId(61), Hostname(c6403.ambari.apache.org)
+2016-10-03T17:07:52.844Z, User(admin), Operation(START DATANODE), Status(COMPLETED), RequestId(5), TaskId(60), Hostname(c6402.ambari.apache.org)
+2016-10-03T17:07:53.820Z, User(admin), Operation(START DATANODE), Status(COMPLETED), RequestId(5), TaskId(62), Hostname(c6404.ambari.apache.org)
+2016-10-03T17:07:53.833Z, User(admin), Operation(START DATANODE), Status(COMPLETED), RequestId(5), TaskId(58), Hostname(c6401.ambari.apache.org)
+2016-10-03T17:08:13.818Z, User(admin), Operation(START NAMENODE), Status(COMPLETED), RequestId(5), TaskId(59), Hostname(c6401.ambari.apache.org)
+2016-10-03T17:08:14.280Z, User(admin), Operation(START SECONDARY_NAMENODE), Status(QUEUED), RequestId(5), TaskId(63), Hostname(c6402.ambari.apache.org)
+2016-10-03T17:08:20.821Z, User(admin), Operation(START SECONDARY_NAMENODE), Status(COMPLETED), RequestId(5), TaskId(63), Hostname(c6402.ambari.apache.org)
+2016-10-03T17:08:21.333Z, User(admin), Operation(SERVICE_CHECK HDFS_SERVICE_CHECK), Details(SERVICE_CHECK HDFS), Status(QUEUED), RequestId(5), TaskId(64), Hostname(c6401.ambari.apache.org)
+2016-10-03T17:08:21.334Z, User(admin), Operation(START METRICS_COLLECTOR), Status(QUEUED), RequestId(5), TaskId(65), Hostname(c6403.ambari.apache.org)
+2016-10-03T17:08:29.815Z, User(admin), Operation(SERVICE_CHECK HDFS_SERVICE_CHECK), Details(SERVICE_CHECK HDFS), Status(COMPLETED), RequestId(5), TaskId(64), Hostname(c6401.ambari.apache.org)
+2016-10-03T17:09:17.819Z, User(admin), Operation(START METRICS_COLLECTOR), Status(COMPLETED), RequestId(5), TaskId(65), Hostname(c6403.ambari.apache.org)
+2016-10-03T17:09:18.621Z, User(admin), Operation(SERVICE_CHECK AMBARI_METRICS_SERVICE_CHECK), Details(SERVICE_CHECK AMBARI_METRICS), Status(QUEUED), RequestId(5), TaskId(66), Hostname(c6401.ambari.apache.org)
+2016-10-03T17:09:18.621Z, User(admin), Operation(START METRICS_GRAFANA), Status(QUEUED), RequestId(5), TaskId(67), Hostname(c6401.ambari.apache.org)
+2016-10-03T17:09:39.816Z, User(admin), Operation(SERVICE_CHECK AMBARI_METRICS_SERVICE_CHECK), Details(SERVICE_CHECK AMBARI_METRICS), Status(COMPLETED), RequestId(5), TaskId(66), Hostname(c6401.ambari.apache.org)
+2016-10-03T17:09:43.823Z, User(admin), Operation(Start Services), Status(COMPLETED), RequestId(5)
+2016-10-03T17:09:43.824Z, User(admin), Operation(START METRICS_GRAFANA), Status(COMPLETED), RequestId(5), TaskId(67), Hostname(c6401.ambari.apache.org)
+2016-10-03T17:14:46.087Z, User(admin), RemoteIp(192.168.64.1), RequestType(POST), url(http://c6401.ambari.apache.org:8080/api/v1/version_definitions?dry_run=true), ResultStatus(201 Created)
+2016-10-03T17:14:56.802Z, User(admin), RemoteIp(192.168.64.1), Operation(Configuration change), RequestType(PUT), url(http://c6401.ambari.apache.org:8080/api/v1/clusters/myCluster), ResultStatus(200 OK), VersionNumber(Vnull), VersionNote(null)
+2016-10-04T05:55:42.000Z, User(null), RemoteIp(192.168.64.1), Operation(User login), Roles(
+), Status(Failed), Reason(Authentication required)
+2016-10-04T05:55:42.020Z, User(null), RemoteIp(192.168.64.1), Operation(User login), Roles(
+), Status(Failed), Reason(Authentication required)
+2016-10-04T05:55:42.024Z, User(null), RemoteIp(192.168.64.1), Operation(User login), Roles(
+), Status(Failed), Reason(Authentication required)
+2016-10-04T05:55:42.027Z, User(null), RemoteIp(192.168.64.1), Operation(User login), Roles(
+), Status(Failed), Reason(Authentication required)
+2016-10-04T05:55:42.029Z, User(null), RemoteIp(192.168.64.1), Operation(User login), Roles(
+), Status(Failed), Reason(Authentication required)
+2016-10-04T05:55:42.033Z, User(null), RemoteIp(192.168.64.1), Operation(User login), Roles(
+), Status(Failed), Reason(Authentication required)
+2016-10-04T05:55:42.045Z, User(null), RemoteIp(192.168.64.1), Operation(User login), Roles(
+), Status(Failed), Reason(Authentication required)
+2016-10-04T05:55:42.047Z, User(null), RemoteIp(192.168.64.1), Operation(User login), Roles(
+), Status(Failed), Reason(Authentication required)
+2016-10-04T05:55:42.049Z, User(null), RemoteIp(192.168.64.1), Operation(User login), Roles(
+), Status(Failed), Reason(Authentication required)
+2016-10-04T05:55:42.051Z, User(null), RemoteIp(192.168.64.1), Operation(User login), Roles(
+), Status(Failed), Reason(Authentication required)
+2016-10-04T05:55:42.054Z, User(null), RemoteIp(192.168.64.1), Operation(User login), Roles(
+), Status(Failed), Reason(Authentication required)
+2016-10-04T05:55:42.055Z, User(null), RemoteIp(192.168.64.1), Operation(User login), Roles(
+), Status(Failed), Reason(Authentication required)
+2016-10-04T05:55:42.057Z, User(null), RemoteIp(192.168.64.1), Operation(User login), Roles(
+), Status(Failed), Reason(Authentication required)
+2016-10-04T05:55:42.061Z, User(null), RemoteIp(192.168.64.1), Operation(User login), Roles(
+), Status(Failed), Reason(Authentication required)
+2016-10-04T05:55:42.064Z, User(null), RemoteIp(192.168.64.1), Operation(User login), Roles(
+), Status(Failed), Reason(Authentication required)
+2016-10-04T05:55:42.068Z, User(null), RemoteIp(192.168.64.1), Operation(User login), Roles(
+), Status(Failed), Reason(Authentication required)
+2016-10-04T05:55:42.070Z, User(null), RemoteIp(192.168.64.1), Operation(User login), Roles(
+), Status(Failed), Reason(Authentication required)
+2016-10-04T05:55:42.072Z, User(null), RemoteIp(192.168.64.1), Operation(User login), Roles(
+), Status(Failed), Reason(Authentication required)
+2016-10-04T05:55:42.074Z, User(null), RemoteIp(192.168.64.1), Operation(User login), Roles(
+), Status(Failed), Reason(Authentication required)
+2016-10-04T05:55:42.078Z, User(null), RemoteIp(192.168.64.1), Operation(User login), Roles(
+), Status(Failed), Reason(Authentication required)
+2016-10-04T05:55:42.080Z, User(null), RemoteIp(192.168.64.1), Operation(User login), Roles(
+), Status(Failed), Reason(Authentication required)
+2016-10-04T05:55:42.081Z, User(null), RemoteIp(192.168.64.1), Operation(User login), Roles(
+), Status(Failed), Reason(Authentication required)
+2016-10-04T05:55:42.083Z, User(null), RemoteIp(192.168.64.1), Operation(User login), Roles(
+), Status(Failed), Reason(Authentication required)
+2016-10-04T05:55:42.085Z, User(null), RemoteIp(192.168.64.1), Operation(User login), Roles(
+), Status(Failed), Reason(Authentication required)
+2016-10-04T05:55:42.087Z, User(null), RemoteIp(192.168.64.1), Operation(User login), Roles(
+), Status(Failed), Reason(Authentication required)
+2016-10-04T05:55:42.088Z, User(null), RemoteIp(192.168.64.1), Operation(User login), Roles(
+), Status(Failed), Reason(Authentication required)
+2016-10-04T05:55:42.090Z, User(null), RemoteIp(192.168.64.1), Operation(User login), Roles(
+), Status(Failed), Reason(Authentication required)
+2016-10-04T05:55:42.091Z, User(null), RemoteIp(192.168.64.1), Operation(User login), Roles(
+), Status(Failed), Reason(Authentication required)
+2016-10-04T05:55:42.092Z, User(null), RemoteIp(192.168.64.1), Operation(User login), Roles(
+), Status(Failed), Reason(Authentication required)
+2016-10-04T05:55:42.100Z, User(null), RemoteIp(192.168.64.1), Operation(User login), Roles(
+), Status(Failed), Reason(Authentication required)
+2016-10-04T05:55:42.100Z, User(null), RemoteIp(192.168.64.1), Operation(User login), Roles(
+), Status(Failed), Reason(Authentication required)
+2016-10-04T05:55:42.102Z, User(null), RemoteIp(192.168.64.1), Operation(User login), Roles(
+), Status(Failed), Reason(Authentication required)
+2016-10-04T05:55:42.103Z, User(null), RemoteIp(192.168.64.1), Operation(User login), Roles(
+), Status(Failed), Reason(Authentication required)
+2016-10-04T05:55:42.104Z, User(null), RemoteIp(192.168.64.1), Operation(User login), Roles(
+), Status(Failed), Reason(Authentication required)
+2016-10-04T05:55:42.105Z, User(null), RemoteIp(192.168.64.1), Operation(User login), Roles(
+), Status(Failed), Reason(Authentication required)
+2016-10-04T05:55:42.107Z, User(null), RemoteIp(192.168.64.1), Operation(User login), Roles(
+), Status(Failed), Reason(Authentication required)
+2016-10-04T05:55:42.108Z, User(null), RemoteIp(192.168.64.1), Operation(User login), Roles(
+), Status(Failed), Reason(Authentication required)
+2016-10-04T05:55:42.109Z, User(null), RemoteIp(192.168.64.1), Operation(User login), Roles(
+), Status(Failed), Reason(Authentication required)
+2016-10-04T05:55:42.110Z, User(null), RemoteIp(192.168.64.1), Operation(User login), Roles(
+), Status(Failed), Reason(Authentication required)
+2016-10-04T05:55:42.130Z, User(null), RemoteIp(192.168.64.1), Operation(User login), Roles(
+), Status(Failed), Reason(Authentication required)
+2016-10-04T05:55:44.919Z, User(null), RemoteIp(192.168.64.1), Operation(User login), Roles(
+), Status(Failed), Reason(Authentication required)
+2016-10-04T08:02:57.511Z, User(null), RemoteIp(192.168.64.1), Operation(User login), Roles(
+), Status(Failed), Reason(Authentication required)
+2016-10-04T08:02:59.309Z, User(admin), RemoteIp(192.168.64.1), Operation(User login), Roles(
+    Ambari: Ambari Administrator
+), Status(Success)
+2016-10-04T08:05:40.063Z, User(admin), RemoteIp(192.168.64.1), RequestType(POST), url(http://c6401.ambari.apache.org:8080/api/v1/clusters/myCluster/widget_layouts), ResultStatus(201 Created)
+2016-10-04T08:05:40.085Z, User(admin), RemoteIp(192.168.64.1), RequestType(PUT), url(http://c6401.ambari.apache.org:8080/api/v1/users/admin/activeWidgetLayouts/), ResultStatus(200 OK)
+2016-10-04T08:11:45.150Z, User(admin), RemoteIp(192.168.64.1), Operation(STARTED: METRICS_COLLECTOR/AMBARI_METRICS on c6403.ambari.apache.org (myCluster)), Host name(c6403.ambari.apache.org), RequestId(6), Status(Successfully queued)
+2016-10-04T08:11:45.221Z, User(admin), Operation(Start Metrics Collector), Status(IN_PROGRESS), RequestId(6)
+2016-10-04T08:11:45.222Z, User(admin), Operation(START METRICS_COLLECTOR), Status(QUEUED), RequestId(6), TaskId(102), Hostname(c6403.ambari.apache.org)
+2016-10-04T08:15:30.413Z, User(admin), Operation(Start Metrics Collector), Status(COMPLETED), RequestId(6)
+2016-10-04T08:15:30.414Z, User(admin), Operation(START METRICS_COLLECTOR), Status(COMPLETED), RequestId(6), TaskId(102), Hostname(c6403.ambari.apache.org)
+2016-10-04T08:17:44.550Z, User(null), RemoteIp(192.168.64.1), Operation(User login), Roles(
+), Status(Failed), Reason(Authentication required)
+2016-10-04T08:17:44.552Z, User(null), RemoteIp(192.168.64.1), Operation(User login), Roles(
+), Status(Failed), Reason(Authentication required)
+2016-10-04T08:17:44.554Z, User(null), RemoteIp(192.168.64.1), Operation(User login), Roles(
+), Status(Failed), Reason(Authentication required)
+2016-10-04T08:17:44.556Z, User(null), RemoteIp(192.168.64.1), Operation(User login), Roles(
+), Status(Failed), Reason(Authentication required)
+2016-10-04T08:17:44.557Z, User(null), RemoteIp(192.168.64.1), Operation(User login), Roles(
+), Status(Failed), Reason(Authentication required)
+2016-10-04T08:17:44.559Z, User(null), RemoteIp(192.168.64.1), Operation(User login), Roles(
+), Status(Failed), Reason(Authentication required)
+2016-10-04T08:17:44.561Z, User(null), RemoteIp(192.168.64.1), Operation(User login), Roles(
+), Status(Failed), Reason(Authentication required)
+2016-10-04T08:17:44.564Z, User(null), RemoteIp(192.168.64.1), Operation(User login), Roles(
+), Status(Failed), Reason(Authentication required)
+2016-10-04T08:17:44.595Z, User(null), RemoteIp(192.168.64.1), Operation(User login), Roles(
+), Status(Failed), Reason(Authentication required)
+2016-10-04T08:17:45.370Z, User(null), RemoteIp(192.168.64.1), Operation(User login), Roles(
+), Status(Failed), Reason(Authentication required)
+2016-10-04T08:17:45.495Z, User(null), RemoteIp(192.168.64.1), Operation(User login), Roles(
+), Status(Failed), Reason(Authentication required)
+2016-10-05T12:06:48.400Z, User(null), RemoteIp(192.168.64.1), Operation(User login), Roles(
+), Status(Failed), Reason(Authentication required)
+2016-10-05T12:13:51.541Z, User(admin), RemoteIp(192.168.64.1), Operation(User login), Roles(
+    Ambari: Ambari Administrator
+), Status(Success)
+2016-10-05T12:14:27.945Z, User(admin), RemoteIp(192.168.64.1), Operation(null), RequestId(null), Status(Successfully queued)
+2016-10-05T12:14:28.414Z, User(admin), RemoteIp(192.168.64.1), Operation(Configuration change), RequestType(PUT), url(http://c6401.ambari.apache.org:8080/api/v1/clusters/myCluster), ResultStatus(200 OK), VersionNumber(V1), VersionNote(Initial configurations for Log Search)
+2016-10-05T12:14:28.562Z, User(admin), RemoteIp(192.168.64.1), RequestType(QUERY_POST), url(http://c6401.ambari.apache.org:8080/api/v1/clusters/myCluster/services?ServiceInfo/service_name=LOGSEARCH), ResultStatus(201 Created)
+2016-10-05T12:14:28.630Z, User(admin), RemoteIp(192.168.64.1), Operation(Component addition to host), RequestType(QUERY_POST), url(http://c6401.ambari.apache.org:8080/api/v1/clusters/myCluster/hosts), ResultStatus(201 Created), Hostname(null), Component(LOGSEARCH_SERVER)
+2016-10-05T12:14:28.744Z, User(admin), RemoteIp(192.168.64.1), Operation(Component addition to host), RequestType(QUERY_POST), url(http://c6401.ambari.apache.org:8080/api/v1/clusters/myCluster/hosts), ResultStatus(201 Created), Hostname(null), Component(LOGSEARCH_LOGFEEDER)
+2016-10-05T12:14:29.066Z, User(admin), RemoteIp(192.168.64.1), Operation(INSTALLED: all services (myCluster)), RequestId(7), Status(Successfully queued)
+2016-10-05T12:14:29.138Z, User(admin), Operation(Install Services), Status(IN_PROGRESS), RequestId(7)
+2016-10-05T12:14:29.146Z, User(admin), Operation(INSTALL LOGSEARCH_LOGFEEDER), Status(QUEUED), RequestId(7), TaskId(152), Hostname(c6401.ambari.apache.org)
+2016-10-05T12:14:29.147Z, User(admin), Operation(INSTALL LOGSEARCH_SERVER), Status(QUEUED), RequestId(7), TaskId(153), Hostname(c6401.ambari.apache.org)
+2016-10-05T12:14:29.147Z, User(admin), Operation(INSTALL LOGSEARCH_LOGFEEDER), Status(QUEUED), RequestId(7), TaskId(154), Hostname(c6402.ambari.apache.org)
+2016-10-05T12:14:29.148Z, User(admin), Operation(INSTALL LOGSEARCH_LOGFEEDER), Status(QUEUED), RequestId(7), TaskId(155), Hostname(c6403.ambari.apache.org)
+2016-10-05T12:14:29.151Z, User(admin), Operation(INSTALL LOGSEARCH_LOGFEEDER), Status(QUEUED), RequestId(7), TaskId(156), Hostname(c6404.ambari.apache.org)
+2016-10-05T12:14:32.964Z, User(admin), Operation(INSTALL LOGSEARCH_LOGFEEDER), Status(COMPLETED), RequestId(7), TaskId(152), Hostname(c6401.ambari.apache.org)
+2016-10-05T12:14:34.925Z, User(admin), Operation(INSTALL LOGSEARCH_SERVER), Status(COMPLETED), RequestId(7), TaskId(153), Hostname(c6401.ambari.apache.org)
+2016-10-05T12:14:52.942Z, User(admin), Operation(INSTALL LOGSEARCH_LOGFEEDER), Status(COMPLETED), RequestId(7), TaskId(155), Hostname(c6403.ambari.apache.org)
+2016-10-05T12:14:52.965Z, User(admin), Operation(INSTALL LOGSEARCH_LOGFEEDER), Status(COMPLETED), RequestId(7), TaskId(156), Hostname(c6404.ambari.apache.org)
+2016-10-05T12:15:06.922Z, User(admin), Operation(Install Services), Status(COMPLETED), RequestId(7)
+2016-10-05T12:15:06.928Z, User(admin), Operation(INSTALL LOGSEARCH_LOGFEEDER), Status(COMPLETED), RequestId(7), TaskId(154), Hostname(c6402.ambari.apache.org)
+2016-10-05T12:15:11.172Z, User(admin), RemoteIp(192.168.64.1), Operation(STARTED: all services (myCluster)), RequestId(8), Status(Successfully queued)
+2016-10-05T12:15:11.180Z, User(admin), Operation(Start Added Services), Status(IN_PROGRESS), RequestId(8)
+2016-10-05T12:15:11.180Z, User(admin), Operation(START LOGSEARCH_SERVER), Status(QUEUED), RequestId(8), TaskId(157), Hostname(c6401.ambari.apache.org)
+2016-10-05T12:15:20.953Z, User(admin), Operation(START LOGSEARCH_SERVER), Status(COMPLETED), RequestId(8), TaskId(157), Hostname(c6401.ambari.apache.org)
+2016-10-05T12:15:21.328Z, User(admin), Operation(START LOGSEARCH_LOGFEEDER), Status(QUEUED), RequestId(8), TaskId(158), Hostname(c6401.ambari.apache.org)
+2016-10-05T12:15:21.328Z, User(admin), Operation(SERVICE_CHECK LOGSEARCH_SERVICE_CHECK), Details(SERVICE_CHECK LOGSEARCH), Status(QUEUED), RequestId(8), TaskId(159), Hostname(c6401.ambari.apache.org)
+2016-10-05T12:15:21.329Z, User(admin), Operation(START LOGSEARCH_LOGFEEDER), Status(QUEUED), RequestId(8), TaskId(160), Hostname(c6402.ambari.apache.org)
+2016-10-05T12:15:21.329Z, User(admin), Operation(START LOGSEARCH_LOGFEEDER), Status(QUEUED), RequestId(8), TaskId(161), Hostname(c6403.ambari.apache.org)
+2016-10-05T12:15:21.329Z, User(admin), Operation(START LOGSEARCH_LOGFEEDER), Status(QUEUED), RequestId(8), TaskId(162), Hostname(c6404.ambari.apache.org)
+2016-10-05T12:15:22.968Z, User(admin), Operation(START LOGSEARCH_LOGFEEDER), Status(COMPLETED), RequestId(8), TaskId(160), Hostname(c6402.ambari.apache.org)
+2016-10-05T12:15:23.025Z, User(admin), Operation(START LOGSEARCH_LOGFEEDER), Status(COMPLETED), RequestId(8), TaskId(162), Hostname(c6404.ambari.apache.org)
+2016-10-05T12:15:26.941Z, User(admin), Operation(START LOGSEARCH_LOGFEEDER), Status(COMPLETED), RequestId(8), TaskId(158), Hostname(c6401.ambari.apache.org)
+2016-10-05T12:15:48.950Z, User(admin), Operation(START LOGSEARCH_LOGFEEDER), Status(COMPLETED), RequestId(8), TaskId(161), Hostname(c6403.ambari.apache.org)
+2016-10-05T12:15:55.920Z, User(admin), Operation(Start Added Services), Status(COMPLETED), RequestId(8)
+2016-10-05T12:15:55.920Z, User(admin), Operation(SERVICE_CHECK LOGSEARCH_SERVICE_CHECK), Details(SERVICE_CHECK LOGSEARCH), Status(COMPLETED), RequestId(8), TaskId(159), Hostname(c6401.ambari.apache.org)
+2016-10-05T13:09:33.055Z, User(null), RemoteIp(192.168.64.1), Operation(User login), Roles(
+), Status(Failed), Reason(Authentication required)
+2016-10-05T13:09:33.055Z, User(null), RemoteIp(192.168.64.1), Operation(User login), Roles(
+), Status(Failed), Reason(Authentication required)
+2016-10-05T13:09:33.124Z, User(null), RemoteIp(192.168.64.1), Operation(User login), Roles(
+), Status(Failed), Reason(Authentication required)
+2016-10-05T13:09:34.863Z, User(null), RemoteIp(192.168.64.1), Operation(User login), Roles(
+), Status(Failed), Reason(Authentication required)
+2016-10-05T13:09:55.468Z, User(admin), RemoteIp(192.168.64.1), Operation(User login), Roles(
+    Ambari: Ambari Administrator
+), Status(Success)
+2016-10-06T07:44:56.131Z, User(null), RemoteIp(192.168.64.1), Operation(User login), Roles(
+), Status(Failed), Reason(Authentication required)
+2016-10-06T07:44:56.219Z, User(null), RemoteIp(192.168.64.1), Operation(User login), Roles(
+), Status(Failed), Reason(Authentication required)
+2016-10-06T07:44:56.326Z, User(null), RemoteIp(192.168.64.1), Operation(User login), Roles(
+), Status(Failed), Reason(Authentication required)
+2016-10-06T07:45:01.686Z, User(null), RemoteIp(192.168.64.1), Operation(User login), Roles(
+), Status(Failed), Reason(Authentication required)

http://git-wip-us.apache.org/repos/asf/ambari/blob/a9094ab8/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/templates/input.config-ambari.json.j2
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/templates/input.config-ambari.json.j2 b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/templates/input.config-ambari.json.j2
index e2646ff..36507c9 100644
--- a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/templates/input.config-ambari.json.j2
+++ b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/templates/input.config-ambari.json.j2
@@ -271,6 +271,10 @@
       "value_borders":"()",
       "post_map_values":{
         "User":{
+          "map_fieldvalue":{
+            "pre_value":"null",
+            "post_value":"unknown"
+          },
           "map_fieldname":{
             "new_fieldname":"reqUser"
           }
@@ -280,6 +284,11 @@
             "new_fieldname":"host"
           }
         },
+        "Host name":{
+          "map_fieldname":{
+            "new_fieldname":"host"
+          }
+        },
         "RemoteIp":{
           "map_fieldname":{
             "new_fieldname":"cliIP"
@@ -315,8 +324,113 @@
             "new_fieldname":"resource"
           }
         },
+        "Cluster name":{
+          "map_fieldname":{
+            "new_fieldname":"cluster"
+          }
+        },
+        "Reason":{
+          "map_fieldname":{
+            "new_fieldname":"reason"
+          }
+        },
+        "Base URL":{
+          "map_fieldname":{
+            "new_fieldname":"ws_base_url"
+          }
+        },
+        "Command":{
+          "map_fieldvalue":{
+            "pre_value":"null",
+            "post_value":"unknown"
+          },
+          "map_fieldname":{
+            "new_fieldname":"ws_command"
+          }
+        },
+        "Component":{
+          "map_fieldname":{
+            "new_fieldname":"ws_component"
+          }
+        },
+        "Details":{
+          "map_fieldname":{
+            "new_fieldname":"ws_details"
+          }
+        },
+        "Display name":{
+          "map_fieldvalue":{
+            "pre_value":"null",
+            "post_value":"unknown"
+          },
+          "map_fieldname":{
+            "new_fieldname":"ws_display_name"
+          }
+        },
+        "OS":{
+          "map_fieldname":{
+            "new_fieldname":"ws_os"
+          }
+        },
+        "Repo id":{
+          "map_fieldname":{
+            "new_fieldname":"ws_repo_id"
+          }
+        },
+        "Repo version":{
+          "map_fieldvalue":{
+            "pre_value":"null",
+            "post_value":"unknown"
+          },
+          "map_fieldname":{
+            "new_fieldname":"ws_repo_version"
+          }
+        },
+        "Repositories":{
+          "map_fieldname":{
+            "new_fieldname":"ws_repositories"
+          }
+        },
+        "Roles":{
+          "map_fieldname":{
+            "new_fieldname":"ws_roles"
+          }
+        },
+        "Stack":{
+          "map_fieldname":{
+            "new_fieldname":"ws_stack"
+          }
+        },
+        "Stack version":{
+          "map_fieldname":{
+            "new_fieldname":"ws_stack_version"
+          }
+        },
+        "VersionNote":{
+          "map_fieldvalue":{
+            "pre_value":"null",
+            "post_value":"unknown"
+          },
+          "map_fieldname":{
+            "new_fieldname":"ws_version_note"
+          }
+        },
+        "VersionNumber":{
+          "map_fieldvalue":{
+            "pre_value":"Vnull",
+            "post_value":"unknown"
+          },
+          "map_fieldname":{
+            "new_fieldname":"ws_version_number"
+          }
+        },
         "Status":[
           {
+            "map_fieldcopy":{
+              "copy_name": "ws_status"
+            }
+          },
+          {
             "map_fieldvalue":{
               "pre_value":"Success",
               "post_value":"1"
@@ -414,6 +528,11 @@
         ],
         "ResultStatus":[
           {
+            "map_fieldcopy":{
+              "copy_name": "ws_result_status"
+            }
+          },
+          {
             "map_fieldvalue":{
               "pre_value":"200 OK",
               "post_value":"1"

http://git-wip-us.apache.org/repos/asf/ambari/blob/a9094ab8/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/templates/input.config-falcon.json.j2
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/templates/input.config-falcon.json.j2 b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/templates/input.config-falcon.json.j2
index 3fea3d3..a40e52d 100644
--- a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/templates/input.config-falcon.json.j2
+++ b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/templates/input.config-falcon.json.j2
@@ -41,7 +41,7 @@
       "post_map_values":{
         "logtime":{
           "map_date":{
-            "target_target_date_pattern":"yyyy-MM-dd HH:mm:ss,SSS"
+            "target_date_pattern":"yyyy-MM-dd HH:mm:ss,SSS"
           }
 
         }


[40/58] [abbrv] ambari git commit: AMBARI-18310. Logsearch - Refactor solr query layer (oleewere)

Posted by ol...@apache.org.
http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/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 1d4f91f..6e319da 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
@@ -18,1246 +18,349 @@
  */
 package org.apache.ambari.logsearch.manager;
 
+import java.io.File;
+import java.io.FileOutputStream;
 import java.io.IOException;
-import java.text.ParseException;
+import java.io.StringWriter;
 import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.Collection;
 import java.util.Date;
-import java.util.GregorianCalendar;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Locale;
 import java.util.Map;
-import java.util.TimeZone;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.CopyOnWriteArrayList;
 
 import javax.inject.Inject;
+import javax.inject.Named;
+import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
 
+import com.google.common.collect.Lists;
+import freemarker.template.Configuration;
+import freemarker.template.Template;
+import freemarker.template.TemplateException;
 import org.apache.ambari.logsearch.common.LogSearchConstants;
 import org.apache.ambari.logsearch.common.MessageEnums;
-import org.apache.ambari.logsearch.conf.SolrServiceLogPropsConfig;
 import org.apache.ambari.logsearch.dao.ServiceLogsSolrDao;
 import org.apache.ambari.logsearch.graph.GraphDataGenerator;
-import org.apache.ambari.logsearch.model.response.BarGraphData;
+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;
+import org.apache.ambari.logsearch.model.request.impl.ServiceLogComponentHostRequest;
+import org.apache.ambari.logsearch.model.request.impl.ServiceLogComponentLevelRequest;
+import org.apache.ambari.logsearch.model.request.impl.ServiceLogExportRequest;
+import org.apache.ambari.logsearch.model.request.impl.ServiceLogHostComponentRequest;
+import org.apache.ambari.logsearch.model.request.impl.ServiceLogLevelCountRequest;
+import org.apache.ambari.logsearch.model.request.impl.ServiceLogRequest;
+import org.apache.ambari.logsearch.model.request.impl.ServiceLogTruncatedRequest;
 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.GroupListResponse;
 import org.apache.ambari.logsearch.model.response.LogData;
 import org.apache.ambari.logsearch.model.response.LogListResponse;
-import org.apache.ambari.logsearch.model.response.LogSearchResponse;
-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.ambari.logsearch.model.response.ServiceLogData;
 import org.apache.ambari.logsearch.model.response.ServiceLogResponse;
-import org.apache.ambari.logsearch.query.QueryGenerationBase;
-import org.apache.ambari.logsearch.query.model.CommonServiceLogSearchCriteria;
-import org.apache.ambari.logsearch.query.model.ServiceAnyGraphSearchCriteria;
-import org.apache.ambari.logsearch.query.model.ServiceGraphSearchCriteria;
-import org.apache.ambari.logsearch.query.model.ServiceLogExportSearchCriteria;
-import org.apache.ambari.logsearch.query.model.ServiceLogSearchCriteria;
-import org.apache.ambari.logsearch.query.model.ServiceLogTruncatedSearchCriteria;
+import org.apache.ambari.logsearch.converter.BaseServiceLogRequestQueryConverter;
+import org.apache.ambari.logsearch.converter.ServiceLogTruncatedRequestQueryConverter;
 import org.apache.ambari.logsearch.solr.model.SolrComponentTypeLogData;
 import org.apache.ambari.logsearch.solr.model.SolrHostLogData;
 import org.apache.ambari.logsearch.solr.model.SolrServiceLogData;
-import org.apache.ambari.logsearch.util.BizUtil;
+import org.apache.ambari.logsearch.util.DownloadUtil;
 import org.apache.ambari.logsearch.util.DateUtil;
-import org.apache.ambari.logsearch.util.FileUtil;
 import org.apache.ambari.logsearch.util.RESTErrorUtil;
 import org.apache.ambari.logsearch.util.SolrUtil;
-import org.apache.ambari.logsearch.view.VSummary;
-import org.apache.ambari.logsearch.query.model.SearchCriteria;
+import org.apache.commons.collections.CollectionUtils;
 import org.apache.commons.lang.StringUtils;
-import org.apache.commons.lang.time.DateUtils;
 import org.apache.log4j.Logger;
 import org.apache.solr.client.solrj.SolrQuery;
 import org.apache.solr.client.solrj.SolrServerException;
 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.common.SolrDocument;
 import org.apache.solr.common.SolrDocumentList;
 import org.apache.solr.common.SolrException;
-import org.apache.solr.common.util.NamedList;
-import org.apache.solr.common.util.SimpleOrderedMap;
-import org.springframework.scheduling.annotation.Scheduled;
-import org.springframework.stereotype.Component;
-
-import com.google.common.collect.Lists;
-
-@Component
+import org.springframework.core.convert.ConversionService;
+import org.springframework.data.solr.core.DefaultQueryParser;
+import org.springframework.data.solr.core.query.Criteria;
+import org.springframework.data.solr.core.query.SimpleFacetQuery;
+import org.springframework.data.solr.core.query.SimpleFilterQuery;
+import org.springframework.data.solr.core.query.SimpleQuery;
+import org.springframework.data.solr.core.query.SimpleStringCriteria;
+
+import static org.apache.ambari.logsearch.solr.SolrConstants.CommonLogConstants.ID;
+import static org.apache.ambari.logsearch.solr.SolrConstants.CommonLogConstants.SEQUENCE_ID;
+import static org.apache.ambari.logsearch.solr.SolrConstants.ServiceLogConstants.COMPONENT;
+import static org.apache.ambari.logsearch.solr.SolrConstants.ServiceLogConstants.HOST;
+import static org.apache.ambari.logsearch.solr.SolrConstants.ServiceLogConstants.KEY_LOG_MESSAGE;
+import static org.apache.ambari.logsearch.solr.SolrConstants.ServiceLogConstants.LEVEL;
+import static org.apache.ambari.logsearch.solr.SolrConstants.ServiceLogConstants.LOGTIME;
+
+@Named
 public class ServiceLogsManager extends ManagerBase<SolrServiceLogData, ServiceLogResponse> {
-
   private static final Logger logger = Logger.getLogger(ServiceLogsManager.class);
 
-  private static List<String> cancelByDate = new CopyOnWriteArrayList<String>();
-
-  private static Map<String, String> mapUniqueId = new ConcurrentHashMap<String, String>();
-
-  private enum CONDITION {
-    OR, AND
-  }
+  private static final String SERVICE_LOG_TEMPLATE = "service_log_txt.ftl";
 
   @Inject
   private ServiceLogsSolrDao serviceLogsSolrDao;
   @Inject
   private GraphDataGenerator graphDataGenerator;
   @Inject
-  private SolrServiceLogPropsConfig solrServiceLogPropsConfig;
-
-  public ServiceLogResponse searchLogs(ServiceLogSearchCriteria searchCriteria) {
-    String keyword = searchCriteria.getKeyword();
-    String logId = searchCriteria.getSourceLogId();
-    Boolean isLastPage = searchCriteria.isLastPage();
+  private ConversionService conversionService;
+  @Inject
+  private Configuration freemarkerConfiguration;
 
+  public ServiceLogResponse searchLogs(ServiceLogRequest request) {
+    String event = "/service/logs";
+    String keyword = request.getKeyWord();
+    Boolean isLastPage = request.isLastPage();
+    SimpleQuery solrQuery = conversionService.convert(request, SimpleQuery.class);
     if (!StringUtils.isBlank(keyword)) {
       try {
-        return (ServiceLogResponse) getPageByKeyword(searchCriteria);
+        return (ServiceLogResponse) getPageByKeyword(request, event);
       } catch (SolrException | SolrServerException e) {
         logger.error("Error while getting keyword=" + keyword, e);
-        throw RESTErrorUtil.createRESTException(MessageEnums.SOLR_ERROR
-            .getMessage().getMessage(), MessageEnums.ERROR_SYSTEM);
-      }
-    } else if (!StringUtils.isBlank(logId)) {
-      try {
-        return (ServiceLogResponse) getPageByLogId(searchCriteria);
-      } catch (SolrException e) {
-        logger.error("Error while getting keyword=" + keyword, e);
-        throw RESTErrorUtil.createRESTException(MessageEnums.SOLR_ERROR
-            .getMessage().getMessage(), MessageEnums.ERROR_SYSTEM);
+        throw RESTErrorUtil.createRESTException(MessageEnums.SOLR_ERROR.getMessage().getMessage(), MessageEnums.ERROR_SYSTEM);
       }
     } else if (isLastPage) {
-      SolrQuery lastPageQuery = queryGenerator.commonServiceFilterQuery(searchCriteria);
-      ServiceLogResponse logResponse = getLastPage(searchCriteria,LogSearchConstants.LOGTIME,serviceLogsSolrDao,lastPageQuery);
+      ServiceLogResponse logResponse = getLastPage(serviceLogsSolrDao, solrQuery, event);
       if(logResponse == null){
         logResponse = new ServiceLogResponse();
       }
       return logResponse;
     } else {
-      SolrQuery solrQuery = queryGenerator
-          .commonServiceFilterQuery(searchCriteria);
-
-      solrQuery.setParam("event", "/service/logs");
-
-      return getLogAsPaginationProvided(solrQuery,
-          serviceLogsSolrDao);
+      return getLogAsPaginationProvided(solrQuery, serviceLogsSolrDao, event);
     }
   }
 
   public GroupListResponse getHosts() {
-    return getFields(LogSearchConstants.SOLR_HOST, SolrHostLogData.class);
-  }
-  
-  private <T extends LogData> GroupListResponse getFields(String field, Class<T> clazz) {
-
-    SolrQuery solrQuery = new SolrQuery();
-    GroupListResponse collection = new GroupListResponse();
-    SolrUtil.setMainQuery(solrQuery, null);
-    SolrUtil.setFacetField(solrQuery,
-        field);
-    SolrUtil.setFacetSort(solrQuery, LogSearchConstants.FACET_INDEX);
-    try {
-      QueryResponse response = serviceLogsSolrDao.process(solrQuery);
-      if(response == null){
-        return collection;
-      }
-      FacetField facetField = response
-        .getFacetField(field);
-      if (facetField == null){
-        return collection;
-      }
-      List<Count> fieldList = facetField.getValues();
-      if (fieldList == null){
-        return collection;
-      }
-      SolrDocumentList docList = response.getResults();
-      if(docList == null){
-        return collection;
-      }
-      List<LogData> groupList = getLogDataListByFieldType(clazz, response, fieldList);
-
-      collection.setGroupList(groupList);
-      if(!docList.isEmpty()){
-        collection.setStartIndex((int) docList.getStart());
-        collection.setTotalCount(docList.getNumFound());
-      }
-      return collection;
-    } catch (IOException | SolrServerException | SolrException e) {
-      logger.error(e);
-      throw RESTErrorUtil.createRESTException(MessageEnums.SOLR_ERROR
-          .getMessage().getMessage(), MessageEnums.ERROR_SYSTEM);
-    }
-
+    return getFields(HOST, SolrHostLogData.class);
   }
 
   public GroupListResponse getComponents() {
-    return getFields(LogSearchConstants.SOLR_COMPONENT, SolrComponentTypeLogData.class);
-  }
-
-  public GraphDataListResponse getAggregatedInfo(CommonServiceLogSearchCriteria searchCriteria) {
-    SolrQuery solrQuery = queryGenerator.commonServiceFilterQuery(searchCriteria);
-    String hierarchy = "host,type,level";
-    GraphDataListResponse graphInfo = new GraphDataListResponse();
-    try {
-      SolrUtil.setMainQuery(solrQuery, null);
-      SolrUtil.setFacetPivot(solrQuery, 1, hierarchy);
-      QueryResponse response = serviceLogsSolrDao.process(solrQuery);
-      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;
-    } catch (SolrException | SolrServerException | IOException e) {
-      logger.error("Error during solrQuery=" + solrQuery, e);
-      throw RESTErrorUtil.createRESTException(MessageEnums.SOLR_ERROR
-          .getMessage().getMessage(), MessageEnums.ERROR_SYSTEM);
-    }
+    return getFields(COMPONENT, SolrComponentTypeLogData.class);
   }
 
-  public 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 GraphDataListResponse getAggregatedInfo(ServiceLogAggregatedInfoRequest request) {
+    SimpleQuery solrDataQuery = new BaseServiceLogRequestQueryConverter().convert(request);
+    SolrQuery solrQuery = new DefaultQueryParser().doConstructSolrQuery(solrDataQuery);
+    String hierarchy = String.format("%s,%s,%s", HOST, COMPONENT, LEVEL);
+    solrQuery.setQuery("*:*");
+    SolrUtil.setFacetPivot(solrQuery, 1, hierarchy);
+    QueryResponse response = serviceLogsSolrDao.process(solrQuery);
+    return graphDataGenerator.generateSimpleGraphResponse(response, hierarchy);
   }
 
-  public CountDataListResponse getFieldCount(String field){
-    CountDataListResponse collection = new CountDataListResponse();
-    List<CountData> vCounts = new ArrayList<>();
-    SolrQuery solrQuery = new SolrQuery();
-    SolrUtil.setMainQuery(solrQuery, null);
-    if(field == null){
-      return collection;
-    }
-    SolrUtil.setFacetField(solrQuery, field);
-    try {
-      QueryResponse response = serviceLogsSolrDao.process(solrQuery);
-      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);
-        }
-      }
-
-    } catch (SolrException | SolrServerException | IOException e) {
-      logger.error("Error during solrQuery=" + solrQuery, e);
-      throw RESTErrorUtil.createRESTException(MessageEnums.SOLR_ERROR
-          .getMessage().getMessage(), MessageEnums.ERROR_SYSTEM);
-    }
-
-    collection.setvCounts(vCounts);
-    return collection;
-  }
-  
-  public CountDataListResponse getLogLevelCount() {
-    return getFieldCount(LogSearchConstants.SOLR_LEVEL);
+  public CountDataListResponse getFieldCount(String field) {
+    return graphDataGenerator.generateCountResponseByField(serviceLogsSolrDao.process(conversionService.convert(field, SimpleFacetQuery.class)), field);
   }
 
   public CountDataListResponse getComponentsCount() {
-    return getFieldCount(LogSearchConstants.SOLR_COMPONENT);
+    return getFieldCount(COMPONENT);
   }
 
   public CountDataListResponse getHostsCount() {
-    return getFieldCount(LogSearchConstants.SOLR_HOST);
+    return getFieldCount(HOST);
   }
 
-  public List<NodeData> buidTreeData(List<PivotField> pivotFields,
-                                     List<PivotField> pivotFieldHost, SolrQuery query,
-                                     String firstPriority, String secondPriority) {
-    List<NodeData> extensionTree = new ArrayList<>();
-    String hostQuery = null;
-    if (pivotFields != null) {
-      // For Host
-      for (PivotField pivotHost : pivotFields) {
-        if (pivotHost != null) {
-          NodeData hostNode = new NodeData();
-          String name = (pivotHost.getValue() == null ? "" : ""+ pivotHost.getValue());
-          String value = "" + pivotHost.getCount();
-          if(!StringUtils.isBlank(name)){
-            hostNode.setName(name);
-          }
-          if(!StringUtils.isBlank(value)){
-            hostNode.setValue(value);
-          }
-          if(!StringUtils.isBlank(firstPriority)){
-            hostNode.setType(firstPriority);
-          }
-
-          hostNode.setParent(true);
-          hostNode.setRoot(true);
-          PivotField hostPivot = null;
-          for (PivotField searchHost : pivotFieldHost) {
-            if (!StringUtils.isBlank(hostNode.getName())
-                && hostNode.getName().equals(searchHost.getValue())) {
-              hostPivot = searchHost;
-              break;
-            }
-          }
-          List<PivotField> pivotLevelHost = 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);
-          }
-
-          query.addFilterQuery(hostQuery);
-          List<PivotField> pivotComponents = pivotHost.getPivot();
-          // For Components
-          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.isBlank(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;
-  }
-
-  public NodeListResponse getTreeExtension(ServiceLogSearchCriteria searchCriteria) {
-    SolrQuery solrQuery = queryGenerator.commonServiceFilterQuery(searchCriteria);
-    solrQuery.setParam("event", "/getTreeExtension");
-
-    if (searchCriteria.getSortBy() == null) {
-      searchCriteria.setSortBy(LogSearchConstants.SOLR_HOST);
-      searchCriteria.setSortType(SolrQuery.ORDER.asc.toString());
-    }
-    queryGenerator.setFilterFacetSort(solrQuery, searchCriteria);
-    String hostName = ""
-      + ((searchCriteria.getParamValue("hostName") == null) ? ""
-      : searchCriteria.getParamValue("hostName"));
+  public NodeListResponse getTreeExtension(ServiceLogHostComponentRequest request) {
+    SimpleFacetQuery facetQuery = conversionService.convert(request, SimpleFacetQuery.class);
+    SolrQuery solrQuery = new DefaultQueryParser().doConstructSolrQuery(facetQuery);
+    String hostName = request.getHostName() == null ? "" : request.getHostName();
     if (!StringUtils.isBlank(hostName)){
-      solrQuery.addFilterQuery(LogSearchConstants.SOLR_HOST + ":*"
-        + hostName + "*");
+      solrQuery.addFilterQuery(String.format("%s:*%s*", HOST, hostName));
     }
-    String firstHirarchy = "host,type,level";
-    String secondHirarchy = "host,level";
-    NodeListResponse list = new NodeListResponse();
-    try {
-
-      SolrUtil.setFacetPivot(solrQuery, 1, firstHirarchy,
-        secondHirarchy);
-
-      QueryResponse response = serviceLogsSolrDao.process(solrQuery);
-      List<List<PivotField>> listFirstHirarchicalPivotFields = new ArrayList<List<PivotField>>();
-      NamedList<List<PivotField>> firstNamedList = response
-        .getFacetPivot();
-      if (firstNamedList != null) {
-        listFirstHirarchicalPivotFields = firstNamedList
-          .getAll(firstHirarchy);
-      }
-      List<List<PivotField>> listSecondHirarchicalPivotFields = new ArrayList<List<PivotField>>();
-      NamedList<List<PivotField>> secondNamedList = response
-        .getFacetPivot();
-      if (secondNamedList != null) {
-        listSecondHirarchicalPivotFields = secondNamedList
-          .getAll(secondHirarchy);
-      }
-      List<PivotField> firstHirarchicalPivotFields = new ArrayList<PivotField>();
-      List<PivotField> secondHirarchicalPivotFields = new ArrayList<PivotField>();
-      if (!listFirstHirarchicalPivotFields.isEmpty()) {
-        firstHirarchicalPivotFields = listFirstHirarchicalPivotFields
-          .get(0);
-      }
-      if (!listSecondHirarchicalPivotFields.isEmpty()) {
-        secondHirarchicalPivotFields = listSecondHirarchicalPivotFields
-          .get(0);
-      }
-      List<NodeData> dataList = buidTreeData(firstHirarchicalPivotFields,
-        secondHirarchicalPivotFields, solrQuery,
-        LogSearchConstants.HOST, LogSearchConstants.COMPONENT);
-
-      list.setvNodeList(dataList);
-    } catch (SolrException | SolrServerException | IOException e) {
-      logger.error("Error during solrQuery=" + solrQuery, e);
-      throw RESTErrorUtil.createRESTException(MessageEnums.SOLR_ERROR
-          .getMessage().getMessage(), MessageEnums.ERROR_SYSTEM);
-    }
-
-    return list;
+    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,
+      LogSearchConstants.HOST, LogSearchConstants.COMPONENT);
   }
 
-  public NodeListResponse getHostListByComponent(ServiceLogSearchCriteria searchCriteria) {
-    SolrQuery solrQuery = queryGenerator.commonServiceFilterQuery(searchCriteria);
-    solrQuery.setParam("event", "/service/hosts/components");
+  public NodeListResponse getHostListByComponent(ServiceLogComponentHostRequest request) {
+    SimpleFacetQuery facetQuery = conversionService.convert(request, SimpleFacetQuery.class);
+    SolrQuery solrQuery = new DefaultQueryParser().doConstructSolrQuery(facetQuery);
+    solrQuery.setFacetSort(request.getSortBy() == null ? HOST: request.getSortBy());
 
     NodeListResponse list = new NodeListResponse();
-    if (searchCriteria.getSortBy() == null) {
-      searchCriteria.setSortBy(LogSearchConstants.SOLR_HOST);
-      searchCriteria.setSortType(SolrQuery.ORDER.asc.toString());
-    }
-    queryGenerator.setFilterFacetSort(solrQuery, searchCriteria);
-    String componentName = ""
-      + ((searchCriteria.getParamValue("componentName") == null) ? ""
-      : searchCriteria.getParamValue("componentName"));
+    String componentName = request.getComponentName() == null ? "" : request.getComponentName();
     if (!StringUtils.isBlank(componentName)){
-      solrQuery.addFilterQuery(LogSearchConstants.SOLR_COMPONENT + ":"
+      solrQuery.addFilterQuery(COMPONENT + ":"
         + componentName);
-    } else {
-      return list;
-    }
-
-    String firstHirarchy = "type,host,level";
-    String secondHirarchy = "type,level";
-
-    try {
-      SolrUtil.setFacetPivot(solrQuery, 1, firstHirarchy,
-        secondHirarchy);
-      QueryResponse response = serviceLogsSolrDao.process(solrQuery);
-      List<List<PivotField>> firstHirarchicalPivotFields = null;
-      List<List<PivotField>> secondHirarchicalPivotFields = null;
-      NamedList<List<PivotField>> firstNamedList = response
-        .getFacetPivot();
-      if (firstNamedList != null) {
-        firstHirarchicalPivotFields = firstNamedList
-          .getAll(firstHirarchy);
-        secondHirarchicalPivotFields = firstNamedList
-          .getAll(secondHirarchy);
-      }
-
-      if (firstHirarchicalPivotFields == null
-        || secondHirarchicalPivotFields == null) {
-        return list;
-      }
-
-      List<NodeData> dataList = buidTreeData(
-        firstHirarchicalPivotFields.get(0),
-        secondHirarchicalPivotFields.get(0), solrQuery,
+      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,
         LogSearchConstants.COMPONENT, LogSearchConstants.HOST);
-      if(dataList == null){
-        return list;
-      }
-
-      list.setvNodeList(dataList);
+    } else {
       return list;
-    } catch (SolrException | SolrServerException | IOException e) {
-      logger.error("Error during solrQuery=" + solrQuery, e);
-      throw RESTErrorUtil.createRESTException(MessageEnums.SOLR_ERROR
-          .getMessage().getMessage(), MessageEnums.ERROR_SYSTEM);
     }
   }
 
-  public NameValueDataListResponse getLogsLevelCount(ServiceLogSearchCriteria sc) {
-    NameValueDataListResponse nameValueList = new NameValueDataListResponse();
-    SolrQuery query = queryGenerator.commonServiceFilterQuery(sc);
-    query.setParam("event", "/service/logs/levels/counts/namevalues");
-    List<NameValueData> logsCounts = getLogLevelFacets(query);
-    nameValueList.setvNameValues(logsCounts);
-
-    return nameValueList;
+  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);
   }
 
-  public List<NameValueData> getLogLevelFacets(SolrQuery query) {
-    String defalutValue = "0";
-    HashMap<String, String> map = new HashMap<String, String>();
-    List<NameValueData> logsCounts = new ArrayList<>();
-    try {
-      SolrUtil.setFacetField(query, LogSearchConstants.SOLR_LEVEL);
-      List<Count> logLevelCounts = getFacetCounts(query,
-          LogSearchConstants.SOLR_LEVEL);
-      if (logLevelCounts == null) {
-        return logsCounts;
-      }
-      for (Count count : logLevelCounts) {
-        map.put(count.getName().toUpperCase(), "" + count.getCount());
-      }
-      for (String level : LogSearchConstants.SUPPORTED_LOG_LEVEL) {
-        NameValueData nameValue = new NameValueData();
-        String value = map.get(level);
-        if (StringUtils.isBlank(value)) {
-          value = defalutValue;
-        }
-        nameValue.setName(level);
-        nameValue.setValue(value);
-        logsCounts.add(nameValue);
-      }
-    } catch (SolrException | SolrServerException | IOException e) {
-      logger.error("Error during solrQuery=" + query, e);
-    }
-    return logsCounts;
+  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);
   }
 
-  // Get Facet Count According to FacetFeild
-  public List<Count> getFacetCounts(SolrQuery solrQuery, String facetField)
-    throws SolrServerException, IOException, SolrException {
-    List<Count> list = new ArrayList<FacetField.Count>();
-
-    QueryResponse response = serviceLogsSolrDao.process(solrQuery);
-    if(response == null){
-      return list;
-    }
-
-    FacetField field = response.getFacetField(facetField);
-    if (field == null) {
-      return list;
-    }
-    list = field.getValues();
-
-
-    return list;
-  }
 
-  public LogListResponse getPageByKeyword(ServiceLogSearchCriteria searchCriteria)
+  public LogListResponse getPageByKeyword(ServiceLogRequest request, String event)
     throws SolrServerException {
     String defaultChoice = "0";
-
-    String key = (String) searchCriteria.getKeyword();
-    if(StringUtils.isBlank(key)){
-      throw RESTErrorUtil.createRESTException("Keyword was not given",
-          MessageEnums.DATA_NOT_FOUND);
+    String key = request.getKeyWord();
+    if (StringUtils.isBlank(key)) {
+      throw RESTErrorUtil.createRESTException("Keyword was not given", MessageEnums.DATA_NOT_FOUND);
     }
-
     String keyword = SolrUtil.escapeForStandardTokenizer(key);
 
-    if(keyword.startsWith("\"") && keyword.endsWith("\"")){
+    if (keyword.startsWith("\"") && keyword.endsWith("\"")) {
       keyword = keyword.substring(1);
-      keyword = keyword.substring(0, keyword.length()-1);
+      keyword = keyword.substring(0, keyword.length() - 1);
     }
-    keyword = "*" + keyword + "*";
-
-
-    String keyType = (String) searchCriteria.getKeywordType();
-    QueryResponse queryResponse = null;
-
-    if (!defaultChoice.equals(keyType)) {
-      try {
-        int currentPageNumber = searchCriteria.getPage();
-        int maxRows = searchCriteria.getMaxRows();
-        String nextPageLogID = "";
-
-        int lastLogIndexNumber = ((currentPageNumber + 1)
-          * maxRows);
-        String nextPageLogTime = "";
-
-
-        // Next Page Start Time Calculation
-        SolrQuery nextPageLogTimeQuery = queryGenerator
-          .commonServiceFilterQuery(searchCriteria);
-        nextPageLogTimeQuery.remove("start");
-        nextPageLogTimeQuery.remove("rows");
-        nextPageLogTimeQuery.setStart(lastLogIndexNumber);
-        nextPageLogTimeQuery.setRows(1);
-
-        queryResponse = serviceLogsSolrDao.process(
-            nextPageLogTimeQuery);
-        if(queryResponse == null){
-          throw RESTErrorUtil.createRESTException("The keyword "+"\""+key+"\""+" was not found",
-              MessageEnums.ERROR_SYSTEM);
-        }
-
-        SolrDocumentList docList = queryResponse.getResults();
-        if(docList ==null){
-          throw RESTErrorUtil.createRESTException("The keyword "+"\""+key+"\""+" was not found",
-              MessageEnums.ERROR_SYSTEM);
-        }
-
-        SolrDocument solrDoc = docList.get(0);
-
-        Date logDate = (Date) solrDoc.get(LogSearchConstants.LOGTIME);
-        if(logDate == null){
-          throw RESTErrorUtil.createRESTException("The keyword "+"\""+key+"\""+" was not found",
-              MessageEnums.ERROR_SYSTEM);
-        }
-        nextPageLogTime = DateUtil
-          .convertDateWithMillisecondsToSolrDate(logDate);
-        nextPageLogID = ""
-          + solrDoc.get(LogSearchConstants.ID);
-
-        if (StringUtils.isBlank(nextPageLogID)){
-          nextPageLogID = "0";
-        }
-
-        String filterQueryListIds = "";
-        // Remove the same Time Ids
-        SolrQuery listRemoveIds = queryGenerator
-          .commonServiceFilterQuery(searchCriteria);
-        listRemoveIds.remove("start");
-        listRemoveIds.remove("rows");
-        queryGenerator.setSingleIncludeFilter(listRemoveIds,
-          LogSearchConstants.LOGTIME, "\"" + nextPageLogTime + "\"");
-        queryGenerator.setSingleExcludeFilter(listRemoveIds,
-          LogSearchConstants.ID, nextPageLogID);
-        SolrUtil.setFl(listRemoveIds, LogSearchConstants.ID);
-        queryResponse = serviceLogsSolrDao.process(
-            listRemoveIds);
-        if(queryResponse == null){
-          throw RESTErrorUtil.createRESTException("The keyword "+"\""+key+"\""+" was not found",
-              MessageEnums.ERROR_SYSTEM);
-        }
-
-        SolrDocumentList docListIds = queryResponse.getResults();
-        if(docListIds ==null){
-          throw RESTErrorUtil.createRESTException("The keyword "+"\""+key+"\""+" was not found",
-              MessageEnums.ERROR_SYSTEM);
-        }
-        boolean isFirst = true;
-        for (SolrDocument solrDocId :  docListIds ) {
-          String id = "" + solrDocId.get(LogSearchConstants.ID);
-          if (isFirst) {
-            filterQueryListIds += LogSearchConstants.MINUS_OPERATOR + LogSearchConstants.ID + ":" + id;
-            isFirst = false;
-          } else {
-            filterQueryListIds += " "+CONDITION.AND+" " + LogSearchConstants.MINUS_OPERATOR + LogSearchConstants.ID + ":" + id;
-          }
-        }
-
-        // Keyword Sequence Number Calculation
-        String endTime = searchCriteria.getTo();
-        String startTime = searchCriteria.getFrom();
-        SolrQuery logTimeThroughRangeQuery = queryGenerator
-          .commonServiceFilterQuery(searchCriteria);
-        logTimeThroughRangeQuery.remove("start");
-        logTimeThroughRangeQuery.remove("rows");
-        logTimeThroughRangeQuery.setRows(1);
-        if (!StringUtils.isBlank(filterQueryListIds)){
-          logTimeThroughRangeQuery.setFilterQueries(filterQueryListIds);
-        }
-
-        String sortByType = searchCriteria.getSortType();
-
-        if (!StringUtils.isBlank(sortByType) && sortByType
-          .equalsIgnoreCase(LogSearchConstants.ASCENDING_ORDER)) {
-
-          queryGenerator.setSingleRangeFilter(logTimeThroughRangeQuery,
-            LogSearchConstants.LOGTIME, nextPageLogTime,
-            endTime);
-          logTimeThroughRangeQuery.set(LogSearchConstants.SORT,
-            LogSearchConstants.LOGTIME + " "
-              + LogSearchConstants.ASCENDING_ORDER);
-
-        } else {
-
-          queryGenerator.setSingleRangeFilter(logTimeThroughRangeQuery,
-            LogSearchConstants.LOGTIME, startTime,
-            nextPageLogTime);
-          logTimeThroughRangeQuery.set(LogSearchConstants.SORT,
-            LogSearchConstants.LOGTIME + " "
-              + LogSearchConstants.DESCENDING_ORDER);
-        }
-        queryGenerator.setSingleIncludeFilter(logTimeThroughRangeQuery,
-          LogSearchConstants.SOLR_KEY_LOG_MESSAGE, keyword);
-
-
-        queryResponse = serviceLogsSolrDao.process(
-            logTimeThroughRangeQuery);
-        if(queryResponse == null){
-          throw RESTErrorUtil.createRESTException("The keyword "+"\""+key+"\""+" was not found",
-              MessageEnums.ERROR_SYSTEM);
-        }
-
-        SolrDocumentList documentList = queryResponse.getResults();
-        if(documentList ==null){
-          throw RESTErrorUtil.createRESTException("The keyword "+"\""+key+"\""+" was not found",
-              MessageEnums.ERROR_SYSTEM);
-        }
-
-        SolrDocument solrDocument = new SolrDocument();
-        if (!documentList.isEmpty()){
-          solrDocument = documentList.get(0);
-        }
-
-        Date keywordLogDate = (Date) solrDocument.get(LogSearchConstants.LOGTIME);
-        if(keywordLogDate == null){
-          throw RESTErrorUtil.createRESTException("The keyword "+"\""+key+"\""+" was not found",
-              MessageEnums.ERROR_SYSTEM);
-        }
-        String originalKeywordDate = DateUtil
-          .convertDateWithMillisecondsToSolrDate(keywordLogDate);
-        String keywordId = "" + solrDocument.get(LogSearchConstants.ID);
-
-        // Getting Range Count from StartTime To Keyword Log Time
-        SolrQuery rangeLogQuery = nextPageLogTimeQuery.getCopy();
-        rangeLogQuery.remove("start");
-        rangeLogQuery.remove("rows");
-
-        if (!StringUtils.isBlank(sortByType) && sortByType
-          .equalsIgnoreCase(LogSearchConstants.ASCENDING_ORDER)) {
-          keywordLogDate = DateUtils.addMilliseconds(keywordLogDate, 1);
-          String keywordDateTime = DateUtil
-            .convertDateWithMillisecondsToSolrDate(keywordLogDate);
-          queryGenerator.setSingleRangeFilter(rangeLogQuery,
-            LogSearchConstants.LOGTIME, startTime,
-            keywordDateTime);
-        } else {
-          keywordLogDate = DateUtils.addMilliseconds(keywordLogDate, -1);
-          String keywordDateTime = DateUtil
-            .convertDateWithMillisecondsToSolrDate(keywordLogDate);
-          queryGenerator.setSingleRangeFilter(rangeLogQuery,
-            LogSearchConstants.LOGTIME, keywordDateTime,
-            endTime);
-        }
 
+    boolean isNext = !defaultChoice.equals(request.getKeywordType()); // 1 is next, 0 is previous
+    return getPageForKeywordByType(request, keyword, isNext, event);
+  }
 
-        long countNumberLogs = countQuery(rangeLogQuery,serviceLogsSolrDao) - 1;
+  private LogListResponse getPageForKeywordByType(ServiceLogRequest request, String keyword, boolean isNext, String event) {
+    String fromDate = request.getFrom(); // store start & end dates
+    String toDate = request.getTo();
+    boolean timeAscending = LogSearchConstants.ASCENDING_ORDER.equals(request.getSortType());
 
+    int currentPageNumber = Integer.parseInt(request.getPage());
+    int maxRows = Integer.parseInt(request.getPageSize());
+    Date logDate = getDocDateFromNextOrLastPage(request, keyword, isNext, currentPageNumber, maxRows);
+    if (logDate == null) {
+      throw RESTErrorUtil.createRESTException("The keyword " + "\"" + keyword + "\"" + " was not found", MessageEnums.ERROR_SYSTEM);
+    }
 
-        //Adding numbers on
+    String nextOrPreviousPageDate = DateUtil.convertDateWithMillisecondsToSolrDate(logDate);
+    SolrServiceLogData firstKeywordLog = getNextHitForKeyword(request, keyword, isNext, event, timeAscending, nextOrPreviousPageDate);
 
+    long keywordSeqNum = firstKeywordLog.getSeqNum();
+    String keywordLogtime = DateUtil.convertDateWithMillisecondsToSolrDate(firstKeywordLog.getLogTime());
 
-        try {
-          SolrQuery sameIdQuery = queryGenerator
-            .commonServiceFilterQuery(searchCriteria);
-          queryGenerator.setSingleIncludeFilter(sameIdQuery,
-            LogSearchConstants.LOGTIME, "\"" + originalKeywordDate + "\"");
-          SolrUtil.setFl(sameIdQuery, LogSearchConstants.ID);
-          SolrDocumentList sameQueryDocList = serviceLogsSolrDao.process(sameIdQuery)
-            .getResults();
-          for (SolrDocument solrDocumenent : sameQueryDocList) {
-            String id = (String) solrDocumenent
-              .getFieldValue(LogSearchConstants.ID);
-            countNumberLogs++;
-           
-            if (StringUtils.isBlank(id) && id.equals(keywordId)){
-              break;
-            }
-          }
-        } catch (SolrException | SolrServerException | IOException e) {
-          logger.error(e);
-        }
+    long numberOfDateDuplicates = countNumberOfDuplicates(request, isNext, keywordSeqNum, keywordLogtime);
 
-        int start = (int) ((countNumberLogs / maxRows) * maxRows);
-        SolrQuery logIdQuery = nextPageLogTimeQuery.getCopy();
-        rangeLogQuery.remove("start");
-        rangeLogQuery.remove("rows");
-        logIdQuery.setStart(start);
-        logIdQuery.setRows(searchCriteria.getMaxRows());
-        return getLogAsPaginationProvided(logIdQuery, serviceLogsSolrDao);
+    long numberOfLogsUntilFound = getNumberOfLogsUntilFound(request, fromDate, toDate, timeAscending, keywordLogtime, numberOfDateDuplicates);
+    int start = (int) ((numberOfLogsUntilFound / maxRows));
 
-      } catch (Exception e) {
-        //do nothing
-      }
+    request.setFrom(fromDate);
+    request.setTo(toDate);
+    request.setPage(String.valueOf(start));
+    SolrQuery keywordNextPageQuery = new DefaultQueryParser().doConstructSolrQuery(conversionService.convert(request, SimpleQuery.class));
+    return getLogAsPaginationProvided(keywordNextPageQuery, serviceLogsSolrDao, event);
+  }
 
+  private Long getNumberOfLogsUntilFound(ServiceLogRequest request, String fromDate, String toDate, boolean timeAscending,
+                                         String keywordLogtime, long numberOfDateDuplicates) {
+    if (!timeAscending) {
+      request.setTo(toDate);
+      request.setFrom(keywordLogtime);
     } else {
-      try {
-        int currentPageNumber = searchCriteria.getPage();
-        int maxRows = searchCriteria.getMaxRows();
-
-        if (currentPageNumber == 0) {
-          throw RESTErrorUtil.createRESTException("This is first Page Not",
-            MessageEnums.DATA_NOT_FOUND);
-        }
-
-        int firstLogCurrentPage = (currentPageNumber * maxRows);
-        String lastLogsLogTime = "";
-
-        // Next Page Start Time Calculation
-        SolrQuery lastLogTime = queryGenerator
-          .commonServiceFilterQuery(searchCriteria);
-        lastLogTime.remove("start");
-        lastLogTime.remove("rows");
-
-        lastLogTime.setStart(firstLogCurrentPage);
-        lastLogTime.setRows(1);
-
-        queryResponse = serviceLogsSolrDao.process(
-            lastLogTime);
-        if(queryResponse == null){
-          throw RESTErrorUtil.createRESTException("The keyword "+"\""+key+"\""+" was not found",
-              MessageEnums.ERROR_SYSTEM);
-        }
-
-        SolrDocumentList docList = queryResponse.getResults();
-        if(docList ==null){
-          throw RESTErrorUtil.createRESTException("The keyword "+"\""+key+"\""+" was not found",
-              MessageEnums.ERROR_SYSTEM);
-        }
-        SolrDocument solrDoc = docList.get(0);
-
-        Date logDate = (Date) solrDoc.get(LogSearchConstants.LOGTIME);
-        String sortByType = searchCriteria.getSortType();
-        lastLogsLogTime = DateUtil
-          .convertDateWithMillisecondsToSolrDate(logDate);
-        String lastLogsLogId = ""
-          + solrDoc.get(LogSearchConstants.ID);
-
-
-        String filterQueryListIds = "";
-        // Remove the same Time Ids
-        SolrQuery listRemoveIds = queryGenerator
-          .commonServiceFilterQuery(searchCriteria);
-        listRemoveIds.remove("start");
-        listRemoveIds.remove("rows");
-        queryGenerator.setSingleIncludeFilter(listRemoveIds,
-          LogSearchConstants.LOGTIME, "\"" + lastLogsLogTime + "\"");
-        queryGenerator.setSingleExcludeFilter(listRemoveIds,
-          LogSearchConstants.ID, lastLogsLogId);
-        SolrUtil.setFl(listRemoveIds, LogSearchConstants.ID);
-        queryResponse = serviceLogsSolrDao.process(
-            lastLogTime);
-        if(queryResponse == null){
-          throw RESTErrorUtil.createRESTException("The keyword "+"\""+key+"\""+" was not found",
-              MessageEnums.ERROR_SYSTEM);
-        }
-
-        SolrDocumentList docListIds = queryResponse.getResults();
-        if(docListIds == null){
-          throw RESTErrorUtil.createRESTException("The keyword "+"\""+key+"\""+" was not found",
-              MessageEnums.ERROR_SYSTEM);
-        }
-        boolean isFirst = true;
-        for (SolrDocument solrDocId : docListIds) {
-          if (solrDocId != null) {
-            String id = "" + solrDocId.get(LogSearchConstants.ID);
-            if (isFirst) {
-              filterQueryListIds += LogSearchConstants.MINUS_OPERATOR + LogSearchConstants.ID + ":" + id;
-              isFirst = false;
-            } else {
-              filterQueryListIds += " "+CONDITION.AND+" " + LogSearchConstants.MINUS_OPERATOR + LogSearchConstants.ID + ":"
-                  + id;
-            }
-          }
-        }
-
-
-        // Keyword LogTime Calculation
-        String endTime = (String) searchCriteria.getTo();
-        String startTime = searchCriteria.getFrom();
-        SolrQuery logTimeThroughRangeQuery = queryGenerator
-          .commonServiceFilterQuery(searchCriteria);
-        logTimeThroughRangeQuery.remove("start");
-        logTimeThroughRangeQuery.remove("rows");
-        logTimeThroughRangeQuery.setRows(1);
-        queryGenerator.setSingleExcludeFilter(logTimeThroughRangeQuery,
-          LogSearchConstants.ID, lastLogsLogId);
-        if (!StringUtils.isBlank(filterQueryListIds)){
-          logTimeThroughRangeQuery.setFilterQueries(filterQueryListIds);
-        }
-
-        if (!StringUtils.isBlank(sortByType) && sortByType
-          .equalsIgnoreCase(LogSearchConstants.ASCENDING_ORDER)) {
-
-          logTimeThroughRangeQuery.remove(LogSearchConstants.SORT);
-          logTimeThroughRangeQuery.set(LogSearchConstants.SORT,
-            LogSearchConstants.LOGTIME + " "
-              + LogSearchConstants.DESCENDING_ORDER);
-
-
-          queryGenerator.setSingleRangeFilter(
-            logTimeThroughRangeQuery,
-            LogSearchConstants.LOGTIME, startTime,
-            lastLogsLogTime);
-
-        } else {
-
-          logTimeThroughRangeQuery.remove(LogSearchConstants.SORT);
-          logTimeThroughRangeQuery.set(LogSearchConstants.SORT,
-            LogSearchConstants.LOGTIME + " "
-              + LogSearchConstants.ASCENDING_ORDER);
-
-
-          queryGenerator.setSingleRangeFilter(logTimeThroughRangeQuery,
-            LogSearchConstants.LOGTIME, lastLogsLogTime, endTime);
-        }
-        queryGenerator.setSingleIncludeFilter(logTimeThroughRangeQuery,
-          LogSearchConstants.SOLR_KEY_LOG_MESSAGE, keyword);
-
-
-        queryResponse = serviceLogsSolrDao.process(
-            logTimeThroughRangeQuery);
-        if(queryResponse == null){
-          throw RESTErrorUtil.createRESTException("The keyword "+"\""+key+"\""+" was not found",
-              MessageEnums.ERROR_SYSTEM);
-        }
-
-        SolrDocumentList documentList = queryResponse.getResults();
-        if(documentList == null){
-          throw RESTErrorUtil.createRESTException("The keyword "+"\""+key+"\""+" was not found",
-              MessageEnums.ERROR_SYSTEM);
-        }
-        SolrDocument solrDocument = new SolrDocument();
-        if (!documentList.isEmpty()){
-          solrDocument = documentList.get(0);
-        }
-
-        Date keywordLogDate = (Date) solrDocument.get(LogSearchConstants.LOGTIME);
-        if(keywordLogDate == null){
-          throw RESTErrorUtil.createRESTException("The keyword "+"\""+key+"\""+" was not found",
-              MessageEnums.ERROR_SYSTEM);
-        }
-        String originalKeywordDate = DateUtil
-          .convertDateWithMillisecondsToSolrDate(keywordLogDate);
-        String keywordId = "" + solrDocument.get(LogSearchConstants.ID);
-
-        // Getting Range Count from StartTime To Keyword Log Time
-        SolrQuery rangeLogQuery = lastLogTime.getCopy();
-        rangeLogQuery.remove("start");
-        rangeLogQuery.remove("rows");
-
-        if (!StringUtils.isBlank(sortByType) && sortByType
-          .equalsIgnoreCase(LogSearchConstants.ASCENDING_ORDER)) {
-       //   keywordLogDate = DateUtil.addMilliSecondsToDate(keywordLogDate, 1);
-          String keywordDateTime = DateUtil
-            .convertDateWithMillisecondsToSolrDate(keywordLogDate);
-          queryGenerator.setSingleRangeFilter(rangeLogQuery,
-            LogSearchConstants.LOGTIME, startTime,
-            keywordDateTime);
-
-
-        } else {
-     //     keywordLogDate = DateUtil.addMilliSecondsToDate(keywordLogDate, -1);
-          String keywordDateTime = DateUtil
-            .convertDateWithMillisecondsToSolrDate(keywordLogDate);
-          queryGenerator.setSingleRangeFilter(rangeLogQuery,
-            LogSearchConstants.LOGTIME, keywordDateTime,
-            endTime);
-        }
-
-
-        long countNumberLogs = countQuery(rangeLogQuery,serviceLogsSolrDao) - 1;
-
-        //Adding numbers on
-        try {
-          SolrQuery sameIdQuery = queryGenerator
-            .commonServiceFilterQuery(searchCriteria);
-          queryGenerator.setSingleIncludeFilter(sameIdQuery,
-            LogSearchConstants.LOGTIME, "\"" + originalKeywordDate + "\"");
-          SolrUtil.setFl(sameIdQuery, LogSearchConstants.ID);
-          SolrDocumentList sameQueryDocList = serviceLogsSolrDao.process(sameIdQuery)
-            .getResults();
-          for (SolrDocument solrDocumenent : sameQueryDocList) {
-            if (solrDocumenent != null) {
-              String id = (String) solrDocumenent
-                  .getFieldValue(LogSearchConstants.ID);
-              countNumberLogs++;
-              if ( StringUtils.isBlank(id) && id.equals(keywordId)) {
-                break;
-              }
-            }
-          }
-        } catch (SolrException | SolrServerException | IOException e) {
-          logger.error(e);
-        }
-        int start = (int) ((countNumberLogs / maxRows) * maxRows);
-
-        SolrQuery logIdQuery = lastLogTime.getCopy();
-        rangeLogQuery.remove("start");
-        rangeLogQuery.remove("rows");
-        logIdQuery.setStart(start);
-        logIdQuery.setRows(searchCriteria.getMaxRows());
-        return getLogAsPaginationProvided(logIdQuery, serviceLogsSolrDao);
-      } catch (Exception e) {
-        //do nothing
-      }
-
+      request.setTo(keywordLogtime);
+      request.setFrom(fromDate);
     }
-    throw RESTErrorUtil.createRESTException("The keyword "+"\""+key+"\""+" was not found",
-        MessageEnums.ERROR_SYSTEM);
+    SimpleQuery rangeQuery = conversionService.convert(request, SimpleQuery.class);
+    return serviceLogsSolrDao.count(rangeQuery) - numberOfDateDuplicates;
   }
 
-  private LogSearchResponse getPageByLogId(ServiceLogSearchCriteria searchCriteria) {
-    LogSearchResponse logResponse = new ServiceLogResponse();
-    String endLogTime = (String) searchCriteria.getParamValue("to");
-    if(StringUtils.isBlank(endLogTime)){
-      return logResponse;
-    }
-    long startIndex = 0l;
-
-    String logId = (String) searchCriteria.getParamValue("sourceLogId");
-    if(StringUtils.isBlank(logId)){
-      return logResponse;
+  private long countNumberOfDuplicates(ServiceLogRequest request, boolean isNext, long keywordSeqNum, String keywordLogtime) {
+    request.setFrom(keywordLogtime);
+    request.setTo(keywordLogtime);
+    SimpleQuery duplicationsQuery = conversionService.convert(request, SimpleQuery.class);
+    if (isNext) {
+      duplicationsQuery.addFilterQuery(new SimpleFilterQuery(new SimpleStringCriteria(String.format("%s:[* TO %d]", SEQUENCE_ID, keywordSeqNum - 1))));
+    } else {
+      duplicationsQuery.addFilterQuery(new SimpleFilterQuery(new SimpleStringCriteria(String.format("%s:[%d TO *]", SEQUENCE_ID, keywordSeqNum + 1))));
     }
-    SolrQuery solrQuery = queryGenerator.commonServiceFilterQuery(searchCriteria);
-
-    String endTimeMinusOneMilli = "";
-    String logTime = "";
-    try {
-
-      SolrQuery logTimeByIdQuery = new SolrQuery();
-      SolrUtil.setMainQuery(logTimeByIdQuery, null);
-      queryGenerator.setSingleIncludeFilter(logTimeByIdQuery,
-          LogSearchConstants.ID, logId);
-      SolrUtil.setRowCount(solrQuery, 1);
-
-      QueryResponse queryResponse = serviceLogsSolrDao
-          .process(logTimeByIdQuery);
-
-      if(queryResponse == null){
-        return new ServiceLogResponse();
-      }
-
-      SolrDocumentList docList = queryResponse.getResults();
-      Date dateOfLogId = null;
-      if (docList != null && !docList.isEmpty()) {
-        SolrDocument dateLogIdDoc = docList.get(0);
-        if(dateLogIdDoc != null){
-          dateOfLogId = (Date) dateLogIdDoc.get(LogSearchConstants.LOGTIME);
-        }
-      }
-
-      if (dateOfLogId != null) {
-        logTime = DateUtil.convertDateWithMillisecondsToSolrDate(dateOfLogId);
-        Date endDate = DateUtils.addMilliseconds(dateOfLogId, 1);
-        endTimeMinusOneMilli = (String) DateUtil
-            .convertDateWithMillisecondsToSolrDate(endDate);
-      }
+    return serviceLogsSolrDao.count(duplicationsQuery);
+  }
 
-    } catch (SolrException | SolrServerException | IOException e) {
-      logger.error(e);
+  private SolrServiceLogData getNextHitForKeyword(ServiceLogRequest request, String keyword, boolean isNext, String event, boolean timeAscending, String nextOrPreviousPageDate) {
+    if (hasNextOrAscOrder(isNext, timeAscending)) {
+      request.setTo(nextOrPreviousPageDate);
+    } else {
+      request.setFrom(nextOrPreviousPageDate);
+    }
+    SimpleQuery keywordNextQuery = conversionService.convert(request, SimpleQuery.class);
+    keywordNextQuery.addFilterQuery(new SimpleFilterQuery(new Criteria(KEY_LOG_MESSAGE).contains(keyword)));
+    keywordNextQuery.setRows(1);
+    SolrQuery kewordNextSolrQuery = new DefaultQueryParser().doConstructSolrQuery(keywordNextQuery);
+    kewordNextSolrQuery.setStart(0);
+    if (hasNextOrAscOrder(isNext, timeAscending)) {
+      kewordNextSolrQuery.setSort(LOGTIME, SolrQuery.ORDER.desc);
+    } else {
+      kewordNextSolrQuery.setSort(LOGTIME, SolrQuery.ORDER.asc);
     }
-
-    try {
-      solrQuery.remove(LogSearchConstants.ID);
-      solrQuery.remove(LogSearchConstants.LOGTIME);
-      queryGenerator.setSingleRangeFilter(solrQuery,
-          LogSearchConstants.LOGTIME, endTimeMinusOneMilli, endLogTime);
-      SolrUtil.setRowCount(solrQuery, 0);
-      startIndex = countQuery(solrQuery,serviceLogsSolrDao);
-    } catch (SolrException | SolrServerException | IOException e) {
-      logger.error(e);
+    kewordNextSolrQuery.addSort(SEQUENCE_ID, SolrQuery.ORDER.desc);
+    QueryResponse  queryResponse = serviceLogsSolrDao.process(kewordNextSolrQuery, event);
+    if (queryResponse == null) {
+      throw RESTErrorUtil.createRESTException("The keyword " + "\"" + keyword + "\"" + " was not found", MessageEnums.ERROR_SYSTEM);
     }
-
-    try {
-      SolrQuery sameIdQuery = queryGenerator.commonServiceFilterQuery(searchCriteria);
-      queryGenerator.setSingleIncludeFilter(sameIdQuery,
-          LogSearchConstants.LOGTIME, "\"" + logTime + "\"");
-      sameIdQuery.set("fl", LogSearchConstants.ID);
-
-      QueryResponse sameIdResponse = serviceLogsSolrDao.process(sameIdQuery);
-      SolrDocumentList docList = sameIdResponse.getResults();
-
-      for (SolrDocument solrDocumenent : docList) {
-        String id = (String) solrDocumenent
-            .getFieldValue(LogSearchConstants.ID);
-        startIndex++;
-        if (!StringUtils.isBlank(id)) {
-          if (id.equals(logId)) {
-            break;
-          }
-        }
-      }
-
-      SolrQuery logIdQuery = queryGenerator.commonServiceFilterQuery(searchCriteria);
-      logIdQuery.remove("rows");
-      logIdQuery.remove("start");
-      int start = (int) ((startIndex / searchCriteria.getMaxRows()) * searchCriteria
-          .getMaxRows());
-      logIdQuery.setStart(start);
-      logIdQuery.setRows(searchCriteria.getMaxRows());
-      logResponse = getLogAsPaginationProvided(logIdQuery,
-          serviceLogsSolrDao);
-      return logResponse;
-    } catch (SolrException | SolrServerException | IOException e) {
-      logger.error(e);
+    List<SolrServiceLogData> solrServiceLogDataList = queryResponse.getBeans(SolrServiceLogData.class);
+    if (!CollectionUtils.isNotEmpty(solrServiceLogDataList)) {
+      throw RESTErrorUtil.createRESTException("The keyword " + "\"" + keyword + "\"" + " was not found", MessageEnums.ERROR_SYSTEM);
     }
-
-    throw RESTErrorUtil.createRESTException("LogId not Found",
-        MessageEnums.ERROR_SYSTEM);
+    return solrServiceLogDataList.get(0);
   }
 
-  @SuppressWarnings("unchecked")
-  public BarGraphDataListResponse getHistogramData(ServiceGraphSearchCriteria searchCriteria) {
-    String deafalutValue = "0";
-    BarGraphDataListResponse dataList = new BarGraphDataListResponse();
-    SolrQuery solrQuery = queryGenerator.commonServiceFilterQuery(searchCriteria);
-    solrQuery.set("event", "/audit/logs/histogram");
-    String from = getFrom(searchCriteria.getFrom());
-    String to = getTo(searchCriteria.getTo());
-    String unit = getUnit(searchCriteria.getUnit());
-
-    List<BarGraphData> histogramData = new ArrayList<>();
-
-    String jsonHistogramQuery = queryGenerator
-      .buildJSONFacetTermTimeRangeQuery(
-        LogSearchConstants.SOLR_LEVEL,
-        LogSearchConstants.LOGTIME, from, to, unit).replace(
-        "\\", "");
-
-    try {
-      SolrUtil.setJSONFacet(solrQuery, jsonHistogramQuery);
-      SolrUtil.setRowCount(solrQuery,Integer.parseInt(deafalutValue));
-      QueryResponse response = serviceLogsSolrDao.process(solrQuery);
-      if (response == null){
-        return dataList;
-      }
-      SimpleOrderedMap<Object> jsonFacetResponse = (SimpleOrderedMap<Object>) response
-        .getResponse().get("facets");
-
-      if (jsonFacetResponse == null
-        || jsonFacetResponse.toString().equals("{count=0}")){
-        return dataList;
-      }
-
-      serviceLogsSolrDao.extractValuesFromBuckets(jsonFacetResponse, "x", "y", histogramData);
-
-      Collection<NameValueData> vNameValues = new ArrayList<NameValueData>();
-      List<BarGraphData> graphDatas = new ArrayList<BarGraphData>();
-      for (String level : LogSearchConstants.SUPPORTED_LOG_LEVEL) {
-        boolean isLevelPresent = false;
-        BarGraphData vData1 = null;
-        for (BarGraphData vData2 : histogramData) {
-          String name = vData2.getName();
-          if (level.contains(name)) {
-            isLevelPresent = true;
-            vData1 = vData2;
-            break;
-          }
-          if (vNameValues.isEmpty()) {
-            Collection<NameValueData> vNameValues2 = vData2
-              .getDataCount();
-            for (NameValueData value : vNameValues2) {
-              NameValueData value2 = new NameValueData();
-              value2.setValue(deafalutValue);
-              value2.setName(value.getName());
-              vNameValues.add(value2);
-            }
-          }
-        }
-        if (!isLevelPresent) {
-          BarGraphData vBarGraphData = new BarGraphData();
-          vBarGraphData.setName(level);
-          vBarGraphData.setDataCount(vNameValues);
-          graphDatas.add(vBarGraphData);
-        } else {
-          graphDatas.add(vData1);
-        }
+  private Date getDocDateFromNextOrLastPage(ServiceLogRequest request, String keyword, boolean isNext, int currentPageNumber, int maxRows) {
+    int lastOrFirstLogIndex;
+    if (isNext) {
+      lastOrFirstLogIndex = ((currentPageNumber + 1) * maxRows);
+    } else {
+      if (currentPageNumber == 0) {
+        throw RESTErrorUtil.createRESTException("This is the first Page", MessageEnums.DATA_NOT_FOUND);
       }
-
-      dataList.setGraphData(graphDatas);
-      return dataList;
-
-    } catch (SolrServerException | SolrException | IOException e) {
-      logger.error(e);
-      throw RESTErrorUtil.createRESTException(MessageEnums.SOLR_ERROR
-          .getMessage().getMessage(), MessageEnums.ERROR_SYSTEM);
-
+      lastOrFirstLogIndex = (currentPageNumber * maxRows) - 1;
     }
-  }
+    SimpleQuery sq = conversionService.convert(request, SimpleQuery.class);
+    SolrQuery nextPageLogTimeQuery = new DefaultQueryParser().doConstructSolrQuery(sq);
+    nextPageLogTimeQuery.remove("start");
+    nextPageLogTimeQuery.remove("rows");
+    nextPageLogTimeQuery.setStart(lastOrFirstLogIndex);
+    nextPageLogTimeQuery.setRows(1);
 
-  public String cancelFindRequestByDate(String uniqueId) {
-    if (StringUtils.isEmpty(uniqueId)) {
-      logger.error("Unique id is Empty");
-      throw RESTErrorUtil.createRESTException("Unique id is Empty",
-        MessageEnums.DATA_NOT_FOUND);
+    QueryResponse queryResponse = serviceLogsSolrDao.process(nextPageLogTimeQuery);
+    if (queryResponse == null) {
+      throw RESTErrorUtil.createRESTException(String.format("Cannot process next page query for \"%s\" ", keyword), MessageEnums.ERROR_SYSTEM);
     }
-
-    if (cancelByDate.remove(uniqueId)) {
-      mapUniqueId.remove(uniqueId);
-      return "Cancel Request Successfully Procssed ";
+    SolrDocumentList docList = queryResponse.getResults();
+    if (docList == null || docList.isEmpty()) {
+      throw RESTErrorUtil.createRESTException(String.format("Next page element for \"%s\" is not found", keyword), MessageEnums.ERROR_SYSTEM);
     }
-    return "Cancel Request Unable to Process";
+
+    SolrDocument solrDoc = docList.get(0);
+    return (Date) solrDoc.get(LOGTIME);
   }
 
-  public boolean cancelRequest(String uniqueId) {
-    if (StringUtils.isBlank(uniqueId)) {
-      logger.error("Unique id is Empty");
-      throw RESTErrorUtil.createRESTException("Unique id is Empty",
-        MessageEnums.DATA_NOT_FOUND);
-    }
-    for (String date : cancelByDate) {
-      if (uniqueId.equalsIgnoreCase(date)){
-        return false;
-      }
-    }
-    return true;
+  private boolean hasNextOrAscOrder(boolean isNext, boolean timeAscending) {
+    return isNext && !timeAscending || !isNext && timeAscending;
   }
 
-  public Response exportToTextFile(ServiceLogExportSearchCriteria searchCriteria) {
+  public Response export(ServiceLogExportRequest request) {
     String defaultFormat = "text";
-    SolrQuery solrQuery = queryGenerator.commonServiceFilterQuery(searchCriteria);
-    String from = searchCriteria.getFrom();
-    String to = searchCriteria.getTo();
-    String utcOffset = searchCriteria.getUtcOffset();
-    String format = searchCriteria.getFormat();
-
-    format = defaultFormat.equalsIgnoreCase(format) && format != null ? ".txt"
-        : ".json";
-    
-    if(StringUtils.isBlank(utcOffset)){
-      utcOffset = "0";
-    }
+    SimpleQuery solrQuery = conversionService.convert(request, SimpleQuery.class);
+    String from = request.getFrom();
+    String to = request.getTo();
+    String utcOffset = StringUtils.isBlank(request.getUtcOffset()) ? "0" : request.getUtcOffset();
+    String format = request.getFormat() != null && defaultFormat.equalsIgnoreCase(request.getFormat()) ? ".txt" : ".json";
+    String fileName = "Component_Logs_" + DateUtil.getCurrentDateInString();
 
     if (!DateUtil.isDateValid(from) || !DateUtil.isDateValid(to)) {
-      logger.error("Not valid date format. Valid format should be"
-          + LogSearchConstants.SOLR_DATE_FORMAT_PREFIX_Z);
+      logger.error("Not valid date format. Valid format should be" + LogSearchConstants.SOLR_DATE_FORMAT_PREFIX_Z);
       throw RESTErrorUtil.createRESTException("Not valid date format. Valid format should be"
-          + LogSearchConstants.SOLR_DATE_FORMAT_PREFIX_Z,
-          MessageEnums.INVALID_INPUT_DATA);
+          + LogSearchConstants.SOLR_DATE_FORMAT_PREFIX_Z, MessageEnums.INVALID_INPUT_DATA);
 
     } else {
       from = from.replace("T", " ");
@@ -1266,91 +369,28 @@ public class ServiceLogsManager extends ManagerBase<SolrServiceLogData, ServiceL
       to = to.replace("T", " ");
       to = to.replace(".", ",");
 
-      to = DateUtil.addOffsetToDate(to, Long.parseLong(utcOffset),
-          "yyyy-MM-dd HH:mm:ss,SSS");
-      from = DateUtil.addOffsetToDate(from, Long.parseLong(utcOffset),
-          "yyyy-MM-dd HH:mm:ss,SSS");
-    }
-
-    String fileName = DateUtil.getCurrentDateInString();
-    if (searchCriteria.getParamValue("hostLogFile") != null
-      && searchCriteria.getParamValue("compLogFile") != null) {
-      fileName = searchCriteria.getParamValue("hostLogFile") + "_"
-        + searchCriteria.getParamValue("compLogFile");
+      to = DateUtil.addOffsetToDate(to, Long.parseLong(utcOffset), "yyyy-MM-dd HH:mm:ss,SSS");
+      from = DateUtil.addOffsetToDate(from, Long.parseLong(utcOffset), "yyyy-MM-dd HH:mm:ss,SSS");
     }
 
     String textToSave = "";
     try {
       QueryResponse response = serviceLogsSolrDao.process(solrQuery);
       if (response == null) {
-        throw RESTErrorUtil.createRESTException(MessageEnums.SOLR_ERROR
-            .getMessage().getMessage(), MessageEnums.ERROR_SYSTEM);
+        throw RESTErrorUtil.createRESTException(MessageEnums.SOLR_ERROR.getMessage().getMessage(), MessageEnums.ERROR_SYSTEM);
       }
       SolrDocumentList docList = response.getResults();
       if (docList == null) {
-        throw RESTErrorUtil.createRESTException(MessageEnums.SOLR_ERROR
-            .getMessage().getMessage(), MessageEnums.ERROR_SYSTEM);
-      }
-
-      VSummary vsummary = BizUtil.buildSummaryForLogFile(docList);
-      vsummary.setFormat(format);
-      vsummary.setFrom(from);
-      vsummary.setTo(to);
-
-      String includeString = (String) searchCriteria.getParamValue("iMessage");
-      if (StringUtils.isBlank(includeString)) {
-        includeString = "";
-      }
-
-      String include[] = includeString.split(LogSearchConstants.I_E_SEPRATOR);
-
-      for (String inc : include) {
-        includeString = includeString + ",\"" + inc + "\"";
-      }
-      includeString = includeString.replaceFirst(",", "");
-      if (!StringUtils.isBlank(includeString)) {
-        vsummary.setIncludeString(includeString);
-      }
-
-      String excludeString = null;
-      boolean isNormalExcluded = false;
-
-      excludeString = (String) searchCriteria.getParamValue("eMessage");
-      if (StringUtils.isBlank(excludeString)) {
-        excludeString = "";
-      }
-
-      String exclude[] = excludeString.split(LogSearchConstants.I_E_SEPRATOR);
-      for (String exc : exclude) {
-        excludeString = excludeString + ",\"" + exc + "\"";
-      }
-
-      excludeString = excludeString.replaceFirst(",", "");
-      if (!StringUtils.isBlank(excludeString)) {
-        vsummary.setExcludeString(excludeString);
-        isNormalExcluded = true;
-      }
-
-      if (!StringUtils.isBlank(excludeString)) {
-        if (!isNormalExcluded) {
-          excludeString = excludeString.replaceFirst(",", "");
-        }
-        vsummary.setExcludeString(excludeString);
-      }
-
-      for (SolrDocument solrDoc : docList) {
-
-        Date logTimeDateObj = (Date) solrDoc.get(LogSearchConstants.LOGTIME);
-        if(logTimeDateObj != null){
-        String logTime = DateUtil.convertSolrDateToNormalDateFormat(
-            logTimeDateObj.getTime(), Long.parseLong(utcOffset));
-        solrDoc.remove(LogSearchConstants.LOGTIME);
-        solrDoc.addField(LogSearchConstants.LOGTIME, logTime);
-        }
+        throw RESTErrorUtil.createRESTException(MessageEnums.SOLR_ERROR.getMessage().getMessage(), MessageEnums.ERROR_SYSTEM);
       }
 
       if (format.toLowerCase(Locale.ENGLISH).equals(".txt")) {
-        textToSave = BizUtil.convertObjectToNormalText(docList);
+        Template template = freemarkerConfiguration.getTemplate(SERVICE_LOG_TEMPLATE);
+        Map<String, Object> models = new HashMap<>();
+        DownloadUtil.fillModelsForLogFile(docList, models, request, format, from, to);
+        StringWriter stringWriter = new StringWriter();
+        template.process(models, stringWriter);
+        textToSave = stringWriter.toString();
       } else if (format.toLowerCase(Locale.ENGLISH).equals(".json")) {
         textToSave = convertObjToString(docList);
       } else {
@@ -1358,222 +398,68 @@ public class ServiceLogsManager extends ManagerBase<SolrServiceLogData, ServiceL
             "unsoported format either should be json or text",
             MessageEnums.ERROR_SYSTEM);
       }
-      return FileUtil.saveToFile(textToSave, fileName, vsummary);
-
-    } catch (SolrException | SolrServerException | IOException
-      | ParseException e) {
+      File file = File.createTempFile(fileName, format);
+      FileOutputStream fis = new FileOutputStream(file);
+      fis.write(textToSave.getBytes());
+      return Response
+        .ok(file, MediaType.APPLICATION_OCTET_STREAM)
+        .header("Content-Disposition", "attachment;filename=" + fileName + format)
+        .build();
+    } catch (SolrException | TemplateException | IOException e) {
       logger.error("Error during solrQuery=" + solrQuery, e);
-      throw RESTErrorUtil.createRESTException(MessageEnums.SOLR_ERROR
-          .getMessage().getMessage(), MessageEnums.ERROR_SYSTEM);
-    }
-  }
-
-  public NodeListResponse getComponentListWithLevelCounts(ServiceLogSearchCriteria searchCriteria) {
-    SolrQuery solrQuery = queryGenerator.commonServiceFilterQuery(searchCriteria);
-    solrQuery.setParam("event", "/service/logs/components/levels/counts");
-
-    if (searchCriteria.getSortBy() == null) {
-      searchCriteria.setSortBy(LogSearchConstants.SOLR_COMPONENT);
-      searchCriteria.setSortType(SolrQuery.ORDER.asc.toString());
-    }
-    queryGenerator.setFilterFacetSort(solrQuery, searchCriteria);
-    String componentLevelHirachy = "type,level";
-    NodeListResponse list = new NodeListResponse();
-    try {
-
-      SolrUtil.setFacetPivot(solrQuery, 1, componentLevelHirachy);
-
-      QueryResponse response = serviceLogsSolrDao.process(solrQuery);
-
-      List<List<PivotField>> listPivotField = new ArrayList<List<PivotField>>();
-      NamedList<List<PivotField>> namedList = response.getFacetPivot();
-      if (namedList != null) {
-        listPivotField = namedList.getAll(componentLevelHirachy);
-      }
-      List<PivotField> secondHirarchicalPivotFields = null;
-      if (listPivotField == null || listPivotField.isEmpty()) {
-        return list;
-      } else {
-        secondHirarchicalPivotFields = listPivotField.get(0);
-      }
-      List<NodeData> datatList = new ArrayList<>();
-      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);
-        }
-      }
-      list.setvNodeList(datatList);
-      return list;
-    } catch (SolrException | SolrServerException | IOException e) {
-      logger.error(e.getMessage() + "SolrQuery"+solrQuery);
-      throw RESTErrorUtil.createRESTException(MessageEnums.SOLR_ERROR
-          .getMessage().getMessage(), MessageEnums.ERROR_SYSTEM);
+      throw RESTErrorUtil.createRESTException(MessageEnums.SOLR_ERROR.getMessage().getMessage(), MessageEnums.ERROR_SYSTEM);
     }
   }
 
-  public NameValueDataListResponse getExtremeDatesForBundelId(SearchCriteria searchCriteria) {
-    SolrQuery solrQuery = new SolrQuery();
-    NameValueDataListResponse nameValueList = new NameValueDataListResponse();
-    try {
-      String bundelId = (String) searchCriteria
-        .getParamValue(LogSearchConstants.BUNDLE_ID);
-      if(StringUtils.isBlank(bundelId)){
-        bundelId = "";
-      }
-
-      queryGenerator.setSingleIncludeFilter(solrQuery,
-        LogSearchConstants.BUNDLE_ID, bundelId);
-
-      SolrUtil.setMainQuery(solrQuery, null);
-      solrQuery.setSort(LogSearchConstants.LOGTIME, SolrQuery.ORDER.asc);
-      SolrUtil.setRowCount(solrQuery, 1);
-
-      List<NameValueData> vNameValues = new ArrayList<>();
-      QueryResponse response = serviceLogsSolrDao.process(solrQuery);
-
-      if(response == null){
-        return nameValueList;
-      }
-
-      SolrDocumentList solrDocList = response.getResults();
-      if(solrDocList == null){
-        return nameValueList;
-      }
-      for (SolrDocument solrDoc : solrDocList) {
-
-        Date logTimeAsc = (Date) solrDoc
-          .getFieldValue(LogSearchConstants.LOGTIME);
-        if (logTimeAsc != null) {
-          NameValueData nameValue = new NameValueData();
-          nameValue.setName("From");
-          nameValue.setValue("" + logTimeAsc.getTime());
-          vNameValues.add(nameValue);
-        }
-      }
-
-      solrQuery.clear();
-      SolrUtil.setMainQuery(solrQuery, null);
-      queryGenerator.setSingleIncludeFilter(solrQuery,
-        LogSearchConstants.BUNDLE_ID, bundelId);
-      solrQuery.setSort(LogSearchConstants.LOGTIME, SolrQuery.ORDER.desc);
-      SolrUtil.setRowCount(solrQuery, 1);
-
-      solrDocList.clear();
-      response = serviceLogsSolrDao.process(solrQuery);
-
-      solrDocList = response.getResults();
-      for (SolrDocument solrDoc : solrDocList) {
-        if (solrDoc != null) {
-          Date logTimeDesc = (Date) solrDoc
-              .getFieldValue(LogSearchConstants.LOGTIME);
-
-          if (logTimeDesc != null) {
-            NameValueData nameValue = new NameValueData();
-            nameValue.setName("To");
-            nameValue.setValue("" + logTimeDesc.getTime());
-            vNameValues.add(nameValue);
-          }
-        }
-      }
-      nameValueList.setvNameValues(vNameValues);
-
-
-    } catch (SolrServerException | SolrException | IOException e) {
-      logger.error(e.getMessage() + "SolrQuery"+solrQuery);
-      nameValueList = new NameValueDataListResponse();
-    }
-    return nameValueList;
+  public NodeListResponse getComponentListWithLevelCounts(ServiceLogComponentLevelRequest request) {
+    SimpleFacetQuery facetQuery = conversionService.convert(request, SimpleFacetQuery.class);
+    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));
   }
 
   public String getServiceLogsSchemaFieldsName() {
-    return convertObjToString(serviceLogsSolrDao.schemaFieldNameMap);
+    return convertObjToString(serviceLogsSolrDao.getSolrSchemaFieldDao().getSchemaFieldNameMap());
   }
 
-  public BarGraphDataListResponse getAnyGraphData(ServiceAnyGraphSearchCriteria searchCriteria) {
-    searchCriteria.addParam("fieldTime", LogSearchConstants.LOGTIME);
-    SolrQuery solrQuery = queryGenerator.commonServiceFilterQuery(searchCriteria);
-    BarGraphDataListResponse result = graphDataGenerator.getAnyGraphData(searchCriteria, serviceLogsSolrDao, solrQuery);
-    if (result == null) {
-      result = new BarGraphDataListResponse();
-    }
-    return result;
-
+  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);
   }
 
-  public ServiceLogResponse getAfterBeforeLogs(ServiceLogTruncatedSearchCriteria searchCriteria) {
+  public ServiceLogResponse getAfterBeforeLogs(ServiceLogTruncatedRequest request) {
     ServiceLogResponse logResponse = new ServiceLogResponse();
     List<SolrServiceLogData> docList = null;
-    String id = (String) searchCriteria
-      .getParamValue(LogSearchConstants.ID);
-    if (StringUtils.isBlank(id)) {
-      return logResponse;
-
-    }
-    String maxRows = "";
-
-    maxRows = searchCriteria.getNumberRows();
-    if (StringUtils.isBlank(maxRows)){
-      maxRows = ""+maxRows;
-    }
-    String scrollType = searchCriteria.getScrollType();
-    if(StringUtils.isBlank(scrollType)){
-      scrollType = "";
-    }
+    String scrollType = request.getScrollType() != null ? request.getScrollType() : "";
 
     String logTime = null;
     String sequenceId = null;
-    try {
-      SolrQuery solrQuery = new SolrQuery();
-      SolrUtil.setMainQuery(solrQuery,
-        queryGenerator.buildFilterQuery(LogSearchConstants.ID, id));
-      SolrUtil.setRowCount(solrQuery, 1);
-      QueryResponse response = serviceLogsSolrDao.process(solrQuery);
-      if(response == null){
-        return logResponse;
-      }
-      docList = convertToSolrBeans(response);
-      if (docList != null && !docList.isEmpty()) {
-        Date date = docList.get(0).getLogTime();
-        logTime = DateUtil.convertDateWithMillisecondsToSolrDate(date);
-        sequenceId = ""
-          + docList.get(0).getSeqNum();
-      }
-      if (StringUtils.isBlank(logTime)) {
-        return logResponse;
-      }
-    } catch (SolrServerException | SolrException | IOException e) {
-      throw RESTErrorUtil.createRESTException(MessageEnums.SOLR_ERROR
-          .getMessage().getMessage(), MessageEnums.ERROR_SYSTEM);
+    SolrQuery solrQuery = new SolrQuery();
+    solrQuery.setQuery("*:*");
+    solrQuery.setRows(1);
+    solrQuery.addFilterQuery(String.format("%s:%s", ID, request.getId()));
+    QueryResponse response = serviceLogsSolrDao.process(solrQuery);
+    if (response == null) {
+      return logResponse;
     }
-    if (LogSearchConstants.SCROLL_TYPE_BEFORE.equals(scrollType)) {
-      logResponse = whenScrollUp(searchCriteria, logTime,
-        sequenceId, maxRows);
-
+    docList = convertToSolrBeans(response);
+    if (docList != null && !docList.isEmpty()) {
+      Date date = docList.get(0).getLogTime();
+      logTime = DateUtil.convertDateWithMillisecondsToSolrDate(date);
+      sequenceId = docList.get(0).getSeqNum().toString();
+    }
+    if (StringUtils.isBlank(logTime)) {
+      return logResponse;
+    }
+    if (LogSearchConstants.SCROLL_TYPE_BEFORE.equals(scrollType) || LogSearchConstants.SCROLL_TYPE_AFTER.equals(scrollType)) {
       List<ServiceLogData> solrDocList = new ArrayList<>();
-      for (ServiceLogData solrDoc : logResponse.getLogList()) {
-        solrDocList.add(solrDoc);
-      }
-      logResponse.setLogList(solrDocList);
+      ServiceLogResponse beforeAfterResponse = whenScroll(request, logTime, sequenceId, scrollType);
+      if (beforeAfterResponse.getLogList() == null) {
         return logResponse;
-
-    } else if (LogSearchConstants.SCROLL_TYPE_AFTER.equals(scrollType)) {
-      List<ServiceLogData> solrDocList = new ArrayList<>();
-      logResponse = new ServiceLogResponse();
-      for (ServiceLogData solrDoc : whenScrollDown(searchCriteria, logTime,
-          sequenceId, maxRows).getLogList()) {
+      }
+      for (ServiceLogData solrDoc : beforeAfterResponse.getLogList()) {
         solrDocList.add(solrDoc);
       }
       logResponse.setLogList(solrDocList);
@@ -1582,122 +468,30 @@ public class ServiceLogsManager extends ManagerBase<SolrServiceLogData, ServiceL
     } else {
       logResponse = new ServiceLogResponse();
       List<ServiceLogData> initial = new ArrayList<>();
-      List<ServiceLogData> before = whenScrollUp(searchCriteria, logTime,
-        sequenceId, maxRows).getLogList();
-      List<ServiceLogData> after = whenScrollDown(searchCriteria, logTime,
-        sequenceId, maxRows).getLogList();
+      List<ServiceLogData> before = whenScroll(request, logTime, sequenceId, LogSearchConstants.SCROLL_TYPE_BEFORE).getLogList();
+      List<ServiceLogData> after = whenScroll(request, logTime, sequenceId, LogSearchConstants.SCROLL_TYPE_AFTER).getLogList();
       if (before != null && !before.isEmpty()) {
         for (ServiceLogData solrDoc : Lists.reverse(before)) {
           initial.add(solrDoc);
         }
       }
-
       initial.add(docList.get(0));
       if (after != null && !after.isEmpty()) {
         for (ServiceLogData solrDoc : after) {
           initial.add(solrDoc);
         }
       }
-
       logResponse.setLogList(initial);
-
       return logResponse;
-
-    }
-  }
-
-  private ServiceLogResponse whenScrollUp(SearchCriteria searchCriteria,
-                                          String logTime, String sequenceId, String maxRows) {
-    SolrQuery solrQuery = new SolrQuery();
-    SolrUtil.setMainQuery(solrQuery, null);
-    try {
-      int seq_num = Integer.parseInt(sequenceId) - 1;
-      sequenceId = "" + seq_num;
-    } catch (Exception e) {
-
     }
-    queryGenerator.setSingleRangeFilter(
-      solrQuery,
-      LogSearchConstants.SEQUNCE_ID, "*", sequenceId);
-
-    queryGenerator.applyLogFileFilter(solrQuery, searchCriteria);
-
-    queryGenerator.setSingleRangeFilter(solrQuery,
-      LogSearchConstants.LOGTIME, "*", logTime);
-    SolrUtil.setRowCount(solrQuery, Integer.parseInt(maxRows));
-    String order1 = LogSearchConstants.LOGTIME + " "
-      + LogSearchConstants.DESCENDING_ORDER;
-    String order2 = LogSearchConstants.SEQUNCE_ID + " "
-      + LogSearchConstants.DESCENDING_ORDER;
-    List<String> sortOrder = new ArrayList<String>();
-    sortOrder.add(order1);
-    sortOrder.add(order2);
-    searchCriteria.addParam(LogSearchConstants.SORT, sortOrder);
-    queryGenerator.setMultipleSortOrder(solrQuery, searchCriteria);
-
-    return getLogAsPaginationProvided(solrQuery, serviceLogsSolrDao);
   }
 
-  private ServiceLogResponse whenScrollDown(SearchCriteria searchCriteria,
-                                            String logTime, String sequenceId, String maxRows) {
-    SolrQuery solrQuery = new SolrQuery();
-    SolrUtil.setMainQuery(solrQuery, null);
-    queryGenerator.applyLogFileFilter(solrQuery, searchCriteria);
-
-    try {
-      int seq_num = Integer.parseInt(sequenceId) + 1;
-      sequenceId = "" + seq_num;
-    } catch (Exception e) {
-
-    }
-    queryGenerator.setSingleRangeFilter(
-      solrQuery,
-      LogSearchConstants.SEQUNCE_ID, sequenceId, "*");
-    queryGenerator.setSingleRangeFilter(solrQuery,
-      LogSearchConstants.LOGTIME, logTime, "*");
-    SolrUtil.setRowCount(solrQuery, Integer.parseInt(maxRows));
-
-    String order1 = LogSearchConstants.LOGTIME + " "
-      + LogSearchConstants.ASCENDING_ORDER;
-    String order2 = LogSearchConstants.SEQUNCE_ID + " "
-      + LogSearchConstants.ASCENDING_ORDER;
-    List<String> sortOrder = new ArrayList<String>();
-    sortOrder.add(order1);
-    sortOrder.add(order2);
-    searchCriteria.addParam(LogSearchConstants.SORT, sortOrder);
-    queryGenerator.setMultipleSortOrder(solrQuery, searchCriteria);
-
-    return getLogAsPaginationProvided(solrQuery, serviceLogsSolrDao);
-  }
-
-  @Scheduled(cron = "${logsearch.solr.warming.cron}")
-  public void warmingSolrServer(){
-    logger.info("solr warming triggered.");
-    SolrQuery solrQuery = new SolrQuery();
-    TimeZone gmtTimeZone = TimeZone.getTimeZone("GMT");
-    GregorianCalendar utc = new GregorianCalendar(gmtTimeZone);
-    utc.setTimeInMillis(new Date().getTime());
-    utc.set(Calendar.HOUR, 0);
-    utc.set(Calendar.MINUTE, 0);
-    utc.set(Calendar.MILLISECOND, 001);
-    utc.set(Calendar.SECOND, 0);
-    DateUtil.convertDateWithMillisecondsToSolrDate(utc.getTime());
-    String from = DateUtil.convertDateWithMillisecondsToSolrDate(utc.getTime());
-    utc.set(Calendar.MILLISECOND, 999);
-    utc.set(Calendar.SECOND, 59);
-    utc.set(Calendar.MINUTE, 59);
-    utc.set(Calendar.HOUR, 23);
-    String to = DateUtil.convertDateWithMillisecondsToSolrDate(utc.getTime());
-    queryGenerator.setSingleRangeFilter(solrQuery,
-        LogSearchConstants.LOGTIME, from,to);
-    String level = LogSearchConstants.FATAL+","+LogSearchConstants.ERROR+","+LogSearchConstants.WARN;
-    queryGenerator.setFilterClauseWithFieldName(solrQuery, level,
-        LogSearchConstants.SOLR_LEVEL, "", QueryGenerationBase.Condition.OR);
-    try {
-      serviceLogsSolrDao.process(solrQuery);
-    } catch (SolrServerException | IOException e) {
-      logger.error("Error while warming solr server",e);
-    }
+  private ServiceLogResponse whenScroll(ServiceLogTruncatedRequest request, String logTime, String sequenceId, String afterOrBefore) {
+    request.setScrollType(afterOrBefore);
+    ServiceLogTruncatedRequestQueryConverter converter = new ServiceLogTruncatedRequestQueryConverter();
+    converter.setLogTime(logTime);
+    converter.setSequenceId(sequenceId);
+    return getLogAsPaginationProvided(converter.convert(request), serviceLogsSolrDao, "service/logs/truncated");
   }
 
   @Override
@@ -1728,6 +522,40 @@ public class ServiceLogsManager extends ManagerBase<SolrServiceLogData, ServiceL
     }
   }
 
+  private <T extends LogData> GroupListResponse getFields(String field, Class<T> clazz) {
+    SolrQuery solrQuery = new SolrQuery();
+    solrQuery.setQuery("*:*");
+    GroupListResponse collection = new GroupListResponse();
+    SolrUtil.setFacetField(solrQuery,
+      field);
+    SolrUtil.setFacetSort(solrQuery, LogSearchConstants.FACET_INDEX);
+    QueryResponse response = serviceLogsSolrDao.process(solrQuery);
+    if (response == null) {
+      return collection;
+    }
+    FacetField facetField = response
+      .getFacetField(field);
+    if (facetField == null) {
+      return collection;
+    }
+    List<Count> fieldList = facetField.getValues();
+    if (fieldList == null) {
+      return collection;
+    }
+    SolrDocumentList docList = response.getResults();
+    if (docList == null) {
+      return collection;
+    }
+    List<LogData> groupList = getLogDataListByFieldType(clazz, response, fieldList);
+
+    collection.setGroupList(groupList);
+    if (!docList.isEmpty()) {
+      collection.setStartIndex((int) docList.getStart());
+      collection.setTotalCount(docList.getNumFound());
+    }
+    return collection;
+  }
+
   private <T extends LogData> LogData createNewFieldByType(Class<T> clazz, Count count, String temp) {
     temp = count.getName();
     LogData result = null;
@@ -1745,5 +573,4 @@ public class ServiceLogsManager extends ManagerBase<SolrServiceLogData, ServiceL
     }
     throw new UnsupportedOperationException();
   }
-
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/manager/SessionManager.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/manager/SessionManager.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/manager/SessionManager.java
index 206636a..e8b699e 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/manager/SessionManager.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/manager/SessionManager.java
@@ -24,9 +24,10 @@ import org.apache.log4j.Logger;
 import org.springframework.security.core.Authentication;
 import org.springframework.security.core.context.SecurityContextHolder;
 import org.springframework.security.web.authentication.WebAuthenticationDetails;
-import org.springframework.stereotype.Component;
 
-@Component
+import javax.inject.Named;
+
+@Named
 public class SessionManager {
 
   private static final Logger logger = Logger.getLogger(SessionManager.class);


[58/58] [abbrv] ambari git commit: AMBARI-18660. Log Search schema meta data loader fix (Miklos Gergely via oleewere)

Posted by ol...@apache.org.
AMBARI-18660. Log Search schema meta data loader fix (Miklos Gergely via oleewere)

Change-Id: Ibbf3f15984b3439e25cb2b7f06be1830aa389240


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

Branch: refs/heads/branch-2.5
Commit: 59c839c87352d88998d0f8febb92eedfb18f0385
Parents: 559fc2e
Author: Miklos Gergely <mg...@hortonworks.com>
Authored: Sat Nov 5 14:42:36 2016 +0100
Committer: oleewere <ol...@gmail.com>
Committed: Sat Nov 5 14:46:48 2016 +0100

----------------------------------------------------------------------
 .../ambari/logsearch/conf/SolrConfig.java       |  19 +-
 .../ambari/logsearch/conf/SolrPropsConfig.java  |   1 -
 .../logsearch/conf/SolrUserPropsConfig.java     |  12 ++
 .../AbstractOperationHolderConverter.java       |  50 +++--
 .../AbstractSearchRequestQueryConverter.java    |   4 -
 .../ambari/logsearch/dao/AuditSolrDao.java      |   6 +-
 .../logsearch/dao/ServiceLogsSolrDao.java       |   3 +-
 .../ambari/logsearch/dao/SolrAliasDao.java      |  10 +-
 .../ambari/logsearch/dao/SolrCollectionDao.java |   8 +-
 .../logsearch/dao/SolrSchemaFieldDao.java       | 201 ++++++++++++-------
 .../ambari/logsearch/dao/UserConfigSolrDao.java |   7 +-
 .../ambari/logsearch/doc/DocConstants.java      |   1 +
 .../logsearch/manager/AuditLogsManager.java     |   7 +-
 .../logsearch/manager/ServiceLogsManager.java   |   8 +-
 .../model/request/impl/CommonSearchRequest.java |   7 +
 .../logsearch/rest/ServiceLogsResource.java     |   9 +
 .../apache/ambari/logsearch/util/SolrUtil.java  |  93 +++------
 .../webapp/scripts/views/tabs/LogFileView.js    |   9 +-
 .../src/main/webapp/static/schema_fields.json   |   4 +-
 .../converter/AuditLogRequestConverterTest.java |   2 +-
 ...ditServiceLoadRequestQueryConverterTest.java |   4 +-
 ...BaseServiceLogRequestQueryConverterTest.java |   2 +-
 .../FieldAuditLogRequestQueryConverterTest.java |   2 +-
 .../ServiceLogAnyGraphRequestConverterTest.java |   4 +-
 ...ComponentLevelRequestQueryConverterTest.java |   4 +-
 ...ComponentRequestFacetQueryConverterTest.java |   2 +-
 ...eLogLevelCountRequestQueryConverterTest.java |   2 +-
 ...ceLogTreeRequestFacetQueryConverterTest.java |   4 +-
 ...ceLogTruncatedRequestQueryConverterTest.java |   2 +-
 .../UserExportRequestQueryConverterTest.java    |   2 +-
 .../shipper-conf/input.config-ambari.json       |  20 +-
 31 files changed, 272 insertions(+), 237 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/59c839c8/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/SolrConfig.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/SolrConfig.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/SolrConfig.java
index 79df3c2..fb25a63 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/SolrConfig.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/SolrConfig.java
@@ -19,8 +19,6 @@
 package org.apache.ambari.logsearch.conf;
 
 import org.apache.ambari.logsearch.dao.SolrSchemaFieldDao;
-import org.apache.ambari.logsearch.solr.AmbariSolrCloudClient;
-import org.apache.ambari.logsearch.solr.AmbariSolrCloudClientBuilder;
 import org.apache.commons.lang.StringUtils;
 import org.apache.solr.client.solrj.impl.CloudSolrClient;
 import org.apache.solr.client.solrj.impl.HttpClientUtil;
@@ -32,11 +30,13 @@ import org.springframework.context.annotation.Configuration;
 import org.springframework.context.annotation.DependsOn;
 import org.springframework.data.solr.core.SolrTemplate;
 import org.springframework.data.solr.repository.config.EnableSolrRepositories;
+import org.springframework.scheduling.annotation.EnableScheduling;
 
 import javax.inject.Inject;
 
 @Configuration
 @EnableSolrRepositories
+@EnableScheduling
 public class SolrConfig {
 
   private static final Logger LOG = LoggerFactory.getLogger(SolrConfig.class);
@@ -80,18 +80,9 @@ public class SolrConfig {
       solrUserConfigPropsConfig.getCollection()));
   }
 
-  @Bean(name = "serviceSolrFieldDao")
-  public SolrSchemaFieldDao serviceSolrFieldDao() {
-    return new SolrSchemaFieldDao();
-  }
-
-  @Bean(name = "auditSolrFieldDao")
-  public SolrSchemaFieldDao auditSolrFieldDao() {
-    return new SolrSchemaFieldDao();
-  }
-
-  @Bean(name = "userConfigSolrFieldDao")
-  public SolrSchemaFieldDao userConfigSolrFieldDao() {
+  @Bean
+  @DependsOn({"serviceSolrTemplate", "auditSolrTemplate"})
+  public SolrSchemaFieldDao solrSchemaFieldDao() {
     return new SolrSchemaFieldDao();
   }
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/59c839c8/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/SolrPropsConfig.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/SolrPropsConfig.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/SolrPropsConfig.java
index 78012b0..f80d6e5 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/SolrPropsConfig.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/SolrPropsConfig.java
@@ -46,5 +46,4 @@ public interface SolrPropsConfig {
   String getSplitInterval();
 
   void setSplitInterval(String splitInterval);
-
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/59c839c8/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/SolrUserPropsConfig.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/SolrUserPropsConfig.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/SolrUserPropsConfig.java
index 38366d5..c8c96c8 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/SolrUserPropsConfig.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/SolrUserPropsConfig.java
@@ -44,6 +44,9 @@ public class SolrUserPropsConfig extends SolrConnectionPropsConfig {
   @Value("#{'${logsearch.logfeeder.include.default.level:FATAL,ERROR,WARN,INFO,DEBUG,TRACE,UNKNOWN}'.split(',')}")
   private List<String> logLevels;
 
+  @Value("${logsearch.schema.fields.populate.interval.mins:1}")
+  private Integer populateIntervalMins;
+  
   @Override
   public String getCollection() {
     return collection;
@@ -101,4 +104,13 @@ public class SolrUserPropsConfig extends SolrConnectionPropsConfig {
   public void setLogLevels(List<String> logLevels) {
     this.logLevels = logLevels;
   }
+  
+
+  public Integer getPopulateIntervalMins() {
+    return populateIntervalMins;
+  }
+  
+  void setPopulateIntervalMins(Integer populateIntervalMins) {
+    this.populateIntervalMins = populateIntervalMins;
+  }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/59c839c8/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/AbstractOperationHolderConverter.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/AbstractOperationHolderConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/AbstractOperationHolderConverter.java
index 5945d72..3c91f51 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/AbstractOperationHolderConverter.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/AbstractOperationHolderConverter.java
@@ -26,13 +26,13 @@ import org.apache.ambari.logsearch.dao.SolrSchemaFieldDao;
 import org.apache.ambari.logsearch.util.SolrUtil;
 import org.apache.commons.collections.CollectionUtils;
 import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang.text.StrTokenizer;
 import org.springframework.data.solr.core.query.Criteria;
 import org.springframework.data.solr.core.query.Query;
 import org.springframework.data.solr.core.query.SimpleFilterQuery;
 import org.springframework.data.solr.core.query.SimpleStringCriteria;
 
 import javax.inject.Inject;
-import javax.inject.Named;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -43,12 +43,7 @@ public abstract class AbstractOperationHolderConverter <REQUEST_TYPE, QUERY_TYPE
   extends AbstractConverterAware<REQUEST_TYPE, QUERY_TYPE> {
 
   @Inject
-  @Named("serviceSolrFieldDao")
-  private SolrSchemaFieldDao serviceSolrSchemaFieldDao;
-
-  @Inject
-  @Named("auditSolrFieldDao")
-  private SolrSchemaFieldDao auditSolrSchemaFieldDao;
+  private SolrSchemaFieldDao solrSchemaFieldDao;
 
   public List<String> splitValueAsList(String value, String separator) {
     return StringUtils.isNotEmpty(value) ? Splitter.on(separator).omitEmptyStrings().splitToList(value) : null;
@@ -111,11 +106,10 @@ public abstract class AbstractOperationHolderConverter <REQUEST_TYPE, QUERY_TYPE
         new TypeToken<List<HashMap<String, String>>>(){}.getType());
       for (Map<String, String> criteriaMap : criterias) {
         for (Map.Entry<String, String> fieldEntry : criteriaMap.entrySet()) {
-          escapeFieldValueByType(fieldEntry);
           if (fieldEntry.getKey().equalsIgnoreCase(LOG_MESSAGE)) {
-            addFilterQuery(query, new Criteria(fieldEntry.getKey()).contains(escapeFieldValueByType(fieldEntry)), false);
+            addLogMessageFilter(query, fieldEntry.getValue(), false);
           } else {
-            addFilterQuery(query, new Criteria(fieldEntry.getKey()).is(escapeFieldValueByType(fieldEntry)), false);
+            addFilterQuery(query, new Criteria(fieldEntry.getKey()).is(escapeNonLogMessageField(fieldEntry)), false);
           }
         }
       }
@@ -129,11 +123,10 @@ public abstract class AbstractOperationHolderConverter <REQUEST_TYPE, QUERY_TYPE
         new TypeToken<List<HashMap<String, String>>>(){}.getType());
       for (Map<String, String> criteriaMap : criterias) {
         for (Map.Entry<String, String> fieldEntry : criteriaMap.entrySet()) {
-          escapeFieldValueByType(fieldEntry);
           if (fieldEntry.getKey().equalsIgnoreCase(LOG_MESSAGE)) {
-            addFilterQuery(query, new Criteria(fieldEntry.getKey()).contains(escapeFieldValueByType(fieldEntry)), true);
+            addLogMessageFilter(query, fieldEntry.getValue(), true);
           } else {
-            addFilterQuery(query, new Criteria(fieldEntry.getKey()).is(escapeFieldValueByType(fieldEntry)), true);
+            addFilterQuery(query, new Criteria(fieldEntry.getKey()).is(escapeNonLogMessageField(fieldEntry)), true);
           }
         }
       }
@@ -143,18 +136,31 @@ public abstract class AbstractOperationHolderConverter <REQUEST_TYPE, QUERY_TYPE
 
   public abstract LogType getLogType();
 
-  private String escapeFieldValueByType(Map.Entry<String, String> fieldEntry) {
-    String escapedFieldValue;
-    if (fieldEntry.getKey().equalsIgnoreCase(LOG_MESSAGE)) {
-      escapedFieldValue = SolrUtil.escapeForLogMessage(fieldEntry.getValue());
-    } else {
-      escapedFieldValue = SolrUtil.putWildCardByType(fieldEntry.getValue(), fieldEntry.getKey(), getSchemaFieldsTypeMapByLogType(getLogType()));
+  private void addLogMessageFilter(Query query, String value, boolean negate) {
+    StrTokenizer tokenizer = new StrTokenizer(value, ' ', '"');
+    for (String token : tokenizer.getTokenArray()) {
+      token = token.trim();
+      if (token.contains(" ") || !token.startsWith("*") && !token.endsWith("*")) {
+        addFilterQuery(query, new Criteria(LOG_MESSAGE).is(SolrUtil.escapeQueryChars(token)), negate);
+      } else if (token.startsWith("*") && token.endsWith("*")) {
+        String plainToken = StringUtils.substring(token, 1, -1);
+        addFilterQuery(query, new Criteria(LOG_MESSAGE).contains(SolrUtil.escapeQueryChars(plainToken)), negate);
+      } else if (token.startsWith("*") && !token.endsWith("*")) {
+        String plainToken = StringUtils.substring(token, 1);
+        addFilterQuery(query, new Criteria(LOG_MESSAGE).endsWith(SolrUtil.escapeQueryChars(plainToken)), negate);
+      } else if (!token.startsWith("*") && token.endsWith("*")) {
+        String plainToken = StringUtils.substring(token, 0, -1);
+        addFilterQuery(query, new Criteria(LOG_MESSAGE).startsWith(SolrUtil.escapeQueryChars(plainToken)), negate);
+      }
     }
-    return escapedFieldValue;
   }
 
-  private Map<String, String> getSchemaFieldsTypeMapByLogType(LogType logType) {
-    return LogType.AUDIT.equals(logType) ? auditSolrSchemaFieldDao.getSchemaFieldTypeMap() : serviceSolrSchemaFieldDao.getSchemaFieldTypeMap();
+  private String escapeNonLogMessageField(Map.Entry<String, String> fieldEntry) {
+    Map<String, String> schemaFieldNameMap = solrSchemaFieldDao.getSchemaFieldNameMap(getLogType());
+    Map<String, String> schemaFieldTypeMap = solrSchemaFieldDao.getSchemaFieldTypeMap(getLogType());
+    String fieldType = schemaFieldNameMap.get(fieldEntry.getKey());
+    String fieldTypeMetaData = schemaFieldTypeMap.get(fieldType);
+    return SolrUtil.putWildCardByType(fieldEntry.getValue(), fieldType, fieldTypeMetaData);
   }
 
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/59c839c8/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/AbstractSearchRequestQueryConverter.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/AbstractSearchRequestQueryConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/AbstractSearchRequestQueryConverter.java
index 2604f13..d44b866 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/AbstractSearchRequestQueryConverter.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/AbstractSearchRequestQueryConverter.java
@@ -18,7 +18,6 @@
  */
 package org.apache.ambari.logsearch.converter;
 
-import org.apache.ambari.logsearch.dao.SolrSchemaFieldDao;
 import org.apache.ambari.logsearch.model.request.impl.CommonSearchRequest;
 import org.apache.commons.lang.StringUtils;
 import org.springframework.data.domain.PageRequest;
@@ -27,9 +26,6 @@ import org.springframework.data.solr.core.query.Criteria;
 import org.springframework.data.solr.core.query.Query;
 import org.springframework.data.solr.core.query.SimpleStringCriteria;
 
-import javax.inject.Inject;
-import javax.inject.Named;
-
 public abstract class AbstractSearchRequestQueryConverter<REQUEST_TYPE extends CommonSearchRequest, QUERY_TYPE extends Query>
   extends AbstractOperationHolderConverter<REQUEST_TYPE, QUERY_TYPE> {
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/59c839c8/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/AuditSolrDao.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/AuditSolrDao.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/AuditSolrDao.java
index 2fbdb46..309687d 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/AuditSolrDao.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/AuditSolrDao.java
@@ -48,7 +48,6 @@ public class AuditSolrDao extends SolrDaoBase {
   private SolrCollectionDao solrCollectionDao;
 
   @Inject
-  @Named("auditSolrFieldDao")
   private SolrSchemaFieldDao solrSchemaFieldDao;
 
   public AuditSolrDao() {
@@ -70,10 +69,9 @@ public class AuditSolrDao extends SolrDaoBase {
       boolean createAlias = (aliasNameIn != null && StringUtils.isNotBlank(rangerAuditCollection));
       solrCollectionDao.setupCollections(getSolrClient(), solrAuditLogPropsConfig);
       if (createAlias) {
-        solrAliasDao.setupAlias(solrSchemaFieldDao, getSolrClient(), solrAuditLogPropsConfig);
-      } else {
-        solrSchemaFieldDao.populateSchemaFields(getSolrClient(), solrAuditLogPropsConfig);
+        solrAliasDao.setupAlias(getSolrClient(), solrAuditLogPropsConfig);
       }
+      solrSchemaFieldDao.auditCollectionSetUp();
     } catch (Exception e) {
       LOG.error("Error while connecting to Solr for audit logs : solrUrl=" + solrAuditLogPropsConfig.getSolrUrl() + ", zkConnectString=" +
           solrAuditLogPropsConfig.getZkConnectString() + ", collection=" + solrAuditLogPropsConfig.getCollection(), e);

http://git-wip-us.apache.org/repos/asf/ambari/blob/59c839c8/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/ServiceLogsSolrDao.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/ServiceLogsSolrDao.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/ServiceLogsSolrDao.java
index 0e1d57c..cf61163 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/ServiceLogsSolrDao.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/ServiceLogsSolrDao.java
@@ -44,7 +44,6 @@ public class ServiceLogsSolrDao extends SolrDaoBase {
   private SolrTemplate serviceSolrTemplate;
 
   @Inject
-  @Named("serviceSolrFieldDao")
   private SolrSchemaFieldDao solrSchemaFieldDao;
 
   public ServiceLogsSolrDao() {
@@ -62,7 +61,7 @@ public class ServiceLogsSolrDao extends SolrDaoBase {
     try {
       solrCollectionDao.checkSolrStatus(getSolrClient());
       solrCollectionDao.setupCollections(getSolrClient(), solrServiceLogPropsConfig);
-      solrSchemaFieldDao.populateSchemaFields(getSolrClient(), solrServiceLogPropsConfig);
+      solrSchemaFieldDao.serviceCollectionSetUp();
     } catch (Exception e) {
       LOG.error("error while connecting to Solr for service logs : solrUrl=" + solrServiceLogPropsConfig.getSolrUrl()
         + ", zkConnectString=" + solrServiceLogPropsConfig.getZkConnectString()

http://git-wip-us.apache.org/repos/asf/ambari/blob/59c839c8/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/SolrAliasDao.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/SolrAliasDao.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/SolrAliasDao.java
index 6389446..d78ff0da 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/SolrAliasDao.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/SolrAliasDao.java
@@ -32,11 +32,10 @@ import javax.inject.Named;
 import java.io.IOException;
 import java.util.Arrays;
 import java.util.Collection;
-import java.util.HashMap;
 import java.util.List;
 
 @Named
-public class SolrAliasDao {
+class SolrAliasDao {
 
   private static final Logger LOG = LoggerFactory.getLogger(SolrAliasDao.class);
 
@@ -45,9 +44,9 @@ public class SolrAliasDao {
   @Inject
   private SolrCollectionDao solrCollectionDao;
 
-  protected void setupAlias(final SolrSchemaFieldDao solrSchemaFieldDao, final CloudSolrClient solrClient,
-                            final SolrAuditLogPropsConfig solrPropsConfig) throws Exception {
-    final Collection<String> collectionListIn = Arrays.asList(solrPropsConfig.getCollection(), solrPropsConfig.getRangerCollection().trim());
+  void setupAlias(final CloudSolrClient solrClient, final SolrAuditLogPropsConfig solrPropsConfig) throws Exception {
+    final Collection<String> collectionListIn =
+        Arrays.asList(solrPropsConfig.getCollection(), solrPropsConfig.getRangerCollection().trim());
 
     if (solrPropsConfig.getAliasNameIn() == null || collectionListIn.size() == 0 || solrClient == null) {
       LOG.info("Will not create alias " + solrPropsConfig.getAliasNameIn() + " for " +
@@ -71,7 +70,6 @@ public class SolrAliasDao {
               if (count == collectionListIn.size()) {
                 LOG.info("Setup for alias " + solrPropsConfig.getAliasNameIn() + " is successful. Exiting setup retry thread. " +
                   "Collections=" + collectionListIn);
-                solrSchemaFieldDao.populateSchemaFields(solrClient, solrPropsConfig);
                 break;
               }
             } else {

http://git-wip-us.apache.org/repos/asf/ambari/blob/59c839c8/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/SolrCollectionDao.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/SolrCollectionDao.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/SolrCollectionDao.java
index c83cd99..834ba38 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/SolrCollectionDao.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/SolrCollectionDao.java
@@ -40,7 +40,7 @@ import java.util.HashSet;
 import java.util.List;
 
 @Named
-public class SolrCollectionDao {
+class SolrCollectionDao {
 
   private static final Logger LOG = LoggerFactory.getLogger(SolrCollectionDao.class);
 
@@ -50,7 +50,7 @@ public class SolrCollectionDao {
    * This will try to get the collections from the Solr. Ping doesn't work if
    * collection is not given
    */
-  public boolean checkSolrStatus(CloudSolrClient cloudSolrClient) {
+  boolean checkSolrStatus(CloudSolrClient cloudSolrClient) {
     int waitDurationMS = 3 * 60 * 1000;
     boolean status = false;
     try {
@@ -86,7 +86,7 @@ public class SolrCollectionDao {
     return status;
   }
 
-  public void setupCollections(final CloudSolrClient solrClient, final SolrPropsConfig solrPropsConfig) throws Exception {
+  void setupCollections(final CloudSolrClient solrClient, final SolrPropsConfig solrPropsConfig) throws Exception {
     boolean setupStatus = createCollectionsIfNeeded(solrClient, solrPropsConfig);
     LOG.info("Setup status for " + solrPropsConfig.getCollection() + " is " + setupStatus);
     if (!setupStatus) {
@@ -136,7 +136,7 @@ public class SolrCollectionDao {
   }
 
   @SuppressWarnings("unchecked")
-  public List<String> getCollections(CloudSolrClient solrClient) throws SolrServerException,
+  List<String> getCollections(CloudSolrClient solrClient) throws SolrServerException,
     IOException {
     try {
       CollectionAdminRequest.List colListReq = new CollectionAdminRequest.List();

http://git-wip-us.apache.org/repos/asf/ambari/blob/59c839c8/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/SolrSchemaFieldDao.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/SolrSchemaFieldDao.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/SolrSchemaFieldDao.java
index 35bc2dc..e6a562e 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/SolrSchemaFieldDao.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/SolrSchemaFieldDao.java
@@ -19,123 +19,178 @@
 package org.apache.ambari.logsearch.dao;
 
 import org.apache.ambari.logsearch.common.LogSearchConstants;
+import org.apache.ambari.logsearch.common.LogType;
 import org.apache.ambari.logsearch.common.MessageEnums;
-import org.apache.ambari.logsearch.conf.SolrPropsConfig;
 import org.apache.ambari.logsearch.conf.SolrUserPropsConfig;
+import org.apache.http.HttpResponse;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.impl.client.CloseableHttpClient;
 import org.apache.solr.client.solrj.SolrRequest;
 import org.apache.solr.client.solrj.SolrServerException;
 import org.apache.solr.client.solrj.impl.CloudSolrClient;
-import org.apache.solr.client.solrj.request.LukeRequest;
+import org.apache.solr.client.solrj.impl.HttpClientUtil;
 import org.apache.solr.client.solrj.request.schema.FieldTypeDefinition;
 import org.apache.solr.client.solrj.request.schema.SchemaRequest;
 import org.apache.solr.client.solrj.response.LukeResponse;
 import org.apache.solr.client.solrj.response.LukeResponse.FieldInfo;
 import org.apache.solr.client.solrj.response.schema.SchemaResponse;
 import org.apache.solr.common.SolrException;
+import org.apache.solr.common.cloud.Replica;
+import org.apache.solr.common.cloud.Slice;
+import org.apache.solr.common.cloud.ZkStateReader;
+import org.apache.solr.common.util.JavaBinCodec;
+import org.apache.solr.common.util.NamedList;
 import org.codehaus.jettison.json.JSONObject;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.springframework.data.solr.core.SolrTemplate;
+import org.springframework.scheduling.annotation.Scheduled;
 
-import javax.inject.Inject;
 import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collection;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.Map.Entry;
 
+import javax.annotation.PostConstruct;
+import javax.inject.Inject;
+import javax.inject.Named;
+
 public class SolrSchemaFieldDao {
 
   private static final Logger LOG = LoggerFactory.getLogger(SolrSchemaFieldDao.class);
 
-  private static final int SETUP_RETRY_SECOND = 30;
-  private static final int SETUP_UPDATE_SECOND = 1 * 60; // 1 min
+  private static final int RETRY_SECOND = 30;
   
-  private boolean populateFieldsThreadActive = false;
-
-  private Map<String, String> schemaFieldNameMap = new HashMap<>();
-  private Map<String, String> schemaFieldTypeMap = new HashMap<>();
+  @Inject
+  @Named("serviceSolrTemplate")
+  private SolrTemplate serviceSolrTemplate;
 
   @Inject
-  private SolrUserPropsConfig solrUserPropsConfig;
+  @Named("auditSolrTemplate")
+  private SolrTemplate auditSolrTemplate;
+  
+  @Inject
+  private SolrUserPropsConfig solrUserConfigPropsConfig;
+  
+  private CloudSolrClient serviceSolrClient;
+  private CloudSolrClient auditSolrClient;
+  
+  private int retryCount;
+  private int skipCount;
 
-  public void populateSchemaFields(final CloudSolrClient solrClient, final SolrPropsConfig solrPropsConfig) {
-    if (!populateFieldsThreadActive) {
-      populateFieldsThreadActive = true;
-      LOG.info("Creating thread to populated fields for collection=" + solrPropsConfig.getCollection());
-      Thread fieldPopulationThread = new Thread("populated_fields_" + solrPropsConfig.getCollection()) {
-        @Override
-        public void run() {
-          LOG.info("Started thread to get fields for collection=" + solrPropsConfig.getCollection());
-          int retryCount = 0;
-          while (true) {
-            try {
-              Thread.sleep(SETUP_RETRY_SECOND * 1000);
-              retryCount++;
-              boolean _result = _populateSchemaFields(solrClient, solrPropsConfig);
-              if (_result) {
-                LOG.info("Populate fields for collection " + solrPropsConfig.getCollection() + " is success, Update it after " +
-                  SETUP_UPDATE_SECOND + " sec");
-                Thread.sleep(SETUP_UPDATE_SECOND * 1000);
-              }
-            } catch (InterruptedException sleepInterrupted) {
-              LOG.info("Sleep interrupted while populating fields for collection " + solrPropsConfig.getCollection());
-              break;
-            } catch (Exception ex) {
-              LOG.error("Error while populating fields for collection " + solrPropsConfig.getCollection() + ", retryCount=" + retryCount);
-            }
-          }
-          populateFieldsThreadActive = false;
-          LOG.info("Exiting thread for populating fields. collection=" + solrPropsConfig.getCollection());
-        }
-      };
-      fieldPopulationThread.setDaemon(true);
-      fieldPopulationThread.start();
+  private boolean serviceCollectionSetUp = false;
+  private boolean auditCollectionSetUp = false;
+  
+  private Map<String, String> serviceSchemaFieldNameMap = new HashMap<>();
+  private Map<String, String> serviceSchemaFieldTypeMap = new HashMap<>();
+  private Map<String, String> auditSchemaFieldNameMap = new HashMap<>();
+  private Map<String, String> auditSchemaFieldTypeMap = new HashMap<>();
+
+  @PostConstruct
+  public void init() {
+    this.serviceSolrClient = (CloudSolrClient) serviceSolrTemplate.getSolrClient();
+    this.auditSolrClient = (CloudSolrClient) auditSolrTemplate.getSolrClient();
+  }
+  
+  void serviceCollectionSetUp() {
+    this.serviceCollectionSetUp = true;
+  }
+  
+  void auditCollectionSetUp() {
+    this.auditCollectionSetUp = true;
+  }
+  
+  @Scheduled(fixedDelay = RETRY_SECOND * 1000)
+  public void populateAllSchemaFields() {
+    if (skipCount > 0) {
+      skipCount--;
+      return;
+    }
+    
+    if (serviceCollectionSetUp) {
+      populateSchemaFields(serviceSolrClient, serviceSchemaFieldNameMap, serviceSchemaFieldTypeMap);
+    }
+    if (auditCollectionSetUp) {
+      populateSchemaFields(auditSolrClient, auditSchemaFieldNameMap, auditSchemaFieldTypeMap);
     }
   }
 
-  /**
-   * Called from the thread. Don't call this directly
-   */
-  private boolean _populateSchemaFields(CloudSolrClient solrClient, SolrPropsConfig solrPropsConfig) {
-    String historyCollection = solrUserPropsConfig.getCollection();
-    if (solrClient != null && !solrPropsConfig.getCollection().equals(historyCollection)) {
-      LukeResponse lukeResponse = null;
+  private void populateSchemaFields(CloudSolrClient solrClient, Map<String, String> schemaFieldNameMap,
+      Map<String, String> schemaFieldTypeMap) {
+    if (solrClient != null) {
+      LOG.debug("Started thread to get fields for collection=" + solrClient.getDefaultCollection());
+      List<LukeResponse> lukeResponses = null;
       SchemaResponse schemaResponse = null;
       try {
-        LukeRequest lukeRequest = new LukeRequest();
-        lukeRequest.setNumTerms(0);
-        lukeResponse = lukeRequest.process(solrClient);
-        
+        lukeResponses = getLukeResponsesForCores(solrClient);
+
         SolrRequest<SchemaResponse> schemaRequest = new SchemaRequest();
         schemaRequest.setMethod(SolrRequest.METHOD.GET);
         schemaRequest.setPath("/schema");
         schemaResponse = schemaRequest.process(solrClient);
         
-        LOG.debug("populateSchemaFields() collection=" + solrPropsConfig.getCollection() + ", luke=" + lukeResponse +
+        LOG.debug("populateSchemaFields() collection=" + solrClient.getDefaultCollection() + ", luke=" + lukeResponses +
             ", schema= " + schemaResponse);
       } catch (SolrException | SolrServerException | IOException e) {
-        LOG.error("Error occured while popuplating field. collection=" + solrPropsConfig.getCollection(), e);
+        LOG.error("Error occured while popuplating field. collection=" + solrClient.getDefaultCollection(), e);
       }
 
-      if (lukeResponse != null && schemaResponse != null) {
-        extractSchemaFieldsName(lukeResponse, schemaResponse);
-        return true;
+      if (schemaResponse != null) {
+        extractSchemaFieldsName(lukeResponses, schemaResponse, schemaFieldNameMap, schemaFieldTypeMap);
+        LOG.debug("Populate fields for collection " + solrClient.getDefaultCollection()+ " was successful, next update it after " +
+            solrUserConfigPropsConfig.getPopulateIntervalMins() + " minutes");
+        retryCount = 0;
+        skipCount = (solrUserConfigPropsConfig.getPopulateIntervalMins() * 60) / RETRY_SECOND - 1;
+      }
+      else {
+        retryCount++;
+        LOG.error("Error while populating fields for collection " + solrClient.getDefaultCollection() + ", retryCount=" + retryCount);
       }
     }
-    return false;
+  }
+  
+  private static final String LUKE_REQUEST_URL_SUFFIX = "admin/luke?numTerms=0&wt=javabin&version=2";
+  
+  @SuppressWarnings("unchecked")
+  private List<LukeResponse> getLukeResponsesForCores(CloudSolrClient solrClient) {
+    ZkStateReader zkStateReader = solrClient.getZkStateReader();
+    Collection<Slice> activeSlices = zkStateReader.getClusterState().getActiveSlices(solrClient.getDefaultCollection());
+    
+    List<LukeResponse> lukeResponses = new ArrayList<>();
+    for (Slice slice : activeSlices) {
+      for (Replica replica : slice.getReplicas()) {
+        try (CloseableHttpClient httpClient = HttpClientUtil.createClient(null)) {
+          HttpGet request = new HttpGet(replica.getCoreUrl() + LUKE_REQUEST_URL_SUFFIX);
+          HttpResponse response = httpClient.execute(request);
+          NamedList<Object> lukeData = (NamedList<Object>) new JavaBinCodec(null, null).unmarshal(response.getEntity().getContent());
+          LukeResponse lukeResponse = new LukeResponse();
+          lukeResponse.setResponse(lukeData);
+          lukeResponses.add(lukeResponse);
+        } catch (IOException e) {
+          LOG.error("Exception during getting luke responses", e);
+        }
+      }
+    }
+    return lukeResponses;
   }
 
-  private void extractSchemaFieldsName(LukeResponse lukeResponse, SchemaResponse schemaResponse) {
+  private void extractSchemaFieldsName(List<LukeResponse> lukeResponses, SchemaResponse schemaResponse,
+      Map<String, String> schemaFieldNameMap, Map<String, String> schemaFieldTypeMap) {
     try {
       HashMap<String, String> _schemaFieldNameMap = new HashMap<>();
       HashMap<String, String> _schemaFieldTypeMap = new HashMap<>();
       
-      for (Entry<String, FieldInfo> e : lukeResponse.getFieldInfo().entrySet()) {
-        String name = e.getKey();
-        String type = e.getValue().getType();
-        if (!name.contains("@") && !name.startsWith("_") && !name.contains("_md5") && !name.contains("_ms") &&
-          !name.contains(LogSearchConstants.NGRAM_PREFIX) && !name.contains("tags") && !name.contains("_str")) {
-          _schemaFieldNameMap.put(name, type);
+      for (LukeResponse lukeResponse : lukeResponses) {
+        for (Entry<String, FieldInfo> e : lukeResponse.getFieldInfo().entrySet()) {
+          String name = e.getKey();
+          String type = e.getValue().getType();
+          if (!name.contains("@") && !name.startsWith("_") && !name.contains("_md5") && !name.contains("_ms") &&
+              !name.contains(LogSearchConstants.NGRAM_PREFIX) && !name.contains("tags") && !name.contains("_str")) {
+            _schemaFieldNameMap.put(name, type);
+          }
         }
       }
       
@@ -162,19 +217,21 @@ public class SolrSchemaFieldDao {
       }
       
       synchronized (this) {
-        schemaFieldNameMap = _schemaFieldNameMap;
-        schemaFieldTypeMap = _schemaFieldTypeMap;
+        schemaFieldNameMap.clear();
+        schemaFieldNameMap.putAll(_schemaFieldNameMap);
+        schemaFieldTypeMap.clear();
+        schemaFieldTypeMap.putAll(_schemaFieldTypeMap);
       }
     } catch (Exception e) {
       LOG.error(e + "Credentials not specified in logsearch.properties " + MessageEnums.ERROR_SYSTEM);
     }
   }
 
-  public synchronized Map<String, String> getSchemaFieldNameMap() {
-    return schemaFieldNameMap;
+  public Map<String, String> getSchemaFieldNameMap(LogType logType) {
+    return LogType.AUDIT == logType ? auditSchemaFieldNameMap : serviceSchemaFieldNameMap;
   }
 
-  public synchronized Map<String, String> getSchemaFieldTypeMap() {
-    return schemaFieldTypeMap;
+  public Map<String, String> getSchemaFieldTypeMap(LogType logType) {
+    return LogType.AUDIT == logType ? auditSchemaFieldTypeMap : serviceSchemaFieldTypeMap;
   }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/59c839c8/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/UserConfigSolrDao.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/UserConfigSolrDao.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/UserConfigSolrDao.java
index 418a405..106bedc 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/UserConfigSolrDao.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/UserConfigSolrDao.java
@@ -69,10 +69,6 @@ public class UserConfigSolrDao extends SolrDaoBase {
   private SolrCollectionDao solrCollectionDao;
 
   @Inject
-  @Named("userConfigSolrFieldDao")
-  private SolrSchemaFieldDao solrSchemaFieldDao;
-
-  @Inject
   @Named("userConfigSolrTemplate")
   private SolrTemplate userConfigSolrTemplate;
 
@@ -94,7 +90,6 @@ public class UserConfigSolrDao extends SolrDaoBase {
     try {
       solrCollectionDao.checkSolrStatus(getSolrClient());
       solrCollectionDao.setupCollections(getSolrClient(), solrUserConfig);
-      solrSchemaFieldDao.populateSchemaFields(getSolrClient(), solrUserConfig);
       intializeLogFeederFilter();
 
     } catch (Exception e) {
@@ -185,6 +180,6 @@ public class UserConfigSolrDao extends SolrDaoBase {
 
   @Override
   public SolrSchemaFieldDao getSolrSchemaFieldDao() {
-    return solrSchemaFieldDao;
+    throw new UnsupportedOperationException();
   }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/59c839c8/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 e6f5103..3639b88 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
@@ -90,6 +90,7 @@ public class DocConstants {
     public static final String GET_SERVICE_LOGS_SCHEMA_FIELD_NAME_OD = "Get service logs schema fields";
     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 class PublicOperationDescriptions {

http://git-wip-us.apache.org/repos/asf/ambari/blob/59c839c8/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 aded1d4..3ee1d17 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
@@ -36,8 +36,11 @@ import java.util.Map;
 import freemarker.template.Configuration;
 import freemarker.template.Template;
 import freemarker.template.TemplateException;
+
+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;
@@ -79,6 +82,8 @@ public class AuditLogsManager extends ManagerBase<SolrAuditLogData, AuditLogResp
   private ConversionService conversionService;
   @Inject
   private Configuration freemarkerConfiguration;
+  @Inject
+  private SolrSchemaFieldDao solrSchemaFieldDao;
 
   public AuditLogResponse getLogs(AuditLogRequest auditLogRequest) {
     return getLogAsPaginationProvided(conversionService.convert(auditLogRequest, SimpleQuery.class), auditSolrDao, "/audit/logs");
@@ -118,7 +123,7 @@ public class AuditLogsManager extends ManagerBase<SolrAuditLogData, AuditLogResp
   }
 
   public String getAuditLogsSchemaFieldsName() {
-    return convertObjToString(auditSolrDao.getSolrSchemaFieldDao().getSchemaFieldNameMap());
+    return convertObjToString(solrSchemaFieldDao.getSchemaFieldNameMap(LogType.AUDIT));
   }
 
   public BarGraphDataListResponse getServiceLoad(AuditServiceLoadRequest request) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/59c839c8/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 44d0c00..8986544 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
@@ -28,7 +28,6 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Locale;
 import java.util.Map;
-import java.util.Scanner;
 
 import javax.inject.Inject;
 import javax.inject.Named;
@@ -42,8 +41,10 @@ import freemarker.template.TemplateException;
 
 import org.apache.ambari.logsearch.common.HadoopServiceConfigHelper;
 import org.apache.ambari.logsearch.common.LogSearchConstants;
+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.ServiceAnyGraphRequest;
 import org.apache.ambari.logsearch.model.request.impl.ServiceGraphRequest;
@@ -71,7 +72,6 @@ import org.apache.ambari.logsearch.solr.model.SolrComponentTypeLogData;
 import org.apache.ambari.logsearch.solr.model.SolrHostLogData;
 import org.apache.ambari.logsearch.solr.model.SolrServiceLogData;
 import org.apache.ambari.logsearch.util.DownloadUtil;
-import org.apache.ambari.logsearch.util.JSONUtil;
 import org.apache.ambari.logsearch.util.DateUtil;
 import org.apache.ambari.logsearch.util.RESTErrorUtil;
 import org.apache.ambari.logsearch.util.SolrUtil;
@@ -116,6 +116,8 @@ public class ServiceLogsManager extends ManagerBase<SolrServiceLogData, ServiceL
   private ConversionService conversionService;
   @Inject
   private Configuration freemarkerConfiguration;
+  @Inject
+  private SolrSchemaFieldDao solrSchemaFieldDao;
 
   public ServiceLogResponse searchLogs(ServiceLogRequest request) {
     String event = "/service/logs";
@@ -418,7 +420,7 @@ public class ServiceLogsManager extends ManagerBase<SolrServiceLogData, ServiceL
   }
 
   public String getServiceLogsSchemaFieldsName() {
-    return convertObjToString(serviceLogsSolrDao.getSolrSchemaFieldDao().getSchemaFieldNameMap());
+    return convertObjToString(solrSchemaFieldDao.getSchemaFieldNameMap(LogType.SERVICE));
   }
 
   public BarGraphDataListResponse getAnyGraphCountData(ServiceAnyGraphRequest request) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/59c839c8/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/CommonSearchRequest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/CommonSearchRequest.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/CommonSearchRequest.java
index 7001cf3..2617c51 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/CommonSearchRequest.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/CommonSearchRequest.java
@@ -21,6 +21,8 @@ package org.apache.ambari.logsearch.model.request.impl;
 import org.apache.ambari.logsearch.common.LogSearchConstants;
 import org.apache.ambari.logsearch.model.request.CommonSearchParamDefinition;
 import org.apache.ambari.logsearch.model.request.SearchRequest;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
 
 import javax.ws.rs.QueryParam;
 
@@ -116,4 +118,9 @@ public class CommonSearchRequest implements SearchRequest, CommonSearchParamDefi
   public void setEndTime(String endTime) {
     this.endTime = endTime;
   }
+  
+  @Override
+  public String toString() {
+    return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
+  }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/59c839c8/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 492a5b2..3e1e120 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
@@ -184,4 +184,13 @@ public class ServiceLogsResource {
   public String getHadoopServiceConfigJSON() {
     return serviceLogsManager.getHadoopServiceConfigJSON();
   }
+
+  @GET
+  @Path("/request/cancel")
+  @Produces({"application/json"})
+  @ApiOperation(REQUEST_CANCEL)
+  public String cancelRequest() {
+    // TODO: create function that cancels an ongoing solr request
+    return "{\"endpoint status\": \"not supported yet\"}";
+  }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/59c839c8/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/util/SolrUtil.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/util/SolrUtil.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/util/SolrUtil.java
index 7a856d2..a3824de 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/util/SolrUtil.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/util/SolrUtil.java
@@ -35,7 +35,7 @@ import org.apache.solr.schema.TrieFloatField;
 import org.apache.solr.schema.TrieIntField;
 import org.apache.solr.schema.TrieLongField;
 import org.apache.commons.collections.MapUtils;
-import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang3.StringUtils;
 
 public class SolrUtil {
   private SolrUtil() {
@@ -74,50 +74,14 @@ public class SolrUtil {
     if (search == null) {
       return null;
     }
-    String newString = search.trim();
-    String newSearch = escapeQueryChars(newString);
-    boolean isSingleWord = true;
-    for (int i = 0; i < search.length(); i++) {
-      if (Character.isWhitespace(search.charAt(i))) {
-        isSingleWord = false;
-      }
-    }
-    if (!isSingleWord) {
+    String newSearch = escapeQueryChars(search.trim());
+    if (StringUtils.containsWhitespace(newSearch)) {
       newSearch = "\"" + newSearch + "\"";
     }
 
     return newSearch;
   }
 
-  private static String escapeForKeyTokenizer(String search) {
-    if (search.startsWith("*") && search.endsWith("*") && StringUtils.isNotBlank(search)) {
-      // Remove the * from both the sides
-      if (search.length() > 1) {
-        search = search.substring(1, search.length() - 1);
-      } else {
-        //search string have only * 
-        search="";
-      }
-    }
-    search = escapeQueryChars(search);
-
-    return "*" + search + "*";
-  }
-
-  /**
-   * This is a special case scenario to handle log_message for wild card
-   * scenarios
-   */
-  public static String escapeForLogMessage(String search) {
-    if (search.startsWith("*") && search.endsWith("*")) {
-      search = escapeForKeyTokenizer(search);
-    } else {
-      // Use whitespace index
-      search = escapeForStandardTokenizer(search);
-    }
-    return search;
-  }
-
   private static String makeSolrSearchStringWithoutAsterisk(String search) {
     String newString = search.trim();
     String newSearch = newString.replaceAll("(?=[]\\[+&|!(){}^\"~=/$@%?:.\\\\])", "\\\\");
@@ -152,48 +116,45 @@ public class SolrUtil {
   }
   
 
-  private static boolean isSolrFieldNumber(String fieldType, Map<String, String> schemaFieldsMap) {
-    if (StringUtils.isBlank(fieldType)) {
+  private static boolean isSolrFieldNumber(Map<String, Object> fieldTypeInfoMap) {
+    if (MapUtils.isEmpty(fieldTypeInfoMap)) {
       return false;
-    } else {
-      HashMap<String, Object> typeInfoMap = getFieldTypeInfoMap(fieldType, schemaFieldsMap);
-      if (MapUtils.isEmpty(typeInfoMap)) {
-        return false;
-      }
-      String fieldTypeClassName = (String) typeInfoMap.get("class");
-      return fieldTypeClassName.equalsIgnoreCase(TrieIntField.class.getSimpleName()) ||
-             fieldTypeClassName.equalsIgnoreCase(TrieDoubleField.class.getSimpleName()) ||
-             fieldTypeClassName.equalsIgnoreCase(TrieFloatField.class.getSimpleName()) ||
-             fieldTypeClassName.equalsIgnoreCase(TrieLongField.class.getSimpleName());
     }
+    String fieldTypeClassName = (String) fieldTypeInfoMap.get("class");
+    return fieldTypeClassName.equalsIgnoreCase(TrieIntField.class.getSimpleName()) ||
+           fieldTypeClassName.equalsIgnoreCase(TrieDoubleField.class.getSimpleName()) ||
+           fieldTypeClassName.equalsIgnoreCase(TrieFloatField.class.getSimpleName()) ||
+           fieldTypeClassName.equalsIgnoreCase(TrieLongField.class.getSimpleName());
   }
 
-  public static String putWildCardByType(String str, String key, Map<String, String> schemaFieldsMap) {
-    String fieldType = schemaFieldsMap.get(key);
+  public static String putWildCardByType(String str, String fieldType, String fieldTypeMetaData) {
+    Map<String, Object> fieldTypeInfoMap = getFieldTypeInfoMap(fieldTypeMetaData);
     if (StringUtils.isNotBlank(fieldType)) {
-      if (isSolrFieldNumber(fieldType, schemaFieldsMap)) {
-        String value = putEscapeCharacterForNumber(str, fieldType, schemaFieldsMap);
+      if (isSolrFieldNumber(fieldTypeInfoMap)) {
+        String value = putEscapeCharacterForNumber(str, fieldTypeInfoMap);
         if (StringUtils.isNotBlank(value)) {
           return value;
         } else {
           return null;
         }
-      } else if (checkTokenizer(fieldType, StandardTokenizerFactory.class, schemaFieldsMap)) {
+      } else if (checkTokenizer(StandardTokenizerFactory.class, fieldTypeInfoMap)) {
         return escapeForStandardTokenizer(str);
-      } else if (checkTokenizer(fieldType, KeywordTokenizerFactory.class, schemaFieldsMap)|| "string".equalsIgnoreCase(fieldType)) {
+      } else if (checkTokenizer(KeywordTokenizerFactory.class, fieldTypeInfoMap) || "string".equalsIgnoreCase(fieldType)) {
         return makeSolrSearchStringWithoutAsterisk(str);
-      } else if (checkTokenizer(fieldType, PathHierarchyTokenizerFactory.class, schemaFieldsMap)) {
+      } else if (checkTokenizer(PathHierarchyTokenizerFactory.class, fieldTypeInfoMap)) {
         return str;
+      } else {
+        return escapeQueryChars(str);
       }
     }
     return str;
   }
 
-  private static String putEscapeCharacterForNumber(String str,String fieldType, Map<String, String> schemaFieldsMap) {
+  private static String putEscapeCharacterForNumber(String str, Map<String, Object> fieldTypeInfoMap) {
     if (StringUtils.isNotEmpty(str)) {
       str = str.replace("*", "");
     }
-    String escapeCharSting = parseInputValueAsPerFieldType(str,fieldType, schemaFieldsMap);
+    String escapeCharSting = parseInputValueAsPerFieldType(str, fieldTypeInfoMap);
     if (escapeCharSting == null || escapeCharSting.isEmpty()) {
       return null;
     }
@@ -201,9 +162,8 @@ public class SolrUtil {
     return escapeCharSting;
   }
 
-  private static String parseInputValueAsPerFieldType(String str,String fieldType, Map<String, String> schemaFieldsMap) {
+  private static String parseInputValueAsPerFieldType(String str, Map<String, Object> fieldTypeInfoMap) {
     try {
-      HashMap<String, Object> fieldTypeInfoMap = SolrUtil.getFieldTypeInfoMap(fieldType, schemaFieldsMap);
       String className = (String) fieldTypeInfoMap.get("class");
       if (className.equalsIgnoreCase(TrieDoubleField.class.getSimpleName())) {
         return "" + Double.parseDouble(str);
@@ -219,8 +179,7 @@ public class SolrUtil {
     }
   }
   
-  private static HashMap<String, Object> getFieldTypeInfoMap(String fieldType, Map<String, String> schemaFieldsTypeMap) {
-    String fieldTypeMetaData = schemaFieldsTypeMap.get(fieldType);
+  private static Map<String, Object> getFieldTypeInfoMap(String fieldTypeMetaData) {
     HashMap<String, Object> fieldTypeMap = JSONUtil.jsonToMapObject(fieldTypeMetaData);
     if (fieldTypeMap == null) {
       return new HashMap<>();
@@ -269,10 +228,8 @@ public class SolrUtil {
   }
 
   @SuppressWarnings("unchecked")
-  private static boolean checkTokenizer(String fieldType, Class<? extends TokenizerFactory> tokenizerFactoryClass,
-      Map<String, String> schemaFieldsMap) {
-    HashMap<String, Object> fieldTypeMap = SolrUtil.getFieldTypeInfoMap(fieldType ,schemaFieldsMap);
-    HashMap<String, Object> analyzer = (HashMap<String, Object>) fieldTypeMap.get("analyzer");
+  private static boolean checkTokenizer(Class<? extends TokenizerFactory> tokenizerFactoryClass, Map<String, Object> fieldTypeInfoMap) {
+    HashMap<String, Object> analyzer = (HashMap<String, Object>) fieldTypeInfoMap.get("analyzer");
     HashMap<String, Object> tokenizerMap = (HashMap<String, Object>)MapUtils.getObject(analyzer, "tokenizer");
     if (tokenizerMap != null) {
       String tokenizerClass = (String) tokenizerMap.get("class");

http://git-wip-us.apache.org/repos/asf/ambari/blob/59c839c8/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/tabs/LogFileView.js
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/tabs/LogFileView.js b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/tabs/LogFileView.js
index a4e3a1a..57d4acd 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/tabs/LogFileView.js
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/tabs/LogFileView.js
@@ -596,12 +596,13 @@ define(['require',
                         this.ui.find.trigger("keyup");
                         this.ui.find.focus();
                     }else if(type === "IA" || type === "EA"){
-    					this.vent.trigger("toggle:facet",{viewName:((type === "IA") ? "include" : "exclude") +"ServiceColumns",
-    						key:Globals.serviceLogsColumns["log_message"],value:"*"+this.selectionText+"*"});
-    				}
+                        this.vent.trigger("toggle:facet",{viewName:((type === "IA") ? "include" : "exclude") +"ServiceColumns",
+                          key:Globals.defaultServiceLogMappings["log_message"],value:"*"+this.selectionText+"*"});
+                    }
                     else {
                         //this.vent.trigger("add:include:exclude",{type:type,value:this.selectionText});
-                        this.vent.trigger("toggle:facet", { viewName: ((type === "I") ? "include" : "exclude") + "ServiceColumns", key: Globals.serviceLogsColumns["log_message"], value: this.selectionText });
+                        this.vent.trigger("toggle:facet", { viewName: ((type === "I") ? "include" : "exclude") + "ServiceColumns",
+                          key: Globals.defaultServiceLogMappings["log_message"], value: this.selectionText });
                     }
                     this.ui.contextMenu.hide();
                 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/59c839c8/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/static/schema_fields.json
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/static/schema_fields.json b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/static/schema_fields.json
index 55f1d3c..d145141 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/static/schema_fields.json
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/static/schema_fields.json
@@ -46,7 +46,7 @@
     "logType": "Log Type",
     "logfile_line_number": "Logfile Line Number",
     "logger_name": "Logger Name",
-    "logtime": "logtime",
+    "logtime": "Log Time",
     "path": "Path",
     "perm": "Perm",
     "policy": "Policy",
@@ -76,11 +76,13 @@
     "ws_repo_id": "Repo Id",
     "ws_repo_version": "Repo Version",
     "ws_repositories": "Repositories",
+    "ws_request_id": "Request Id",
     "ws_result_status": "Result Status",
     "ws_roles": "Roles",
     "ws_stack_version": "Stack Version",
     "ws_stack": "Stack",
     "ws_status": "Status",
+    "ws_task_id": "Task Id",
     "ws_version_note": "Version Note",
     "ws_version_number": "Version Number"
   },

http://git-wip-us.apache.org/repos/asf/ambari/blob/59c839c8/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/AuditLogRequestConverterTest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/AuditLogRequestConverterTest.java b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/AuditLogRequestConverterTest.java
index ec6aad7..1aae82a 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/AuditLogRequestConverterTest.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/AuditLogRequestConverterTest.java
@@ -46,7 +46,7 @@ public class AuditLogRequestConverterTest extends AbstractRequestConverterTest {
     SolrQuery queryResult = new DefaultQueryParser().doConstructSolrQuery(simpleQuery);
     // THEN
     assertEquals("?q=*%3A*&start=0&rows=25&fq=repo%3A%28logsearch_app+secure_log%29&fq=-repo%3A%28hst_agent+system_message%29" +
-      "&fq=log_message%3A*myincludemessage*&fq=-log_message%3A*myexcludemessage*&sort=evtTime+desc%2Cseq_num+desc",
+      "&fq=log_message%3Amyincludemessage&fq=-log_message%3Amyexcludemessage&sort=evtTime+desc%2Cseq_num+desc",
       queryResult.toQueryString());
   }
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/59c839c8/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/AuditServiceLoadRequestQueryConverterTest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/AuditServiceLoadRequestQueryConverterTest.java b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/AuditServiceLoadRequestQueryConverterTest.java
index 71e91e1..2b629e5 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/AuditServiceLoadRequestQueryConverterTest.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/AuditServiceLoadRequestQueryConverterTest.java
@@ -43,8 +43,8 @@ public class AuditServiceLoadRequestQueryConverterTest extends AbstractRequestCo
     // WHEN
     SolrQuery solrQuery = new DefaultQueryParser().doConstructSolrQuery(underTest.convert(request));
     // THEN
-    assertEquals("?q=*%3A*&rows=0&fq=evtTime%3A%5B2016-09-13T22%3A00%3A01.000Z+TO+2016-09-14T22%3A00%3A01.000Z%5D&fq=log_message%3A*myincludemessage*&" +
-      "fq=-log_message%3A*myexcludemessage*&fq=repo%3A%28logsearch_app+secure_log%29&fq=-repo%3A%28hst_agent+system_message%29" +
+    assertEquals("?q=*%3A*&rows=0&fq=evtTime%3A%5B2016-09-13T22%3A00%3A01.000Z+TO+2016-09-14T22%3A00%3A01.000Z%5D&fq=log_message%3Amyincludemessage&" +
+      "fq=-log_message%3Amyexcludemessage&fq=repo%3A%28logsearch_app+secure_log%29&fq=-repo%3A%28hst_agent+system_message%29" +
       "&facet=true&facet.mincount=1&facet.limit=10&facet.field=repo", solrQuery.toQueryString());
   }
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/59c839c8/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/BaseServiceLogRequestQueryConverterTest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/BaseServiceLogRequestQueryConverterTest.java b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/BaseServiceLogRequestQueryConverterTest.java
index 3775a2d..89f8eba 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/BaseServiceLogRequestQueryConverterTest.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/BaseServiceLogRequestQueryConverterTest.java
@@ -53,7 +53,7 @@ public class BaseServiceLogRequestQueryConverterTest extends AbstractRequestConv
     SolrUtil.removeDoubleOrTripleEscapeFromFilters(solrQuery);
     // THEN
     assertEquals("?q=*%3A*&start=0&rows=25&fq=type%3A%28logsearch_app+secure_log%29&fq=-type%3A%28hst_agent+system_message%29" +
-      "&fq=log_message%3A*myincludemessage*&fq=-log_message%3A*myexcludemessage*&fq=host%3Alogsearch.com" +
+      "&fq=log_message%3Amyincludemessage&fq=-log_message%3Amyexcludemessage&fq=host%3Alogsearch.com" +
       "&fq=path%3A%5C%2Fvar%5C%2Flog%5C%2Fmyfile%5C-%5C*%5C-hdfs.log&fq=type%3Acomponent&fq=level%3A%28FATAL+ERROR+WARN+UNKNOWN%29" +
       "&fq=logtime%3A%5B2016-09-13T22%3A00%3A01.000Z+TO+2016-09-14T22%3A00%3A01.000Z%5D&sort=logtime+desc%2Cseq_num+desc",
       solrQuery.toQueryString());

http://git-wip-us.apache.org/repos/asf/ambari/blob/59c839c8/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/FieldAuditLogRequestQueryConverterTest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/FieldAuditLogRequestQueryConverterTest.java b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/FieldAuditLogRequestQueryConverterTest.java
index 1864af3..1428276 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/FieldAuditLogRequestQueryConverterTest.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/FieldAuditLogRequestQueryConverterTest.java
@@ -46,7 +46,7 @@ public class FieldAuditLogRequestQueryConverterTest extends AbstractRequestConve
     SolrQuery query = new DefaultQueryParser().doConstructSolrQuery(underTest.convert(request));
     // THEN
     assertEquals("?q=*%3A*&rows=0&fq=evtTime%3A%5B2016-09-13T22%3A00%3A01.000Z+TO+2016-09-14T22%3A00%3A01.000Z%5D&" +
-      "fq=log_message%3A*myincludemessage*&fq=-log_message%3A*myexcludemessage*&fq=repo%3A%28logsearch_app+secure_log%29&" +
+      "fq=log_message%3Amyincludemessage&fq=-log_message%3Amyexcludemessage&fq=repo%3A%28logsearch_app+secure_log%29&" +
       "fq=-repo%3A%28hst_agent+system_message%29&facet=true&facet.mincount=1&facet.limit=10&facet.pivot=myfield%2Crepo",
       query.toQueryString());
   }

http://git-wip-us.apache.org/repos/asf/ambari/blob/59c839c8/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/ServiceLogAnyGraphRequestConverterTest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/ServiceLogAnyGraphRequestConverterTest.java b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/ServiceLogAnyGraphRequestConverterTest.java
index 63dc733..5d15166 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/ServiceLogAnyGraphRequestConverterTest.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/ServiceLogAnyGraphRequestConverterTest.java
@@ -44,8 +44,8 @@ public class ServiceLogAnyGraphRequestConverterTest extends AbstractRequestConve
     // WHEN
     SolrQuery query = new DefaultQueryParser().doConstructSolrQuery(underTest.convert(request));
     // THEN
-    assertEquals("?q=*%3A*&rows=0&fq=logtime%3A%5B2016-09-13T22%3A00%3A01.000Z+TO+2016-09-14T22%3A00%3A01.000Z%5D&fq=log_message%3A*myincludemessage*" +
-      "&fq=-log_message%3A*myexcludemessage*&fq=type%3A%28logsearch_app+secure_log%29&fq=-type%3A%28hst_agent+system_message%29" +
+    assertEquals("?q=*%3A*&rows=0&fq=logtime%3A%5B2016-09-13T22%3A00%3A01.000Z+TO+2016-09-14T22%3A00%3A01.000Z%5D&fq=log_message%3Amyincludemessage" +
+      "&fq=-log_message%3Amyexcludemessage&fq=type%3A%28logsearch_app+secure_log%29&fq=-type%3A%28hst_agent+system_message%29" +
       "&facet=true&facet.mincount=1&facet.limit=-1&facet.field=level", query.toQueryString());
   }
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/59c839c8/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/ServiceLogComponentLevelRequestQueryConverterTest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/ServiceLogComponentLevelRequestQueryConverterTest.java b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/ServiceLogComponentLevelRequestQueryConverterTest.java
index 2a7cc16..b1ae332 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/ServiceLogComponentLevelRequestQueryConverterTest.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/ServiceLogComponentLevelRequestQueryConverterTest.java
@@ -45,8 +45,8 @@ public class ServiceLogComponentLevelRequestQueryConverterTest extends AbstractR
     // WHEN
     SolrQuery query = new DefaultQueryParser().doConstructSolrQuery(underTest.convert(request));
     // THEN
-    assertEquals("?q=*%3A*&rows=0&fq=logtime%3A%5B2016-09-13T22%3A00%3A01.000Z+TO+2016-09-14T22%3A00%3A01.000Z%5D&fq=log_message%3A*myincludemessage*" +
-      "&fq=-log_message%3A*myexcludemessage*&fq=type%3A%28logsearch_app+secure_log%29&fq=-type%3A%28hst_agent+system_message%29" +
+    assertEquals("?q=*%3A*&rows=0&fq=logtime%3A%5B2016-09-13T22%3A00%3A01.000Z+TO+2016-09-14T22%3A00%3A01.000Z%5D&fq=log_message%3Amyincludemessage" +
+      "&fq=-log_message%3Amyexcludemessage&fq=type%3A%28logsearch_app+secure_log%29&fq=-type%3A%28hst_agent+system_message%29" +
       "&fq=level%3A%28WARN+ERROR+FATAL%29&facet=true&facet.mincount=1&facet.limit=-1&facet.sort=index&facet.pivot=type%2Clevel",
       query.toQueryString());
   }

http://git-wip-us.apache.org/repos/asf/ambari/blob/59c839c8/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/ServiceLogComponentRequestFacetQueryConverterTest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/ServiceLogComponentRequestFacetQueryConverterTest.java b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/ServiceLogComponentRequestFacetQueryConverterTest.java
index a5ea683..3c7f242 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/ServiceLogComponentRequestFacetQueryConverterTest.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/ServiceLogComponentRequestFacetQueryConverterTest.java
@@ -46,7 +46,7 @@ public class ServiceLogComponentRequestFacetQueryConverterTest extends AbstractR
     SolrQuery query = new DefaultQueryParser().doConstructSolrQuery(underTest.convert(request));
     // THEN
     assertEquals("?q=*%3A*&rows=0&fq=logtime%3A%5B2016-09-13T22%3A00%3A01.000Z+TO+2016-09-14T22%3A00%3A01.000Z%5D" +
-      "&fq=log_message%3A*myincludemessage*&fq=-log_message%3A*myexcludemessage*&fq=type%3A%28logsearch_app+secure_log%29" +
+      "&fq=log_message%3Amyincludemessage&fq=-log_message%3Amyexcludemessage&fq=type%3A%28logsearch_app+secure_log%29" +
       "&fq=-type%3A%28hst_agent+system_message%29&fq=level%3A%28WARN+ERROR+FATAL%29&facet=true&facet.mincount=1&facet.limit=-1" +
       "&facet.sort=index&facet.pivot=type%2Chost%2Clevel&facet.pivot=type%2Clevel",
       query.toQueryString());

http://git-wip-us.apache.org/repos/asf/ambari/blob/59c839c8/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/ServiceLogLevelCountRequestQueryConverterTest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/ServiceLogLevelCountRequestQueryConverterTest.java b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/ServiceLogLevelCountRequestQueryConverterTest.java
index b79ff91..f6beb3d 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/ServiceLogLevelCountRequestQueryConverterTest.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/ServiceLogLevelCountRequestQueryConverterTest.java
@@ -44,7 +44,7 @@ public class ServiceLogLevelCountRequestQueryConverterTest extends AbstractReque
     SolrQuery query = new DefaultQueryParser().doConstructSolrQuery(underTest.convert(request));
     // THEN
     assertEquals("?q=*%3A*&rows=0&fq=logtime%3A%5B2016-09-13T22%3A00%3A01.000Z+TO+2016-09-14T22%3A00%3A01.000Z%5D" +
-      "&fq=log_message%3A*myincludemessage*&fq=-log_message%3A*myexcludemessage*&fq=type%3A%28logsearch_app+secure_log%29" +
+      "&fq=log_message%3Amyincludemessage&fq=-log_message%3Amyexcludemessage&fq=type%3A%28logsearch_app+secure_log%29" +
       "&fq=-type%3A%28hst_agent+system_message%29&facet=true&facet.mincount=1&facet.limit=-1&facet.field=level",
       query.toQueryString());
   }

http://git-wip-us.apache.org/repos/asf/ambari/blob/59c839c8/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 634ac19..107a99d 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
@@ -44,8 +44,8 @@ public class ServiceLogTreeRequestFacetQueryConverterTest extends AbstractReques
     // WHEN
     SolrQuery query = new DefaultQueryParser().doConstructSolrQuery(underTest.convert(request));
     // THEN
-    assertEquals("?q=*%3A*&rows=0&fq=logtime%3A%5B2016-09-13T22%3A00%3A01.000Z+TO+2016-09-14T22%3A00%3A01.000Z%5D&fq=log_message%3A*myincludemessage*" +
-      "&fq=-log_message%3A*myexcludemessage*&fq=type%3A%28logsearch_app+secure_log%29&fq=-type%3A%28hst_agent+system_message%29&fq=level%3A%28WARN+ERROR+FATAL%29" +
+    assertEquals("?q=*%3A*&rows=0&fq=logtime%3A%5B2016-09-13T22%3A00%3A01.000Z+TO+2016-09-14T22%3A00%3A01.000Z%5D&fq=log_message%3Amyincludemessage" +
+      "&fq=-log_message%3Amyexcludemessage&fq=type%3A%28logsearch_app+secure_log%29&fq=-type%3A%28hst_agent+system_message%29&fq=level%3A%28WARN+ERROR+FATAL%29" +
       "&facet=true&facet.mincount=1&facet.limit=-1&facet.sort=index&facet.pivot=host%2Ctype%2Clevel&facet.pivot=host%2Clevel",
       query.toQueryString());
   }

http://git-wip-us.apache.org/repos/asf/ambari/blob/59c839c8/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/ServiceLogTruncatedRequestQueryConverterTest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/ServiceLogTruncatedRequestQueryConverterTest.java b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/ServiceLogTruncatedRequestQueryConverterTest.java
index 41761bc..0151c6c 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/ServiceLogTruncatedRequestQueryConverterTest.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/ServiceLogTruncatedRequestQueryConverterTest.java
@@ -47,7 +47,7 @@ public class ServiceLogTruncatedRequestQueryConverterTest extends AbstractReques
     SolrQuery query = new DefaultQueryParser().doConstructSolrQuery(underTest.convert(request));
     // THEN
     assertEquals("?q=*%3A*&start=0&rows=10&fq=type%3A%28logsearch_app+secure_log%29&fq=-type%3A%28hst_agent+system_message%29" +
-      "&fq=log_message%3A*myincludemessage*&fq=-log_message%3A*myexcludemessage*&sort=logtime+desc%2Cseq_num+desc",
+      "&fq=log_message%3Amyincludemessage&fq=-log_message%3Amyexcludemessage&sort=logtime+desc%2Cseq_num+desc",
       query.toQueryString());
   }
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/59c839c8/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/UserExportRequestQueryConverterTest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/UserExportRequestQueryConverterTest.java b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/UserExportRequestQueryConverterTest.java
index 6644ca1..1608bbf 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/UserExportRequestQueryConverterTest.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/UserExportRequestQueryConverterTest.java
@@ -44,7 +44,7 @@ public class UserExportRequestQueryConverterTest extends AbstractRequestConverte
     SolrQuery query = new DefaultQueryParser().doConstructSolrQuery(underTest.convert(request));
     // THEN
     assertEquals("?q=*%3A*&rows=0&fq=evtTime%3A%5B2016-09-13T22%3A00%3A01.000Z+TO+2016-09-14T22%3A00%3A01.000Z%5D" +
-      "&fq=log_message%3A*myincludemessage*&fq=-log_message%3A*myexcludemessage*&fq=repo%3A%28logsearch_app+secure_log%29" +
+      "&fq=log_message%3Amyincludemessage&fq=-log_message%3Amyexcludemessage&fq=repo%3A%28logsearch_app+secure_log%29" +
       "&fq=-repo%3A%28hst_agent+system_message%29&facet=true&facet.mincount=1&facet.limit=-1&facet.pivot=reqUser%2Crepo&facet.pivot=resource%2Crepo",
       query.toQueryString());
   }

http://git-wip-us.apache.org/repos/asf/ambari/blob/59c839c8/ambari-logsearch/docker/test-config/logfeeder/shipper-conf/input.config-ambari.json
----------------------------------------------------------------------
diff --git a/ambari-logsearch/docker/test-config/logfeeder/shipper-conf/input.config-ambari.json b/ambari-logsearch/docker/test-config/logfeeder/shipper-conf/input.config-ambari.json
index 576bfa8..2dfe6d3 100644
--- a/ambari-logsearch/docker/test-config/logfeeder/shipper-conf/input.config-ambari.json
+++ b/ambari-logsearch/docker/test-config/logfeeder/shipper-conf/input.config-ambari.json
@@ -282,16 +282,6 @@
             "new_fieldname":"cliType"
           }
         },
-        "RequestId":{
-          "map_fieldname":{
-            "new_fieldname":"request_id"
-          }
-        },
-        "TaskId":{
-          "map_fieldname":{
-            "new_fieldname":"task_id"
-          }
-        },
         "Operation":{
           "map_fieldname":{
             "new_fieldname":"action"
@@ -374,6 +364,11 @@
             "new_fieldname":"ws_repositories"
           }
         },
+        "RequestId":{
+          "map_fieldname":{
+            "new_fieldname":"ws_request_id"
+          }
+        },
         "Roles":{
           "map_fieldname":{
             "new_fieldname":"ws_roles"
@@ -389,6 +384,11 @@
             "new_fieldname":"ws_stack_version"
           }
         },
+        "TaskId":{
+          "map_fieldname":{
+            "new_fieldname":"ws_task_id"
+          }
+        },
         "VersionNote":{
           "map_fieldvalue":{
             "pre_value":"null",


[05/58] [abbrv] ambari git commit: AMBARI-18310. Refactor logsearch portal side code (oleewere)

Posted by ol...@apache.org.
http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/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
new file mode 100644
index 0000000..41d8a31
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/NodeData.java
@@ -0,0 +1,111 @@
+/*
+ * 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 com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+import java.util.Collection;
+
+@ApiModel
+@JsonInclude(value = JsonInclude.Include.NON_NULL)
+public class NodeData {
+
+  @ApiModelProperty
+  private String name;
+
+  @ApiModelProperty
+  private String type;
+
+  @ApiModelProperty
+  private String value;
+
+  @ApiModelProperty
+  private Collection<NodeData> childs;
+
+  @ApiModelProperty
+  private Collection<NameValueData> logLevelCount;
+
+  @ApiModelProperty
+  @JsonProperty("isParent")
+  private boolean parent;
+
+  @ApiModelProperty
+  @JsonProperty("isRoot")
+  private boolean root;
+
+  public String getName() {
+    return name;
+  }
+
+  public void setName(String name) {
+    this.name = name;
+  }
+
+  public String getType() {
+    return type;
+  }
+
+  public void setType(String type) {
+    this.type = type;
+  }
+
+  public String getValue() {
+    return value;
+  }
+
+  public void setValue(String value) {
+    this.value = value;
+  }
+
+  public boolean isRoot() {
+    return root;
+  }
+
+  public void setRoot(boolean root) {
+    this.root = root;
+  }
+
+  public Collection<NodeData> getChilds() {
+    return childs;
+  }
+
+  public void setChilds(Collection<NodeData> childs) {
+    this.childs = childs;
+  }
+
+  public Collection<NameValueData> getLogLevelCount() {
+    return logLevelCount;
+  }
+
+  public void setLogLevelCount(Collection<NameValueData> logLevelCount) {
+    this.logLevelCount = logLevelCount;
+  }
+
+  public boolean isParent() {
+    return parent;
+  }
+
+  public void setParent(boolean parent) {
+    this.parent = parent;
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/NodeListResponse.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/NodeListResponse.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/NodeListResponse.java
new file mode 100644
index 0000000..51044b3
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/NodeListResponse.java
@@ -0,0 +1,50 @@
+/*
+ * 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.ArrayList;
+import java.util.List;
+
+@ApiModel
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class NodeListResponse extends SearchResponse {
+
+  @ApiModelProperty
+  protected List<NodeData> vNodeList = new ArrayList<NodeData>();
+
+  public List<NodeData> getvNodeList() {
+    return vNodeList;
+  }
+
+  public void setvNodeList(List<NodeData> vNodeList) {
+    this.vNodeList = vNodeList;
+  }
+
+  @Override
+  public int getListSize() {
+    if (vNodeList == null) {
+      return 0;
+    }
+    return vNodeList.size();
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/SearchResponse.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/SearchResponse.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/SearchResponse.java
new file mode 100644
index 0000000..dd88d29
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/SearchResponse.java
@@ -0,0 +1,110 @@
+/*
+ * 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;
+
+@JsonIgnoreProperties(ignoreUnknown = true)
+public abstract class SearchResponse {
+  /**
+   * Start index for the result
+   */
+  private int startIndex;
+  /**
+   * Page size used for the result
+   */
+  private int pageSize;
+  /**
+   * Total records in the database for the given search conditions
+   */
+  private long totalCount;
+  /**
+   * Number of rows returned for the search condition
+   */
+  private int resultSize;
+  /**
+   * Sort type. Either desc or asc
+   */
+  private String sortType;
+  /**
+   * Comma seperated list of the fields for sorting
+   */
+  private String sortBy;
+
+  private long queryTimeMS = System.currentTimeMillis();
+
+  public int getStartIndex() {
+    return startIndex;
+  }
+
+  public int getPageSize() {
+    return pageSize;
+  }
+
+  public long getTotalCount() {
+    return totalCount;
+  }
+
+  public int getResultSize() {
+    return resultSize;
+  }
+
+  public String getSortType() {
+    return sortType;
+  }
+
+  public String getSortBy() {
+    return sortBy;
+  }
+
+  public long getQueryTimeMS() {
+    return queryTimeMS;
+  }
+
+  public void setStartIndex(int startIndex) {
+    this.startIndex = startIndex;
+  }
+
+  public void setPageSize(int pageSize) {
+    this.pageSize = pageSize;
+  }
+
+  public void setTotalCount(long totalCount) {
+    this.totalCount = totalCount;
+  }
+
+  public void setResultSize(int resultSize) {
+    this.resultSize = resultSize;
+  }
+
+  public void setSortType(String sortType) {
+    this.sortType = sortType;
+  }
+
+  public void setSortBy(String sortBy) {
+    this.sortBy = sortBy;
+  }
+
+  public void setQueryTimeMS(long queryTimeMS) {
+    this.queryTimeMS = queryTimeMS;
+  }
+
+  public abstract int getListSize();
+
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/ServiceLogData.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/ServiceLogData.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/ServiceLogData.java
new file mode 100644
index 0000000..16aed16
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/ServiceLogData.java
@@ -0,0 +1,63 @@
+/*
+ * 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 com.fasterxml.jackson.annotation.JsonProperty;
+
+import java.util.Date;
+
+@JsonIgnoreProperties(ignoreUnknown = true)
+public interface ServiceLogData extends CommonLogData, ComponentTypeLogData, HostLogData {
+
+  @JsonProperty("level")
+  String getLevel();
+
+  void setLevel(String level);
+
+  @JsonProperty("line_number")
+  Integer getLineNumber();
+
+  void setLineNumber(Integer lineNumber);
+
+  @JsonProperty("logtime")
+  Date getLogTime();
+
+  void setLogTime(Date logTime);
+
+  @JsonProperty("ip")
+  String getIp();
+
+  void setIp(String ip);
+
+  @JsonProperty("path")
+  String getPath();
+
+  void setPath(String path);
+
+  @JsonProperty("type")
+  String getType();
+
+  void setType(String type);
+
+  @JsonProperty("host")
+  String getHost();
+
+  void setHost(String host);
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/ServiceLogResponse.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/ServiceLogResponse.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/ServiceLogResponse.java
new file mode 100644
index 0000000..2e689c1
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/ServiceLogResponse.java
@@ -0,0 +1,48 @@
+/*
+ * 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.List;
+
+@ApiModel
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class ServiceLogResponse extends LogSearchResponse<ServiceLogData> {
+
+  @ApiModelProperty
+  private List<ServiceLogData> logList;
+
+  @Override
+  public List<ServiceLogData> getLogList() {
+    return logList;
+  }
+
+  @Override
+  public void setLogList(List<ServiceLogData> logList) {
+    this.logList = logList;
+  }
+
+  @Override
+  public int getListSize() {
+    return logList == null ? 0 : logList.size();
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/QueryGeneration.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/QueryGeneration.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/QueryGeneration.java
index 16cf932..10224bc 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/QueryGeneration.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/QueryGeneration.java
@@ -28,9 +28,11 @@ import java.util.regex.Pattern;
 import org.apache.ambari.logsearch.common.ConfigHelper;
 import org.apache.ambari.logsearch.common.LogSearchConstants;
 import org.apache.ambari.logsearch.common.PropertiesHelper;
-import org.apache.ambari.logsearch.common.SearchCriteria;
+import org.apache.ambari.logsearch.conf.SolrAuditLogConfig;
+import org.apache.ambari.logsearch.conf.SolrServiceLogConfig;
+import org.apache.ambari.logsearch.query.model.SearchCriteria;
 import org.apache.ambari.logsearch.dao.SolrDaoBase;
-import org.apache.ambari.logsearch.manager.MgrBase.LogType;
+import org.apache.ambari.logsearch.manager.ManagerBase.LogType;
 import org.apache.ambari.logsearch.util.JSONUtil;
 import org.apache.ambari.logsearch.util.SolrUtil;
 import org.apache.commons.lang.StringUtils;
@@ -44,11 +46,19 @@ import org.apache.solr.schema.TrieFloatField;
 import org.apache.solr.schema.TrieLongField;
 import org.springframework.stereotype.Component;
 
+import javax.inject.Inject;
+
 @Component
 public class QueryGeneration extends QueryGenerationBase {
 
   private static Logger logger = Logger.getLogger(QueryGeneration.class);
 
+  @Inject
+  private SolrServiceLogConfig solrServiceLogConfig;
+
+  @Inject
+  private SolrAuditLogConfig solrAuditLogConfig;
+
   public SolrQuery commonServiceFilterQuery(SearchCriteria searchCriteria) {
     LogType logType = LogType.SERVICE;
     SolrQuery solrQuery = new SolrQuery();
@@ -349,10 +359,10 @@ public class QueryGeneration extends QueryGenerationBase {
     String originalKey;
     switch (logType) {
     case AUDIT:
-      originalKey = ConfigHelper.auditLogsColumnMapping.get(key + LogSearchConstants.UI_SUFFIX);
+      originalKey = solrAuditLogConfig.getSolrAndUiColumns().get(key + LogSearchConstants.UI_SUFFIX);
       break;
     case SERVICE:
-      originalKey = ConfigHelper.serviceLogsColumnMapping.get(key + LogSearchConstants.UI_SUFFIX);
+      originalKey = solrServiceLogConfig.getSolrAndUiColumns().get(key + LogSearchConstants.UI_SUFFIX);
       break;
     default:
       originalKey = null;

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/QueryGenerationBase.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/QueryGenerationBase.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/QueryGenerationBase.java
index 77d4969..d7d30d7 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/QueryGenerationBase.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/QueryGenerationBase.java
@@ -23,7 +23,7 @@ import java.util.ArrayList;
 import java.util.List;
 
 import org.apache.ambari.logsearch.common.LogSearchConstants;
-import org.apache.ambari.logsearch.common.SearchCriteria;
+import org.apache.ambari.logsearch.query.model.SearchCriteria;
 import org.apache.ambari.logsearch.dao.AuditSolrDao;
 import org.apache.ambari.logsearch.dao.ServiceLogsSolrDao;
 import org.apache.ambari.logsearch.util.SolrUtil;
@@ -31,21 +31,22 @@ import org.apache.commons.lang.StringUtils;
 import org.apache.log4j.Logger;
 import org.apache.solr.client.solrj.SolrQuery;
 import org.apache.solr.client.solrj.SolrQuery.ORDER;
-import org.springframework.beans.factory.annotation.Autowired;
 
 import com.google.gson.Gson;
 
+import javax.inject.Inject;
+
 public abstract class QueryGenerationBase {
 
   private static final Logger logger = Logger.getLogger(QueryGenerationBase.class);
   
-  @Autowired
+  @Inject
   protected AuditSolrDao auditSolrDao;
   
-  @Autowired
+  @Inject
   protected ServiceLogsSolrDao serviceLogsSolrDao;
 
-  public static enum Condition {
+  public enum Condition {
     OR, AND
   }
 
@@ -98,7 +99,6 @@ public abstract class QueryGenerationBase {
         solrQuery.addFilterQuery(filterQuery);
         logger.debug("Filter added :- " + filterQuery);
       }
-
     }
   }
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AbstractCommonAuditLogRequestConverter.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AbstractCommonAuditLogRequestConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AbstractCommonAuditLogRequestConverter.java
new file mode 100644
index 0000000..798bd47
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AbstractCommonAuditLogRequestConverter.java
@@ -0,0 +1,48 @@
+/*
+ * 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.query.converter;
+
+import org.apache.ambari.logsearch.model.request.impl.BaseAuditLogRequest;
+import org.apache.ambari.logsearch.query.model.CommonSearchCriteria;
+import org.apache.commons.lang.StringEscapeUtils;
+import org.springframework.stereotype.Component;
+
+@Component
+public abstract class AbstractCommonAuditLogRequestConverter<SOURCE extends BaseAuditLogRequest, RESULT extends CommonSearchCriteria>
+  extends AbstractCommonSearchRequestConverter<SOURCE, RESULT> {
+
+  @Override
+  public RESULT convertToSearchCriteria(SOURCE request) {
+    RESULT criteria = createCriteria(request);
+    criteria.addParam("q", request.getQuery());
+    criteria.addParam("columnQuery", StringEscapeUtils.unescapeXml(request.getColumnQuery()));
+    criteria.addParam("iMessage", StringEscapeUtils.unescapeXml(request.getiMessage()));
+    criteria.addParam("gEMessage", StringEscapeUtils.unescapeXml(request.getgEMessage()));
+    criteria.addParam("eMessage", StringEscapeUtils.unescapeXml(request.getgEMessage()));
+    criteria.addParam("includeString", request.getMustBe());
+    criteria.addParam("unselectComp", request.getMustNot());
+    criteria.addParam("excludeQuery", StringEscapeUtils.unescapeXml(request.getExcludeQuery()));
+    criteria.addParam("includeQuery", StringEscapeUtils.unescapeXml(request.getIncludeQuery()));
+    criteria.addParam("startTime", request.getFrom());
+    criteria.addParam("endTime", request.getTo());
+    return criteria;
+  }
+
+  public abstract RESULT createCriteria(SOURCE request);
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AbstractCommonSearchRequestConverter.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AbstractCommonSearchRequestConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AbstractCommonSearchRequestConverter.java
new file mode 100644
index 0000000..3fd07e2
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AbstractCommonSearchRequestConverter.java
@@ -0,0 +1,53 @@
+/*
+ * 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.query.converter;
+
+import org.apache.ambari.logsearch.model.request.impl.CommonSearchRequest;
+import org.apache.ambari.logsearch.query.model.CommonSearchCriteria;
+import org.apache.commons.lang.StringUtils;
+import org.springframework.core.convert.converter.Converter;
+
+public abstract class AbstractCommonSearchRequestConverter<SOURCE extends CommonSearchRequest, RESULT extends CommonSearchCriteria>
+  implements Converter<SOURCE, RESULT> {
+
+  @Override
+  public RESULT convert(SOURCE source) {
+    RESULT criteria = convertToSearchCriteria(source);
+    addDefaultParams(source, criteria);
+    return criteria;
+  }
+
+  public abstract RESULT convertToSearchCriteria(SOURCE source);
+
+  private void addDefaultParams(SOURCE request, RESULT criteria) {
+    criteria.setStartIndex(StringUtils.isNumeric(request.getStartIndex()) ? new Integer(request.getStartIndex()) : 0);
+    criteria.setPage(StringUtils.isNumeric(request.getPage()) ? new Integer(request.getPage()) : 0);
+    criteria.setMaxRows(StringUtils.isNumeric(request.getPageSize()) ? new Integer(request.getPageSize()) : 50);
+    criteria.setSortBy(request.getSortBy());
+    criteria.setSortType(request.getSortType());
+    if (StringUtils.isNotEmpty(request.getStartTime())){
+      criteria.setGlobalStartTime(request.getStartTime());
+      criteria.getUrlParamMap().put("globalStartTime", request.getStartTime());
+    }
+    if (StringUtils.isNotEmpty(request.getEndTime())){
+      criteria.setGlobalEndTime(request.getEndTime());
+      criteria.getUrlParamMap().put("globalEndTime", request.getEndTime());
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AbstractCommonServiceLogRequestConverter.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AbstractCommonServiceLogRequestConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AbstractCommonServiceLogRequestConverter.java
new file mode 100644
index 0000000..a02d585
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AbstractCommonServiceLogRequestConverter.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.query.converter;
+
+import org.apache.ambari.logsearch.common.LogSearchConstants;
+import org.apache.ambari.logsearch.model.request.impl.BaseServiceLogRequest;
+import org.apache.ambari.logsearch.query.model.CommonSearchCriteria;
+import org.apache.commons.lang.StringEscapeUtils;
+
+public abstract class AbstractCommonServiceLogRequestConverter<SOURCE extends BaseServiceLogRequest, RESULT extends CommonSearchCriteria>
+  extends AbstractCommonSearchRequestConverter<SOURCE, RESULT> {
+
+  @Override
+  public RESULT convertToSearchCriteria(SOURCE request) {
+    RESULT criteria = createCriteria(request);
+    criteria.addParam("advanceSearch", StringEscapeUtils.unescapeXml(request.getAdvancedSearch()));
+    criteria.addParam("q", request.getQuery());
+    criteria.addParam("treeParams", StringEscapeUtils.unescapeHtml(request.getTreeParams()));
+    criteria.addParam("level", request.getLevel());
+    criteria.addParam("gMustNot", request.getgMustNot());
+    criteria.addParam("from", request.getFrom());
+    criteria.addParam("to", request.getTo());
+    criteria.addParam("selectComp", request.getMustBe());
+    criteria.addParam("unselectComp", request.getMustNot());
+    criteria.addParam("iMessage", StringEscapeUtils.unescapeXml(request.getiMessage()));
+    criteria.addParam("gEMessage", StringEscapeUtils.unescapeXml(request.getgEMessage()));
+    criteria.addParam("eMessage", StringEscapeUtils.unescapeXml(request.getgEMessage()));
+    criteria.addParam(LogSearchConstants.BUNDLE_ID, request.getBundleId());
+    criteria.addParam("host_name", request.getHostName());
+    criteria.addParam("component_name", request.getComponentName());
+    criteria.addParam("file_name", request.getFileName());
+    criteria.addParam("startDate", request.getStartTime());
+    criteria.addParam("endDate", request.getEndTime());
+    criteria.addParam("excludeQuery", StringEscapeUtils.unescapeXml(request.getExcludeQuery()));
+    criteria.addParam("includeQuery", StringEscapeUtils.unescapeXml(request.getIncludeQuery()));
+    return criteria;
+  }
+
+  public abstract RESULT createCriteria(SOURCE request);
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AnyGraphRequestConverter.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AnyGraphRequestConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AnyGraphRequestConverter.java
new file mode 100644
index 0000000..0372168
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AnyGraphRequestConverter.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.query.converter;
+
+import org.apache.ambari.logsearch.model.request.impl.AnyGraphRequest;
+import org.apache.ambari.logsearch.query.model.AnyGraphSearchCriteria;
+import org.springframework.stereotype.Component;
+
+@Component
+public class AnyGraphRequestConverter extends AbstractCommonSearchRequestConverter<AnyGraphRequest, AnyGraphSearchCriteria> {
+
+  @Override
+  public AnyGraphSearchCriteria convertToSearchCriteria(AnyGraphRequest anyGraphRequest) {
+    AnyGraphSearchCriteria criteria = new AnyGraphSearchCriteria();
+    criteria.addParam("xAxis", anyGraphRequest.getxAxis());
+    criteria.addParam("yAxis", anyGraphRequest.getyAxis());
+    criteria.addParam("stackBy", anyGraphRequest.getStackBy());
+    criteria.addParam("unit", anyGraphRequest.getUnit());
+    criteria.addParam("from", anyGraphRequest.getFrom());
+    criteria.addParam("to", anyGraphRequest.getTo());
+    return criteria;
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AuditBarGraphRequestConverter.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AuditBarGraphRequestConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AuditBarGraphRequestConverter.java
new file mode 100644
index 0000000..f72a673
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AuditBarGraphRequestConverter.java
@@ -0,0 +1,34 @@
+/*
+ * 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.query.converter;
+
+import org.apache.ambari.logsearch.model.request.impl.AuditBarGraphRequest;
+import org.apache.ambari.logsearch.query.model.AuditBarGraphSearchCriteria;
+import org.springframework.stereotype.Component;
+
+@Component
+public class AuditBarGraphRequestConverter extends AbstractCommonAuditLogRequestConverter<AuditBarGraphRequest, AuditBarGraphSearchCriteria>{
+
+  @Override
+  public AuditBarGraphSearchCriteria createCriteria(AuditBarGraphRequest request) {
+    AuditBarGraphSearchCriteria criteria = new AuditBarGraphSearchCriteria();
+    criteria.addParam("unit", request.getUnit());
+    return criteria;
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AuditLogRequestConverter.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AuditLogRequestConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AuditLogRequestConverter.java
new file mode 100644
index 0000000..27d314d
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AuditLogRequestConverter.java
@@ -0,0 +1,34 @@
+/*
+ * 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.query.converter;
+
+import org.apache.ambari.logsearch.model.request.impl.AuditLogRequest;
+import org.apache.ambari.logsearch.query.model.AuditLogSearchCriteria;
+import org.springframework.stereotype.Component;
+
+@Component
+public class AuditLogRequestConverter extends AbstractCommonAuditLogRequestConverter<AuditLogRequest, AuditLogSearchCriteria> {
+
+  @Override
+  public AuditLogSearchCriteria createCriteria(AuditLogRequest request) {
+    AuditLogSearchCriteria criteria = new AuditLogSearchCriteria();
+    criteria.addParam("isLastPage", request.isLastPage());
+    return criteria;
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/BaseAuditLogRequestConverter.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/BaseAuditLogRequestConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/BaseAuditLogRequestConverter.java
new file mode 100644
index 0000000..35aceb2
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/BaseAuditLogRequestConverter.java
@@ -0,0 +1,33 @@
+/*
+ * 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.query.converter;
+
+import org.apache.ambari.logsearch.model.request.impl.BaseAuditLogRequest;
+import org.apache.ambari.logsearch.query.model.CommonSearchCriteria;
+import org.springframework.stereotype.Component;
+
+@Component
+public class BaseAuditLogRequestConverter extends AbstractCommonAuditLogRequestConverter<BaseAuditLogRequest, CommonSearchCriteria> {
+
+  @Override
+  public CommonSearchCriteria createCriteria(BaseAuditLogRequest request) {
+    return new CommonSearchCriteria();
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/BaseServiceLogRequestConverter.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/BaseServiceLogRequestConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/BaseServiceLogRequestConverter.java
new file mode 100644
index 0000000..cfd544c
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/BaseServiceLogRequestConverter.java
@@ -0,0 +1,32 @@
+/*
+ * 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.query.converter;
+
+import org.apache.ambari.logsearch.model.request.impl.BaseServiceLogRequest;
+import org.apache.ambari.logsearch.query.model.CommonSearchCriteria;
+import org.springframework.stereotype.Component;
+
+@Component
+public class BaseServiceLogRequestConverter extends AbstractCommonServiceLogRequestConverter<BaseServiceLogRequest, CommonSearchCriteria> {
+
+  @Override
+  public CommonSearchCriteria createCriteria(BaseServiceLogRequest request) {
+    return new CommonSearchCriteria();
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/FieldAuditLogRequestConverter.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/FieldAuditLogRequestConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/FieldAuditLogRequestConverter.java
new file mode 100644
index 0000000..089b593
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/FieldAuditLogRequestConverter.java
@@ -0,0 +1,34 @@
+/*
+ * 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.query.converter;
+
+import org.apache.ambari.logsearch.model.request.impl.FieldAuditLogRequest;
+import org.apache.ambari.logsearch.query.model.FieldAuditLogSearchCriteria;
+import org.springframework.stereotype.Component;
+
+@Component
+public class FieldAuditLogRequestConverter extends AbstractCommonAuditLogRequestConverter<FieldAuditLogRequest, FieldAuditLogSearchCriteria> {
+
+  @Override
+  public FieldAuditLogSearchCriteria createCriteria(FieldAuditLogRequest request) {
+    FieldAuditLogSearchCriteria criteria = new FieldAuditLogSearchCriteria();
+    criteria.addParam("field", request.getField());
+    return criteria;
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/FieldBarGraphRequestConverter.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/FieldBarGraphRequestConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/FieldBarGraphRequestConverter.java
new file mode 100644
index 0000000..dd518f8
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/FieldBarGraphRequestConverter.java
@@ -0,0 +1,35 @@
+/*
+ * 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.query.converter;
+
+import org.apache.ambari.logsearch.model.request.impl.FieldAuditBarGraphRequest;
+import org.apache.ambari.logsearch.query.model.FieldAuditBarGraphSearchCriteria;
+import org.springframework.stereotype.Component;
+
+@Component
+public class FieldBarGraphRequestConverter extends AbstractCommonAuditLogRequestConverter<FieldAuditBarGraphRequest, FieldAuditBarGraphSearchCriteria> {
+
+  @Override
+  public FieldAuditBarGraphSearchCriteria createCriteria(FieldAuditBarGraphRequest request) {
+    FieldAuditBarGraphSearchCriteria criteria = new FieldAuditBarGraphSearchCriteria();
+    criteria.addParam("unit", request.getUnit());
+    criteria.addParam("field", request.getField());
+    return criteria;
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/LogFileRequestConverter.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/LogFileRequestConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/LogFileRequestConverter.java
new file mode 100644
index 0000000..7c3038e
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/LogFileRequestConverter.java
@@ -0,0 +1,37 @@
+/*
+ * 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.query.converter;
+
+import org.apache.ambari.logsearch.model.request.impl.LogFileRequest;
+import org.apache.ambari.logsearch.query.model.LogFileSearchCriteria;
+import org.springframework.core.convert.converter.Converter;
+import org.springframework.stereotype.Component;
+
+@Component
+public class LogFileRequestConverter implements Converter<LogFileRequest, LogFileSearchCriteria> {
+
+  @Override
+  public LogFileSearchCriteria convert(LogFileRequest request) {
+    LogFileSearchCriteria criteria = new LogFileSearchCriteria();
+    criteria.addParam("component", request.getComponent());
+    criteria.addParam("host", request.getHost());
+    criteria.addParam("logType", request.getLogType());
+    return criteria;
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/LogFileTailRequestConverter.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/LogFileTailRequestConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/LogFileTailRequestConverter.java
new file mode 100644
index 0000000..88b1a34
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/LogFileTailRequestConverter.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.query.converter;
+
+import org.apache.ambari.logsearch.model.request.impl.LogFileTailRequest;
+import org.apache.ambari.logsearch.query.model.LogFileTailSearchCriteria;
+import org.springframework.core.convert.converter.Converter;
+import org.springframework.stereotype.Component;
+
+@Component
+public class LogFileTailRequestConverter implements Converter<LogFileTailRequest, LogFileTailSearchCriteria> {
+
+  @Override
+  public LogFileTailSearchCriteria convert(LogFileTailRequest request) {
+    LogFileTailSearchCriteria criteria = new LogFileTailSearchCriteria();
+    criteria.addParam("component", request.getComponent());
+    criteria.addParam("host", request.getHost());
+    criteria.addParam("logType", request.getLogType());
+    criteria.addParam("tailSize", request.getTailSize());
+    return criteria;
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceAnyGraphRequestConverter.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceAnyGraphRequestConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceAnyGraphRequestConverter.java
new file mode 100644
index 0000000..7a559de
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceAnyGraphRequestConverter.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.query.converter;
+
+import org.apache.ambari.logsearch.model.request.impl.ServiceAnyGraphRequest;
+import org.apache.ambari.logsearch.query.model.ServiceAnyGraphSearchCriteria;
+import org.springframework.stereotype.Component;
+
+@Component
+public class ServiceAnyGraphRequestConverter extends AbstractCommonServiceLogRequestConverter<ServiceAnyGraphRequest, ServiceAnyGraphSearchCriteria> {
+
+  @Override
+  public ServiceAnyGraphSearchCriteria createCriteria(ServiceAnyGraphRequest anyGraphRequest) {
+    ServiceAnyGraphSearchCriteria criteria = new ServiceAnyGraphSearchCriteria();
+    criteria.addParam("xAxis", anyGraphRequest.getxAxis());
+    criteria.addParam("yAxis", anyGraphRequest.getyAxis());
+    criteria.addParam("stackBy", anyGraphRequest.getStackBy());
+    criteria.addParam("unit", anyGraphRequest.getUnit());
+    criteria.addParam("from", anyGraphRequest.getFrom());
+    criteria.addParam("to", anyGraphRequest.getTo());
+    return criteria;
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceExtremeDatesRequestConverter.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceExtremeDatesRequestConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceExtremeDatesRequestConverter.java
new file mode 100644
index 0000000..fe81468
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceExtremeDatesRequestConverter.java
@@ -0,0 +1,35 @@
+/*
+ * 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.query.converter;
+
+import org.apache.ambari.logsearch.common.LogSearchConstants;
+import org.apache.ambari.logsearch.model.request.impl.ServiceExtremeDatesRequest;
+import org.apache.ambari.logsearch.query.model.ServiceExtremeDatesCriteria;
+import org.springframework.stereotype.Component;
+
+@Component
+public class ServiceExtremeDatesRequestConverter extends AbstractCommonSearchRequestConverter<ServiceExtremeDatesRequest, ServiceExtremeDatesCriteria> {
+
+  @Override
+  public ServiceExtremeDatesCriteria convertToSearchCriteria(ServiceExtremeDatesRequest request) {
+    ServiceExtremeDatesCriteria criteria = new ServiceExtremeDatesCriteria();
+    criteria.addParam(LogSearchConstants.BUNDLE_ID, request.getBundleId());
+    return criteria;
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceGraphRequestConverter.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceGraphRequestConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceGraphRequestConverter.java
new file mode 100644
index 0000000..19165c0
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceGraphRequestConverter.java
@@ -0,0 +1,36 @@
+/*
+ * 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.query.converter;
+
+import org.apache.ambari.logsearch.model.request.impl.ServiceGraphRequest;
+import org.apache.ambari.logsearch.query.model.ServiceGraphSearchCriteria;
+import org.springframework.stereotype.Component;
+
+@Component
+public class ServiceGraphRequestConverter extends AbstractCommonServiceLogRequestConverter<ServiceGraphRequest, ServiceGraphSearchCriteria> {
+
+  @Override
+  public ServiceGraphSearchCriteria createCriteria(ServiceGraphRequest request) {
+    ServiceGraphSearchCriteria criteria = new ServiceGraphSearchCriteria();
+    criteria.addParam("hostLogFile", request.getHostLogFile());
+    criteria.addParam("compLogFile", request.getComponentLogFile());
+    criteria.addParam("unit", request.getUnit());
+    return criteria;
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceLogExportRequestConverter.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceLogExportRequestConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceLogExportRequestConverter.java
new file mode 100644
index 0000000..7d83e49
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceLogExportRequestConverter.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.query.converter;
+
+import org.apache.ambari.logsearch.model.request.impl.ServiceLogExportRequest;
+import org.apache.ambari.logsearch.query.model.ServiceLogExportSearchCriteria;
+import org.springframework.stereotype.Component;
+
+@Component
+public class ServiceLogExportRequestConverter extends AbstractCommonServiceLogRequestConverter<ServiceLogExportRequest, ServiceLogExportSearchCriteria> {
+
+  @Override
+  public ServiceLogExportSearchCriteria createCriteria(ServiceLogExportRequest request) {
+    ServiceLogExportSearchCriteria criteria = new ServiceLogExportSearchCriteria();
+    criteria.addParam("hostLogFile", request.getHostLogFile());
+    criteria.addParam("compLogFile",
+      request.getComponentLogFile());
+    criteria.addParam("format", request.getFormat());
+    criteria.addParam("utcOffset", request.getUtcOffset());
+    return criteria;
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceLogFileRequestConverter.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceLogFileRequestConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceLogFileRequestConverter.java
new file mode 100644
index 0000000..f5148f3
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceLogFileRequestConverter.java
@@ -0,0 +1,36 @@
+/*
+ * 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.query.converter;
+
+import org.apache.ambari.logsearch.model.request.impl.ServiceLogFileRequest;
+import org.apache.ambari.logsearch.query.model.ServiceLogFileSearchCriteria;
+import org.springframework.stereotype.Component;
+
+@Component
+public class ServiceLogFileRequestConverter
+  extends AbstractCommonServiceLogRequestConverter<ServiceLogFileRequest, ServiceLogFileSearchCriteria> {
+
+  @Override
+  public ServiceLogFileSearchCriteria createCriteria(ServiceLogFileRequest request) {
+    ServiceLogFileSearchCriteria criteria = new ServiceLogFileSearchCriteria();
+    criteria.addParam("hostLogFile", request.getHostLogFile());
+    criteria.addParam("compLogFile", request.getComponentLogFile());
+    return criteria;
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceLogRequestConverter.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceLogRequestConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceLogRequestConverter.java
new file mode 100644
index 0000000..6a70d55
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceLogRequestConverter.java
@@ -0,0 +1,41 @@
+/*
+ * 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.query.converter;
+
+import org.apache.ambari.logsearch.model.request.impl.ServiceLogRequest;
+import org.apache.ambari.logsearch.query.model.ServiceLogSearchCriteria;
+import org.apache.commons.lang.StringEscapeUtils;
+import org.springframework.stereotype.Component;
+
+@Component
+public class ServiceLogRequestConverter extends AbstractCommonServiceLogRequestConverter<ServiceLogRequest, ServiceLogSearchCriteria> {
+
+  @Override
+  public ServiceLogSearchCriteria createCriteria(ServiceLogRequest request) {
+    ServiceLogSearchCriteria criteria = new ServiceLogSearchCriteria();
+    criteria.addParam("hostLogFile", request.getHostLogFile());
+    criteria.addParam("compLogFile", request.getComponentLogFile());
+    criteria.addParam("keyword", StringEscapeUtils.unescapeXml(request.getKeyWord()));
+    criteria.addParam("sourceLogId", request.getSourceLogId());
+    criteria.addParam("keywordType", request.getKeywordType());
+    criteria.addParam("token", request.getToken());
+    criteria.addParam("isLastPage", request.isLastPage());
+    return criteria;
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceLogTruncatedRequestConverter.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceLogTruncatedRequestConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceLogTruncatedRequestConverter.java
new file mode 100644
index 0000000..676f049
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceLogTruncatedRequestConverter.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.query.converter;
+
+import org.apache.ambari.logsearch.model.request.impl.ServiceLogTruncatedRequest;
+import org.apache.ambari.logsearch.query.model.ServiceLogTruncatedSearchCriteria;
+import org.springframework.stereotype.Component;
+
+@Component
+public class ServiceLogTruncatedRequestConverter extends AbstractCommonServiceLogRequestConverter<ServiceLogTruncatedRequest, ServiceLogTruncatedSearchCriteria> {
+
+  @Override
+  public ServiceLogTruncatedSearchCriteria createCriteria(ServiceLogTruncatedRequest request) {
+    ServiceLogTruncatedSearchCriteria criteria = new ServiceLogTruncatedSearchCriteria();
+    criteria.addParam("hostLogFile", request.getHostLogFile());
+    criteria.addParam("compLogFile", request.getComponentLogFile());
+    criteria.addParam("id", request.getId());
+    criteria.addParam("scrollType", request.getScrollType());
+    criteria.addParam("numberRows", request.getNumberRows());
+    return criteria;
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/SimpleQueryRequestConverter.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/SimpleQueryRequestConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/SimpleQueryRequestConverter.java
new file mode 100644
index 0000000..8c50f66
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/SimpleQueryRequestConverter.java
@@ -0,0 +1,34 @@
+/*
+ * 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.query.converter;
+
+import org.apache.ambari.logsearch.model.request.impl.SimpleQueryRequest;
+import org.apache.ambari.logsearch.query.model.SearchCriteria;
+import org.springframework.core.convert.converter.Converter;
+import org.springframework.stereotype.Component;
+
+@Component
+public class SimpleQueryRequestConverter implements Converter<SimpleQueryRequest, SearchCriteria> {
+  @Override
+  public SearchCriteria convert(SimpleQueryRequest simpleQueryRequest) {
+    SearchCriteria searchCriteria = new SearchCriteria();
+    searchCriteria.addParam("q", simpleQueryRequest.getQuery());
+    return searchCriteria;
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/UserConfigRequestConverter.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/UserConfigRequestConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/UserConfigRequestConverter.java
new file mode 100644
index 0000000..50847c7
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/UserConfigRequestConverter.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.query.converter;
+
+import org.apache.ambari.logsearch.common.LogSearchConstants;
+import org.apache.ambari.logsearch.model.request.impl.UserConfigRequest;
+import org.apache.ambari.logsearch.query.model.UserConfigSearchCriteria;
+import org.springframework.core.convert.converter.Converter;
+import org.springframework.stereotype.Component;
+
+@Component
+public class UserConfigRequestConverter implements Converter<UserConfigRequest, UserConfigSearchCriteria> {
+
+  @Override
+  public UserConfigSearchCriteria convert(UserConfigRequest request) {
+    UserConfigSearchCriteria criteria = new UserConfigSearchCriteria();
+    criteria.addParam(LogSearchConstants.USER_NAME, request.getUserId());
+    criteria.addParam(LogSearchConstants.FILTER_NAME, request.getFilterName());
+    criteria.addParam(LogSearchConstants.ROW_TYPE, request.getRowType());
+    return criteria;
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/UserExportRequestConverter.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/UserExportRequestConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/UserExportRequestConverter.java
new file mode 100644
index 0000000..a0b5f0f
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/UserExportRequestConverter.java
@@ -0,0 +1,35 @@
+/*
+ * 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.query.converter;
+
+import org.apache.ambari.logsearch.model.request.impl.UserExportRequest;
+import org.apache.ambari.logsearch.query.model.UserExportSearchCriteria;
+import org.springframework.stereotype.Component;
+
+@Component
+public class UserExportRequestConverter extends AbstractCommonAuditLogRequestConverter<UserExportRequest, UserExportSearchCriteria> {
+
+  @Override
+  public UserExportSearchCriteria createCriteria(UserExportRequest request) {
+    UserExportSearchCriteria criteria = new UserExportSearchCriteria();
+    criteria.addParam("field", request.getField());
+    return criteria;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/AnyGraphSearchCriteria.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/AnyGraphSearchCriteria.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/AnyGraphSearchCriteria.java
new file mode 100644
index 0000000..a11c056
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/AnyGraphSearchCriteria.java
@@ -0,0 +1,25 @@
+/*
+ * 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.query.model;
+
+import org.apache.ambari.logsearch.common.Marker;
+
+@Marker
+public class AnyGraphSearchCriteria extends CommonSearchCriteria {
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/AuditBarGraphSearchCriteria.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/AuditBarGraphSearchCriteria.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/AuditBarGraphSearchCriteria.java
new file mode 100644
index 0000000..c41ec15
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/AuditBarGraphSearchCriteria.java
@@ -0,0 +1,25 @@
+/*
+ * 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.query.model;
+
+import org.apache.ambari.logsearch.common.Marker;
+
+@Marker
+public class AuditBarGraphSearchCriteria extends CommonSearchCriteria {
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/AuditLogSearchCriteria.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/AuditLogSearchCriteria.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/AuditLogSearchCriteria.java
new file mode 100644
index 0000000..f4fe207
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/AuditLogSearchCriteria.java
@@ -0,0 +1,25 @@
+/*
+ * 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.query.model;
+
+import org.apache.ambari.logsearch.common.Marker;
+
+@Marker
+public class AuditLogSearchCriteria extends CommonSearchCriteria {
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/CommonSearchCriteria.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/CommonSearchCriteria.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/CommonSearchCriteria.java
new file mode 100644
index 0000000..47d12e5
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/CommonSearchCriteria.java
@@ -0,0 +1,100 @@
+/*
+ * 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.query.model;
+
+public class CommonSearchCriteria extends SearchCriteria {
+  private int startIndex = 0;
+  private int maxRows = Integer.MAX_VALUE;
+  private String sortBy = null;
+  private String sortType = null;
+  private int page = 0;
+
+  private String globalStartTime = null;
+  private String globalEndTime = null;
+
+  @Override
+  public int getStartIndex() {
+    return startIndex;
+  }
+
+  @Override
+  public void setStartIndex(int startIndex) {
+    this.startIndex = startIndex;
+  }
+
+  @Override
+  public int getMaxRows() {
+    return maxRows;
+  }
+
+  @Override
+  public void setMaxRows(int maxRows) {
+    this.maxRows = maxRows;
+  }
+
+  @Override
+  public String getSortType() {
+    return sortType;
+  }
+
+  @Override
+  public void setSortType(String sortType) {
+    this.sortType = sortType;
+  }
+
+  @Override
+  public String getSortBy() {
+    return sortBy;
+  }
+
+  @Override
+  public void setSortBy(String sortBy) {
+    this.sortBy = sortBy;
+  }
+
+  @Override
+  public int getPage() {
+    return page;
+  }
+
+  @Override
+  public void setPage(int page) {
+    this.page = page;
+  }
+
+  @Override
+  public String getGlobalStartTime() {
+    return globalStartTime;
+  }
+
+  @Override
+  public void setGlobalStartTime(String globalStartTime) {
+    this.globalStartTime = globalStartTime;
+  }
+
+  @Override
+  public String getGlobalEndTime() {
+    return globalEndTime;
+  }
+
+  @Override
+  public void setGlobalEndTime(String globalEndTime) {
+    this.globalEndTime = globalEndTime;
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/FieldAuditBarGraphSearchCriteria.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/FieldAuditBarGraphSearchCriteria.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/FieldAuditBarGraphSearchCriteria.java
new file mode 100644
index 0000000..f931f5d
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/FieldAuditBarGraphSearchCriteria.java
@@ -0,0 +1,25 @@
+/*
+ * 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.query.model;
+
+import org.apache.ambari.logsearch.common.Marker;
+
+@Marker
+public class FieldAuditBarGraphSearchCriteria extends AuditBarGraphSearchCriteria {
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/FieldAuditLogSearchCriteria.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/FieldAuditLogSearchCriteria.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/FieldAuditLogSearchCriteria.java
new file mode 100644
index 0000000..8dd5854
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/FieldAuditLogSearchCriteria.java
@@ -0,0 +1,25 @@
+/*
+ * 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.query.model;
+
+import org.apache.ambari.logsearch.common.Marker;
+
+@Marker
+public class FieldAuditLogSearchCriteria extends CommonSearchCriteria {
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/LogFileSearchCriteria.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/LogFileSearchCriteria.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/LogFileSearchCriteria.java
new file mode 100644
index 0000000..e4e2a14
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/LogFileSearchCriteria.java
@@ -0,0 +1,25 @@
+/*
+ * 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.query.model;
+
+import org.apache.ambari.logsearch.common.Marker;
+
+@Marker
+public class LogFileSearchCriteria extends SearchCriteria {
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/LogFileTailSearchCriteria.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/LogFileTailSearchCriteria.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/LogFileTailSearchCriteria.java
new file mode 100644
index 0000000..fecb396
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/LogFileTailSearchCriteria.java
@@ -0,0 +1,25 @@
+/*
+ * 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.query.model;
+
+import org.apache.ambari.logsearch.common.Marker;
+
+@Marker
+public class LogFileTailSearchCriteria extends SearchCriteria {
+}


[21/58] [abbrv] ambari git commit: AMBARI-18095. Update zookeeper server/client tests (oleewere)

Posted by ol...@apache.org.
AMBARI-18095. Update zookeeper server/client tests (oleewere)


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

Branch: refs/heads/branch-2.5
Commit: 199c6e30fa97b3928a7def778fc378f1c81628e4
Parents: 3d62b00
Author: oleewere <ol...@gmail.com>
Authored: Thu Sep 8 01:15:01 2016 +0200
Committer: oleewere <ol...@gmail.com>
Committed: Sat Nov 5 14:46:44 2016 +0100

----------------------------------------------------------------------
 .../python/stacks/2.0.6/ZOOKEEPER/test_zookeeper_client.py   | 4 ++--
 .../python/stacks/2.0.6/ZOOKEEPER/test_zookeeper_server.py   | 8 ++++----
 2 files changed, 6 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/199c6e30/ambari-server/src/test/python/stacks/2.0.6/ZOOKEEPER/test_zookeeper_client.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.0.6/ZOOKEEPER/test_zookeeper_client.py b/ambari-server/src/test/python/stacks/2.0.6/ZOOKEEPER/test_zookeeper_client.py
index 8e028a1..e4c6fbd 100644
--- a/ambari-server/src/test/python/stacks/2.0.6/ZOOKEEPER/test_zookeeper_client.py
+++ b/ambari-server/src/test/python/stacks/2.0.6/ZOOKEEPER/test_zookeeper_client.py
@@ -79,7 +79,7 @@ class TestZookeeperClient(RMFTestCase):
     )
     self.assertResourceCalled('File',
                               '/etc/zookeeper/conf/log4j.properties',
-                              content='log4jproperties\nline2',
+                              content=InlineTemplate(self.getConfig()['configurations']['zookeeper-log4j']['content']),
                               mode=0644,
                               group='hadoop',
                               owner='zookeeper'
@@ -142,7 +142,7 @@ class TestZookeeperClient(RMFTestCase):
     )
     self.assertResourceCalled('File',
                               '/etc/zookeeper/conf/log4j.properties',
-                              content='log4jproperties\nline2',
+                              content=InlineTemplate(self.getConfig()['configurations']['zookeeper-log4j']['content']),
                               mode=0644,
                               group='hadoop',
                               owner='zookeeper'

http://git-wip-us.apache.org/repos/asf/ambari/blob/199c6e30/ambari-server/src/test/python/stacks/2.0.6/ZOOKEEPER/test_zookeeper_server.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.0.6/ZOOKEEPER/test_zookeeper_server.py b/ambari-server/src/test/python/stacks/2.0.6/ZOOKEEPER/test_zookeeper_server.py
index 7757fd9..b9ebea2 100644
--- a/ambari-server/src/test/python/stacks/2.0.6/ZOOKEEPER/test_zookeeper_server.py
+++ b/ambari-server/src/test/python/stacks/2.0.6/ZOOKEEPER/test_zookeeper_server.py
@@ -167,7 +167,7 @@ class TestZookeeperServer(RMFTestCase):
     )
     self.assertResourceCalled('File',
                               '/etc/zookeeper/conf/log4j.properties',
-                              content='log4jproperties\nline2',
+                              content=InlineTemplate(self.getConfig()['configurations']['zookeeper-log4j']['content']),
                               mode=0644,
                               group='hadoop',
                               owner='zookeeper'
@@ -225,10 +225,10 @@ class TestZookeeperServer(RMFTestCase):
     )
     self.assertResourceCalled('File',
                               '/etc/zookeeper/conf/log4j.properties',
-                              content='log4jproperties\nline2',
                               mode=0644,
-                              group='hadoop',
-                              owner='zookeeper'
+                              owner='zookeeper',
+                              content=InlineTemplate(self.getConfig()['configurations']['zookeeper-log4j']['content']),
+                              group='hadoop'
     )
     self.assertResourceCalled('File', '/etc/zookeeper/conf/zookeeper_jaas.conf',
       owner = 'zookeeper',


[33/58] [abbrv] ambari git commit: Update ambari-logsearch-it version to 2.5.0.0.0 (oleewere)

Posted by ol...@apache.org.
Update ambari-logsearch-it version to 2.5.0.0.0 (oleewere)

Change-Id: I5210d854a4f051356022439b316bff551706e2fd


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

Branch: refs/heads/branch-2.5
Commit: 39ffb74f226e87d09dc85702ad1cc59cbce05416
Parents: 149cb7d
Author: oleewere <ol...@gmail.com>
Authored: Fri Sep 30 11:42:57 2016 +0200
Committer: oleewere <ol...@gmail.com>
Committed: Sat Nov 5 14:46:45 2016 +0100

----------------------------------------------------------------------
 ambari-logsearch/ambari-logsearch-it/pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/39ffb74f/ambari-logsearch/ambari-logsearch-it/pom.xml
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-it/pom.xml b/ambari-logsearch/ambari-logsearch-it/pom.xml
index 1355a27..74e67fc 100644
--- a/ambari-logsearch/ambari-logsearch-it/pom.xml
+++ b/ambari-logsearch/ambari-logsearch-it/pom.xml
@@ -21,7 +21,7 @@
   <parent>
     <artifactId>ambari-logsearch</artifactId>
     <groupId>org.apache.ambari</groupId>
-    <version>2.0.0.0-SNAPSHOT</version>
+    <version>2.5.0.0.0</version>
   </parent>
   <modelVersion>4.0.0</modelVersion>
 


[22/58] [abbrv] ambari git commit: AMBARI-18246. Clean up Log Feeder (Miklos Gergely via oleewere)

Posted by ol...@apache.org.
http://git-wip-us.apache.org/repos/asf/ambari/blob/1b07a6dd/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/input/InputManagerTest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/input/InputManagerTest.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/input/InputManagerTest.java
new file mode 100644
index 0000000..368a930
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/input/InputManagerTest.java
@@ -0,0 +1,241 @@
+/*
+ * 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.logfeeder.input;
+
+import static org.easymock.EasyMock.*;
+import static org.junit.Assert.*;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.ambari.logfeeder.metrics.MetricData;
+import org.junit.Test;
+
+public class InputManagerTest {
+
+  @Test
+  public void testInputManager_addAndRemoveInputs() {
+    Input input1 = strictMock(Input.class);
+    Input input2 = strictMock(Input.class);
+    Input input3 = strictMock(Input.class);
+    Input input4 = strictMock(Input.class);
+    
+    expect(input3.getShortDescription()).andReturn("").times(2);
+    expect(input4.getShortDescription()).andReturn("").once();
+    
+    replay(input1, input2, input3, input4);
+    
+    InputManager manager = new InputManager();
+    manager.add(input1);
+    manager.add(input2);
+    manager.add(input3);
+    
+    manager.removeInput(input3);
+    manager.removeInput(input4);
+    
+    verify(input1, input2, input3, input4);
+    
+    List<Input> inputList = manager.getInputList();
+    assertEquals(inputList.size(), 2);
+    assertEquals(inputList.get(0), input1);
+    assertEquals(inputList.get(1), input2);
+  }
+
+  @Test
+  public void testInputManager_init() throws Exception {
+    Input input1 = strictMock(Input.class);
+    Input input2 = strictMock(Input.class);
+    Input input3 = strictMock(Input.class);
+    
+    input1.init(); expectLastCall();
+    input2.init(); expectLastCall();
+    input3.init(); expectLastCall();
+    
+    expect(input1.isTail()).andReturn(false);
+    expect(input2.isTail()).andReturn(false);
+    expect(input3.isTail()).andReturn(false);
+    
+    replay(input1, input2, input3);
+    
+    InputManager manager = new InputManager();
+    manager.add(input1);
+    manager.add(input2);
+    manager.add(input3);
+    
+    manager.init();
+    
+    verify(input1, input2, input3);
+  }
+
+  @Test
+  public void testInputManager_monitor() throws Exception {
+    Input input1 = strictMock(Input.class);
+    Input input2 = strictMock(Input.class);
+    Input input3 = strictMock(Input.class);
+    
+    expect(input1.isReady()).andReturn(true);
+    expect(input2.isReady()).andReturn(true);
+    expect(input3.isReady()).andReturn(false);
+    
+    expect(input1.monitor()).andReturn(false);
+    expect(input2.monitor()).andReturn(false);
+    expect(input3.isTail()).andReturn(false);
+    expect(input3.getShortDescription()).andReturn("").once();
+    
+    replay(input1, input2, input3);
+    
+    InputManager manager = new InputManager();
+    manager.add(input1);
+    manager.add(input2);
+    manager.add(input3);
+    
+    manager.monitor();
+    
+    verify(input1, input2, input3);
+  }
+  
+
+  @Test
+  public void testInputManager_addMetricsContainers() throws Exception {
+    List<MetricData> metrics = new ArrayList<MetricData>();
+    
+    Input input1 = strictMock(Input.class);
+    Input input2 = strictMock(Input.class);
+    Input input3 = strictMock(Input.class);
+    
+    input1.addMetricsContainers(metrics); expectLastCall();
+    input2.addMetricsContainers(metrics); expectLastCall();
+    input3.addMetricsContainers(metrics); expectLastCall();
+    
+    expect(input1.isReady()).andReturn(true);
+    expect(input2.isReady()).andReturn(true);
+    expect(input3.isReady()).andReturn(false);
+    
+    replay(input1, input2, input3);
+    
+    InputManager manager = new InputManager();
+    manager.add(input1);
+    manager.add(input2);
+    manager.add(input3);
+    
+    manager.addMetricsContainers(metrics);
+    
+    verify(input1, input2, input3);
+  }
+
+  @Test
+  public void testInputManager_logStat() throws Exception {
+    Input input1 = strictMock(Input.class);
+    Input input2 = strictMock(Input.class);
+    Input input3 = strictMock(Input.class);
+    
+    input1.logStat(); expectLastCall();
+    input2.logStat(); expectLastCall();
+    input3.logStat(); expectLastCall();
+    
+    expect(input1.isReady()).andReturn(true);
+    expect(input2.isReady()).andReturn(true);
+    expect(input3.isReady()).andReturn(false);
+    
+    replay(input1, input2, input3);
+    
+    InputManager manager = new InputManager();
+    manager.add(input1);
+    manager.add(input2);
+    manager.add(input3);
+    
+    manager.logStats();
+    
+    verify(input1, input2, input3);
+  }
+
+  @Test
+  public void testInputManagr_waitOnAllInputs() throws Exception {
+    Input input1 = strictMock(Input.class);
+    Input input2 = strictMock(Input.class);
+    Input input3 = strictMock(Input.class);
+    
+    Thread mockThread = strictMock(Thread.class);
+    
+    expect(input1.getThread()).andReturn(null);
+    expect(input2.getThread()).andReturn(null);
+    expect(input3.getThread()).andReturn(mockThread);
+    
+    mockThread.join(); expectLastCall();
+    
+    replay(input1, input2, input3);
+    
+    InputManager manager = new InputManager();
+    manager.add(input1);
+    manager.add(input2);
+    manager.add(input3);
+    
+    manager.waitOnAllInputs();
+    
+    verify(input1, input2, input3);
+  }
+
+  @Test
+  public void testInputManager_checkInAll() throws Exception {
+    Input input1 = strictMock(Input.class);
+    Input input2 = strictMock(Input.class);
+    Input input3 = strictMock(Input.class);
+    
+    input1.lastCheckIn(); expectLastCall();
+    input2.lastCheckIn(); expectLastCall();
+    input3.lastCheckIn(); expectLastCall();
+    
+    replay(input1, input2, input3);
+    
+    InputManager manager = new InputManager();
+    manager.add(input1);
+    manager.add(input2);
+    manager.add(input3);
+    
+    manager.checkInAll();
+    
+    verify(input1, input2, input3);
+  }
+
+  @Test
+  public void testInputManager_close() throws Exception {
+    Input input1 = strictMock(Input.class);
+    Input input2 = strictMock(Input.class);
+    Input input3 = strictMock(Input.class);
+    
+    input1.setDrain(true); expectLastCall();
+    input2.setDrain(true); expectLastCall();
+    input3.setDrain(true); expectLastCall();
+    
+    expect(input1.isClosed()).andReturn(true);
+    expect(input2.isClosed()).andReturn(true);
+    expect(input3.isClosed()).andReturn(true);
+    
+    replay(input1, input2, input3);
+    
+    InputManager manager = new InputManager();
+    manager.add(input1);
+    manager.add(input2);
+    manager.add(input3);
+    
+    manager.close();
+    
+    verify(input1, input2, input3);
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/1b07a6dd/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/logconfig/LogConfigHandlerTest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/logconfig/LogConfigHandlerTest.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/logconfig/LogConfigHandlerTest.java
new file mode 100644
index 0000000..02ffd47
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/logconfig/LogConfigHandlerTest.java
@@ -0,0 +1,117 @@
+/*
+ * 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.logfeeder.logconfig;
+
+import java.lang.reflect.Field;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+import static org.easymock.EasyMock.*;
+import static org.junit.Assert.*;
+
+import org.apache.ambari.logfeeder.util.LogFeederUtil;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class LogConfigHandlerTest {
+  
+  private static LogConfigFetcher mockFetcher;
+  
+  private static final Map<String, Object> CONFIG_MAP = new HashMap<>();
+  static {
+    CONFIG_MAP.put("jsons",
+        "{'filter':{" +
+          "'configured_log_file':{" +
+            "'label':'configured_log_file'," +
+            "'hosts':[]," +
+            "'defaultLevels':['FATAL','ERROR','WARN','INFO']," +
+            "'overrideLevels':[]}," +
+          "'configured_log_file2':{" +
+            "'label':'configured_log_file2'," +
+            "'hosts':['host1']," +
+            "'defaultLevels':['FATAL','ERROR','WARN','INFO']," +
+            "'overrideLevels':['FATAL','ERROR','WARN','INFO','DEBUG','TRACE']," +
+            "'expiryTime':'3000-01-01T00:00:00.000Z'}," +
+          "'configured_log_file3':{" +
+            "'label':'configured_log_file3'," +
+            "'hosts':['host1']," +
+            "'defaultLevels':['FATAL','ERROR','WARN','INFO']," +
+            "'overrideLevels':['FATAL','ERROR','WARN','INFO','DEBUG','TRACE']," +
+            "'expiryTime':'1000-01-01T00:00:00.000Z'}" +
+          "}}");
+  }
+  
+  @BeforeClass
+  public static void init() throws Exception {
+    mockFetcher = strictMock(LogConfigFetcher.class);
+    Field f = LogConfigFetcher.class.getDeclaredField("instance");
+    f.setAccessible(true);
+    f.set(null, mockFetcher);
+    expect(mockFetcher.getConfigDoc()).andReturn(CONFIG_MAP).anyTimes();
+    replay(mockFetcher);
+    
+    LogFeederUtil.loadProperties("logfeeder.properties", null);
+    LogConfigHandler.handleConfig();
+    Thread.sleep(1000);
+  }
+  
+  @Test
+  public void testLogConfigHandler_emptyDataAllowed() throws Exception {
+    assertTrue(FilterLogData.INSTANCE.isAllowed((String)null));
+    assertTrue(FilterLogData.INSTANCE.isAllowed(""));
+    assertTrue(FilterLogData.INSTANCE.isAllowed(Collections.<String, Object> emptyMap()));
+  }
+  
+  @Test
+  public void testLogConfigHandler_notConfiguredLogAllowed() throws Exception {
+    assertTrue(FilterLogData.INSTANCE.isAllowed("{'host':'host1', 'type':'not_configured_log_file', 'level':'INFO'}"));
+  }
+  
+  @Test
+  public void testLogConfigHandler_configuredDataAllow() throws Exception {
+    assertTrue(FilterLogData.INSTANCE.isAllowed("{'host':'host1', 'type':'configured_log_file', 'level':'INFO'}"));
+  }
+  
+  @Test
+  public void testLogConfigHandler_configuredDataDontAllow() throws Exception {
+    assertFalse(FilterLogData.INSTANCE.isAllowed("{'host':'host1', 'type':'configured_log_file', 'level':'DEBUG'}"));
+  }
+  
+  @Test
+  public void testLogConfigHandler_overridenConfiguredData() throws Exception {
+    assertTrue(FilterLogData.INSTANCE.isAllowed("{'host':'host1', 'type':'configured_log_file2', 'level':'DEBUG'}"));
+  }
+  
+  @Test
+  public void testLogConfigHandler_overridenConfiguredDataDifferentHost() throws Exception {
+    assertFalse(FilterLogData.INSTANCE.isAllowed("{'host':'host2', 'type':'configured_log_file2', 'level':'DEBUG'}"));
+  }
+  
+  @Test
+  public void testLogConfigHandler_overridenConfiguredDataExpired() throws Exception {
+    assertFalse(FilterLogData.INSTANCE.isAllowed("{'host':'host1', 'type':'configured_log_file3', 'level':'DEBUG'}"));
+  }
+  
+  @AfterClass
+  public static void finish() {
+    verify(mockFetcher);
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/1b07a6dd/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/mapper/MapperDateTest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/mapper/MapperDateTest.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/mapper/MapperDateTest.java
index 301dea9..667c9ff 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/mapper/MapperDateTest.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/mapper/MapperDateTest.java
@@ -1,4 +1,4 @@
-/**
+/*
  * 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
@@ -24,7 +24,6 @@ import java.util.Date;
 import java.util.HashMap;
 import java.util.Map;
 
-import org.apache.ambari.logfeeder.util.LogFeederUtil;
 import org.apache.commons.lang3.time.DateUtils;
 import org.apache.log4j.Logger;
 import org.junit.Test;
@@ -61,7 +60,7 @@ public class MapperDateTest {
     LOG.info("testMapperDate_pattern()");
 
     Map<String, Object> mapConfigs = new HashMap<>();
-    mapConfigs.put("target_date_pattern", LogFeederUtil.DATE_FORMAT);
+    mapConfigs.put("target_date_pattern", "yyyy-MM-dd HH:mm:ss.SSS");
 
     MapperDate mapperDate = new MapperDate();
     assertTrue("Could not initialize!", mapperDate.init(null, "someField", null, mapConfigs));
@@ -70,7 +69,7 @@ public class MapperDateTest {
     String dateString = "2016-04-08 15:55:23.548";
     Object mappedValue = mapperDate.apply(jsonObj, dateString);
 
-    Date d = new SimpleDateFormat(LogFeederUtil.DATE_FORMAT).parse(dateString);
+    Date d = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS").parse(dateString);
 
     assertEquals("Value wasn't matched properly", d, mappedValue);
     assertEquals("Value wasn't put into jsonObj", d, jsonObj.remove("someField"));
@@ -130,7 +129,7 @@ public class MapperDateTest {
     LOG.info("testMapperDate_invalidDateStringValue()");
 
     Map<String, Object> mapConfigs = new HashMap<>();
-    mapConfigs.put("target_date_pattern", LogFeederUtil.DATE_FORMAT);
+    mapConfigs.put("target_date_pattern", "yyyy-MM-dd HH:mm:ss.SSS");
 
     MapperDate mapperDate = new MapperDate();
     assertTrue("Could not initialize!", mapperDate.init(null, "someField", null, mapConfigs));
@@ -149,7 +148,7 @@ public class MapperDateTest {
     String fieldName = "logtime";
     Calendar currentCalendar = Calendar.getInstance();
     Map<String, Object> mapConfigs = new HashMap<>();
-    mapConfigs.put("target_date_pattern", LogFeederUtil.DATE_FORMAT);
+    mapConfigs.put("target_date_pattern", "yyyy-MM-dd HH:mm:ss.SSS");
     String srcDatePattern ="MMM dd HH:mm:ss";
     mapConfigs.put("src_date_pattern", srcDatePattern);
     MapperDate mapperDate = new MapperDate();
@@ -160,7 +159,7 @@ public class MapperDateTest {
     nextMonthCalendar.set(Calendar.MONTH, currentCalendar.get(Calendar.MONTH)+1 );
     String inputDateStr = new SimpleDateFormat("MMM").format(nextMonthCalendar.getTime()) + " 01 12:01:45";
     Object mappedValue = mapperDate.apply(jsonObj, inputDateStr);
-    Date mappedDateValue = new SimpleDateFormat(LogFeederUtil.DATE_FORMAT).parse(mappedValue.toString());
+    Date mappedDateValue = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS").parse(mappedValue.toString());
     String mappedDateValueStr = new SimpleDateFormat(srcDatePattern).format(mappedDateValue);
     assertEquals(Date.class, mappedDateValue.getClass());
     
@@ -179,7 +178,7 @@ public class MapperDateTest {
     String fieldName = "logtime";
     Calendar currentCalendar = Calendar.getInstance();
     Map<String, Object> mapConfigs = new HashMap<>();
-    mapConfigs.put("target_date_pattern", LogFeederUtil.DATE_FORMAT);
+    mapConfigs.put("target_date_pattern", "yyyy-MM-dd HH:mm:ss.SSS");
     String srcDatePattern ="MMM dd HH:mm:ss";
     mapConfigs.put("src_date_pattern", srcDatePattern);
     MapperDate mapperDate = new MapperDate();
@@ -187,7 +186,7 @@ public class MapperDateTest {
     Map<String, Object> jsonObj = new HashMap<>();
     String inputDateStr = new SimpleDateFormat("MMM").format(currentCalendar.getTime()) + " 01 12:01:45";
     Object mappedValue = mapperDate.apply(jsonObj, inputDateStr);
-    Date mappedDateValue = new SimpleDateFormat(LogFeederUtil.DATE_FORMAT).parse(mappedValue.toString());
+    Date mappedDateValue = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS").parse(mappedValue.toString());
     String mappedDateValueStr = new SimpleDateFormat(srcDatePattern).format(mappedDateValue);
     assertEquals(Date.class, mappedDateValue.getClass());
     int expectedLogYear = currentCalendar.get(Calendar.YEAR);

http://git-wip-us.apache.org/repos/asf/ambari/blob/1b07a6dd/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/mapper/MapperFieldNameTest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/mapper/MapperFieldNameTest.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/mapper/MapperFieldNameTest.java
index 6edf766..8ecaad1 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/mapper/MapperFieldNameTest.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/mapper/MapperFieldNameTest.java
@@ -1,4 +1,4 @@
-/**
+/*
  * 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

http://git-wip-us.apache.org/repos/asf/ambari/blob/1b07a6dd/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/mapper/MapperFieldValueTest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/mapper/MapperFieldValueTest.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/mapper/MapperFieldValueTest.java
index df84b8e..fce4308 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/mapper/MapperFieldValueTest.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/mapper/MapperFieldValueTest.java
@@ -1,4 +1,4 @@
-/**
+/*
  * 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

http://git-wip-us.apache.org/repos/asf/ambari/blob/1b07a6dd/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/metrics/MetrcisManagerTest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/metrics/MetrcisManagerTest.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/metrics/MetrcisManagerTest.java
new file mode 100644
index 0000000..8ee6d00
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/metrics/MetrcisManagerTest.java
@@ -0,0 +1,128 @@
+/*
+ * 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.logfeeder.metrics;
+
+import static org.easymock.EasyMock.*;
+import static org.junit.Assert.*;
+import org.easymock.Capture;
+import org.easymock.CaptureType;
+import org.easymock.EasyMock;
+
+import java.lang.reflect.Field;
+import java.util.Arrays;
+import java.util.List;
+import java.util.TreeMap;
+
+import org.apache.ambari.logfeeder.util.LogFeederUtil;
+import org.apache.hadoop.metrics2.sink.timeline.TimelineMetric;
+import org.apache.hadoop.metrics2.sink.timeline.TimelineMetrics;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class MetrcisManagerTest {
+
+  private MetricsManager manager;
+  private LogFeederAMSClient mockClient;
+  private Capture<TimelineMetrics> capture;
+  
+  @BeforeClass
+  public static void loadProperties() throws Exception {
+    LogFeederUtil.loadProperties("logfeeder.properties", null);
+  }
+  
+  @Before
+  public void init() throws Exception {
+    manager = new MetricsManager();
+    manager.init();
+    
+    mockClient = strictMock(LogFeederAMSClient.class);
+    Field f = MetricsManager.class.getDeclaredField("amsClient");
+    f.setAccessible(true);
+    f.set(manager, mockClient);
+    
+    capture = EasyMock.newCapture(CaptureType.FIRST);
+    mockClient.emitMetrics(EasyMock.capture(capture));
+    EasyMock.expectLastCall().andReturn(true).once();
+    
+    replay(mockClient);
+  }
+  
+  @Test
+  public void testMetricManager_pointInTime() throws Exception {
+    MetricData metricCount1 = new MetricData("metric1", true);
+    metricCount1.value = 123;
+    metricCount1.prevPublishValue = 0;
+    metricCount1.publishCount = 0;
+    
+    manager.useMetrics(Arrays.asList(metricCount1));
+    
+    verify(mockClient);
+    
+    TimelineMetrics metrics = capture.getValue();
+    List<TimelineMetric> metricList = metrics.getMetrics();
+    assertEquals(metricList.size(), 1);
+    
+    TimelineMetric metric = metricList.get(0);
+    assertEquals(metric.getHostName(), "test_host_name");
+    assertEquals(metric.getAppId(), "logfeeder");
+    assertEquals(metric.getMetricName(), "metric1");
+    assertEquals(metric.getType(), "Long");
+    
+    TreeMap<Long, Double> values = metric.getMetricValues();
+    assertEquals(values.size(), 1);
+    assertEquals(values.firstEntry().getValue(), Double.valueOf(123.0));
+  }
+  
+  @Test
+  public void testMetricManager_notPointInTime() throws Exception {
+    MetricData metricCount1 = new MetricData("metric1", false);
+    metricCount1.value = 123;
+    metricCount1.prevPublishValue = 0;
+    metricCount1.publishCount = 0;
+    
+    MetricData metricCount2 = new MetricData("metric1", false);
+    metricCount2.value = 123;
+    metricCount2.prevPublishValue = 100;
+    metricCount2.publishCount = 0;
+    
+    MetricData metricCount3 = new MetricData("metric1", false); // not included due to decrease of count
+    metricCount3.value = 99;
+    metricCount3.prevPublishValue = 100;
+    metricCount3.publishCount = 1;
+    
+    manager.useMetrics(Arrays.asList(metricCount1, metricCount2, metricCount3));
+    
+    verify(mockClient);
+    
+    TimelineMetrics metrics = capture.getValue();
+    List<TimelineMetric> metricList = metrics.getMetrics();
+    assertEquals(metricList.size(), 1);
+    
+    TimelineMetric metric = metricList.get(0);
+    assertEquals(metric.getHostName(), "test_host_name");
+    assertEquals(metric.getAppId(), "logfeeder");
+    assertEquals(metric.getMetricName(), "metric1");
+    assertEquals(metric.getType(), "Long");
+    
+    TreeMap<Long, Double> values = metric.getMetricValues();
+    assertEquals(values.size(), 1);
+    assertEquals(values.firstEntry().getValue(), Double.valueOf(146.0));
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/1b07a6dd/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/output/OutputKafkaTest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/output/OutputKafkaTest.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/output/OutputKafkaTest.java
index a7db3f8..38d4b8b 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/output/OutputKafkaTest.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/output/OutputKafkaTest.java
@@ -1,4 +1,4 @@
-/**
+/*
  * 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
@@ -85,8 +85,7 @@ public class OutputKafkaTest {
     EasyMock.replay(mockKafkaProducer);
 
     for (int i = 0; i < 10; i++) {
-      InputMarker inputMarker = new InputMarker();
-      inputMarker.input = EasyMock.mock(Input.class);
+      InputMarker inputMarker = new InputMarker(EasyMock.mock(Input.class), null, 0);
       outputKafka.write("value" + i, inputMarker);
     }
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/1b07a6dd/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/output/OutputManagerTest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/output/OutputManagerTest.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/output/OutputManagerTest.java
new file mode 100644
index 0000000..e103346
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/output/OutputManagerTest.java
@@ -0,0 +1,256 @@
+/*
+ * 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.logfeeder.output;
+
+import static org.easymock.EasyMock.*;
+import static org.junit.Assert.*;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.ambari.logfeeder.input.Input;
+import org.apache.ambari.logfeeder.input.InputMarker;
+import org.apache.ambari.logfeeder.metrics.MetricData;
+import org.junit.Test;
+
+public class OutputManagerTest {
+
+  @Test
+  public void testOutputManager_addAndRemoveOutputs() {
+    Output output1 = strictMock(Output.class);
+    Output output2 = strictMock(Output.class);
+    Output output3 = strictMock(Output.class);
+    Output output4 = strictMock(Output.class);
+    
+    replay(output1, output2, output3, output4);
+    
+    OutputManager manager = new OutputManager();
+    manager.add(output1);
+    manager.add(output2);
+    manager.add(output3);
+    
+    manager.retainUsedOutputs(Arrays.asList(output1, output2, output4));
+    
+    verify(output1, output2, output3, output4);
+    
+    List<Output> outputs = manager.getOutputs();
+    assertEquals(outputs.size(), 2);
+    assertEquals(outputs.get(0), output1);
+    assertEquals(outputs.get(1), output2);
+  }
+
+  @Test
+  public void testOutputManager_init() throws Exception {
+    Output output1 = strictMock(Output.class);
+    Output output2 = strictMock(Output.class);
+    Output output3 = strictMock(Output.class);
+    
+    output1.init(); expectLastCall();
+    output2.init(); expectLastCall();
+    output3.init(); expectLastCall();
+    
+    replay(output1, output2, output3);
+    
+    OutputManager manager = new OutputManager();
+    manager.add(output1);
+    manager.add(output2);
+    manager.add(output3);
+    
+    manager.init();
+    
+    verify(output1, output2, output3);
+  }
+
+  @Test
+  public void testOutputManager_write() throws Exception {
+    Map<String, Object> jsonObj = new HashMap<>();
+    jsonObj.put("type", "testType");
+    jsonObj.put("path", "testPath");
+    jsonObj.put("host", "testHost");
+    jsonObj.put("ip", "testIp");
+    jsonObj.put("level", "testLevel");
+    jsonObj.put("id", "testId");
+    
+    Input mockInput = strictMock(Input.class);
+    InputMarker inputMarker = new InputMarker(mockInput, null, 0);
+    
+    Output output1 = strictMock(Output.class);
+    Output output2 = strictMock(Output.class);
+    Output output3 = strictMock(Output.class);
+    
+    expect(mockInput.getContextFields()).andReturn(Collections.<String, String> emptyMap());
+    expect(mockInput.isUseEventMD5()).andReturn(false);
+    expect(mockInput.isGenEventMD5()).andReturn(false);
+    expect(mockInput.getOutputList()).andReturn(Arrays.asList(output1, output2, output3));
+    
+    output1.write(jsonObj, inputMarker); expectLastCall();
+    output2.write(jsonObj, inputMarker); expectLastCall();
+    output3.write(jsonObj, inputMarker); expectLastCall();
+    
+    replay(output1, output2, output3, mockInput);
+    
+    OutputManager manager = new OutputManager();
+    manager.add(output1);
+    manager.add(output2);
+    manager.add(output3);
+    
+    manager.write(jsonObj, inputMarker);
+    
+    verify(output1, output2, output3, mockInput);
+  }
+
+  @Test
+  public void testOutputManager_write2() throws Exception {
+    String jsonString = "{}";
+    
+    Input mockInput = strictMock(Input.class);
+    InputMarker inputMarker = new InputMarker(mockInput, null, 0);
+    
+    Output output1 = strictMock(Output.class);
+    Output output2 = strictMock(Output.class);
+    Output output3 = strictMock(Output.class);
+    
+    expect(mockInput.getOutputList()).andReturn(Arrays.asList(output1, output2, output3));
+    
+    output1.write(jsonString, inputMarker); expectLastCall();
+    output2.write(jsonString, inputMarker); expectLastCall();
+    output3.write(jsonString, inputMarker); expectLastCall();
+    
+    replay(output1, output2, output3, mockInput);
+    
+    OutputManager manager = new OutputManager();
+    manager.add(output1);
+    manager.add(output2);
+    manager.add(output3);
+    
+    manager.write(jsonString, inputMarker);
+    
+    verify(output1, output2, output3, mockInput);
+  }
+
+  @Test
+  public void testOutputManager_addMetricsContainers() throws Exception {
+    List<MetricData> metrics = new ArrayList<MetricData>();
+    
+    Output output1 = strictMock(Output.class);
+    Output output2 = strictMock(Output.class);
+    Output output3 = strictMock(Output.class);
+    
+    output1.addMetricsContainers(metrics); expectLastCall();
+    output2.addMetricsContainers(metrics); expectLastCall();
+    output3.addMetricsContainers(metrics); expectLastCall();
+    
+    replay(output1, output2, output3);
+    
+    OutputManager manager = new OutputManager();
+    manager.add(output1);
+    manager.add(output2);
+    manager.add(output3);
+    
+    manager.addMetricsContainers(metrics);
+    
+    verify(output1, output2, output3);
+  }
+
+  @Test
+  public void testOutputManager_logStat() throws Exception {
+    Output output1 = strictMock(Output.class);
+    Output output2 = strictMock(Output.class);
+    Output output3 = strictMock(Output.class);
+    
+    output1.logStat(); expectLastCall();
+    output2.logStat(); expectLastCall();
+    output3.logStat(); expectLastCall();
+    
+    replay(output1, output2, output3);
+    
+    OutputManager manager = new OutputManager();
+    manager.add(output1);
+    manager.add(output2);
+    manager.add(output3);
+    
+    manager.logStats();
+    
+    verify(output1, output2, output3);
+  }
+
+  @Test
+  public void testOutputManager_copyFile() throws Exception {
+    File f = new File("");
+    
+    Input mockInput = strictMock(Input.class);
+    InputMarker inputMarker = new InputMarker(mockInput, null, 0);
+    
+    Output output1 = strictMock(Output.class);
+    Output output2 = strictMock(Output.class);
+    Output output3 = strictMock(Output.class);
+    
+    expect(mockInput.getOutputList()).andReturn(Arrays.asList(output1, output2, output3));
+    
+    output1.copyFile(f, inputMarker); expectLastCall();
+    output2.copyFile(f, inputMarker); expectLastCall();
+    output3.copyFile(f, inputMarker); expectLastCall();
+    
+    replay(output1, output2, output3, mockInput);
+    
+    OutputManager manager = new OutputManager();
+    manager.add(output1);
+    manager.add(output2);
+    manager.add(output3);
+    
+    manager.copyFile(f, inputMarker);
+    
+    verify(output1, output2, output3, mockInput);
+  }
+
+  @Test
+  public void testOutputManager_close() throws Exception {
+    Output output1 = strictMock(Output.class);
+    Output output2 = strictMock(Output.class);
+    Output output3 = strictMock(Output.class);
+    
+    output1.setDrain(true); expectLastCall();
+    output2.setDrain(true); expectLastCall();
+    output3.setDrain(true); expectLastCall();
+    
+    output1.close(); expectLastCall();
+    output2.close(); expectLastCall();
+    output3.close(); expectLastCall();
+    
+    expect(output1.isClosed()).andReturn(true);
+    expect(output2.isClosed()).andReturn(true);
+    expect(output3.isClosed()).andReturn(true);
+    
+    replay(output1, output2, output3);
+    
+    OutputManager manager = new OutputManager();
+    manager.add(output1);
+    manager.add(output2);
+    manager.add(output3);
+    
+    manager.close();
+    
+    verify(output1, output2, output3);
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/1b07a6dd/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/output/OutputS3FileTest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/output/OutputS3FileTest.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/output/OutputS3FileTest.java
index 20a4f1f..1872135 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/output/OutputS3FileTest.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/output/OutputS3FileTest.java
@@ -1,4 +1,4 @@
-/**
+/*
  * 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
@@ -69,15 +69,14 @@ public class OutputS3FileTest {
   @Test
   public void shouldSpoolLogEventToNewSpooler() throws Exception {
 
-    InputMarker inputMarker = mock(InputMarker.class);
     Input input = mock(Input.class);
-    inputMarker.input = input;
+    InputMarker inputMarker = new InputMarker(input, null, 0);
     expect(input.getFilePath()).andReturn("/var/log/hdfs-namenode.log");
     expect(input.getStringValue(OutputS3File.INPUT_ATTRIBUTE_TYPE)).andReturn("hdfs-namenode");
     final LogSpooler spooler = mock(LogSpooler.class);
     spooler.add("log event block");
     final S3Uploader s3Uploader = mock(S3Uploader.class);
-    replay(input, inputMarker, spooler, s3Uploader);
+    replay(input, spooler, s3Uploader);
 
     OutputS3File outputS3File = new OutputS3File() {
       @Override
@@ -98,16 +97,15 @@ public class OutputS3FileTest {
 
   @Test
   public void shouldReuseSpoolerForSamePath() throws Exception {
-    InputMarker inputMarker = mock(InputMarker.class);
     Input input = mock(Input.class);
-    inputMarker.input = input;
+    InputMarker inputMarker = new InputMarker(input, null, 0);
     expect(input.getFilePath()).andReturn("/var/log/hdfs-namenode.log");
     expect(input.getStringValue(OutputS3File.INPUT_ATTRIBUTE_TYPE)).andReturn("hdfs-namenode");
     final LogSpooler spooler = mock(LogSpooler.class);
     spooler.add("log event block1");
     spooler.add("log event block2");
     final S3Uploader s3Uploader = mock(S3Uploader.class);
-    replay(input, inputMarker, spooler, s3Uploader);
+    replay(input, spooler, s3Uploader);
 
     OutputS3File outputS3File = new OutputS3File() {
       private boolean firstCallComplete;
@@ -169,16 +167,15 @@ public class OutputS3FileTest {
 
   @Test
   public void shouldUploadFileOnRollover() throws Exception {
-    InputMarker inputMarker = mock(InputMarker.class);
     Input input = mock(Input.class);
-    inputMarker.input = input;
+    InputMarker inputMarker = new InputMarker(input, null, 0);
     expect(input.getFilePath()).andReturn("/var/log/hdfs-namenode.log");
     expect(input.getStringValue(OutputS3File.INPUT_ATTRIBUTE_TYPE)).andReturn("hdfs-namenode");
     final LogSpooler spooler = mock(LogSpooler.class);
     spooler.add("log event block1");
     final S3Uploader s3Uploader = mock(S3Uploader.class);
     s3Uploader.addFileForUpload("/var/ambari-logsearch/logfeeder/hdfs-namenode.log.gz");
-    replay(input, inputMarker, spooler, s3Uploader);
+    replay(input, spooler, s3Uploader);
 
     OutputS3File outputS3File = new OutputS3File() {
       @Override

http://git-wip-us.apache.org/repos/asf/ambari/blob/1b07a6dd/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/output/OutputSolrTest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/output/OutputSolrTest.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/output/OutputSolrTest.java
index 33bb33f..8985110 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/output/OutputSolrTest.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/output/OutputSolrTest.java
@@ -1,4 +1,4 @@
-/**
+/*
  * 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
@@ -97,8 +97,7 @@ public class OutputSolrTest {
         jsonObj.put("name" + ++count, "value" + ++count);
       jsonObj.put("id", ++count);
 
-      InputMarker inputMarker = new InputMarker();
-      inputMarker.input = EasyMock.mock(Input.class);
+      InputMarker inputMarker = new InputMarker(EasyMock.mock(Input.class), null, 0);
       outputSolr.write(jsonObj, inputMarker);
 
       SolrInputDocument doc = new SolrInputDocument();

http://git-wip-us.apache.org/repos/asf/ambari/blob/1b07a6dd/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/output/S3LogPathResolverTest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/output/S3LogPathResolverTest.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/output/S3LogPathResolverTest.java
index cc6da56..d1376c4 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/output/S3LogPathResolverTest.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/output/S3LogPathResolverTest.java
@@ -1,4 +1,4 @@
-/**
+/*
  * 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

http://git-wip-us.apache.org/repos/asf/ambari/blob/1b07a6dd/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/output/S3UploaderTest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/output/S3UploaderTest.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/output/S3UploaderTest.java
index c64e0c5..5477f5c 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/output/S3UploaderTest.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/output/S3UploaderTest.java
@@ -1,4 +1,4 @@
-/**
+/*
  * 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
@@ -18,7 +18,6 @@
 
 package org.apache.ambari.logfeeder.output;
 
-import org.apache.ambari.logfeeder.util.S3Util;
 import org.junit.Test;
 
 import java.io.File;
@@ -46,22 +45,20 @@ public class S3UploaderTest {
     Map<String, Object> configs = setupS3Configs();
 
     S3OutputConfiguration s3OutputConfiguration = new S3OutputConfiguration(configs);
-    S3Util s3Util = mock(S3Util.class);
-    String s3Key = String.format("%s/%s/%s.%s", TEST_PATH, LOG_TYPE, fileName, GZ);
-    s3Util.uploadFileTos3(TEST_BUCKET, s3Key, compressedFile, ACCESS_KEY_VALUE, SECRET_KEY_VALUE);
     expect(compressedFile.delete()).andReturn(true);
     expect(fileToUpload.delete()).andReturn(true);
-    replay(fileToUpload, compressedFile, s3Util);
+    replay(fileToUpload, compressedFile);
 
-    S3Uploader s3Uploader = new S3Uploader(s3OutputConfiguration, s3Util, true, LOG_TYPE) {
+    S3Uploader s3Uploader = new S3Uploader(s3OutputConfiguration, true, LOG_TYPE) {
       @Override
       protected File createCompressedFileForUpload(File fileToUpload, String compressionAlgo) {
         return compressedFile;
       }
+      protected void uploadFileToS3(String bucketName, String s3Key, File localFile, String accessKey, String secretKey) {
+      }
     };
     String resolvedPath = s3Uploader.uploadFile(fileToUpload, LOG_TYPE);
 
-    verify(s3Util);
     assertEquals("test_path/hdfs_namenode/hdfs_namenode.log.123343493473948.gz", resolvedPath);
   }
 
@@ -74,18 +71,17 @@ public class S3UploaderTest {
     Map<String, Object> configs = setupS3Configs();
 
     S3OutputConfiguration s3OutputConfiguration = new S3OutputConfiguration(configs);
-    S3Util s3Util = mock(S3Util.class);
-    String s3Key = String.format("%s/%s/%s.%s", TEST_PATH, LOG_TYPE, fileName, GZ);
-    s3Util.uploadFileTos3(TEST_BUCKET, s3Key, compressedFile, ACCESS_KEY_VALUE, SECRET_KEY_VALUE);
     expect(compressedFile.delete()).andReturn(true);
     expect(fileToUpload.delete()).andReturn(true);
-    replay(fileToUpload, compressedFile, s3Util);
+    replay(fileToUpload, compressedFile);
 
-    S3Uploader s3Uploader = new S3Uploader(s3OutputConfiguration, s3Util, true, LOG_TYPE) {
+    S3Uploader s3Uploader = new S3Uploader(s3OutputConfiguration, true, LOG_TYPE) {
       @Override
       protected File createCompressedFileForUpload(File fileToUpload, String compressionAlgo) {
         return compressedFile;
       }
+      protected void uploadFileToS3(String bucketName, String s3Key, File localFile, String accessKey, String secretKey) {
+      }
     };
     s3Uploader.uploadFile(fileToUpload, LOG_TYPE);
 
@@ -102,17 +98,16 @@ public class S3UploaderTest {
     Map<String, Object> configs = setupS3Configs();
 
     S3OutputConfiguration s3OutputConfiguration = new S3OutputConfiguration(configs);
-    S3Util s3Util = mock(S3Util.class);
-    String s3Key = String.format("%s/%s/%s.%s", TEST_PATH, LOG_TYPE, fileName, GZ);
-    s3Util.uploadFileTos3(TEST_BUCKET, s3Key, compressedFile, ACCESS_KEY_VALUE, SECRET_KEY_VALUE);
     expect(compressedFile.delete()).andReturn(true);
-    replay(fileToUpload, compressedFile, s3Util);
+    replay(fileToUpload, compressedFile);
 
-    S3Uploader s3Uploader = new S3Uploader(s3OutputConfiguration, s3Util, false, LOG_TYPE) {
+    S3Uploader s3Uploader = new S3Uploader(s3OutputConfiguration, false, LOG_TYPE) {
       @Override
       protected File createCompressedFileForUpload(File fileToUpload, String compressionAlgo) {
         return compressedFile;
       }
+      protected void uploadFileToS3(String bucketName, String s3Key, File localFile, String accessKey, String secretKey) {
+      }
     };
     s3Uploader.uploadFile(fileToUpload, LOG_TYPE);
 
@@ -131,22 +126,19 @@ public class S3UploaderTest {
 
 
     S3OutputConfiguration s3OutputConfiguration = new S3OutputConfiguration(configs);
-    S3Util s3Util = mock(S3Util.class);
-    String s3Key = String.format("%s/%s/%s/%s.%s", "cl1", TEST_PATH, LOG_TYPE, fileName, GZ);
-    s3Util.uploadFileTos3(TEST_BUCKET, s3Key, compressedFile, ACCESS_KEY_VALUE, SECRET_KEY_VALUE);
     expect(compressedFile.delete()).andReturn(true);
     expect(fileToUpload.delete()).andReturn(true);
-    replay(fileToUpload, compressedFile, s3Util);
+    replay(fileToUpload, compressedFile);
 
-    S3Uploader s3Uploader = new S3Uploader(s3OutputConfiguration, s3Util, true, LOG_TYPE) {
+    S3Uploader s3Uploader = new S3Uploader(s3OutputConfiguration, true, LOG_TYPE) {
       @Override
       protected File createCompressedFileForUpload(File fileToUpload, String compressionAlgo) {
         return compressedFile;
       }
+      protected void uploadFileToS3(String bucketName, String s3Key, File localFile, String accessKey, String secretKey) {
+      }
     };
     s3Uploader.uploadFile(fileToUpload, LOG_TYPE);
-
-    verify(s3Util);
   }
 
   private Map<String, Object> setupS3Configs() {

http://git-wip-us.apache.org/repos/asf/ambari/blob/1b07a6dd/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/output/spool/LogSpoolerTest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/output/spool/LogSpoolerTest.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/output/spool/LogSpoolerTest.java
index 7a47039..2cfe9ff 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/output/spool/LogSpoolerTest.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/output/spool/LogSpoolerTest.java
@@ -1,4 +1,4 @@
-/**
+/*
  * 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

http://git-wip-us.apache.org/repos/asf/ambari/blob/1b07a6dd/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/util/AWSUtilTest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/util/AWSUtilTest.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/util/AWSUtilTest.java
deleted file mode 100644
index 6df2283..0000000
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/util/AWSUtilTest.java
+++ /dev/null
@@ -1,29 +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.logfeeder.util;
-
-import org.apache.ambari.logfeeder.util.AWSUtil;
-
-public class AWSUtilTest {
-  public void testAWSUtil_getAwsUserName() throws Exception {
-    String S3_ACCESS_KEY = "S3_ACCESS_KEY";
-    String S3_SECRET_KEY = "S3_SECRET_KEY";
-    AWSUtil.INSTANCE.getAwsUserName(S3_ACCESS_KEY, S3_SECRET_KEY);
-  }
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/1b07a6dd/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/util/PlaceholderUtilTest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/util/PlaceholderUtilTest.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/util/PlaceholderUtilTest.java
index 9789a14..43e03c7 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/util/PlaceholderUtilTest.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/util/PlaceholderUtilTest.java
@@ -1,6 +1,4 @@
-package org.apache.ambari.logfeeder.util;
-
-/**
+/*
  * 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
@@ -17,6 +15,9 @@ package org.apache.ambari.logfeeder.util;
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
+package org.apache.ambari.logfeeder.util;
+
 import java.util.HashMap;
 
 import org.junit.Test;
@@ -26,19 +27,18 @@ import static org.junit.Assert.assertEquals;
 public class PlaceholderUtilTest {
   @Test
   public void testPlaceholderUtil_replaceVariables() {
-    HashMap<String, String> contextParam = new HashMap<String, String>();
     String hostName = "host1";
     String ip = "127.0.0.1";
     String clusterName = "test-cluster";
+    
+    HashMap<String, String> contextParam = new HashMap<String, String>();
     contextParam.put("host", hostName);
     contextParam.put("ip", ip);
     contextParam.put("cluster", clusterName);
-    String inputStr = "$CLUSTER/logfeeder/$HOST-$IP/logs";
-    String resultStr = PlaceholderUtil.replaceVariables(inputStr, contextParam);
+    
+    String resultStr = PlaceholderUtil.replaceVariables("$CLUSTER/logfeeder/$HOST-$IP/logs", contextParam);
     String expectedStr = clusterName + "/logfeeder/" + hostName + "-" + ip + "/logs";
-    assertEquals("Result string :" + resultStr
-        + " is not equal to exptected string :" + expectedStr, resultStr,
-        expectedStr);
+    
+    assertEquals("Result string :" + resultStr + " is not equal to exptected string :" + expectedStr, resultStr, expectedStr);
   }
-
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/1b07a6dd/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/util/S3UtilTest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/util/S3UtilTest.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/util/S3UtilTest.java
index 84554b0..02918be 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/util/S3UtilTest.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/util/S3UtilTest.java
@@ -26,14 +26,14 @@ public class S3UtilTest {
   public void testS3Util_pathToBucketName() throws Exception {
     String s3Path = "s3://bucket_name/path/file.txt";
     String expectedBucketName = "bucket_name";
-    String actualBucketName = S3Util.INSTANCE.getBucketName(s3Path);
+    String actualBucketName = S3Util.getBucketName(s3Path);
     assertEquals(expectedBucketName, actualBucketName);
   }
 
   public void testS3Util_pathToS3Key() throws Exception {
     String s3Path = "s3://bucket_name/path/file.txt";
     String expectedS3key = "path/file.txt";
-    String actualS3key = S3Util.INSTANCE.getS3Key(s3Path);
+    String actualS3key = S3Util.getS3Key(s3Path);
     assertEquals(expectedS3key, actualS3key);
   }
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/1b07a6dd/ambari-logsearch/ambari-logsearch-logfeeder/src/test/resources/logfeeder.properties
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/test/resources/logfeeder.properties b/ambari-logsearch/ambari-logsearch-logfeeder/src/test/resources/logfeeder.properties
new file mode 100644
index 0000000..59020cc
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/test/resources/logfeeder.properties
@@ -0,0 +1,20 @@
+# 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.
+
+logfeeder.log.filter.enable=true
+logfeeder.solr.config.interval=5
+logfeeder.solr.zk_connect_string=some_connect_string
+logfeeder.metrics.collector.hosts=some_collector_host
+node.hostname=test_host_name
\ No newline at end of file


[27/58] [abbrv] ambari git commit: AMBARI-18246. Clean up Log Feeder (Miklos Gergely via oleewere)

Posted by ol...@apache.org.
AMBARI-18246. Clean up Log Feeder (Miklos Gergely via oleewere)


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

Branch: refs/heads/branch-2.5
Commit: 1b07a6dde2373d205d6b6fc5110e5d9b05c398ea
Parents: f7dcf0a
Author: Miklos Gergely <mg...@hortonworks.com>
Authored: Wed Sep 7 22:24:51 2016 +0200
Committer: oleewere <ol...@gmail.com>
Committed: Sat Nov 5 14:46:44 2016 +0100

----------------------------------------------------------------------
 .../org/apache/ambari/logfeeder/LogFeeder.java  | 594 +++++++------------
 .../ambari/logfeeder/common/ConfigBlock.java    |  71 +--
 .../logfeeder/common/LogFeederConstants.java    |  39 ++
 .../apache/ambari/logfeeder/filter/Filter.java  |  55 +-
 .../ambari/logfeeder/filter/FilterGrok.java     |  94 +--
 .../ambari/logfeeder/filter/FilterJSON.java     |   8 +-
 .../ambari/logfeeder/filter/FilterKeyValue.java |  44 +-
 .../logfeeder/input/AbstractInputFile.java      | 319 ++++++++++
 .../apache/ambari/logfeeder/input/Input.java    | 313 +++++-----
 .../ambari/logfeeder/input/InputFile.java       | 503 ++--------------
 .../ambari/logfeeder/input/InputManager.java    | 379 ++++++++++++
 .../ambari/logfeeder/input/InputMarker.java     |  17 +-
 .../apache/ambari/logfeeder/input/InputMgr.java | 451 --------------
 .../ambari/logfeeder/input/InputS3File.java     | 424 +------------
 .../ambari/logfeeder/input/InputSimulate.java   |  40 +-
 .../logfeeder/input/reader/GZIPReader.java      |  23 +-
 .../input/reader/LogsearchReaderFactory.java    |   8 +-
 .../logconfig/FetchConfigFromSolr.java          | 194 ------
 .../logfeeder/logconfig/FilterLogData.java      |  83 +++
 .../logfeeder/logconfig/LogConfigFetcher.java   | 168 ++++++
 .../logfeeder/logconfig/LogConfigHandler.java   | 189 ++++++
 .../logfeeder/logconfig/LogFeederConstants.java |  34 --
 .../logfeeder/logconfig/LogFeederFilter.java    |  90 +++
 .../logconfig/LogFeederFilterWrapper.java       |  55 ++
 .../logfeeder/logconfig/LogfeederScheduler.java |  59 --
 .../logconfig/filter/ApplyLogFilter.java        |  62 --
 .../logconfig/filter/DefaultDataFilter.java     |  49 --
 .../logconfig/filter/FilterLogData.java         |  53 --
 .../apache/ambari/logfeeder/mapper/Mapper.java  |  14 +-
 .../ambari/logfeeder/mapper/MapperDate.java     |  32 +-
 .../logfeeder/mapper/MapperFieldName.java       |  20 +-
 .../logfeeder/mapper/MapperFieldValue.java      |  31 +-
 .../logfeeder/metrics/LogFeederAMSClient.java   |  10 +-
 .../ambari/logfeeder/metrics/MetricCount.java   |  31 -
 .../ambari/logfeeder/metrics/MetricData.java    |  46 ++
 .../logfeeder/metrics/MetricsManager.java       | 178 ++++++
 .../ambari/logfeeder/metrics/MetricsMgr.java    | 178 ------
 .../apache/ambari/logfeeder/output/Output.java  |  13 +-
 .../ambari/logfeeder/output/OutputData.java     |   8 +-
 .../ambari/logfeeder/output/OutputDevNull.java  |   7 +-
 .../ambari/logfeeder/output/OutputFile.java     |  42 +-
 .../ambari/logfeeder/output/OutputHDFSFile.java |  70 +--
 .../ambari/logfeeder/output/OutputKafka.java    |  58 +-
 .../ambari/logfeeder/output/OutputManager.java  | 250 ++++++++
 .../ambari/logfeeder/output/OutputMgr.java      | 263 --------
 .../ambari/logfeeder/output/OutputS3File.java   |  41 +-
 .../ambari/logfeeder/output/OutputSolr.java     |  62 +-
 .../logfeeder/output/S3LogPathResolver.java     |   6 +-
 .../logfeeder/output/S3OutputConfiguration.java |   5 +-
 .../ambari/logfeeder/output/S3Uploader.java     |  64 +-
 .../logfeeder/output/spool/LogSpooler.java      |  23 +-
 .../output/spool/LogSpoolerContext.java         |   2 +-
 .../output/spool/LogSpoolerException.java       |   2 +-
 .../output/spool/RolloverCondition.java         |   2 +-
 .../logfeeder/output/spool/RolloverHandler.java |   2 +-
 .../apache/ambari/logfeeder/util/AWSUtil.java   |  52 +-
 .../apache/ambari/logfeeder/util/AliasUtil.java | 103 ++--
 .../ambari/logfeeder/util/CompressionUtil.java  |  15 +-
 .../apache/ambari/logfeeder/util/DateUtil.java  |  39 +-
 .../apache/ambari/logfeeder/util/FileUtil.java  |  66 ++-
 .../ambari/logfeeder/util/LogFeederUtil.java    | 511 +++++-----------
 .../logfeeder/util/LogfeederHDFSUtil.java       |  58 +-
 .../ambari/logfeeder/util/PlaceholderUtil.java  |  32 +-
 .../apache/ambari/logfeeder/util/S3Util.java    |  81 +--
 .../apache/ambari/logfeeder/util/SolrUtil.java  | 186 ------
 .../ambari/logfeeder/view/VLogfeederFilter.java |  90 ---
 .../logfeeder/view/VLogfeederFilterWrapper.java |  55 --
 .../org/apache/ambari/logfeeder/AppTest.java    | 116 ----
 .../ambari/logfeeder/filter/FilterGrokTest.java |  55 +-
 .../ambari/logfeeder/filter/FilterJSONTest.java |  41 +-
 .../logfeeder/filter/FilterKeyValueTest.java    |  34 +-
 .../ambari/logfeeder/input/InputFileTest.java   |  24 +-
 .../logfeeder/input/InputManagerTest.java       | 241 ++++++++
 .../logconfig/LogConfigHandlerTest.java         | 117 ++++
 .../ambari/logfeeder/mapper/MapperDateTest.java |  17 +-
 .../logfeeder/mapper/MapperFieldNameTest.java   |   2 +-
 .../logfeeder/mapper/MapperFieldValueTest.java  |   2 +-
 .../logfeeder/metrics/MetrcisManagerTest.java   | 128 ++++
 .../logfeeder/output/OutputKafkaTest.java       |   5 +-
 .../logfeeder/output/OutputManagerTest.java     | 256 ++++++++
 .../logfeeder/output/OutputS3FileTest.java      |  17 +-
 .../ambari/logfeeder/output/OutputSolrTest.java |   5 +-
 .../logfeeder/output/S3LogPathResolverTest.java |   2 +-
 .../ambari/logfeeder/output/S3UploaderTest.java |  42 +-
 .../logfeeder/output/spool/LogSpoolerTest.java  |   2 +-
 .../ambari/logfeeder/util/AWSUtilTest.java      |  29 -
 .../logfeeder/util/PlaceholderUtilTest.java     |  20 +-
 .../ambari/logfeeder/util/S3UtilTest.java       |   4 +-
 .../src/test/resources/logfeeder.properties     |  20 +
 89 files changed, 3864 insertions(+), 4481 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/1b07a6dd/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/LogFeeder.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/LogFeeder.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/LogFeeder.java
index 373d743..6d0f22c 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/LogFeeder.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/LogFeeder.java
@@ -20,14 +20,10 @@
 package org.apache.ambari.logfeeder;
 
 import java.io.BufferedInputStream;
-import java.io.BufferedReader;
 import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStreamReader;
 import java.lang.reflect.Type;
 import java.util.ArrayList;
-import java.util.Collection;
+import java.util.Arrays;
 import java.util.Collections;
 import java.util.Comparator;
 import java.util.Date;
@@ -39,18 +35,21 @@ import java.util.Set;
 
 import org.apache.ambari.logfeeder.filter.Filter;
 import org.apache.ambari.logfeeder.input.Input;
-import org.apache.ambari.logfeeder.input.InputMgr;
+import org.apache.ambari.logfeeder.input.InputManager;
 import org.apache.ambari.logfeeder.input.InputSimulate;
-import org.apache.ambari.logfeeder.logconfig.LogfeederScheduler;
-import org.apache.ambari.logfeeder.metrics.MetricCount;
-import org.apache.ambari.logfeeder.metrics.MetricsMgr;
+import org.apache.ambari.logfeeder.logconfig.LogConfigHandler;
+import org.apache.ambari.logfeeder.metrics.MetricData;
+import org.apache.ambari.logfeeder.metrics.MetricsManager;
 import org.apache.ambari.logfeeder.output.Output;
-import org.apache.ambari.logfeeder.output.OutputMgr;
+import org.apache.ambari.logfeeder.output.OutputManager;
 import org.apache.ambari.logfeeder.util.AliasUtil;
 import org.apache.ambari.logfeeder.util.FileUtil;
 import org.apache.ambari.logfeeder.util.LogFeederUtil;
-import org.apache.ambari.logfeeder.util.AliasUtil.ALIAS_PARAM;
-import org.apache.ambari.logfeeder.util.AliasUtil.ALIAS_TYPE;
+import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.io.IOUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.ambari.logfeeder.util.AliasUtil.AliasType;
 import org.apache.hadoop.util.ShutdownHookManager;
 import org.apache.log4j.Level;
 import org.apache.log4j.Logger;
@@ -58,171 +57,142 @@ import org.apache.log4j.Logger;
 import com.google.gson.reflect.TypeToken;
 
 public class LogFeeder {
-  private static final Logger logger = Logger.getLogger(LogFeeder.class);
+  private static final Logger LOG = Logger.getLogger(LogFeeder.class);
 
   private static final int LOGFEEDER_SHUTDOWN_HOOK_PRIORITY = 30;
+  private static final int CHECKPOINT_CLEAN_INTERVAL_MS = 24 * 60 * 60 * 60 * 1000; // 24 hours
 
-  private Collection<Output> outputList = new ArrayList<Output>();
+  private OutputManager outputManager = new OutputManager();
+  private InputManager inputManager = new InputManager();
+  private MetricsManager metricsManager = new MetricsManager();
 
-  private OutputMgr outMgr = new OutputMgr();
-  private InputMgr inputMgr = new InputMgr();
-  private MetricsMgr metricsMgr = new MetricsMgr();
+  public static Map<String, Object> globalConfigs = new HashMap<>();
 
-  public static Map<String, Object> globalMap = null;
-  private String[] inputParams;
-
-  private List<Map<String, Object>> globalConfigList = new ArrayList<Map<String, Object>>();
-  private List<Map<String, Object>> inputConfigList = new ArrayList<Map<String, Object>>();
-  private List<Map<String, Object>> filterConfigList = new ArrayList<Map<String, Object>>();
-  private List<Map<String, Object>> outputConfigList = new ArrayList<Map<String, Object>>();
+  private List<Map<String, Object>> inputConfigList = new ArrayList<>();
+  private List<Map<String, Object>> filterConfigList = new ArrayList<>();
+  private List<Map<String, Object>> outputConfigList = new ArrayList<>();
   
-  private int checkPointCleanIntervalMS = 24 * 60 * 60 * 60 * 1000; // 24 hours
   private long lastCheckPointCleanedMS = 0;
-  
-  private static boolean isLogfeederCompleted = false;
-  
+  private boolean isLogfeederCompleted = false;
   private Thread statLoggerThread = null;
 
-  private LogFeeder(String[] args) {
-    inputParams = args;
+  private LogFeeder() {}
+
+  public void run() {
+    try {
+      init();
+      monitor();
+      waitOnAllDaemonThreads();
+    } catch (Throwable t) {
+      LOG.fatal("Caught exception in main.", t);
+      System.exit(1);
+    }
   }
 
   private void init() throws Throwable {
+    Date startTime = new Date();
 
-    LogFeederUtil.loadProperties("logfeeder.properties", inputParams);
-
-    String configFiles = LogFeederUtil.getStringProperty("logfeeder.config.files");
-    logger.info("logfeeder.config.files=" + configFiles);
+    loadConfigFiles();
+    addSimulatedInputs();
+    mergeAllConfigs();
     
-    String[] configFileList = null;
-    if (configFiles != null) {
-      configFileList = configFiles.split(",");
-    }
-    //list of config those are there in cmd line config dir , end with .json
-    String[] cmdLineConfigs = getConfigFromCmdLine();
-    //merge both config
-    String mergedConfigList[] = LogFeederUtil.mergeArray(configFileList,
-        cmdLineConfigs);
-    //mergedConfigList is null then set default conifg 
-    if (mergedConfigList == null || mergedConfigList.length == 0) {
-      mergedConfigList = LogFeederUtil.getStringProperty("config.file",
-          "config.json").split(",");
-    }
-    for (String configFileName : mergedConfigList) {
-      logger.info("Going to load config file:" + configFileName);
-      //escape space from config file path
-      configFileName= configFileName.replace("\\ ", "%20");
+    LogConfigHandler.handleConfig();
+    
+    outputManager.init();
+    inputManager.init();
+    metricsManager.init();
+    
+    LOG.debug("==============");
+    
+    Date endTime = new Date();
+    LOG.info("Took " + (endTime.getTime() - startTime.getTime()) + " ms to initialize");
+  }
+
+  private void loadConfigFiles() throws Exception {
+    List<String> configFiles = getConfigFiles();
+    for (String configFileName : configFiles) {
+      LOG.info("Going to load config file:" + configFileName);
+      configFileName = configFileName.replace("\\ ", "%20");
       File configFile = new File(configFileName);
       if (configFile.exists() && configFile.isFile()) {
-        logger.info("Config file exists in path."
-          + configFile.getAbsolutePath());
+        LOG.info("Config file exists in path." + configFile.getAbsolutePath());
         loadConfigsUsingFile(configFile);
       } else {
-        // Let's try to load it from class loader
-        logger.info("Trying to load config file from classloader: "
-          + configFileName);
+        LOG.info("Trying to load config file from classloader: " + configFileName);
         loadConfigsUsingClassLoader(configFileName);
-        logger.info("Loaded config file from classloader: "
-          + configFileName);
+        LOG.info("Loaded config file from classloader: " + configFileName);
       }
     }
-    
-    addSimulatedInputs();
-    
-    mergeAllConfigs();
-    
-    LogfeederScheduler.INSTANCE.start();
-    
-    outMgr.setOutputList(outputList);
-    for (Output output : outputList) {
-      output.init();
-    }
-    inputMgr.init();
-    metricsMgr.init();
-    logger.debug("==============");
   }
 
-  private void loadConfigsUsingClassLoader(String configFileName) throws Exception {
-    BufferedInputStream fileInputStream = null;
-    BufferedReader br = null;
-    try {
-      fileInputStream = (BufferedInputStream) this
-        .getClass().getClassLoader()
-        .getResourceAsStream(configFileName);
-      if (fileInputStream != null) {
-        br = new BufferedReader(new InputStreamReader(
-          fileInputStream));
-        String configData = readFile(br);
-        loadConfigs(configData);
-      } else {
-        throw new Exception("Can't find configFile=" + configFileName);
-      }
-    } finally {
-      if (br != null) {
-        try {
-          br.close();
-        } catch (IOException e) {
-        }
-      }
+  private List<String> getConfigFiles() {
+    List<String> configFiles = new ArrayList<>();
+    
+    String logfeederConfigFilesProperty = LogFeederUtil.getStringProperty("logfeeder.config.files");
+    LOG.info("logfeeder.config.files=" + logfeederConfigFilesProperty);
+    if (logfeederConfigFilesProperty != null) {
+      configFiles.addAll(Arrays.asList(logfeederConfigFilesProperty.split(",")));
+    }
 
-      if (fileInputStream != null) {
-        try {
-          fileInputStream.close();
-        } catch (IOException e) {
-        }
+    String inputConfigDir = LogFeederUtil.getStringProperty("input_config_dir");
+    if (StringUtils.isNotEmpty(inputConfigDir)) {
+      File configDirFile = new File(inputConfigDir);
+      List<File> inputConfigFiles = FileUtil.getAllFileFromDir(configDirFile, "json", false);
+      for (File inputConfigFile : inputConfigFiles) {
+        configFiles.add(inputConfigFile.getAbsolutePath());
       }
     }
+    
+    if (CollectionUtils.isEmpty(configFiles)) {
+      String configFileProperty = LogFeederUtil.getStringProperty("config.file", "config.json");
+      configFiles.addAll(Arrays.asList(configFileProperty.split(",")));
+    }
+    
+    return configFiles;
   }
 
-  /**
-   * This method loads the configurations from the given file.
-   */
   private void loadConfigsUsingFile(File configFile) throws Exception {
-    FileInputStream fileInputStream = null;
     try {
-      fileInputStream = new FileInputStream(configFile);
-      BufferedReader br = new BufferedReader(new InputStreamReader(
-        fileInputStream));
-      String configData = readFile(br);
+      String configData = FileUtils.readFileToString(configFile);
       loadConfigs(configData);
     } catch (Exception t) {
-      logger.error("Error opening config file. configFilePath="
-        + configFile.getAbsolutePath());
+      LOG.error("Error opening config file. configFilePath=" + configFile.getAbsolutePath());
       throw t;
-    } finally {
-      if (fileInputStream != null) {
-        try {
-          fileInputStream.close();
-        } catch (Throwable t) {
-          // ignore
-        }
-      }
+    }
+  }
+
+  private void loadConfigsUsingClassLoader(String configFileName) throws Exception {
+    try (BufferedInputStream fis = (BufferedInputStream) this.getClass().getClassLoader().getResourceAsStream(configFileName)) {
+      String configData = IOUtils.toString(fis);
+      loadConfigs(configData);
     }
   }
 
   @SuppressWarnings("unchecked")
   private void loadConfigs(String configData) throws Exception {
-    Type type = new TypeToken<Map<String, Object>>() {
-    }.getType();
-    Map<String, Object> configMap = LogFeederUtil.getGson().fromJson(
-      configData, type);
+    Type type = new TypeToken<Map<String, Object>>() {}.getType();
+    Map<String, Object> configMap = LogFeederUtil.getGson().fromJson(configData, type);
 
     // Get the globals
     for (String key : configMap.keySet()) {
-      if (key.equalsIgnoreCase("global")) {
-        globalConfigList.add((Map<String, Object>) configMap.get(key));
-      } else if (key.equalsIgnoreCase("input")) {
-        List<Map<String, Object>> mapList = (List<Map<String, Object>>) configMap
-          .get(key);
-        inputConfigList.addAll(mapList);
-      } else if (key.equalsIgnoreCase("filter")) {
-        List<Map<String, Object>> mapList = (List<Map<String, Object>>) configMap
-          .get(key);
-        filterConfigList.addAll(mapList);
-      } else if (key.equalsIgnoreCase("output")) {
-        List<Map<String, Object>> mapList = (List<Map<String, Object>>) configMap
-          .get(key);
-        outputConfigList.addAll(mapList);
+      switch (key) {
+        case "global" :
+          globalConfigs.putAll((Map<String, Object>) configMap.get(key));
+          break;
+        case "input" :
+          List<Map<String, Object>> inputConfig = (List<Map<String, Object>>) configMap.get(key);
+          inputConfigList.addAll(inputConfig);
+          break;
+        case "filter" :
+          List<Map<String, Object>> filterConfig = (List<Map<String, Object>>) configMap.get(key);
+          filterConfigList.addAll(filterConfig);
+          break;
+        case "output" :
+          List<Map<String, Object>> outputConfig = (List<Map<String, Object>>) configMap.get(key);
+          outputConfigList.addAll(outputConfig);
+          break;
+        default :
+          LOG.warn("Unknown config key: " + key);
       }
     }
   }
@@ -244,231 +214,175 @@ public class LogFeeder {
   }
 
   private void mergeAllConfigs() {
-    globalMap = mergeConfigs(globalConfigList);
+    loadOutputs();
+    loadInputs();
+    loadFilters();
+    
+    assignOutputsToInputs();
+  }
 
-    sortBlocks(filterConfigList);
-    // First loop for output
+  private void loadOutputs() {
     for (Map<String, Object> map : outputConfigList) {
       if (map == null) {
         continue;
       }
-      mergeBlocks(globalMap, map);
+      mergeBlocks(globalConfigs, map);
 
       String value = (String) map.get("destination");
-      Output output;
-      if (value == null || value.isEmpty()) {
-        logger.error("Output block doesn't have destination element");
-        continue;
-      }
-      String classFullName = AliasUtil.getInstance().readAlias(value, ALIAS_TYPE.OUTPUT, ALIAS_PARAM.KLASS);
-      if (classFullName == null || classFullName.isEmpty()) {
-        logger.error("Destination block doesn't have output element");
+      if (StringUtils.isEmpty(value)) {
+        LOG.error("Output block doesn't have destination element");
         continue;
       }
-      output = (Output) LogFeederUtil.getClassInstance(classFullName, ALIAS_TYPE.OUTPUT);
-
+      Output output = (Output) AliasUtil.getClassInstance(value, AliasType.OUTPUT);
       if (output == null) {
-        logger.error("Destination Object is null");
+        LOG.error("Output object could not be found");
         continue;
       }
-
       output.setDestination(value);
       output.loadConfig(map);
 
-      // We will only check for is_enabled out here. Down below we will
-      // check whether this output is enabled for the input
-      boolean isEnabled = output.getBooleanValue("is_enabled", true);
-      if (isEnabled) {
-        outputList.add(output);
+      // We will only check for is_enabled out here. Down below we will check whether this output is enabled for the input
+      if (output.getBooleanValue("is_enabled", true)) {
         output.logConfgs(Level.INFO);
+        outputManager.add(output);
       } else {
-        logger.info("Output is disabled. So ignoring it. "
-          + output.getShortDescription());
+        LOG.info("Output is disabled. So ignoring it. " + output.getShortDescription());
       }
     }
+  }
 
-    // Second loop for input
+  private void loadInputs() {
     for (Map<String, Object> map : inputConfigList) {
       if (map == null) {
         continue;
       }
-      mergeBlocks(globalMap, map);
+      mergeBlocks(globalConfigs, map);
 
       String value = (String) map.get("source");
-      Input input;
-      if (value == null || value.isEmpty()) {
-        logger.error("Input block doesn't have source element");
-        continue;
-      }
-      String classFullName = AliasUtil.getInstance().readAlias(value, ALIAS_TYPE.INPUT, ALIAS_PARAM.KLASS);
-      if (classFullName == null || classFullName.isEmpty()) {
-        logger.error("Source block doesn't have source element");
+      if (StringUtils.isEmpty(value)) {
+        LOG.error("Input block doesn't have source element");
         continue;
       }
-      input = (Input) LogFeederUtil.getClassInstance(classFullName, ALIAS_TYPE.INPUT);
-
+      Input input = (Input) AliasUtil.getClassInstance(value, AliasType.INPUT);
       if (input == null) {
-        logger.error("Source Object is null");
+        LOG.error("Input object could not be found");
         continue;
       }
-
       input.setType(value);
       input.loadConfig(map);
 
       if (input.isEnabled()) {
-        input.setOutputMgr(outMgr);
-        input.setInputMgr(inputMgr);
-        inputMgr.add(input);
+        input.setOutputManager(outputManager);
+        input.setInputManager(inputManager);
+        inputManager.add(input);
         input.logConfgs(Level.INFO);
       } else {
-        logger.info("Input is disabled. So ignoring it. "
-          + input.getShortDescription());
+        LOG.info("Input is disabled. So ignoring it. " + input.getShortDescription());
       }
     }
+  }
+
+  private void loadFilters() {
+    sortFilters();
 
-    // Third loop is for filter, but we will have to create a filter
-    // instance for each input, so it can maintain the state per input
     List<Input> toRemoveInputList = new ArrayList<Input>();
-    for (Input input : inputMgr.getInputList()) {
-      Filter prevFilter = null;
+    for (Input input : inputManager.getInputList()) {
       for (Map<String, Object> map : filterConfigList) {
         if (map == null) {
           continue;
         }
-        mergeBlocks(globalMap, map);
+        mergeBlocks(globalConfigs, map);
 
         String value = (String) map.get("filter");
-        Filter filter;
-        if (value == null || value.isEmpty()) {
-          logger.error("Filter block doesn't have filter element");
-          continue;
-        }
-
-        String classFullName = AliasUtil.getInstance().readAlias(value, ALIAS_TYPE.FILTER, ALIAS_PARAM.KLASS);
-        if (classFullName == null || classFullName.isEmpty()) {
-          logger.error("Filter block doesn't have filter element");
+        if (StringUtils.isEmpty(value)) {
+          LOG.error("Filter block doesn't have filter element");
           continue;
         }
-        filter = (Filter) LogFeederUtil.getClassInstance(classFullName, ALIAS_TYPE.FILTER);
-
+        Filter filter = (Filter) AliasUtil.getClassInstance(value, AliasType.FILTER);
         if (filter == null) {
-          logger.error("Filter Object is null");
+          LOG.error("Filter object could not be found");
           continue;
         }
         filter.loadConfig(map);
         filter.setInput(input);
 
         if (filter.isEnabled()) {
-          filter.setOutputMgr(outMgr);
-          if (prevFilter == null) {
-            input.setFirstFilter(filter);
-          } else {
-            prevFilter.setNextFilter(filter);
-          }
-          prevFilter = filter;
+          filter.setOutputManager(outputManager);
+          input.addFilter(filter);
           filter.logConfgs(Level.INFO);
         } else {
-          logger.debug("Ignoring filter "
-            + filter.getShortDescription() + " for input "
-            + input.getShortDescription());
+          LOG.debug("Ignoring filter " + filter.getShortDescription() + " for input " + input.getShortDescription());
         }
       }
+      
       if (input.getFirstFilter() == null) {
         toRemoveInputList.add(input);
       }
     }
 
-    // Fourth loop is for associating valid outputs to input
-    Set<Output> usedOutputSet = new HashSet<Output>();
-    for (Input input : inputMgr.getInputList()) {
-      for (Output output : outputList) {
-        boolean ret = LogFeederUtil.isEnabled(output.getConfigs(),
-          input.getConfigs());
-        if (ret) {
-          usedOutputSet.add(output);
-          input.addOutput(output);
-        }
-      }
-    }
-    outputList = usedOutputSet;
-
     for (Input toRemoveInput : toRemoveInputList) {
-      logger.warn("There are no filters, we will ignore this input. "
-        + toRemoveInput.getShortDescription());
-      inputMgr.removeInput(toRemoveInput);
+      LOG.warn("There are no filters, we will ignore this input. " + toRemoveInput.getShortDescription());
+      inputManager.removeInput(toRemoveInput);
     }
   }
 
-  private void sortBlocks(List<Map<String, Object>> blockList) {
-
-    Collections.sort(blockList, new Comparator<Map<String, Object>>() {
+  private void sortFilters() {
+    Collections.sort(filterConfigList, new Comparator<Map<String, Object>>() {
 
       @Override
       public int compare(Map<String, Object> o1, Map<String, Object> o2) {
         Object o1Sort = o1.get("sort_order");
         Object o2Sort = o2.get("sort_order");
-        if (o1Sort == null) {
-          return 0;
-        }
-        if (o2Sort == null) {
+        if (o1Sort == null || o2Sort == null) {
           return 0;
         }
-        int o1Value = 0;
-        if (!(o1Sort instanceof Number)) {
-          try {
-            o1Value = (new Double(Double.parseDouble(o1Sort
-              .toString()))).intValue();
-          } catch (Throwable t) {
-            logger.error("Value is not of type Number. class="
-              + o1Sort.getClass().getName() + ", value="
-              + o1Sort.toString() + ", map=" + o1.toString());
-          }
-        } else {
-          o1Value = ((Number) o1Sort).intValue();
-        }
-        int o2Value = 0;
-        if (!(o2Sort instanceof Integer)) {
+        
+        int o1Value = parseSort(o1, o1Sort);
+        int o2Value = parseSort(o2, o2Sort);
+        
+        return o1Value - o2Value;
+      }
+
+      private int parseSort(Map<String, Object> map, Object o) {
+        if (!(o instanceof Number)) {
           try {
-            o2Value = (new Double(Double.parseDouble(o2Sort
-              .toString()))).intValue();
+            return (new Double(Double.parseDouble(o.toString()))).intValue();
           } catch (Throwable t) {
-            logger.error("Value is not of type Number. class="
-              + o2Sort.getClass().getName() + ", value="
-              + o2Sort.toString() + ", map=" + o2.toString());
+            LOG.error("Value is not of type Number. class=" + o.getClass().getName() + ", value=" + o.toString()
+              + ", map=" + map.toString());
+            return 0;
           }
         } else {
-
+          return ((Number) o).intValue();
         }
-        return o1Value - o2Value;
       }
     });
   }
 
-  private Map<String, Object> mergeConfigs(
-    List<Map<String, Object>> configList) {
-    Map<String, Object> mergedConfig = new HashMap<String, Object>();
-    for (Map<String, Object> config : configList) {
-      mergeBlocks(config, mergedConfig);
+  private void assignOutputsToInputs() {
+    Set<Output> usedOutputSet = new HashSet<Output>();
+    for (Input input : inputManager.getInputList()) {
+      for (Output output : outputManager.getOutputs()) {
+        if (LogFeederUtil.isEnabled(output.getConfigs(), input.getConfigs())) {
+          usedOutputSet.add(output);
+          input.addOutput(output);
+        }
+      }
     }
-    return mergedConfig;
+    outputManager.retainUsedOutputs(usedOutputSet);
   }
 
-  private void mergeBlocks(Map<String, Object> fromMap,
-                           Map<String, Object> toMap) {
-    // Merge the non-string
+  @SuppressWarnings("unchecked")
+  private void mergeBlocks(Map<String, Object> fromMap, Map<String, Object> toMap) {
     for (String key : fromMap.keySet()) {
       Object objValue = fromMap.get(key);
       if (objValue == null) {
         continue;
       }
       if (objValue instanceof Map) {
-        @SuppressWarnings("unchecked")
-        Map<String, Object> globalFields = LogFeederUtil
-          .cloneObject((Map<String, Object>) fromMap.get(key));
+        Map<String, Object> globalFields = LogFeederUtil.cloneObject((Map<String, Object>) objValue);
 
-        @SuppressWarnings("unchecked")
-        Map<String, Object> localFields = (Map<String, Object>) toMap
-          .get(key);
+        Map<String, Object> localFields = (Map<String, Object>) toMap.get(key);
         if (localFields == null) {
           localFields = new HashMap<String, Object>();
           toMap.put(key, localFields);
@@ -477,8 +391,7 @@ public class LogFeeder {
         if (globalFields != null) {
           for (String fieldKey : globalFields.keySet()) {
             if (!localFields.containsKey(fieldKey)) {
-              localFields.put(fieldKey,
-                globalFields.get(fieldKey));
+              localFields.put(fieldKey, globalFields.get(fieldKey));
             }
           }
         }
@@ -493,11 +406,29 @@ public class LogFeeder {
     }
   }
 
+  private class JVMShutdownHook extends Thread {
+
+    public void run() {
+      try {
+        LOG.info("Processing is shutting down.");
+
+        inputManager.close();
+        outputManager.close();
+        inputManager.checkInAll();
+
+        logStats();
+
+        LOG.info("LogSearch is exiting.");
+      } catch (Throwable t) {
+        // Ignore
+      }
+    }
+  }
+
   private void monitor() throws Exception {
-    inputMgr.monitor();
+    inputManager.monitor();
     JVMShutdownHook logfeederJVMHook = new JVMShutdownHook();
-    ShutdownHookManager.get().addShutdownHook(logfeederJVMHook,
-        LOGFEEDER_SHUTDOWN_HOOK_PRIORITY);
+    ShutdownHookManager.get().addShutdownHook(logfeederJVMHook, LOGFEEDER_SHUTDOWN_HOOK_PRIORITY);
     
     statLoggerThread = new Thread("statLogger") {
 
@@ -512,17 +443,14 @@ public class LogFeeder {
           try {
             logStats();
           } catch (Throwable t) {
-            logger.error(
-              "LogStats: Caught exception while logging stats.",
-              t);
+            LOG.error("LogStats: Caught exception while logging stats.", t);
           }
 
-          if (System.currentTimeMillis() > (lastCheckPointCleanedMS + checkPointCleanIntervalMS)) {
+          if (System.currentTimeMillis() > (lastCheckPointCleanedMS + CHECKPOINT_CLEAN_INTERVAL_MS)) {
             lastCheckPointCleanedMS = System.currentTimeMillis();
-            inputMgr.cleanCheckPointFiles();
+            inputManager.cleanCheckPointFiles();
           }
 
-          // logfeeder is stopped then break the loop
           if (isLogfeederCompleted) {
             break;
           }
@@ -536,84 +464,20 @@ public class LogFeeder {
   }
 
   private void logStats() {
-    inputMgr.logStats();
-    outMgr.logStats();
-
-    if (metricsMgr.isMetricsEnabled()) {
-      List<MetricCount> metricsList = new ArrayList<MetricCount>();
-      inputMgr.addMetricsContainers(metricsList);
-      outMgr.addMetricsContainers(metricsList);
-      metricsMgr.useMetrics(metricsList);
-    }
-  }
-
-  private String readFile(BufferedReader br) throws Exception {
-    try {
-      StringBuilder sb = new StringBuilder();
-      String line = br.readLine();
-      while (line != null) {
-        sb.append(line);
-        line = br.readLine();
-      }
-      return sb.toString();
-    } catch (Exception t) {
-      logger.error("Error loading properties file.", t);
-      throw t;
-    }
-  }
-
-  public Collection<Output> getOutputList() {
-    return outputList;
-  }
-
-  public OutputMgr getOutMgr() {
-    return outMgr;
-  }
-
-  public static void main(String[] args) {
-    LogFeeder logFeeder = new LogFeeder(args);
-    logFeeder.run();
-  }
-
-  public void run() {
-    try {
-      Date startTime = new Date();
-      this.init();
-      Date endTime = new Date();
-      logger.info("Took " + (endTime.getTime() - startTime.getTime())
-        + " ms to initialize");
-      this.monitor();
-      //wait for all background thread before stop main thread
-      this.waitOnAllDaemonThreads();
-    } catch (Throwable t) {
-      logger.fatal("Caught exception in main.", t);
-      System.exit(1);
+    inputManager.logStats();
+    outputManager.logStats();
+
+    if (metricsManager.isMetricsEnabled()) {
+      List<MetricData> metricsList = new ArrayList<MetricData>();
+      inputManager.addMetricsContainers(metricsList);
+      outputManager.addMetricsContainers(metricsList);
+      metricsManager.useMetrics(metricsList);
     }
   }
 
-  private class JVMShutdownHook extends Thread {
-
-    public void run() {
-      try {
-        logger.info("Processing is shutting down.");
-
-        inputMgr.close();
-        outMgr.close();
-        inputMgr.checkInAll();
-
-        logStats();
-
-        logger.info("LogSearch is exiting.");
-      } catch (Throwable t) {
-        // Ignore
-      }
-    }
-  }
-  
   private void waitOnAllDaemonThreads() {
-    String foreground = LogFeederUtil.getStringProperty("foreground");
-    if (foreground != null && foreground.equalsIgnoreCase("true")) {
-      inputMgr.waitOnAllInputs();
+    if ("true".equals(LogFeederUtil.getStringProperty("foreground"))) {
+      inputManager.waitOnAllInputs();
       isLogfeederCompleted = true;
       if (statLoggerThread != null) {
         try {
@@ -624,24 +488,16 @@ public class LogFeeder {
       }
     }
   }
-  
-  private String[] getConfigFromCmdLine() {
-    String inputConfigDir = LogFeederUtil.getStringProperty("input_config_dir");
-    if (inputConfigDir != null && !inputConfigDir.isEmpty()) {
-      String[] searchFileWithExtensions = new String[] { "json" };
-      File configDirFile = new File(inputConfigDir);
-      List<File> configFiles = FileUtil.getAllFileFromDir(configDirFile,
-          searchFileWithExtensions, false);
-      if (configFiles != null && configFiles.size() > 0) {
-        String configPaths[] = new String[configFiles.size()];
-        for (int index = 0; index < configFiles.size(); index++) {
-          File configFile = configFiles.get(index);
-          String configFilePath = configFile.getAbsolutePath();
-          configPaths[index] = configFilePath;
-        }
-        return configPaths;
-      }
+
+  public static void main(String[] args) {
+    try {
+      LogFeederUtil.loadProperties("logfeeder.properties", args);
+    } catch (Throwable t) {
+      LOG.warn("Could not load logfeeder properites");
+      System.exit(1);
     }
-    return new String[0];
+
+    LogFeeder logFeeder = new LogFeeder();
+    logFeeder.run();
   }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/1b07a6dd/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/common/ConfigBlock.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/common/ConfigBlock.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/common/ConfigBlock.java
index 287982f..47ddc51 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/common/ConfigBlock.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/common/ConfigBlock.java
@@ -23,27 +23,27 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
-import org.apache.ambari.logfeeder.metrics.MetricCount;
+import org.apache.ambari.logfeeder.metrics.MetricData;
 import org.apache.ambari.logfeeder.util.LogFeederUtil;
+import org.apache.commons.collections.MapUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.log4j.Logger;
 import org.apache.log4j.Priority;
 
 
 public abstract class ConfigBlock {
-  static private Logger logger = Logger.getLogger(ConfigBlock.class);
+  private static final Logger LOG = Logger.getLogger(ConfigBlock.class);
 
   private boolean drain = false;
 
   protected Map<String, Object> configs;
   protected Map<String, String> contextFields = new HashMap<String, String>();
-  public MetricCount statMetric = new MetricCount();
-
-  /**
-   *
-   */
+  public MetricData statMetric = new MetricData(getStatMetricName(), false);
+  protected String getStatMetricName() {
+    return null;
+  }
+  
   public ConfigBlock() {
-    super();
   }
 
   /**
@@ -58,10 +58,7 @@ public abstract class ConfigBlock {
     return this.getClass().getSimpleName();
   }
 
-  /**
-   * @param metricsList
-   */
-  public void addMetricsContainers(List<MetricCount> metricsList) {
+  public void addMetricsContainers(List<MetricData> metricsList) {
     metricsList.add(statMetric);
   }
 
@@ -89,25 +86,21 @@ public abstract class ConfigBlock {
     boolean isEnabled = getBooleanValue("is_enabled", true);
     if (isEnabled) {
       // Let's check for static conditions
-      Map<String, Object> conditions = (Map<String, Object>) configs
-        .get("conditions");
+      Map<String, Object> conditions = (Map<String, Object>) configs.get("conditions");
       boolean allow = true;
-      if (conditions != null && conditions.size() > 0) {
+      if (MapUtils.isNotEmpty(conditions)) {
         allow = false;
         for (String conditionType : conditions.keySet()) {
           if (conditionType.equalsIgnoreCase("fields")) {
-            Map<String, Object> fields = (Map<String, Object>) conditions
-              .get("fields");
+            Map<String, Object> fields = (Map<String, Object>) conditions.get("fields");
             for (String fieldName : fields.keySet()) {
               Object values = fields.get(fieldName);
               if (values instanceof String) {
-                allow = isFieldConditionMatch(fieldName,
-                  (String) values);
+                allow = isFieldConditionMatch(fieldName, (String) values);
               } else {
                 List<String> listValues = (List<String>) values;
                 for (String stringValue : listValues) {
-                  allow = isFieldConditionMatch(fieldName,
-                    stringValue);
+                  allow = isFieldConditionMatch(fieldName, stringValue);
                   if (allow) {
                     break;
                   }
@@ -135,8 +128,7 @@ public abstract class ConfigBlock {
       allow = true;
     } else {
       @SuppressWarnings("unchecked")
-      Map<String, Object> addFields = (Map<String, Object>) configs
-        .get("add_fields");
+      Map<String, Object> addFields = (Map<String, Object>) configs.get("add_fields");
       if (addFields != null && addFields.get(fieldName) != null) {
         String addFieldValue = (String) addFields.get(fieldName);
         if (stringValue.equalsIgnoreCase(addFieldValue)) {
@@ -184,12 +176,7 @@ public abstract class ConfigBlock {
     String strValue = getStringValue(key);
     boolean retValue = defaultValue;
     if (!StringUtils.isEmpty(strValue)) {
-      if (strValue.equalsIgnoreCase("true")
-        || strValue.equalsIgnoreCase("yes")) {
-        retValue = true;
-      } else {
-        retValue = false;
-      }
+      retValue = (strValue.equalsIgnoreCase("true") || strValue.equalsIgnoreCase("yes"));
     }
     return retValue;
   }
@@ -201,8 +188,7 @@ public abstract class ConfigBlock {
       try {
         retValue = Integer.parseInt(strValue);
       } catch (Throwable t) {
-        logger.error("Error parsing integer value. key=" + key
-          + ", value=" + strValue);
+        LOG.error("Error parsing integer value. key=" + key + ", value=" + strValue);
       }
     }
     return retValue;
@@ -215,8 +201,7 @@ public abstract class ConfigBlock {
       try {
         retValue = Long.parseLong(strValue);
       } catch (Throwable t) {
-        logger.error("Error parsing long value. key=" + key + ", value="
-            + strValue);
+        LOG.error("Error parsing long value. key=" + key + ", value=" + strValue);
       }
     }
     return retValue;
@@ -227,29 +212,27 @@ public abstract class ConfigBlock {
   }
 
   public void incrementStat(int count) {
-    statMetric.count += count;
+    statMetric.value += count;
   }
 
-  public void logStatForMetric(MetricCount metric, String prefixStr) {
-    LogFeederUtil.logStatForMetric(metric, prefixStr, ", key="
-      + getShortDescription());
+  public void logStatForMetric(MetricData metric, String prefixStr) {
+    LogFeederUtil.logStatForMetric(metric, prefixStr, ", key=" + getShortDescription());
   }
 
-  synchronized public void logStat() {
+  public synchronized void logStat() {
     logStatForMetric(statMetric, "Stat");
   }
 
   public boolean logConfgs(Priority level) {
-    if (level.toInt() == Priority.INFO_INT && !logger.isInfoEnabled()) {
+    if (level.toInt() == Priority.INFO_INT && !LOG.isInfoEnabled()) {
       return false;
     }
-    if (level.toInt() == Priority.DEBUG_INT && !logger.isDebugEnabled()) {
+    if (level.toInt() == Priority.DEBUG_INT && !LOG.isDebugEnabled()) {
       return false;
     }
-    logger.log(level, "Printing configuration Block="
-      + getShortDescription());
-    logger.log(level, "configs=" + configs);
-    logger.log(level, "contextFields=" + contextFields);
+    LOG.log(level, "Printing configuration Block=" + getShortDescription());
+    LOG.log(level, "configs=" + configs);
+    LOG.log(level, "contextFields=" + contextFields);
     return true;
   }
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/1b07a6dd/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/common/LogFeederConstants.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/common/LogFeederConstants.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/common/LogFeederConstants.java
new file mode 100644
index 0000000..d1e7fba
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/common/LogFeederConstants.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.logfeeder.common;
+
+public class LogFeederConstants {
+
+  public static final String ALL = "all";
+  public static final String LOGFEEDER_FILTER_NAME = "log_feeder_config";
+  public static final String LOG_LEVEL_UNKNOWN = "UNKNOWN";
+  
+  // solr fields
+  public static final String SOLR_LEVEL = "level";
+  public static final String SOLR_COMPONENT = "type";
+  public static final String SOLR_HOST = "host";
+
+  // UserConfig Constants History
+  public static final String VALUES = "jsons";
+  public static final String ROW_TYPE = "rowtype";
+  
+  // S3 Constants
+  public static final String S3_PATH_START_WITH = "s3://";
+  public static final String S3_PATH_SEPARATOR = "/";
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/1b07a6dd/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/filter/Filter.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/filter/Filter.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/filter/Filter.java
index ab371f1..684f3c4 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/filter/Filter.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/filter/Filter.java
@@ -29,21 +29,19 @@ import org.apache.ambari.logfeeder.common.LogfeederException;
 import org.apache.ambari.logfeeder.input.Input;
 import org.apache.ambari.logfeeder.input.InputMarker;
 import org.apache.ambari.logfeeder.mapper.Mapper;
-import org.apache.ambari.logfeeder.metrics.MetricCount;
-import org.apache.ambari.logfeeder.output.OutputMgr;
+import org.apache.ambari.logfeeder.metrics.MetricData;
+import org.apache.ambari.logfeeder.output.OutputManager;
 import org.apache.ambari.logfeeder.util.AliasUtil;
-import org.apache.ambari.logfeeder.util.LogFeederUtil;
-import org.apache.ambari.logfeeder.util.AliasUtil.ALIAS_PARAM;
-import org.apache.ambari.logfeeder.util.AliasUtil.ALIAS_TYPE;
+import org.apache.ambari.logfeeder.util.AliasUtil.AliasType;
 import org.apache.log4j.Logger;
 import org.apache.log4j.Priority;
 
 public abstract class Filter extends ConfigBlock {
-  private static final Logger logger = Logger.getLogger(Filter.class);
+  private static final Logger LOG = Logger.getLogger(Filter.class);
 
   protected Input input;
   private Filter nextFilter = null;
-  private OutputMgr outputMgr;
+  private OutputManager outputManager;
 
   private Map<String, List<Mapper>> postFieldValueMappers = new HashMap<String, List<Mapper>>();
 
@@ -74,15 +72,12 @@ public abstract class Filter extends ConfigBlock {
       }
       for (Map<String, Object> mapObject : mapList) {
         for (String mapClassCode : mapObject.keySet()) {
-          Mapper mapper = getMapper(mapClassCode);
+          Mapper mapper = (Mapper) AliasUtil.getClassInstance(mapClassCode, AliasType.MAPPER);
           if (mapper == null) {
             break;
           }
-          if (mapper.init(getInput().getShortDescription(),
-            fieldName, mapClassCode,
-            mapObject.get(mapClassCode))) {
-            List<Mapper> fieldMapList = postFieldValueMappers
-              .get(fieldName);
+          if (mapper.init(getInput().getShortDescription(), fieldName, mapClassCode, mapObject.get(mapClassCode))) {
+            List<Mapper> fieldMapList = postFieldValueMappers.get(fieldName);
             if (fieldMapList == null) {
               fieldMapList = new ArrayList<Mapper>();
               postFieldValueMappers.put(fieldName, fieldMapList);
@@ -94,17 +89,8 @@ public abstract class Filter extends ConfigBlock {
     }
   }
 
-  private Mapper getMapper(String mapClassCode) {
-    String classFullName = AliasUtil.getInstance().readAlias(mapClassCode, ALIAS_TYPE.MAPPER, ALIAS_PARAM.KLASS);
-    if (classFullName != null && !classFullName.isEmpty()) {
-      Mapper mapper = (Mapper) LogFeederUtil.getClassInstance(classFullName, ALIAS_TYPE.MAPPER);
-      return mapper;
-    }
-    return null;
-  }
-
-  public void setOutputMgr(OutputMgr outputMgr) {
-    this.outputMgr = outputMgr;
+  public void setOutputManager(OutputManager outputManager) {
+    this.outputManager = outputManager;
   }
 
   public Filter getNextFilter() {
@@ -131,25 +117,23 @@ public abstract class Filter extends ConfigBlock {
     if (nextFilter != null) {
       nextFilter.apply(inputStr, inputMarker);
     } else {
-      outputMgr.write(inputStr, inputMarker);
+      outputManager.write(inputStr, inputMarker);
     }
   }
 
   public void apply(Map<String, Object> jsonObj, InputMarker inputMarker) throws LogfeederException {
-    if (postFieldValueMappers.size() > 0) {
-      for (String fieldName : postFieldValueMappers.keySet()) {
-        Object value = jsonObj.get(fieldName);
-        if (value != null) {
-          for (Mapper mapper : postFieldValueMappers.get(fieldName)) {
-            value = mapper.apply(jsonObj, value);
-          }
+    for (String fieldName : postFieldValueMappers.keySet()) {
+      Object value = jsonObj.get(fieldName);
+      if (value != null) {
+        for (Mapper mapper : postFieldValueMappers.get(fieldName)) {
+          value = mapper.apply(jsonObj, value);
         }
       }
     }
     if (nextFilter != null) {
       nextFilter.apply(jsonObj, inputMarker);
     } else {
-      outputMgr.write(jsonObj, inputMarker);
+      outputManager.write(jsonObj, inputMarker);
     }
   }
 
@@ -193,16 +177,15 @@ public abstract class Filter extends ConfigBlock {
     if (!super.logConfgs(level)) {
       return false;
     }
-    logger.log(level, "input=" + input.getShortDescription());
+    LOG.log(level, "input=" + input.getShortDescription());
     return true;
   }
 
   @Override
-  public void addMetricsContainers(List<MetricCount> metricsList) {
+  public void addMetricsContainers(List<MetricData> metricsList) {
     super.addMetricsContainers(metricsList);
     if (nextFilter != null) {
       nextFilter.addMetricsContainers(metricsList);
     }
   }
-
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/1b07a6dd/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/filter/FilterGrok.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/filter/FilterGrok.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/filter/FilterGrok.java
index 372c208..7e2da70 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/filter/FilterGrok.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/filter/FilterGrok.java
@@ -36,7 +36,7 @@ import oi.thekraken.grok.api.exception.GrokException;
 
 import org.apache.ambari.logfeeder.common.LogfeederException;
 import org.apache.ambari.logfeeder.input.InputMarker;
-import org.apache.ambari.logfeeder.metrics.MetricCount;
+import org.apache.ambari.logfeeder.metrics.MetricData;
 import org.apache.ambari.logfeeder.util.LogFeederUtil;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.log4j.Level;
@@ -45,7 +45,7 @@ import org.apache.log4j.Logger;
 import com.google.gson.reflect.TypeToken;
 
 public class FilterGrok extends Filter {
-  static private Logger logger = Logger.getLogger(FilterGrok.class);
+  private static final Logger LOG = Logger.getLogger(FilterGrok.class);
 
   private static final String GROK_PATTERN_FILE = "grok-patterns";
 
@@ -68,25 +68,23 @@ public class FilterGrok extends Filter {
 
   private Type jsonType = new TypeToken<Map<String, String>>() {}.getType();
 
-  private MetricCount grokErrorMetric = new MetricCount();
+  private MetricData grokErrorMetric = new MetricData("filter.error.grok", false);
 
   @Override
   public void init() throws Exception {
     super.init();
 
     try {
-      grokErrorMetric.metricsName = "filter.error.grok";
       messagePattern = escapePattern(getStringValue("message_pattern"));
       multilinePattern = escapePattern(getStringValue("multiline_pattern"));
       sourceField = getStringValue("source_field");
       removeSourceField = getBooleanValue("remove_source_field",
         removeSourceField);
 
-      logger.info("init() done. grokPattern=" + messagePattern
-        + ", multilinePattern=" + multilinePattern + ", "
-        + getShortDescription());
+      LOG.info("init() done. grokPattern=" + messagePattern + ", multilinePattern=" + multilinePattern + ", " +
+      getShortDescription());
       if (StringUtils.isEmpty(messagePattern)) {
-        logger.error("message_pattern is not set for filter.");
+        LOG.error("message_pattern is not set for filter.");
         return;
       }
       extractNamedParams(messagePattern, namedParamList);
@@ -102,9 +100,7 @@ public class FilterGrok extends Filter {
         grokMultiline.compile(multilinePattern);
       }
     } catch (Throwable t) {
-      logger.fatal(
-        "Caught exception while initializing Grok. multilinePattern="
-          + multilinePattern + ", messagePattern="
+      LOG.fatal("Caught exception while initializing Grok. multilinePattern=" + multilinePattern + ", messagePattern="
           + messagePattern, t);
       grokMessage = null;
       grokMultiline = null;
@@ -123,9 +119,10 @@ public class FilterGrok extends Filter {
   }
 
   private void extractNamedParams(String patternStr, Set<String> paramList) {
-    String grokRegEx = "%\\{" + "(?<name>" + "(?<pattern>[A-z0-9]+)"
-      + "(?::(?<subname>[A-z0-9_:]+))?" + ")" + "(?:=(?<definition>"
-      + "(?:" + "(?:[^{}]+|\\.+)+" + ")+" + ")" + ")?" + "\\}";
+    String grokRegEx = "%\\{" +
+        "(?<name>" + "(?<pattern>[A-z0-9]+)" + "(?::(?<subname>[A-z0-9_:]+))?" + ")" +
+        "(?:=(?<definition>" + "(?:" + "(?:[^{}]+|\\.+)+" + ")+" + ")" + ")?" +
+        "\\}";
 
     Pattern pattern = Pattern.compile(grokRegEx);
     java.util.regex.Matcher matcher = pattern.matcher(patternStr);
@@ -139,28 +136,23 @@ public class FilterGrok extends Filter {
 
   private boolean loadPatterns(Grok grok) {
     InputStreamReader grokPatternsReader = null;
-    logger.info("Loading pattern file " + GROK_PATTERN_FILE);
+    LOG.info("Loading pattern file " + GROK_PATTERN_FILE);
     try {
-      BufferedInputStream fileInputStream = (BufferedInputStream) this
-        .getClass().getClassLoader()
-        .getResourceAsStream(GROK_PATTERN_FILE);
+      BufferedInputStream fileInputStream =
+          (BufferedInputStream) this.getClass().getClassLoader().getResourceAsStream(GROK_PATTERN_FILE);
       if (fileInputStream == null) {
-        logger.fatal("Couldn't load grok-patterns file "
-          + GROK_PATTERN_FILE + ". Things will not work");
+        LOG.fatal("Couldn't load grok-patterns file " + GROK_PATTERN_FILE + ". Things will not work");
         return false;
       }
       grokPatternsReader = new InputStreamReader(fileInputStream);
     } catch (Throwable t) {
-      logger.fatal("Error reading grok-patterns file " + GROK_PATTERN_FILE
-        + " from classpath. Grok filtering will not work.", t);
+      LOG.fatal("Error reading grok-patterns file " + GROK_PATTERN_FILE + " from classpath. Grok filtering will not work.", t);
       return false;
     }
     try {
       grok.addPatternFromReader(grokPatternsReader);
     } catch (GrokException e) {
-      logger.fatal(
-        "Error loading patterns from grok-patterns reader for file "
-          + GROK_PATTERN_FILE, e);
+      LOG.fatal("Error loading patterns from grok-patterns reader for file " + GROK_PATTERN_FILE, e);
       return false;
     }
 
@@ -177,8 +169,7 @@ public class FilterGrok extends Filter {
       String jsonStr = grokMultiline.capture(inputStr);
       if (!"{}".equals(jsonStr)) {
         if (strBuff != null) {
-          Map<String, Object> jsonObj = Collections
-            .synchronizedMap(new HashMap<String, Object>());
+          Map<String, Object> jsonObj = Collections.synchronizedMap(new HashMap<String, Object>());
           try {
             applyMessage(strBuff.toString(), jsonObj, currMultilineJsonStr);
           } finally {
@@ -192,15 +183,13 @@ public class FilterGrok extends Filter {
       if (strBuff == null) {
         strBuff = new StringBuilder();
       } else {
-        strBuff.append('\r');
-        strBuff.append('\n');
+        strBuff.append("\r\n");
       }
       strBuff.append(inputStr);
       savedInputMarker = inputMarker;
     } else {
       savedInputMarker = inputMarker;
-      Map<String, Object> jsonObj = Collections
-        .synchronizedMap(new HashMap<String, Object>());
+      Map<String, Object> jsonObj = Collections.synchronizedMap(new HashMap<String, Object>());
       applyMessage(inputStr, jsonObj, null);
     }
   }
@@ -216,14 +205,8 @@ public class FilterGrok extends Filter {
     }
   }
 
-  /**
-   * @param inputStr
-   * @param jsonObj
-   * @throws LogfeederException 
-   */
-  private void applyMessage(String inputStr, Map<String, Object> jsonObj,
-                            String multilineJsonStr) throws LogfeederException {
-    String jsonStr = grokParse(inputStr);
+  private void applyMessage(String inputStr, Map<String, Object> jsonObj, String multilineJsonStr) throws LogfeederException {
+    String jsonStr = grokMessage.capture(inputStr);
 
     boolean parseError = false;
     if ("{}".equals(jsonStr)) {
@@ -239,8 +222,7 @@ public class FilterGrok extends Filter {
     if (parseError) {
       jsonStr = multilineJsonStr;
     }
-    Map<String, String> jsonSrc = LogFeederUtil.getGson().fromJson(jsonStr,
-      jsonType);
+    Map<String, String> jsonSrc = LogFeederUtil.getGson().fromJson(jsonStr, jsonType);
     for (String namedParam : namedParamList) {
       if (jsonSrc.get(namedParam) != null) {
         jsonObj.put(namedParam, jsonSrc.get(namedParam));
@@ -260,37 +242,26 @@ public class FilterGrok extends Filter {
       }
     }
     super.apply(jsonObj, savedInputMarker);
-    statMetric.count++;
-  }
-
-  public String grokParse(String inputStr) {
-    String jsonStr = grokMessage.capture(inputStr);
-    return jsonStr;
+    statMetric.value++;
   }
 
   private void logParseError(String inputStr) {
-    grokErrorMetric.count++;
-    final String LOG_MESSAGE_KEY = this.getClass().getSimpleName()
-      + "_PARSEERROR";
+    grokErrorMetric.value++;
+    String logMessageKey = this.getClass().getSimpleName() + "_PARSEERROR";
     int inputStrLength = inputStr != null ? inputStr.length() : 0;
-    LogFeederUtil.logErrorMessageByInterval(
-      LOG_MESSAGE_KEY,
-      "Error parsing string. length=" + inputStrLength
-        + ", input=" + input.getShortDescription()
-        + ". First upto 100 characters="
-        + LogFeederUtil.subString(inputStr, 100), null, logger,
-      Level.WARN);
+    LogFeederUtil.logErrorMessageByInterval(logMessageKey, "Error parsing string. length=" + inputStrLength + ", input=" +
+        input.getShortDescription() + ". First upto 100 characters=" + StringUtils.abbreviate(inputStr, 100), null, LOG,
+        Level.WARN);
   }
 
   @Override
   public void flush() {
     if (strBuff != null) {
-      Map<String, Object> jsonObj = Collections
-        .synchronizedMap(new HashMap<String, Object>());
+      Map<String, Object> jsonObj = Collections.synchronizedMap(new HashMap<String, Object>());
       try {
         applyMessage(strBuff.toString(), jsonObj, currMultilineJsonStr);
       } catch (LogfeederException e) {
-        logger.error(e.getLocalizedMessage(), e.getCause());
+        LOG.error(e.getLocalizedMessage(), e.getCause());
       }
       strBuff = null;
       savedInputMarker = null;
@@ -304,7 +275,7 @@ public class FilterGrok extends Filter {
   }
 
   @Override
-  public void addMetricsContainers(List<MetricCount> metricsList) {
+  public void addMetricsContainers(List<MetricData> metricsList) {
     super.addMetricsContainers(metricsList);
     metricsList.add(grokErrorMetric);
   }
@@ -314,5 +285,4 @@ public class FilterGrok extends Filter {
     super.logStat();
     logStatForMetric(grokErrorMetric, "Stat: Grok Errors");
   }
-
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/1b07a6dd/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/filter/FilterJSON.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/filter/FilterJSON.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/filter/FilterJSON.java
index 2954106..ba63c61 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/filter/FilterJSON.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/filter/FilterJSON.java
@@ -22,12 +22,13 @@ import java.util.Map;
 
 import org.apache.ambari.logfeeder.common.LogfeederException;
 import org.apache.ambari.logfeeder.input.InputMarker;
+import org.apache.ambari.logfeeder.util.DateUtil;
 import org.apache.ambari.logfeeder.util.LogFeederUtil;
 import org.apache.log4j.Logger;
 
 public class FilterJSON extends Filter {
   
-  private static final Logger logger  = Logger.getLogger(FilterJSON.class);
+  private static final Logger LOG  = Logger.getLogger(FilterJSON.class);
 
   @Override
   public void apply(String inputStr, InputMarker inputMarker) throws LogfeederException {
@@ -35,7 +36,7 @@ public class FilterJSON extends Filter {
     try {
       jsonMap = LogFeederUtil.toJSONObject(inputStr);
     } catch (Exception e) {
-      logger.error(e.getLocalizedMessage());
+      LOG.error(e.getLocalizedMessage());
       throw new LogfeederException("Json parsing failed for inputstr = " + inputStr ,e.getCause());
     }
     Double lineNumberD = (Double) jsonMap.get("line_number");
@@ -45,10 +46,9 @@ public class FilterJSON extends Filter {
     }
     String timeStampStr = (String) jsonMap.get("logtime");
     if (timeStampStr != null && !timeStampStr.isEmpty()) {
-      String logtime = LogFeederUtil.getDate(timeStampStr);
+      String logtime = DateUtil.getDate(timeStampStr);
       jsonMap.put("logtime", logtime);
     }
     super.apply(jsonMap, inputMarker);
   }
-
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/1b07a6dd/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/filter/FilterKeyValue.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/filter/FilterKeyValue.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/filter/FilterKeyValue.java
index 7adb468..c9c3f2c 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/filter/FilterKeyValue.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/filter/FilterKeyValue.java
@@ -25,38 +25,35 @@ import java.util.StringTokenizer;
 
 import org.apache.ambari.logfeeder.common.LogfeederException;
 import org.apache.ambari.logfeeder.input.InputMarker;
-import org.apache.ambari.logfeeder.metrics.MetricCount;
+import org.apache.ambari.logfeeder.metrics.MetricData;
 import org.apache.ambari.logfeeder.util.LogFeederUtil;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.log4j.Level;
 import org.apache.log4j.Logger;
 
 public class FilterKeyValue extends Filter {
-  private static final Logger logger = Logger.getLogger(FilterKeyValue.class);
+  private static final Logger LOG = Logger.getLogger(FilterKeyValue.class);
 
   private String sourceField = null;
   private String valueSplit = "=";
   private String fieldSplit = "\t";
 
-  private MetricCount errorMetric = new MetricCount();
+  private MetricData errorMetric = new MetricData("filter.error.keyvalue", false);
 
   @Override
   public void init() throws Exception {
     super.init();
-    errorMetric.metricsName = "filter.error.keyvalue";
 
     sourceField = getStringValue("source_field");
     valueSplit = getStringValue("value_split", valueSplit);
     fieldSplit = getStringValue("field_split", fieldSplit);
 
-    logger.info("init() done. source_field=" + sourceField
-      + ", value_split=" + valueSplit + ", " + ", field_split="
-      + fieldSplit + ", " + getShortDescription());
+    LOG.info("init() done. source_field=" + sourceField + ", value_split=" + valueSplit + ", " + ", field_split=" +
+        fieldSplit + ", " + getShortDescription());
     if (StringUtils.isEmpty(sourceField)) {
-      logger.fatal("source_field is not set for filter. This filter will not be applied");
+      LOG.fatal("source_field is not set for filter. This filter will not be applied");
       return;
     }
-
   }
 
   @Override
@@ -71,40 +68,30 @@ public class FilterKeyValue extends Filter {
     }
     Object valueObj = jsonObj.get(sourceField);
     if (valueObj != null) {
-      StringTokenizer fieldTokenizer = new StringTokenizer(
-        valueObj.toString(), fieldSplit);
+      StringTokenizer fieldTokenizer = new StringTokenizer(valueObj.toString(), fieldSplit);
       while (fieldTokenizer.hasMoreTokens()) {
         String nv = fieldTokenizer.nextToken();
-        StringTokenizer nvTokenizer = new StringTokenizer(nv,
-          valueSplit);
+        StringTokenizer nvTokenizer = new StringTokenizer(nv, valueSplit);
         while (nvTokenizer.hasMoreTokens()) {
           String name = nvTokenizer.nextToken();
           if (nvTokenizer.hasMoreTokens()) {
             String value = nvTokenizer.nextToken();
             jsonObj.put(name, value);
           } else {
-            logParseError("name=" + name + ", pair=" + nv
-              + ", field=" + sourceField + ", field_value="
-              + valueObj);
+            logParseError("name=" + name + ", pair=" + nv + ", field=" + sourceField + ", field_value=" + valueObj);
           }
         }
       }
     }
     super.apply(jsonObj, inputMarker);
-    statMetric.count++;
+    statMetric.value++;
   }
 
   private void logParseError(String inputStr) {
-    errorMetric.count++;
-    final String LOG_MESSAGE_KEY = this.getClass().getSimpleName()
-      + "_PARSEERROR";
-    LogFeederUtil
-      .logErrorMessageByInterval(
-        LOG_MESSAGE_KEY,
-        "Error parsing string. length=" + inputStr.length()
-          + ", input=" + input.getShortDescription()
-          + ". First upto 100 characters="
-          + LogFeederUtil.subString(inputStr, 100), null, logger,
+    errorMetric.value++;
+    String logMessageKey = this.getClass().getSimpleName() + "_PARSEERROR";
+    LogFeederUtil.logErrorMessageByInterval(logMessageKey, "Error parsing string. length=" + inputStr.length() + ", input=" +
+        input.getShortDescription() + ". First upto 100 characters=" + StringUtils.abbreviate(inputStr, 100), null, LOG,
         Level.ERROR);
   }
 
@@ -114,9 +101,8 @@ public class FilterKeyValue extends Filter {
   }
 
   @Override
-  public void addMetricsContainers(List<MetricCount> metricsList) {
+  public void addMetricsContainers(List<MetricData> metricsList) {
     super.addMetricsContainers(metricsList);
     metricsList.add(errorMetric);
   }
-
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/1b07a6dd/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/input/AbstractInputFile.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/input/AbstractInputFile.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/input/AbstractInputFile.java
new file mode 100644
index 0000000..41a1fa5
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/input/AbstractInputFile.java
@@ -0,0 +1,319 @@
+/*
+ * 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.logfeeder.input;
+
+import java.io.BufferedReader;
+import java.io.EOFException;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.RandomAccessFile;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.ambari.logfeeder.util.LogFeederUtil;
+import org.apache.commons.lang3.ArrayUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.log4j.Level;
+import org.apache.log4j.Logger;
+
+public abstract class AbstractInputFile extends Input {
+  protected static final Logger LOG = Logger.getLogger(AbstractInputFile.class);
+
+  private static final int DEFAULT_CHECKPOINT_INTERVAL_MS = 5 * 1000;
+
+  protected File[] logFiles;
+  protected String logPath;
+  protected Object fileKey;
+  protected String base64FileKey;
+
+  protected boolean isReady;
+  private boolean isStartFromBegining = true;
+
+  private String checkPointExtension;
+  private File checkPointFile;
+  private RandomAccessFile checkPointWriter;
+  private long lastCheckPointTimeMS;
+  private int checkPointIntervalMS;
+  private Map<String, Object> jsonCheckPoint;
+  private InputMarker lastCheckPointInputMarker;
+
+  @Override
+  protected String getStatMetricName() {
+    return "input.files.read_lines";
+  }
+  
+  @Override
+  protected String getReadBytesMetricName() {
+    return "input.files.read_bytes";
+  }
+  
+  @Override
+  public void init() throws Exception {
+    LOG.info("init() called");
+    
+    checkPointExtension = LogFeederUtil.getStringProperty("logfeeder.checkpoint.extension", InputManager.DEFAULT_CHECKPOINT_EXTENSION);
+
+    // Let's close the file and set it to true after we start monitoring it
+    setClosed(true);
+    logPath = getStringValue("path");
+    tail = getBooleanValue("tail", tail);
+    checkPointIntervalMS = getIntValue("checkpoint.interval.ms", DEFAULT_CHECKPOINT_INTERVAL_MS);
+
+    if (StringUtils.isEmpty(logPath)) {
+      LOG.error("path is empty for file input. " + getShortDescription());
+      return;
+    }
+
+    String startPosition = getStringValue("start_position");
+    if (StringUtils.isEmpty(startPosition) || startPosition.equalsIgnoreCase("beginning") ||
+        startPosition.equalsIgnoreCase("begining") || !tail) {
+      isStartFromBegining = true;
+    }
+
+    setFilePath(logPath);
+    boolean isFileReady = isReady();
+
+    LOG.info("File to monitor " + logPath + ", tail=" + tail + ", isReady=" + isFileReady);
+
+    super.init();
+  }
+
+  protected void processFile(File logPathFile) throws FileNotFoundException, IOException {
+    LOG.info("Monitoring logPath=" + logPath + ", logPathFile=" + logPathFile);
+    BufferedReader br = null;
+    checkPointFile = null;
+    checkPointWriter = null;
+    jsonCheckPoint = null;
+
+    int lineCount = 0;
+    try {
+      setFilePath(logPathFile.getAbsolutePath());
+      
+      br = openLogFile(logPathFile);
+
+      boolean resume = isStartFromBegining;
+      int resumeFromLineNumber = getResumeFromLineNumber();
+      if (resumeFromLineNumber > 0) {
+        resume = false;
+      }
+      
+      setClosed(false);
+      int sleepStep = 2;
+      int sleepIteration = 0;
+      while (true) {
+        try {
+          if (isDrain()) {
+            break;
+          }
+
+          String line = br.readLine();
+          if (line == null) {
+            if (!resume) {
+              resume = true;
+            }
+            sleepIteration++;
+            if (sleepIteration == 2) {
+              flush();
+              if (!tail) {
+                LOG.info("End of file. Done with filePath=" + logPathFile.getAbsolutePath() + ", lineCount=" + lineCount);
+                break;
+              }
+            } else if (sleepIteration > 4) {
+              Object newFileKey = getFileKey(logPathFile);
+              if (newFileKey != null && (fileKey == null || !newFileKey.equals(fileKey))) {
+                LOG.info("File key is different. Marking this input file for rollover. oldKey=" + fileKey + ", newKey=" +
+                    newFileKey + ". " + getShortDescription());
+                
+                try {
+                  LOG.info("File is rolled over. Closing current open file." + getShortDescription() + ", lineCount=" +
+                      lineCount);
+                  br.close();
+                } catch (Exception ex) {
+                  LOG.error("Error closing file" + getShortDescription(), ex);
+                  break;
+                }
+                
+                try {
+                  LOG.info("Opening new rolled over file." + getShortDescription());
+                  br = openLogFile(logPathFile);
+                  lineCount = 0;
+                } catch (Exception ex) {
+                  LOG.error("Error opening rolled over file. " + getShortDescription(), ex);
+                  LOG.info("Added input to not ready list." + getShortDescription());
+                  isReady = false;
+                  inputManager.addToNotReady(this);
+                  break;
+                }
+                LOG.info("File is successfully rolled over. " + getShortDescription());
+                continue;
+              }
+            }
+            try {
+              Thread.sleep(sleepStep * 1000);
+              sleepStep = Math.min(sleepStep * 2, 10);
+            } catch (InterruptedException e) {
+              LOG.info("Thread interrupted." + getShortDescription());
+            }
+          } else {
+            lineCount++;
+            sleepStep = 1;
+            sleepIteration = 0;
+
+            if (!resume && lineCount > resumeFromLineNumber) {
+              LOG.info("Resuming to read from last line. lineCount=" + lineCount + ", input=" + getShortDescription());
+              resume = true;
+            }
+            if (resume) {
+              InputMarker marker = new InputMarker(this, base64FileKey, lineCount);
+              outputLine(line, marker);
+            }
+          }
+        } catch (Throwable t) {
+          String logMessageKey = this.getClass().getSimpleName() + "_READ_LOOP_EXCEPTION";
+          LogFeederUtil.logErrorMessageByInterval(logMessageKey, "Caught exception in read loop. lineNumber=" + lineCount +
+              ", input=" + getShortDescription(), t, LOG, Level.ERROR);
+        }
+      }
+    } finally {
+      if (br != null) {
+        LOG.info("Closing reader." + getShortDescription() + ", lineCount=" + lineCount);
+        try {
+          br.close();
+        } catch (Throwable t) {
+          // ignore
+        }
+      }
+    }
+  }
+
+  protected abstract BufferedReader openLogFile(File logFile) throws IOException;
+
+  protected abstract Object getFileKey(File logFile);
+  
+  private int getResumeFromLineNumber() {
+    int resumeFromLineNumber = 0;
+    
+    if (tail) {
+      try {
+        LOG.info("Checking existing checkpoint file. " + getShortDescription());
+
+        String checkPointFileName = base64FileKey + checkPointExtension;
+        File checkPointFolder = inputManager.getCheckPointFolderFile();
+        checkPointFile = new File(checkPointFolder, checkPointFileName);
+        checkPointWriter = new RandomAccessFile(checkPointFile, "rw");
+
+        try {
+          int contentSize = checkPointWriter.readInt();
+          byte b[] = new byte[contentSize];
+          int readSize = checkPointWriter.read(b, 0, contentSize);
+          if (readSize != contentSize) {
+            LOG.error("Couldn't read expected number of bytes from checkpoint file. expected=" + contentSize + ", read=" +
+                readSize + ", checkPointFile=" + checkPointFile + ", input=" + getShortDescription());
+          } else {
+            String jsonCheckPointStr = new String(b, 0, readSize);
+            jsonCheckPoint = LogFeederUtil.toJSONObject(jsonCheckPointStr);
+
+            resumeFromLineNumber = LogFeederUtil.objectToInt(jsonCheckPoint.get("line_number"), 0, "line_number");
+
+            LOG.info("CheckPoint. checkPointFile=" + checkPointFile + ", json=" + jsonCheckPointStr +
+                ", resumeFromLineNumber=" + resumeFromLineNumber);
+          }
+        } catch (EOFException eofEx) {
+          LOG.info("EOFException. Will reset checkpoint file " + checkPointFile.getAbsolutePath() + " for " +
+              getShortDescription());
+        }
+        if (jsonCheckPoint == null) {
+          // This seems to be first time, so creating the initial checkPoint object
+          jsonCheckPoint = new HashMap<String, Object>();
+          jsonCheckPoint.put("file_path", filePath);
+          jsonCheckPoint.put("file_key", base64FileKey);
+        }
+
+      } catch (Throwable t) {
+        LOG.error("Error while configuring checkpoint file. Will reset file. checkPointFile=" + checkPointFile, t);
+      }
+    }
+    
+    return resumeFromLineNumber;
+  }
+
+  @Override
+  public synchronized void checkIn(InputMarker inputMarker) {
+    if (checkPointWriter != null) {
+      try {
+        int lineNumber = LogFeederUtil.objectToInt(jsonCheckPoint.get("line_number"), 0, "line_number");
+        if (lineNumber > inputMarker.lineNumber) {
+          // Already wrote higher line number for this input
+          return;
+        }
+        // If interval is greater than last checkPoint time, then write
+        long currMS = System.currentTimeMillis();
+        if (!isClosed() && (currMS - lastCheckPointTimeMS) < checkPointIntervalMS) {
+          // Let's save this one so we can update the check point file on flush
+          lastCheckPointInputMarker = inputMarker;
+          return;
+        }
+        lastCheckPointTimeMS = currMS;
+
+        jsonCheckPoint.put("line_number", "" + new Integer(inputMarker.lineNumber));
+        jsonCheckPoint.put("last_write_time_ms", "" + new Long(currMS));
+        jsonCheckPoint.put("last_write_time_date", new Date());
+
+        String jsonStr = LogFeederUtil.getGson().toJson(jsonCheckPoint);
+
+        // Let's rewind
+        checkPointWriter.seek(0);
+        checkPointWriter.writeInt(jsonStr.length());
+        checkPointWriter.write(jsonStr.getBytes());
+
+        if (isClosed()) {
+          String logMessageKey = this.getClass().getSimpleName() + "_FINAL_CHECKIN";
+          LogFeederUtil.logErrorMessageByInterval(logMessageKey, "Wrote final checkPoint, input=" + getShortDescription() +
+              ", checkPointFile=" + checkPointFile.getAbsolutePath() + ", checkPoint=" + jsonStr, null, LOG, Level.INFO);
+        }
+      } catch (Throwable t) {
+        String logMessageKey = this.getClass().getSimpleName() + "_CHECKIN_EXCEPTION";
+        LogFeederUtil.logErrorMessageByInterval(logMessageKey, "Caught exception checkIn. , input=" + getShortDescription(), t,
+            LOG, Level.ERROR);
+      }
+    }
+  }
+
+  @Override
+  public void lastCheckIn() {
+    if (lastCheckPointInputMarker != null) {
+      checkIn(lastCheckPointInputMarker);
+    }
+  }
+
+  @Override
+  public void close() {
+    super.close();
+    LOG.info("close() calling checkPoint checkIn(). " + getShortDescription());
+    lastCheckIn();
+  }
+
+  @Override
+  public String getShortDescription() {
+    return "input:source=" + getStringValue("source") + ", path=" +
+        (!ArrayUtils.isEmpty(logFiles) ? logFiles[0].getAbsolutePath() : logPath);
+  }
+}


[45/58] [abbrv] ambari git commit: AMBARI-18310. Fix regression issues for logsearch refactor (escaping) (oleewere)

Posted by ol...@apache.org.
AMBARI-18310. Fix regression issues for logsearch refactor (escaping) (oleewere)

Change-Id: I3bc878f2e4ccb2068cb12b8e479c5936edb49d11


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

Branch: refs/heads/branch-2.5
Commit: 98d6317f1a2b17bcfd0a3e20af2a6ea6c51f9b47
Parents: 4d5435d
Author: oleewere <ol...@gmail.com>
Authored: Wed Oct 5 16:09:17 2016 +0200
Committer: oleewere <ol...@gmail.com>
Committed: Sat Nov 5 14:46:46 2016 +0100

----------------------------------------------------------------------
 .../AbstractAuditLogRequestQueryConverter.java         |  4 ++--
 .../converter/BaseServiceLogRequestQueryConverter.java |  9 ++++++---
 .../org/apache/ambari/logsearch/dao/SolrDaoBase.java   |  2 ++
 .../ambari/logsearch/manager/ServiceLogsManager.java   | 10 ++--------
 .../ambari/logsearch/rest/ServiceLogsResource.java     |  4 ----
 .../org/apache/ambari/logsearch/util/SolrUtil.java     | 13 +++++++++++++
 .../webapp/scripts/views/audit/AuditTabLayoutView.js   |  4 ++--
 .../scripts/views/tabs/HierarchyTabLayoutView.js       |  4 ++--
 .../src/main/webapp/scripts/views/tabs/LogFileView.js  |  4 ++--
 .../BaseServiceLogRequestQueryConverterTest.java       |  7 ++++---
 .../controller/logging/LogLevelQueryResponse.java      |  2 ++
 .../server/controller/logging/LogQueryResponse.java    |  2 ++
 12 files changed, 39 insertions(+), 26 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/98d6317f/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/AbstractAuditLogRequestQueryConverter.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/AbstractAuditLogRequestQueryConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/AbstractAuditLogRequestQueryConverter.java
index e4bce01..5656c88 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/AbstractAuditLogRequestQueryConverter.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/AbstractAuditLogRequestQueryConverter.java
@@ -44,8 +44,8 @@ public abstract class AbstractAuditLogRequestQueryConverter<SOURCE extends BaseL
     } else {
       defaultSortOrder = new Sort.Order(Sort.Direction.DESC, AUDIT_EVTTIME);
     }
-    Sort.Order secuqnceIdOrder = new Sort.Order(Sort.Direction.DESC, SEQUENCE_ID);
-    return new Sort(defaultSortOrder, secuqnceIdOrder);
+    Sort.Order sequenceIdOrder = new Sort.Order(Sort.Direction.DESC, SEQUENCE_ID);
+    return new Sort(defaultSortOrder, sequenceIdOrder);
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/ambari/blob/98d6317f/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/BaseServiceLogRequestQueryConverter.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/BaseServiceLogRequestQueryConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/BaseServiceLogRequestQueryConverter.java
index 4894bfb..8270f2d 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/BaseServiceLogRequestQueryConverter.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/BaseServiceLogRequestQueryConverter.java
@@ -22,6 +22,7 @@ import org.apache.ambari.logsearch.common.LogSearchConstants;
 import org.apache.ambari.logsearch.common.LogType;
 import org.apache.ambari.logsearch.model.request.impl.BaseServiceLogRequest;
 import org.apache.ambari.logsearch.util.SolrUtil;
+import org.apache.commons.collections.CollectionUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.data.domain.Sort;
 import org.springframework.data.solr.core.query.SimpleQuery;
@@ -49,7 +50,9 @@ public class BaseServiceLogRequestQueryConverter extends AbstractServiceLogReque
     addEqualsFilterQuery(query, PATH, SolrUtil.escapeQueryChars(request.getFileName()));
     addEqualsFilterQuery(query, COMPONENT, SolrUtil.escapeQueryChars(request.getComponentName()));
     addEqualsFilterQuery(query, BUNDLE_ID, request.getBundleId());
-    addInFilterQuery(query, LEVEL, levels);
+    if (CollectionUtils.isNotEmpty(levels)){
+      addInFilterQuery(query, LEVEL, levels);
+    }
     addRangeFilter(query, LOGTIME, request.getFrom(), request.getTo());
     return query;
   }
@@ -65,8 +68,8 @@ public class BaseServiceLogRequestQueryConverter extends AbstractServiceLogReque
     } else {
       defaultSortOrder = new Sort.Order(Sort.Direction.DESC, LOGTIME);
     }
-    Sort.Order secuqnceIdOrder = new Sort.Order(Sort.Direction.DESC, SEQUENCE_ID);
-    return new Sort(defaultSortOrder, secuqnceIdOrder);
+    Sort.Order sequenceIdOrder = new Sort.Order(Sort.Direction.DESC, SEQUENCE_ID);
+    return new Sort(defaultSortOrder, sequenceIdOrder);
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/ambari/blob/98d6317f/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/SolrDaoBase.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/SolrDaoBase.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/SolrDaoBase.java
index d9a9464..77eb51f 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/SolrDaoBase.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/SolrDaoBase.java
@@ -23,6 +23,7 @@ import org.apache.ambari.logsearch.common.LogSearchContext;
 import org.apache.ambari.logsearch.common.LogType;
 import org.apache.ambari.logsearch.common.MessageEnums;
 import org.apache.ambari.logsearch.util.RESTErrorUtil;
+import org.apache.ambari.logsearch.util.SolrUtil;
 import org.apache.log4j.Logger;
 import org.apache.solr.client.solrj.SolrClient;
 import org.apache.solr.client.solrj.SolrQuery;
@@ -49,6 +50,7 @@ public abstract class SolrDaoBase {
   }
 
   public QueryResponse process(SolrQuery solrQuery, String event) {
+    SolrUtil.removeDoubleOrTripleEscapeFromFilters(solrQuery);
     if (getSolrClient() != null) {
       event = event == null ? solrQuery.get("event") : event;
       solrQuery.remove("event");

http://git-wip-us.apache.org/repos/asf/ambari/blob/98d6317f/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 6e319da..d276769 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
@@ -216,16 +216,10 @@ public class ServiceLogsManager extends ManagerBase<SolrServiceLogData, ServiceL
   public LogListResponse getPageByKeyword(ServiceLogRequest request, String event)
     throws SolrServerException {
     String defaultChoice = "0";
-    String key = request.getKeyWord();
-    if (StringUtils.isBlank(key)) {
+    String keyword = request.getKeyWord();
+    if (StringUtils.isBlank(keyword)) {
       throw RESTErrorUtil.createRESTException("Keyword was not given", MessageEnums.DATA_NOT_FOUND);
     }
-    String keyword = SolrUtil.escapeForStandardTokenizer(key);
-
-    if (keyword.startsWith("\"") && keyword.endsWith("\"")) {
-      keyword = keyword.substring(1);
-      keyword = keyword.substring(0, keyword.length() - 1);
-    }
 
     boolean isNext = !defaultChoice.equals(request.getKeywordType()); // 1 is next, 0 is previous
     return getPageForKeywordByType(request, keyword, isNext, event);

http://git-wip-us.apache.org/repos/asf/ambari/blob/98d6317f/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 d6ceca5..492a5b2 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
@@ -47,7 +47,6 @@ import org.apache.ambari.logsearch.model.response.NodeListResponse;
 import org.apache.ambari.logsearch.model.response.ServiceLogResponse;
 import org.apache.ambari.logsearch.manager.ServiceLogsManager;
 import org.springframework.context.annotation.Scope;
-import org.springframework.core.convert.ConversionService;
 
 import static org.apache.ambari.logsearch.doc.DocConstants.ServiceOperationDescriptions.*;
 
@@ -60,9 +59,6 @@ public class ServiceLogsResource {
   @Inject
   private ServiceLogsManager serviceLogsManager;
 
-  @Inject
-  private ConversionService conversionService;
-
   @GET
   @Produces({"application/json"})
   @ApiOperation(SEARCH_LOGS_OD)

http://git-wip-us.apache.org/repos/asf/ambari/blob/98d6317f/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/util/SolrUtil.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/util/SolrUtil.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/util/SolrUtil.java
index 51a0dda..6369107 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/util/SolrUtil.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/util/SolrUtil.java
@@ -19,7 +19,9 @@
 
 package org.apache.ambari.logsearch.util;
 
+import java.util.ArrayList;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 
 import org.apache.ambari.logsearch.common.LogSearchConstants;
@@ -146,6 +148,17 @@ public class SolrUtil {
 
     return newSearch.replace(" ", "\\ ");
   }
+
+  public static void removeDoubleOrTripleEscapeFromFilters(SolrQuery solrQuery) {
+    String[] filterQueries = solrQuery.getFilterQueries();
+    List<String> newArray = new ArrayList<>();
+    if (filterQueries != null && filterQueries.length > 0) {
+      for (String filterQuery : filterQueries) {
+        newArray.add(filterQuery.replaceAll("\\\\\\\\\\\\|\\\\\\\\", "\\\\"));
+      }
+    }
+    solrQuery.setFilterQueries(newArray.toArray(new String[0]));
+  }
   
 
   public static boolean isSolrFieldNumber(String fieldType, Map<String, String> schemaFieldsMap) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/98d6317f/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/audit/AuditTabLayoutView.js
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/audit/AuditTabLayoutView.js b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/audit/AuditTabLayoutView.js
index 371edd2..4e09e88 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/audit/AuditTabLayoutView.js
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/audit/AuditTabLayoutView.js
@@ -193,7 +193,7 @@ define(['require',
               var obj = ViewUtils.replaceColumnNamesWithKeys(searchCollection, Globals.invertedAuditLogMappings, true);
               return {
                 includeQuery: JSON.stringify(obj),
-                iMessage: query
+                query: query
               }
             }
           }));
@@ -207,7 +207,7 @@ define(['require',
               var obj = ViewUtils.replaceColumnNamesWithKeys(searchCollection, Globals.invertedAuditLogMappings, true);
               return {
                 excludeQuery: JSON.stringify(obj),
-                eMessage: query
+                query: query
               }
             }
           }));

http://git-wip-us.apache.org/repos/asf/ambari/blob/98d6317f/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/tabs/HierarchyTabLayoutView.js
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/tabs/HierarchyTabLayoutView.js b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/tabs/HierarchyTabLayoutView.js
index c504afa..43ee5db 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/tabs/HierarchyTabLayoutView.js
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/tabs/HierarchyTabLayoutView.js
@@ -287,7 +287,7 @@ define(['require',
               var obj = ViewUtils.replaceColumnNamesWithKeys(searchCollection, Globals.invertedServiceLogMappings, false);
               return {
                 includeQuery: JSON.stringify(obj),
-                iMessage: query
+                query: query
               }
             }
           }));
@@ -302,7 +302,7 @@ define(['require',
               var obj = ViewUtils.replaceColumnNamesWithKeys(searchCollection, Globals.invertedServiceLogMappings, false);
               return {
                 excludeQuery: JSON.stringify(obj),
-                eMessage: query
+                query: query
               }
             }
           }));

http://git-wip-us.apache.org/repos/asf/ambari/blob/98d6317f/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/tabs/LogFileView.js
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/tabs/LogFileView.js b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/tabs/LogFileView.js
index 2d39e36..a4e3a1a 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/tabs/LogFileView.js
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/tabs/LogFileView.js
@@ -318,7 +318,7 @@ define(['require',
                     var obj = ViewUtils.replaceColumnNamesWithKeys(searchCollection, Globals.invertedServiceLogMappings, false);
                     return {
                       includeQuery: JSON.stringify(obj),
-                      iMessage: query
+                      query: query
                     }
                   }
                 }));
@@ -334,7 +334,7 @@ define(['require',
                     var obj = ViewUtils.replaceColumnNamesWithKeys(searchCollection, Globals.invertedServiceLogMappings, false);
                     return {
                       excludeQuery: JSON.stringify(obj),
-                      eMessage: query
+                      query: query
                     }
                   }
                 }));

http://git-wip-us.apache.org/repos/asf/ambari/blob/98d6317f/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/BaseServiceLogRequestQueryConverterTest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/BaseServiceLogRequestQueryConverterTest.java b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/BaseServiceLogRequestQueryConverterTest.java
index 1ade3c0..a75037b 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/BaseServiceLogRequestQueryConverterTest.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/BaseServiceLogRequestQueryConverterTest.java
@@ -19,6 +19,7 @@
 package org.apache.ambari.logsearch.converter;
 
 import org.apache.ambari.logsearch.model.request.impl.ServiceLogRequest;
+import org.apache.ambari.logsearch.util.SolrUtil;
 import org.apache.solr.client.solrj.SolrQuery;
 import org.junit.Before;
 import org.junit.Test;
@@ -42,17 +43,17 @@ public class BaseServiceLogRequestQueryConverterTest extends AbstractRequestConv
     ServiceLogRequest logRequest = new ServiceLogRequest();
     fillBaseLogRequestWithTestData(logRequest);
     logRequest.setLevel("FATAL,ERROR,WARN,UNKNOWN");
-    logRequest.setFileName("myfile");
+    logRequest.setFileName("/var/log/myfile-*-hdfs.log");
     logRequest.setComponentName("component");
     logRequest.setHostName("logsearch.com");
     // WHEN
     SimpleQuery query = underTest.convert(logRequest);
     DefaultQueryParser defaultQueryParser = new DefaultQueryParser();
     SolrQuery solrQuery = defaultQueryParser.doConstructSolrQuery(query);
-
+    SolrUtil.removeDoubleOrTripleEscapeFromFilters(solrQuery);
     // THEN
     assertEquals("?q=*%3A*&start=0&rows=25&fq=log_message%3A*myincludemessage*&fq=-log_message%3A*myexcludemessage*" +
-      "&fq=host%3Alogsearch.com&fq=path%3Amyfile&fq=type%3Acomponent&fq=level%3A%28FATAL+ERROR+WARN+UNKNOWN%29" +
+      "&fq=host%3Alogsearch.com&fq=path%3A%5C%2Fvar%5C%2Flog%5C%2Fmyfile%5C-%5C*%5C-hdfs.log&fq=type%3Acomponent&fq=level%3A%28FATAL+ERROR+WARN+UNKNOWN%29" +
       "&fq=logtime%3A%5B2016-09-13T22%3A00%3A01.000Z+TO+2016-09-14T22%3A00%3A01.000Z%5D&sort=logtime+desc%2Cseq_num+desc",
       solrQuery.toQueryString());
   }

http://git-wip-us.apache.org/repos/asf/ambari/blob/98d6317f/ambari-server/src/main/java/org/apache/ambari/server/controller/logging/LogLevelQueryResponse.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/logging/LogLevelQueryResponse.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/logging/LogLevelQueryResponse.java
index 1280877..27e4c9c 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/logging/LogLevelQueryResponse.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/logging/LogLevelQueryResponse.java
@@ -17,10 +17,12 @@
  */
 package org.apache.ambari.server.controller.logging;
 
+import org.codehaus.jackson.annotate.JsonIgnoreProperties;
 import org.codehaus.jackson.annotate.JsonProperty;
 
 import java.util.List;
 
+@JsonIgnoreProperties(ignoreUnknown = true)
 public class LogLevelQueryResponse {
 
   private String startIndex;

http://git-wip-us.apache.org/repos/asf/ambari/blob/98d6317f/ambari-server/src/main/java/org/apache/ambari/server/controller/logging/LogQueryResponse.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/logging/LogQueryResponse.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/logging/LogQueryResponse.java
index 9bde7a5..feba8c2 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/logging/LogQueryResponse.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/logging/LogQueryResponse.java
@@ -18,6 +18,7 @@
 
 package org.apache.ambari.server.controller.logging;
 
+import org.codehaus.jackson.annotate.JsonIgnoreProperties;
 import org.codehaus.jackson.annotate.JsonProperty;
 import org.codehaus.jackson.map.util.JSONPObject;
 
@@ -29,6 +30,7 @@ import java.util.List;
  * a call to the LogSearch service.
  *
  */
+@JsonIgnoreProperties(ignoreUnknown = true)
 public class LogQueryResponse {
 
 


[39/58] [abbrv] ambari git commit: AMBARI-18310. Logsearch - Refactor solr query layer (oleewere)

Posted by ol...@apache.org.
http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/manager/UserConfigManager.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/manager/UserConfigManager.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/manager/UserConfigManager.java
index 6772138..00ae332 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/manager/UserConfigManager.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/manager/UserConfigManager.java
@@ -24,17 +24,14 @@ import java.util.ArrayList;
 import java.util.Collection;
 import java.util.List;
 
-import org.apache.ambari.logsearch.common.LogSearchConstants;
 import org.apache.ambari.logsearch.common.MessageEnums;
 import org.apache.ambari.logsearch.dao.UserConfigSolrDao;
-import org.apache.ambari.logsearch.query.QueryGeneration;
-import org.apache.ambari.logsearch.util.JSONUtil;
+import org.apache.ambari.logsearch.model.common.LogFeederDataMap;
+import org.apache.ambari.logsearch.model.request.impl.UserConfigRequest;
+import org.apache.ambari.logsearch.model.response.UserConfigData;
+import org.apache.ambari.logsearch.model.response.UserConfigDataListResponse;
 import org.apache.ambari.logsearch.util.RESTErrorUtil;
 import org.apache.ambari.logsearch.util.SolrUtil;
-import org.apache.ambari.logsearch.view.VLogfeederFilterWrapper;
-import org.apache.ambari.logsearch.view.VUserConfig;
-import org.apache.ambari.logsearch.view.VUserConfigList;
-import org.apache.ambari.logsearch.query.model.SearchCriteria;
 import org.apache.commons.lang.StringUtils;
 import org.apache.log4j.Logger;
 import org.apache.solr.client.solrj.SolrQuery;
@@ -45,56 +42,66 @@ import org.apache.solr.common.SolrDocument;
 import org.apache.solr.common.SolrDocumentList;
 import org.apache.solr.common.SolrException;
 import org.apache.solr.common.SolrInputDocument;
-import org.springframework.stereotype.Component;
+import org.springframework.core.convert.ConversionService;
 
 import javax.inject.Inject;
+import javax.inject.Named;
 
-@Component
+import static org.apache.ambari.logsearch.solr.SolrConstants.UserConfigConstants.ID;
+import static org.apache.ambari.logsearch.solr.SolrConstants.UserConfigConstants.USER_NAME;
+import static org.apache.ambari.logsearch.solr.SolrConstants.UserConfigConstants.VALUES;
+import static org.apache.ambari.logsearch.solr.SolrConstants.UserConfigConstants.FILTER_NAME;
+import static org.apache.ambari.logsearch.solr.SolrConstants.UserConfigConstants.ROW_TYPE;
+import static org.apache.ambari.logsearch.solr.SolrConstants.UserConfigConstants.SHARE_NAME_LIST;
+import static org.apache.ambari.logsearch.solr.SolrConstants.UserConfigConstants.COMPOSITE_KEY;
+
+@Named
 public class UserConfigManager extends JsonManagerBase {
 
   private static final Logger logger = Logger.getLogger(UserConfigManager.class);
+
   @Inject
   private UserConfigSolrDao userConfigSolrDao;
   @Inject
-  private QueryGeneration queryGenerator;
+  private ConversionService conversionService;
 
-  public String saveUserConfig(VUserConfig vHistory) {
+  public String saveUserConfig(UserConfigData userConfig) {
 
     SolrInputDocument solrInputDoc = new SolrInputDocument();
-    if (!isValid(vHistory)) {
+    if (!isValid(userConfig)) {
       throw RESTErrorUtil.createRESTException("No FilterName Specified", MessageEnums.INVALID_INPUT_DATA);
     }
 
-    if (isNotUnique(vHistory) && !vHistory.isOverwrite()) {
-      throw RESTErrorUtil.createRESTException( "Name '" + vHistory.getFiltername() + "' already exists", MessageEnums.INVALID_INPUT_DATA);
+    if (isNotUnique(userConfig) && !userConfig.isOverwrite()) {
+      throw RESTErrorUtil.createRESTException( "Name '" + userConfig.getFiltername() + "' already exists", MessageEnums.INVALID_INPUT_DATA);
     }
-    String loggedInUserName = vHistory.getUserName();
-    String filterName = vHistory.getFiltername();
-
-    solrInputDoc.addField(LogSearchConstants.ID, vHistory.getId());
-    solrInputDoc.addField(LogSearchConstants.USER_NAME, loggedInUserName);
-    solrInputDoc.addField(LogSearchConstants.VALUES, vHistory.getValues());
-    solrInputDoc.addField(LogSearchConstants.FILTER_NAME, filterName);
-    solrInputDoc.addField(LogSearchConstants.ROW_TYPE, vHistory.getRowType());
-    List<String> shareNameList = vHistory.getShareNameList();
+    String loggedInUserName = userConfig.getUserName();
+    String filterName = userConfig.getFiltername();
+
+    solrInputDoc.addField(ID, userConfig.getId());
+    solrInputDoc.addField(USER_NAME, loggedInUserName);
+    solrInputDoc.addField(VALUES, userConfig.getValues());
+    solrInputDoc.addField(FILTER_NAME, filterName);
+    solrInputDoc.addField(ROW_TYPE, userConfig.getRowType());
+    List<String> shareNameList = userConfig.getShareNameList();
     if (shareNameList != null && !shareNameList.isEmpty()) {
-      solrInputDoc.addField(LogSearchConstants.SHARE_NAME_LIST, shareNameList);
+      solrInputDoc.addField(SHARE_NAME_LIST, shareNameList);
     }
     // Check whether the Filter Name exists in solr
     SolrQuery solrQuery = new SolrQuery();
-    SolrUtil.setMainQuery(solrQuery, null);
-    queryGenerator.setSingleIncludeFilter(solrQuery, LogSearchConstants.FILTER_NAME, SolrUtil.makeSearcableString(filterName));
-    queryGenerator.setSingleIncludeFilter(solrQuery, LogSearchConstants.USER_NAME, loggedInUserName);
+    solrQuery.setQuery("*:*");
+    solrQuery.addFilterQuery(String.format("%s:%s", FILTER_NAME, SolrUtil.makeSearcableString(filterName)));
+    solrQuery.addFilterQuery(String.format("%s:%s", USER_NAME, loggedInUserName));
     try {
       QueryResponse queryResponse = userConfigSolrDao.process(solrQuery);
       if (queryResponse != null) {
         SolrDocumentList documentList = queryResponse.getResults();
-        if (documentList != null && !documentList.isEmpty() && !vHistory.isOverwrite()) {
+        if (documentList != null && !documentList.isEmpty() && !userConfig.isOverwrite()) {
           logger.error("Filtername is already present");
           throw RESTErrorUtil.createRESTException("Filtername is already present", MessageEnums.INVALID_INPUT_DATA);
         }
       }
-    } catch (SolrException | SolrServerException | IOException e) {
+    } catch (SolrException e) {
       logger.error("Error in checking same filtername config", e);
       throw RESTErrorUtil.createRESTException(MessageEnums.SOLR_ERROR.getMessage().getMessage(), MessageEnums.ERROR_SYSTEM);
     }
@@ -108,28 +115,28 @@ public class UserConfigManager extends JsonManagerBase {
     }
   }
 
-  private boolean isNotUnique(VUserConfig vHistory) {
-    String filterName = vHistory.getFiltername();
-    String rowType = vHistory.getRowType();
+  private boolean isNotUnique(UserConfigData userConfig) {
+    String filterName = userConfig.getFiltername();
+    String rowType = userConfig.getRowType();
 
     if (filterName != null && rowType != null) {
       SolrQuery solrQuery = new SolrQuery();
       filterName = SolrUtil.makeSearcableString(filterName);
-      solrQuery.setQuery(LogSearchConstants.COMPOSITE_KEY + ":" + filterName + "-" + rowType);
+      solrQuery.setQuery(COMPOSITE_KEY + ":" + filterName + "-" + rowType);
       SolrUtil.setRowCount(solrQuery, 0);
       try {
         Long numFound = userConfigSolrDao.process(solrQuery).getResults().getNumFound();
         if (numFound > 0) {
           return true;
         }
-      } catch (SolrException | SolrServerException | IOException e) {
+      } catch (SolrException e) {
         logger.error("Error while checking if userConfig is unique.", e);
       }
     }
     return false;
   }
 
-  private boolean isValid(VUserConfig vHistory) {
+  private boolean isValid(UserConfigData vHistory) {
     return !StringUtils.isBlank(vHistory.getFiltername())
         && !StringUtils.isBlank(vHistory.getRowType())
         && !StringUtils.isBlank(vHistory.getUserName())
@@ -145,131 +152,99 @@ public class UserConfigManager extends JsonManagerBase {
   }
 
   @SuppressWarnings("unchecked")
-  public String getUserConfig(SearchCriteria searchCriteria) {
-
-    SolrDocumentList solrList = new SolrDocumentList();
-    VUserConfigList userConfigList = new VUserConfigList();
-
-    String rowType = (String) searchCriteria.getParamValue(LogSearchConstants.ROW_TYPE);
+  public UserConfigDataListResponse getUserConfig(UserConfigRequest request) {
+    UserConfigDataListResponse response = new UserConfigDataListResponse();
+    String rowType = request.getRowType();
     if (StringUtils.isBlank(rowType)) {
       throw RESTErrorUtil.createRESTException("row type was not specified", MessageEnums.INVALID_INPUT_DATA);
     }
 
-    String userName = (String) searchCriteria.getParamValue(LogSearchConstants.USER_NAME);
+    String userName = request.getUserId();
     if (StringUtils.isBlank(userName)) {
       throw RESTErrorUtil.createRESTException("user name was not specified", MessageEnums.INVALID_INPUT_DATA);
     }
-    String filterName = (String) searchCriteria.getParamValue(LogSearchConstants.FILTER_NAME);
-    filterName = StringUtils.isBlank(filterName) ? "*" : "*" + filterName + "*";
 
-    try {
+    SolrQuery userConfigQuery = conversionService.convert(request, SolrQuery.class);
+    SolrDocumentList solrList = userConfigSolrDao.process(userConfigQuery).getResults();
 
-      SolrQuery userConfigQuery = new SolrQuery();
-      SolrUtil.setMainQuery(userConfigQuery, null);
-      queryGenerator.setPagination(userConfigQuery, searchCriteria);
-      queryGenerator.setSingleIncludeFilter(userConfigQuery, LogSearchConstants.ROW_TYPE, rowType);
-      queryGenerator.setSingleORFilter(userConfigQuery, LogSearchConstants.USER_NAME, userName, LogSearchConstants.SHARE_NAME_LIST, userName);
-      queryGenerator.setSingleIncludeFilter(userConfigQuery, LogSearchConstants.FILTER_NAME, SolrUtil.makeSearcableString(filterName));
+    Collection<UserConfigData> configList = new ArrayList<>();
 
-      if (StringUtils.isBlank(searchCriteria.getSortBy())) {
-        searchCriteria.setSortBy(LogSearchConstants.FILTER_NAME);
-      }
-      if (StringUtils.isBlank(searchCriteria.getSortType())) {
-        searchCriteria.setSortType("" + SolrQuery.ORDER.asc);
+    for (SolrDocument solrDoc : solrList) {
+      UserConfigData userConfig = new UserConfigData();
+      userConfig.setFiltername("" + solrDoc.get(FILTER_NAME));
+      userConfig.setId("" + solrDoc.get(ID));
+      userConfig.setValues("" + solrDoc.get(VALUES));
+      userConfig.setRowType("" + solrDoc.get(ROW_TYPE));
+      try {
+        List<String> shareNameList = (List<String>) solrDoc.get(SHARE_NAME_LIST);
+        userConfig.setShareNameList(shareNameList);
+      } catch (Exception e) {
+        // do nothing
       }
 
-      queryGenerator.setSingleSortOrder(userConfigQuery, searchCriteria);
-      solrList = userConfigSolrDao.process(userConfigQuery).getResults();
-
-      Collection<VUserConfig> configList = new ArrayList<VUserConfig>();
-
-      for (SolrDocument solrDoc : solrList) {
-        VUserConfig userConfig = new VUserConfig();
-        userConfig.setFiltername("" + solrDoc.get(LogSearchConstants.FILTER_NAME));
-        userConfig.setId("" + solrDoc.get(LogSearchConstants.ID));
-        userConfig.setValues("" + solrDoc.get(LogSearchConstants.VALUES));
-        userConfig.setRowType("" + solrDoc.get(LogSearchConstants.ROW_TYPE));
-        try {
-          List<String> shareNameList = (List<String>) solrDoc.get(LogSearchConstants.SHARE_NAME_LIST);
-          userConfig.setShareNameList(shareNameList);
-        } catch (Exception e) {
-          // do nothing
-        }
+      userConfig.setUserName("" + solrDoc.get(USER_NAME));
 
-        userConfig.setUserName("" + solrDoc.get(LogSearchConstants.USER_NAME));
+      configList.add(userConfig);
+    }
 
-        configList.add(userConfig);
-      }
+    response.setName("historyList");
+    response.setUserConfigList(configList);
 
-      userConfigList.setName("historyList");
-      userConfigList.setUserConfigList(configList);
+    response.setStartIndex(Integer.parseInt(request.getStartIndex()));
+    response.setPageSize(Integer.parseInt(request.getPageSize()));
 
-      userConfigList.setStartIndex(searchCriteria.getStartIndex());
-      userConfigList.setPageSize((int) searchCriteria.getMaxRows());
+    response.setTotalCount((long) solrList.getNumFound());
 
-      userConfigList.setTotalCount((long) solrList.getNumFound());
-    } catch (SolrException | SolrServerException | IOException e) {
-      // do nothing
-      logger.error(e);
-      throw RESTErrorUtil.createRESTException(MessageEnums.SOLR_ERROR.getMessage().getMessage(), MessageEnums.ERROR_SYSTEM);
-    }
-
-    return convertObjToString(userConfigList);
+    return response;
 
   }
 
-  public String updateUserConfig(VUserConfig vuserConfig) {
-    return saveUserConfig(vuserConfig);
+  public String updateUserConfig(UserConfigData userConfig) {
+    return saveUserConfig(userConfig);
   }
 
   // ////////////////////////////LEVEL FILTER/////////////////////////////////////
 
-  public String getUserFilter() {
-    VLogfeederFilterWrapper userFilter;
+  public LogFeederDataMap getUserFilter() {
+    LogFeederDataMap userFilter;
     try {
       userFilter = userConfigSolrDao.getUserFilter();
     } catch (SolrServerException | IOException e) {
       logger.error(e);
       throw RESTErrorUtil.createRESTException(MessageEnums.SOLR_ERROR.getMessage().getMessage(), MessageEnums.ERROR_SYSTEM);
     }
-    return convertObjToString(userFilter);
+    return userFilter;
   }
 
-  public String saveUserFiter(String json) {
-    if (!StringUtils.isBlank(json)) {
-      VLogfeederFilterWrapper logfeederFilterWrapper = (VLogfeederFilterWrapper) JSONUtil.jsonToObj(json, VLogfeederFilterWrapper.class);
-      try {
-        if (logfeederFilterWrapper == null) {
-          logger.error(json + " is a invalid json");
-        }
-        userConfigSolrDao.saveUserFilter(logfeederFilterWrapper);
-      } catch (SolrException | SolrServerException | IOException e) {
-        logger.error("user config not able to save", e);
-        throw RESTErrorUtil.createRESTException(MessageEnums.SOLR_ERROR.getMessage().getMessage(), MessageEnums.ERROR_SYSTEM);
-      }
+  public LogFeederDataMap saveUserFiter(LogFeederDataMap logfeederFilters) {
+    try {
+      userConfigSolrDao.saveUserFilter(logfeederFilters);
+    } catch (SolrException | SolrServerException | IOException e) {
+      logger.error("user config not able to save", e);
+      throw RESTErrorUtil.createRESTException(MessageEnums.SOLR_ERROR.getMessage().getMessage(), MessageEnums.ERROR_SYSTEM);
     }
     return getUserFilter();
   }
 
-  public String getAllUserName() {
+  public List<String> getAllUserName() {
     List<String> userList = new ArrayList<String>();
     try {
       SolrQuery userListQuery = new SolrQuery();
-      SolrUtil.setMainQuery(userListQuery, null);
-      SolrUtil.setFacetField(userListQuery, LogSearchConstants.USER_NAME);
+      userListQuery.setQuery("*:*");
+      SolrUtil.setFacetField(userListQuery, USER_NAME);
       QueryResponse queryResponse = userConfigSolrDao.process(userListQuery);
       if (queryResponse == null) {
-        return convertObjToString(userList);
+        return userList;
       }
-      List<Count> counList = queryResponse.getFacetField(LogSearchConstants.USER_NAME).getValues();
+      List<Count> counList = queryResponse.getFacetField(USER_NAME).getValues();
       for (Count cnt : counList) {
         String userName = cnt.getName();
         userList.add(userName);
       }
-    } catch (SolrException | SolrServerException | IOException e) {
+    } catch (SolrException e) {
       logger.warn("Error getting all users.", e);
       throw RESTErrorUtil.createRESTException(MessageEnums.SOLR_ERROR.getMessage().getMessage(), MessageEnums.ERROR_SYSTEM);
     }
-    return convertObjToString(userList);
+    return userList;
   }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/common/LogFeederDataMap.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/common/LogFeederDataMap.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/common/LogFeederDataMap.java
new file mode 100644
index 0000000..b09610c
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/common/LogFeederDataMap.java
@@ -0,0 +1,50 @@
+/*
+ * 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.common;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+import java.util.HashMap;
+
+@ApiModel
+public class LogFeederDataMap {
+
+  @ApiModelProperty
+  private String id;
+
+  @ApiModelProperty
+  private HashMap<String, LogfeederFilterData> filter;
+
+  public HashMap<String, LogfeederFilterData> getFilter() {
+    return filter;
+  }
+
+  public void setFilter(HashMap<String, LogfeederFilterData> filter) {
+    this.filter = filter;
+  }
+
+  public String getId() {
+    return id;
+  }
+
+  public void setId(String id) {
+    this.id = id;
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/common/LogfeederFilterData.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/common/LogfeederFilterData.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/common/LogfeederFilterData.java
new file mode 100644
index 0000000..e0f8013
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/common/LogfeederFilterData.java
@@ -0,0 +1,87 @@
+/*
+ * 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.common;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+import java.util.ArrayList;
+import java.util.List;
+
+@ApiModel
+public class LogfeederFilterData {
+
+  @ApiModelProperty
+  private String label;
+
+  @ApiModelProperty
+  private List<String> hosts = new ArrayList<>();
+
+  @ApiModelProperty
+  private List<String> defaultLevels = new ArrayList<>();
+
+  @ApiModelProperty
+  private List<String> overrideLevels = new ArrayList<>();
+
+  @ApiModelProperty
+  private String expiryTime;
+
+  public LogfeederFilterData() {
+  }
+
+  public String getLabel() {
+    return label;
+  }
+
+  public void setLabel(String label) {
+    this.label = label;
+  }
+
+  public List<String> getHosts() {
+    return hosts;
+  }
+
+  public void setHosts(List<String> hosts) {
+    this.hosts = hosts;
+  }
+
+  public List<String> getDefaultLevels() {
+    return defaultLevels;
+  }
+
+  public void setDefaultLevels(List<String> defaultLevels) {
+    this.defaultLevels = defaultLevels;
+  }
+
+  public List<String> getOverrideLevels() {
+    return overrideLevels;
+  }
+
+  public void setOverrideLevels(List<String> overrideLevels) {
+    this.overrideLevels = overrideLevels;
+  }
+
+  public String getExpiryTime() {
+    return expiryTime;
+  }
+
+  public void setExpiryTime(String expiryTime) {
+    this.expiryTime = expiryTime;
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/FieldParamDefinition.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/FieldParamDefinition.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/FieldParamDefinition.java
index 396fa93..66b3eeb 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/FieldParamDefinition.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/FieldParamDefinition.java
@@ -27,6 +27,6 @@ public interface FieldParamDefinition {
 
   String getField();
 
-  @ApiParam(value = FIELD_D, name = LogSearchConstants.REQUEST_PARAM_FIELD)
+  @ApiParam(value = FIELD_D, name = LogSearchConstants.REQUEST_PARAM_FIELD, required = true)
   void setField(String field);
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/LogParamDefinition.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/LogParamDefinition.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/LogParamDefinition.java
index e44de35..4840eaa 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/LogParamDefinition.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/LogParamDefinition.java
@@ -20,6 +20,8 @@ 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.CommonDescriptions.E_MESSAGE_D;
 import static org.apache.ambari.logsearch.doc.DocConstants.CommonDescriptions.I_MESSAGE_D;
 import static org.apache.ambari.logsearch.doc.DocConstants.CommonDescriptions.MUST_BE_D;
 import static org.apache.ambari.logsearch.doc.DocConstants.CommonDescriptions.MUST_NOT_D;
@@ -33,6 +35,11 @@ public interface LogParamDefinition {
   @ApiParam(value = I_MESSAGE_D, name = LogSearchConstants.REQUEST_PARAM_I_MESSAGE)
   void setiMessage(String iMessage);
 
+  String geteMessage();
+
+  @ApiParam(value = E_MESSAGE_D, name = LogSearchConstants.REQUEST_PARAM_E_MESSAGE)
+  void seteMessage(String eMessage);
+
   String getMustBe();
 
   @ApiParam(value = MUST_BE_D, name = LogSearchConstants.REQUEST_PARAM_MUST_BE)

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/LogTruncatedParamDefinition.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/LogTruncatedParamDefinition.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/LogTruncatedParamDefinition.java
index c3e2998..d3832c1 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/LogTruncatedParamDefinition.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/LogTruncatedParamDefinition.java
@@ -37,8 +37,8 @@ public interface LogTruncatedParamDefinition {
   @ApiParam(value = SCROLL_TYPE_D, name = LogSearchConstants.REQUEST_PARAM_SCROLL_TYPE)
   void setScrollType(String scrollType);
 
-  String getNumberRows();
+  Integer getNumberRows();
 
   @ApiParam(value = NUMBER_ROWS_D, name = LogSearchConstants.REQUEST_PARAM_NUMBER_ROWS)
-  void setNumberRows(String numberRows);
+  void setNumberRows(Integer numberRows);
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/QueryParamDefinition.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/QueryParamDefinition.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/QueryParamDefinition.java
deleted file mode 100644
index 3fcdbc0..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/QueryParamDefinition.java
+++ /dev/null
@@ -1,32 +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.model.request;
-
-import io.swagger.annotations.ApiParam;
-import org.apache.ambari.logsearch.common.LogSearchConstants;
-
-import static org.apache.ambari.logsearch.doc.DocConstants.CommonDescriptions.QUERY_D;
-
-public interface QueryParamDefinition {
-
-  String getQuery();
-
-  @ApiParam(value = QUERY_D, name = LogSearchConstants.REQUEST_PARAM_QUERY)
-  void setQuery(String query);
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/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 abc1f08..1783a8d 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
@@ -22,12 +22,9 @@ import io.swagger.annotations.ApiParam;
 import org.apache.ambari.logsearch.common.LogSearchConstants;
 
 import static org.apache.ambari.logsearch.doc.DocConstants.ServiceDescriptions.LEVEL_D;
-import static org.apache.ambari.logsearch.doc.DocConstants.CommonDescriptions.E_MESSAGE_D;
-import static org.apache.ambari.logsearch.doc.DocConstants.ServiceDescriptions.G_MUST_NOT_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;
-import static org.apache.ambari.logsearch.doc.DocConstants.ServiceDescriptions.DATE_RANGE_LABEL_D;
 
 public interface ServiceLogParamDefinition {
 
@@ -36,11 +33,6 @@ public interface ServiceLogParamDefinition {
   @ApiParam(value = LEVEL_D, name = LogSearchConstants.REQUEST_PARAM_LEVEL)
   void setLevel(String level);
 
-  String geteMessage();
-
-  @ApiParam(value = E_MESSAGE_D, name = LogSearchConstants.REQUEST_PARAM_E_MESSAGE)
-  void seteMessage(String eMessage);
-
   String getHostName();
 
   @ApiParam(value = HOST_NAME_D, name = LogSearchConstants.REQUEST_PARAM_HOST_NAME)
@@ -55,9 +47,4 @@ public interface ServiceLogParamDefinition {
 
   @ApiParam(value = FILE_NAME_D, name = LogSearchConstants.REQUEST_PARAM_FILE_NAME)
   void setFileName(String fileName);
-
-  String getDateRangeLabel();
-
-  @ApiParam(value = DATE_RANGE_LABEL_D, name = LogSearchConstants.REQUEST_PARAM_DATE_RANGE_LABEL)
-  void setDateRangeLabel(String dateRangeLabel);
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/TopParamDefinition.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/TopParamDefinition.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/TopParamDefinition.java
new file mode 100644
index 0000000..97d9543
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/TopParamDefinition.java
@@ -0,0 +1,31 @@
+/*
+ * 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.CommonDescriptions.TOP;
+
+public interface TopParamDefinition {
+  Integer getTop();
+
+  @ApiParam(value = TOP, name = LogSearchConstants.REQUEST_PARAM_TOP, required = true)
+  void setTop(Integer top);
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/AnyGraphRequest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/AnyGraphRequest.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/AnyGraphRequest.java
deleted file mode 100644
index 41da712..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/AnyGraphRequest.java
+++ /dev/null
@@ -1,109 +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.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;
-
-public class AnyGraphRequest extends CommonSearchRequest
-  implements AnyGraphParamDefinition, DateRangeParamDefinition, UnitParamDefinition{
-
-  @QueryParam(LogSearchConstants.REQUEST_PARAM_XAXIS)
-  private String xAxis;
-
-  @QueryParam(LogSearchConstants.REQUEST_PARAM_YAXIS)
-  private String yAxis;
-
-  @QueryParam(LogSearchConstants.REQUEST_PARAM_STACK_BY)
-  private String stackBy;
-
-  @QueryParam(LogSearchConstants.REQUEST_PARAM_FROM)
-  private String from;
-
-  @QueryParam(LogSearchConstants.REQUEST_PARAM_TO)
-  private String to;
-
-  @QueryParam(LogSearchConstants.REQUEST_PARAM_UNIT)
-  private String unit;
-
-  @Override
-  public String getxAxis() {
-    return xAxis;
-  }
-
-  @Override
-  public void setxAxis(String xAxis) {
-    this.xAxis = xAxis;
-  }
-
-  @Override
-  public String getyAxis() {
-    return yAxis;
-  }
-
-  @Override
-  public void setyAxis(String yAxis) {
-    this.yAxis = yAxis;
-  }
-
-  @Override
-  public String getStackBy() {
-    return stackBy;
-  }
-
-  @Override
-  public void setStackBy(String stackBy) {
-    this.stackBy = stackBy;
-  }
-
-  @Override
-  public String getFrom() {
-    return from;
-  }
-
-  @Override
-  public void setFrom(String from) {
-    this.from = from;
-  }
-
-  @Override
-  public String getTo() {
-    return to;
-  }
-
-  @Override
-  public void setTo(String to) {
-    this.to = to;
-  }
-
-  @Override
-  public String getUnit() {
-    return unit;
-  }
-
-  @Override
-  public void setUnit(String unit) {
-    this.unit = unit;
-  }
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/AuditBarGraphRequest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/AuditBarGraphRequest.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/AuditBarGraphRequest.java
index 91e7d1e..03ca32d 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/AuditBarGraphRequest.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/AuditBarGraphRequest.java
@@ -23,7 +23,7 @@ import org.apache.ambari.logsearch.model.request.UnitParamDefinition;
 
 import javax.ws.rs.QueryParam;
 
-public class AuditBarGraphRequest extends BaseAuditLogRequest implements UnitParamDefinition {
+public class AuditBarGraphRequest extends BaseLogRequest implements UnitParamDefinition {
 
   @QueryParam(LogSearchConstants.REQUEST_PARAM_UNIT)
   private String unit;

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/AuditComponentRequest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/AuditComponentRequest.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/AuditComponentRequest.java
new file mode 100644
index 0000000..94cb255
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/AuditComponentRequest.java
@@ -0,0 +1,25 @@
+/*
+ * 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 org.apache.ambari.logsearch.common.Marker;
+
+@Marker
+public class AuditComponentRequest extends CommonSearchRequest {
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/AuditLogRequest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/AuditLogRequest.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/AuditLogRequest.java
index 8dd13dc..36fa378 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/AuditLogRequest.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/AuditLogRequest.java
@@ -23,7 +23,7 @@ import org.apache.ambari.logsearch.model.request.LastPageParamDefinition;
 
 import javax.ws.rs.QueryParam;
 
-public class AuditLogRequest extends BaseAuditLogRequest implements LastPageParamDefinition {
+public class AuditLogRequest extends BaseLogRequest implements LastPageParamDefinition {
 
   @QueryParam(LogSearchConstants.REQUEST_PARAM_LAST_PAGE)
   private boolean isLastPage;

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/AuditServiceLoadRequest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/AuditServiceLoadRequest.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/AuditServiceLoadRequest.java
new file mode 100644
index 0000000..64ee2d2
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/AuditServiceLoadRequest.java
@@ -0,0 +1,25 @@
+/*
+ * 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 org.apache.ambari.logsearch.common.Marker;
+
+@Marker
+public class AuditServiceLoadRequest extends BaseLogRequest {
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/BaseAuditLogRequest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/BaseAuditLogRequest.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/BaseAuditLogRequest.java
deleted file mode 100644
index 74b4ab7..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/BaseAuditLogRequest.java
+++ /dev/null
@@ -1,53 +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.model.request.impl;
-
-import org.apache.ambari.logsearch.common.LogSearchConstants;
-import org.apache.ambari.logsearch.model.request.DateRangeParamDefinition;
-
-import javax.ws.rs.QueryParam;
-
-public class BaseAuditLogRequest extends BaseLogRequest implements DateRangeParamDefinition {
-
-  @QueryParam(LogSearchConstants.REQUEST_PARAM_FROM)
-  private String from;
-
-  @QueryParam(LogSearchConstants.REQUEST_PARAM_TO)
-  private String to;
-
-  @Override
-  public String getFrom() {
-    return from;
-  }
-
-  @Override
-  public void setFrom(String from) {
-    this.from = from;
-  }
-
-  @Override
-  public String getTo() {
-    return to;
-  }
-
-  @Override
-  public void setTo(String to) {
-    this.to = to;
-  }
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/BaseLogRequest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/BaseLogRequest.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/BaseLogRequest.java
index 1371350..5da2e83 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/BaseLogRequest.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/BaseLogRequest.java
@@ -18,28 +18,37 @@
  */
 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.DateRangeParamDefinition;
 import org.apache.ambari.logsearch.model.request.LogParamDefinition;
 
 import javax.ws.rs.QueryParam;
 
-public class BaseLogRequest extends QueryRequest implements LogParamDefinition {
+public class BaseLogRequest extends CommonSearchRequest implements LogParamDefinition, DateRangeParamDefinition {
 
   @QueryParam(LogSearchConstants.REQUEST_PARAM_I_MESSAGE)
   private String iMessage;
 
+  @QueryParam(LogSearchConstants.REQUEST_PARAM_E_MESSAGE)
+  private String eMessage;
+
   @QueryParam(LogSearchConstants.REQUEST_PARAM_MUST_BE)
   private String mustBe;
 
   @QueryParam(LogSearchConstants.REQUEST_PARAM_MUST_NOT)
   private String mustNot;
 
+  @QueryParam(LogSearchConstants.REQUEST_PARAM_INCLUDE_QUERY)
+  private String includeQuery;
+
   @QueryParam(LogSearchConstants.REQUEST_PARAM_EXCLUDE_QUERY)
   private String excludeQuery;
 
-  @QueryParam(LogSearchConstants.REQUEST_PARAM_INCLUDE_QUERY)
-  private String includeQuery;
+  @QueryParam(LogSearchConstants.REQUEST_PARAM_FROM)
+  private String from;
+
+  @QueryParam(LogSearchConstants.REQUEST_PARAM_TO)
+  private String to;
 
   @Override
   public String getiMessage() {
@@ -52,6 +61,16 @@ public class BaseLogRequest extends QueryRequest implements LogParamDefinition {
   }
 
   @Override
+  public String geteMessage() {
+    return eMessage;
+  }
+
+  @Override
+  public void seteMessage(String eMessage) {
+    this.eMessage = eMessage;
+  }
+
+  @Override
   public String getMustBe() {
     return mustBe;
   }
@@ -90,4 +109,24 @@ public class BaseLogRequest extends QueryRequest implements LogParamDefinition {
   public void setExcludeQuery(String excludeQuery) {
     this.excludeQuery = excludeQuery;
   }
+
+  @Override
+  public String getFrom() {
+    return from;
+  }
+
+  @Override
+  public void setFrom(String from) {
+    this.from = from;
+  }
+
+  @Override
+  public String getTo() {
+    return to;
+  }
+
+  @Override
+  public void setTo(String to) {
+    this.to = to;
+  }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/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 5770ba6..edd7563 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
@@ -26,14 +26,11 @@ import org.apache.ambari.logsearch.model.request.ServiceLogParamDefinition;
 import javax.ws.rs.QueryParam;
 
 public class BaseServiceLogRequest extends BaseLogRequest
-  implements ServiceLogParamDefinition, BundleIdParamDefinition, DateRangeParamDefinition {
+  implements ServiceLogParamDefinition, BundleIdParamDefinition {
 
   @QueryParam(LogSearchConstants.REQUEST_PARAM_LEVEL)
   private String level;
 
-  @QueryParam(LogSearchConstants.REQUEST_PARAM_E_MESSAGE)
-  private String eMessage;
-
   @QueryParam(LogSearchConstants.REQUEST_PARAM_HOST_NAME)
   private String hostName;
 
@@ -46,15 +43,6 @@ public class BaseServiceLogRequest extends BaseLogRequest
   @QueryParam(LogSearchConstants.REQUEST_PARAM_BUNDLE_ID)
   private String bundleId;
 
-  @QueryParam(LogSearchConstants.REQUEST_PARAM_FROM)
-  private String from;
-
-  @QueryParam(LogSearchConstants.REQUEST_PARAM_TO)
-  private String to;
-
-  @QueryParam(LogSearchConstants.REQUEST_PARAM_DATE_RANGE_LABEL)
-  private String dateRangeLabel;
-
   @Override
   public String getLevel() {
     return level;
@@ -66,16 +54,6 @@ public class BaseServiceLogRequest extends BaseLogRequest
   }
 
   @Override
-  public String geteMessage() {
-    return eMessage;
-  }
-
-  @Override
-  public void seteMessage(String eMessage) {
-    this.eMessage = eMessage;
-  }
-
-  @Override
   public String getHostName() {
     return hostName;
   }
@@ -114,34 +92,4 @@ public class BaseServiceLogRequest extends BaseLogRequest
   public void setBundleId(String bundleId) {
     this.bundleId = bundleId;
   }
-
-  @Override
-  public String getFrom() {
-    return from;
-  }
-
-  @Override
-  public void setFrom(String from) {
-    this.from = from;
-  }
-
-  @Override
-  public String getTo() {
-    return to;
-  }
-
-  @Override
-  public void setTo(String to) {
-    this.to = to;
-  }
-
-  @Override
-  public String getDateRangeLabel() {
-    return dateRangeLabel;
-  }
-
-  @Override
-  public void setDateRangeLabel(String dateRangeLabel) {
-    this.dateRangeLabel = dateRangeLabel;
-  }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/FieldAuditLogRequest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/FieldAuditLogRequest.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/FieldAuditLogRequest.java
index 67502fa..0bdcddf 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/FieldAuditLogRequest.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/FieldAuditLogRequest.java
@@ -18,17 +18,21 @@
  */
 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.FieldParamDefinition;
+import org.apache.ambari.logsearch.model.request.TopParamDefinition;
 
+import javax.ws.rs.PathParam;
 import javax.ws.rs.QueryParam;
 
-public class FieldAuditLogRequest extends BaseAuditLogRequest implements FieldParamDefinition {
+public class FieldAuditLogRequest extends BaseLogRequest implements FieldParamDefinition, TopParamDefinition {
 
   @QueryParam(LogSearchConstants.REQUEST_PARAM_FIELD)
   private String field;
 
+  @PathParam(LogSearchConstants.REQUEST_PARAM_TOP)
+  private Integer top;
+
   @Override
   public String getField() {
     return field;
@@ -38,4 +42,14 @@ public class FieldAuditLogRequest extends BaseAuditLogRequest implements FieldPa
   public void setField(String field) {
     this.field = field;
   }
+
+  @Override
+  public Integer getTop() {
+    return top;
+  }
+
+  @Override
+  public void setTop(Integer top) {
+    this.top = top;
+  }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/QueryRequest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/QueryRequest.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/QueryRequest.java
deleted file mode 100644
index 0ce788c..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/QueryRequest.java
+++ /dev/null
@@ -1,40 +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.model.request.impl;
-
-import org.apache.ambari.logsearch.common.LogSearchConstants;
-import org.apache.ambari.logsearch.model.request.QueryParamDefinition;
-
-import javax.ws.rs.QueryParam;
-
-public class QueryRequest extends CommonSearchRequest implements QueryParamDefinition {
-
-  @QueryParam(LogSearchConstants.REQUEST_PARAM_QUERY)
-  private String query;
-
-  @Override
-  public String getQuery() {
-    return query;
-  }
-
-  @Override
-  public void setQuery(String query) {
-    this.query = query;
-  }
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/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 a6aadbb..1fb4bf6 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
@@ -27,7 +27,7 @@ import org.apache.ambari.logsearch.model.request.UnitParamDefinition;
 import javax.ws.rs.QueryParam;
 
 public class ServiceAnyGraphRequest extends ServiceLogRequest
-  implements AnyGraphParamDefinition, DateRangeParamDefinition, UnitParamDefinition {
+  implements AnyGraphParamDefinition, UnitParamDefinition {
 
   @QueryParam(LogSearchConstants.REQUEST_PARAM_XAXIS)
   private String xAxis;
@@ -41,12 +41,6 @@ public class ServiceAnyGraphRequest extends ServiceLogRequest
   @QueryParam(LogSearchConstants.REQUEST_PARAM_UNIT)
   private String unit;
 
-  @QueryParam(LogSearchConstants.REQUEST_PARAM_FROM)
-  private String from;
-
-  @QueryParam(LogSearchConstants.REQUEST_PARAM_TO)
-  private String to;
-
   @Override
   public String getxAxis() {
     return xAxis;
@@ -86,24 +80,4 @@ public class ServiceAnyGraphRequest extends ServiceLogRequest
   public void setUnit(String unit) {
     this.unit = unit;
   }
-
-  @Override
-  public String getFrom() {
-    return from;
-  }
-
-  @Override
-  public void setFrom(String from) {
-    this.from = from;
-  }
-
-  @Override
-  public String getTo() {
-    return to;
-  }
-
-  @Override
-  public void setTo(String to) {
-    this.to = to;
-  }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/ServiceExtremeDatesRequest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/ServiceExtremeDatesRequest.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/ServiceExtremeDatesRequest.java
deleted file mode 100644
index 8207c5d..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/ServiceExtremeDatesRequest.java
+++ /dev/null
@@ -1,41 +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.model.request.impl;
-
-import io.swagger.annotations.ApiParam;
-import org.apache.ambari.logsearch.common.LogSearchConstants;
-import org.apache.ambari.logsearch.model.request.BundleIdParamDefinition;
-
-import javax.ws.rs.QueryParam;
-
-public class ServiceExtremeDatesRequest extends CommonSearchRequest implements BundleIdParamDefinition {
-
-  @QueryParam(LogSearchConstants.REQUEST_PARAM_BUNDLE_ID)
-  private String bundleId;
-
-  @Override
-  public String getBundleId() {
-    return bundleId;
-  }
-
-  @Override
-  public void setBundleId(String bundleId) {
-    this.bundleId = bundleId;
-  }
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/ServiceLogAggregatedInfoRequest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/ServiceLogAggregatedInfoRequest.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/ServiceLogAggregatedInfoRequest.java
new file mode 100644
index 0000000..84955d8
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/ServiceLogAggregatedInfoRequest.java
@@ -0,0 +1,25 @@
+/*
+ * 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 org.apache.ambari.logsearch.common.Marker;
+
+@Marker
+public class ServiceLogAggregatedInfoRequest extends BaseServiceLogRequest {
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/ServiceLogComponentHostRequest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/ServiceLogComponentHostRequest.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/ServiceLogComponentHostRequest.java
new file mode 100644
index 0000000..6d0b3b1
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/ServiceLogComponentHostRequest.java
@@ -0,0 +1,25 @@
+/*
+ * 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 org.apache.ambari.logsearch.common.Marker;
+
+@Marker
+public class ServiceLogComponentHostRequest extends ServiceLogRequest {
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/ServiceLogComponentLevelRequest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/ServiceLogComponentLevelRequest.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/ServiceLogComponentLevelRequest.java
new file mode 100644
index 0000000..dd2b8af
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/ServiceLogComponentLevelRequest.java
@@ -0,0 +1,25 @@
+/*
+ * 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 org.apache.ambari.logsearch.common.Marker;
+
+@Marker
+public class ServiceLogComponentLevelRequest extends ServiceLogRequest {
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/ServiceLogHostComponentRequest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/ServiceLogHostComponentRequest.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/ServiceLogHostComponentRequest.java
new file mode 100644
index 0000000..6242362
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/ServiceLogHostComponentRequest.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.request.impl;
+
+import io.swagger.annotations.ApiParam;
+
+import javax.ws.rs.QueryParam;
+
+public class ServiceLogHostComponentRequest extends ServiceLogRequest {
+  @QueryParam("hostName")
+  @ApiParam
+  String hostName;
+
+  @Override
+  public String getHostName() {
+    return hostName;
+  }
+
+  @Override
+  public void setHostName(String hostName) {
+    this.hostName = hostName;
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/ServiceLogLevelCountRequest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/ServiceLogLevelCountRequest.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/ServiceLogLevelCountRequest.java
new file mode 100644
index 0000000..7f0805f
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/ServiceLogLevelCountRequest.java
@@ -0,0 +1,25 @@
+/*
+ * 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 org.apache.ambari.logsearch.common.Marker;
+
+@Marker
+public class ServiceLogLevelCountRequest extends BaseServiceLogRequest {
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/ServiceLogTruncatedRequest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/ServiceLogTruncatedRequest.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/ServiceLogTruncatedRequest.java
index 8067896..c4b0049 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/ServiceLogTruncatedRequest.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/ServiceLogTruncatedRequest.java
@@ -32,7 +32,7 @@ public class ServiceLogTruncatedRequest extends ServiceLogRequest implements Log
   private String scrollType;
 
   @QueryParam(LogSearchConstants.REQUEST_PARAM_NUMBER_ROWS)
-  private String numberRows;
+  private Integer numberRows;
 
   @Override
   public String getId() {
@@ -55,12 +55,12 @@ public class ServiceLogTruncatedRequest extends ServiceLogRequest implements Log
   }
 
   @Override
-  public String getNumberRows() {
+  public Integer getNumberRows() {
     return numberRows;
   }
 
   @Override
-  public void setNumberRows(String numberRows) {
+  public void setNumberRows(Integer numberRows) {
     this.numberRows = numberRows;
   }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/SimpleQueryRequest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/SimpleQueryRequest.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/SimpleQueryRequest.java
deleted file mode 100644
index eec4379..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/SimpleQueryRequest.java
+++ /dev/null
@@ -1,42 +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.model.request.impl;
-
-import org.apache.ambari.logsearch.common.LogSearchConstants;
-import org.apache.ambari.logsearch.model.request.QueryParamDefinition;
-import org.apache.ambari.logsearch.model.request.SearchRequest;
-
-import javax.ws.rs.QueryParam;
-
-
-public class SimpleQueryRequest implements SearchRequest, QueryParamDefinition {
-
-  @QueryParam(LogSearchConstants.REQUEST_PARAM_QUERY)
-  private String query;
-
-  @Override
-  public String getQuery() {
-    return query;
-  }
-
-  @Override
-  public void setQuery(String query) {
-    this.query = query;
-  }
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/TemplateData.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/TemplateData.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/TemplateData.java
new file mode 100644
index 0000000..05deebd
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/TemplateData.java
@@ -0,0 +1,36 @@
+/*
+ * 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;
+
+public class TemplateData {
+
+  private String data;
+
+  public TemplateData(String data) {
+    this.data = data;
+  }
+
+  public String getData() {
+    return data;
+  }
+
+  public void setData(String data) {
+    this.data = data;
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/UserConfigData.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/UserConfigData.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/UserConfigData.java
new file mode 100644
index 0000000..1fca3ba
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/UserConfigData.java
@@ -0,0 +1,108 @@
+/*
+ * 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 io.swagger.annotations.ApiModelProperty;
+
+import java.util.Date;
+import java.util.List;
+
+public class UserConfigData {
+
+  @ApiModelProperty
+  private String id;
+
+  @ApiModelProperty
+  private String userName;
+
+  @ApiModelProperty
+  private String filtername;
+
+  @ApiModelProperty
+  private String values;
+
+  @ApiModelProperty
+  private List<String> shareNameList;
+
+  @ApiModelProperty
+  private String rowType;
+
+  @ApiModelProperty
+  private boolean isOverwrite = false;
+
+  public UserConfigData() {
+    id = String.valueOf(new Date().getTime());
+  }
+
+  public String getId() {
+    return id;
+  }
+
+  public void setId(String id) {
+    this.id = id;
+  }
+
+  public String getUserName() {
+    return userName;
+  }
+
+  public void setUserName(String userName) {
+    this.userName = userName;
+  }
+
+  public String getFiltername() {
+    return filtername;
+  }
+
+  public void setFiltername(String filtername) {
+    this.filtername = filtername;
+  }
+
+  public List<String> getShareNameList() {
+    return shareNameList;
+  }
+
+  public void setShareNameList(List<String> shareNameList) {
+    this.shareNameList = shareNameList;
+  }
+
+  public String getValues() {
+    return values;
+  }
+
+  public void setValues(String values) {
+    this.values = values;
+  }
+
+  public String getRowType() {
+    return rowType;
+  }
+
+  public void setRowType(String rowType) {
+    this.rowType = rowType;
+  }
+
+  public boolean isOverwrite() {
+    return isOverwrite;
+  }
+
+  public void setOverwrite(boolean overwrite) {
+    isOverwrite = overwrite;
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/UserConfigDataListResponse.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/UserConfigDataListResponse.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/UserConfigDataListResponse.java
new file mode 100644
index 0000000..5c445b2
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/UserConfigDataListResponse.java
@@ -0,0 +1,55 @@
+/*
+ * 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 io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+import java.util.Collection;
+
+@ApiModel
+public class UserConfigDataListResponse extends SearchResponse{
+
+  @ApiModelProperty
+  private String name;
+
+  @ApiModelProperty
+  private Collection<UserConfigData> userConfigList;
+
+  public String getName() {
+    return name;
+  }
+
+  public void setName(String name) {
+    this.name = name;
+  }
+
+  public Collection<UserConfigData> getUserConfigList() {
+    return userConfigList;
+  }
+
+  public void setUserConfigList(Collection<UserConfigData> userConfigList) {
+    this.userConfigList = userConfigList;
+  }
+
+  @Override
+  public int getListSize() {
+    return userConfigList != null ? userConfigList.size() : 0;
+  }
+}


[51/58] [abbrv] ambari git commit: AMBARI-18548. Declarative Logsearch/Logfeeder Component Metadata for Stack Component (oleewere)

Posted by ol...@apache.org.
http://git-wip-us.apache.org/repos/asf/ambari/blob/559fc2e4/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/templates/input.config-yarn.json.j2
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/templates/input.config-yarn.json.j2 b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/templates/input.config-yarn.json.j2
deleted file mode 100644
index f8e77ae..0000000
--- a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/templates/input.config-yarn.json.j2
+++ /dev/null
@@ -1,86 +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.
- #}
-{
-  "input":[
-    {
-      "type":"mapred_historyserver",
-      "rowtype":"service",
-      "path":"{{mapred_log_dir_prefix}}/{{mapred_user}}/mapred-{{mapred_user}}-historyserver*.log"
-    },
-    {
-      "type":"yarn_nodemanager",
-      "rowtype":"service",
-      "path":"{{yarn_log_dir_prefix}}/{{yarn_user}}/yarn-{{yarn_user}}-nodemanager-*.log"
-    },
-    {
-      "type":"yarn_resourcemanager",
-      "rowtype":"service",
-      "path":"{{yarn_log_dir_prefix}}/{{yarn_user}}/yarn-{{yarn_user}}-resourcemanager-*.log"
-    },
-    {
-      "type":"yarn_timelineserver",
-      "rowtype":"service",
-      "path":"{{yarn_log_dir_prefix}}/{{yarn_user}}/yarn-{{yarn_user}}-timelineserver-*.log"
-    },
-    {
-      "type":"yarn_historyserver",
-      "rowtype":"service",
-      "path":"{{yarn_log_dir_prefix}}/{{yarn_user}}/yarn-{{yarn_user}}-historyserver-*.log"
-    },
-    {
-      "type":"yarn_jobsummary",
-      "rowtype":"service",
-      "path":"{{yarn_log_dir_prefix}}/{{yarn_user}}/hadoop-mapreduce.jobsummary.log"
-    }
-
-  ],
-  "filter":[
-    {
-      "filter":"grok",
-      "conditions":{
-        "fields":{
-          "type":[
-            "mapred_historyserver",
-            "yarn_historyserver",
-            "yarn_jobsummary",
-            "yarn_nodemanager",
-            "yarn_resourcemanager",
-            "yarn_timelineserver"
-          ]
-
-        }
-
-      },
-      "log4j_format":"%d{ISO8601} %-5p %c{2} (%F:%M(%L)) - %m%n",
-      "multiline_pattern":"^(%{TIMESTAMP_ISO8601:logtime})",
-      "message_pattern":"(?m)^%{TIMESTAMP_ISO8601:logtime}%{SPACE}%{LOGLEVEL:level}%{SPACE}%{JAVACLASS:logger_name}%{SPACE}\\(%{JAVAFILE:file}:%{JAVAMETHOD:method}\\(%{INT:line_number}\\)\\)%{SPACE}-%{SPACE}%{GREEDYDATA:log_message}",
-      "post_map_values":{
-        "logtime":{
-          "map_date":{
-            "target_date_pattern":"yyyy-MM-dd HH:mm:ss,SSS"
-          }
-
-        }
-
-      }
-
-    }
-
-  ]
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/559fc2e4/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/templates/input.config-zeppelin.json.j2
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/templates/input.config-zeppelin.json.j2 b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/templates/input.config-zeppelin.json.j2
deleted file mode 100644
index c0948b5..0000000
--- a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/templates/input.config-zeppelin.json.j2
+++ /dev/null
@@ -1,56 +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.
- #}
-{
-  "input":[
-    {
-      "type":"zeppelin",
-      "rowtype":"service",
-      "path":"{{zeppelin_log_dir}}/zeppelin-zeppelin-*.log"
-    }
-
-  ],
-  "filter":[
-    {
-      "filter":"grok",
-      "conditions":{
-        "fields":{
-          "type":[
-            "zeppelin"
-          ]
-
-        }
-
-      },
-      "log4j_format":"",
-      "multiline_pattern":"^(%{SPACE}%{LOGLEVEL:level}%{SPACE}\\[%{TIMESTAMP_ISO8601:logtime}\\])",
-      "message_pattern":"(?m)^%{SPACE}%{LOGLEVEL:level}%{SPACE}\\[%{TIMESTAMP_ISO8601:logtime}\\]%{SPACE}\\(\\{{"{"}}%{DATA:thread_name}\\{{"}"}}%{SPACE}%{JAVAFILE:file}\\[%{JAVAMETHOD:method}\\]:%{INT:line_number}\\)%{SPACE}-%{SPACE}%{GREEDYDATA:log_message}",
-      "post_map_values":{
-        "logtime":{
-          "map_date":{
-            "target_date_pattern":"yyyy-MM-dd HH:mm:ss,SSS"
-          }
-
-        }
-
-      }
-
-    }
-
-  ]
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/559fc2e4/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/templates/input.config-zookeeper.json.j2
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/templates/input.config-zookeeper.json.j2 b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/templates/input.config-zookeeper.json.j2
deleted file mode 100644
index fcc5dc9..0000000
--- a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/templates/input.config-zookeeper.json.j2
+++ /dev/null
@@ -1,56 +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.
- #}
-{
-  "input":[
-    {
-      "type":"zookeeper",
-      "rowtype":"service",
-      "path":"{{zk_log_dir}}/zookeeper*.log"
-    }
-
-  ],
-  "filter":[
-    {
-      "filter":"grok",
-      "conditions":{
-        "fields":{
-          "type":[
-            "zookeeper"
-          ]
-
-        }
-
-      },
-      "log4j_format":"%d{ISO8601} - %-5p [%t:%C{1}@%L] - %m%n",
-      "multiline_pattern":"^(%{TIMESTAMP_ISO8601:logtime})",
-      "message_pattern":"(?m)^%{TIMESTAMP_ISO8601:logtime}%{SPACE}-%{SPACE}%{LOGLEVEL:level}%{SPACE}\\[%{DATA:thread_name}\\@%{INT:line_number}\\]%{SPACE}-%{SPACE}%{GREEDYDATA:log_message}",
-      "post_map_values":{
-        "logtime":{
-          "map_date":{
-            "target_date_pattern":"yyyy-MM-dd HH:mm:ss,SSS"
-          }
-
-        }
-
-      }
-
-    }
-
-  ]
-
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/559fc2e4/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/properties/secure_log.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/properties/secure_log.json b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/properties/secure_log.json
new file mode 100644
index 0000000..9d9585e
--- /dev/null
+++ b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/properties/secure_log.json
@@ -0,0 +1,31 @@
+{
+  "input": [
+    {
+      "type": "secure_log",
+      "rowtype": "service",
+      "path": "/var/log/secure"
+    }
+  ],
+  "filter": [
+    {
+      "filter": "grok",
+      "conditions": {
+        "fields": {
+          "type": [
+            "secure_log"
+          ]
+        }
+      },
+      "multiline_pattern": "^(%{SYSLOGTIMESTAMP:logtime})",
+      "message_pattern": "(?m)^%{SYSLOGTIMESTAMP:logtime}%{SPACE}%{SYSLOGHOST:host}%{SPACE}%{GREEDYDATA:log_message}",
+      "post_map_values": {
+        "logtime": {
+          "map_date": {
+            "target_date_pattern": "yyyy-MM-dd HH:mm:ss,SSS",
+            "src_date_pattern" :"MMM dd HH:mm:ss"
+          }
+        }
+      }
+    }
+  ]
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/559fc2e4/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/properties/system_messages.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/properties/system_messages.json b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/properties/system_messages.json
new file mode 100644
index 0000000..e2ea3eb
--- /dev/null
+++ b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/properties/system_messages.json
@@ -0,0 +1,31 @@
+{
+  "input": [
+    {
+      "type": "system_message",
+      "rowtype": "service",
+      "path": "/var/log/messages"
+    }
+  ],
+  "filter": [
+    {
+      "filter": "grok",
+      "conditions": {
+        "fields": {
+          "type": [
+            "system_message"
+          ]
+        }
+      },
+      "multiline_pattern": "^(%{SYSLOGTIMESTAMP:logtime})",
+      "message_pattern": "(?m)^%{SYSLOGTIMESTAMP:logtime}%{SPACE}%{SYSLOGHOST:host}%{SPACE}%{GREEDYDATA:log_message}",
+      "post_map_values": {
+        "logtime": {
+          "map_date": {
+            "target_date_pattern": "yyyy-MM-dd HH:mm:ss,SSS",
+            "src_date_pattern" :"MMM dd HH:mm:ss"
+          }
+        }
+      }
+    }
+  ]
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/559fc2e4/ambari-server/src/main/resources/common-services/OOZIE/4.0.0.2.0/configuration/oozie-logsearch-conf.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/OOZIE/4.0.0.2.0/configuration/oozie-logsearch-conf.xml b/ambari-server/src/main/resources/common-services/OOZIE/4.0.0.2.0/configuration/oozie-logsearch-conf.xml
new file mode 100644
index 0000000..2f13d3f
--- /dev/null
+++ b/ambari-server/src/main/resources/common-services/OOZIE/4.0.0.2.0/configuration/oozie-logsearch-conf.xml
@@ -0,0 +1,80 @@
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
+<!--
+/**
+ * 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.
+ */
+-->
+<configuration supports_final="false" supports_adding_forbidden="true">
+  <property>
+    <name>service_name</name>
+    <display-name>Service name</display-name>
+    <description>Service name for Logsearch Portal (label)</description>
+    <value>Oozie</value>
+    <on-ambari-upgrade add="true"/>
+  </property>
+  <property>
+    <name>component_mappings</name>
+    <display-name>Component mapping</display-name>
+    <description>Logsearch component logid mapping list (e.g.: COMPONENT1:logid1,logid2;COMPONENT2:logid3)</description>
+    <value>OOZIE_SERVER:oozie_app</value>
+    <on-ambari-upgrade add="true"/>
+  </property>
+  <property>
+    <name>content</name>
+    <display-name>Logfeeder Config</display-name>
+    <description>Metadata jinja template for Logfeeder which contains grok patterns for reading service specific logs.</description>
+    <value>
+{
+  "input":[
+    {
+      "type":"oozie_app",
+      "rowtype":"service",
+      "path":"{{default('/configurations/oozie-env/oozie_log_dir', '/var/log/oozie')}}/oozie.log"
+    }
+   ],
+  "filter":[
+    {
+      "filter":"grok",
+      "conditions":{
+        "fields":{
+          "type":[
+            "oozie_app"
+          ]
+         }
+       },
+      "log4j_format":"%d{ISO8601} %5p %c{1}:%L - SERVER[${oozie.instance.id}] %m%n",
+      "multiline_pattern":"^(%{TIMESTAMP_ISO8601:logtime})",
+      "message_pattern":"(?m)^%{TIMESTAMP_ISO8601:logtime}%{SPACE}%{LOGLEVEL:level}%{SPACE}%{DATA:logger_name}:%{INT:line_number}%{SPACE}-%{SPACE}%{GREEDYDATA:log_message}",
+      "post_map_values":{
+        "logtime":{
+          "map_date":{
+            "target_date_pattern":"yyyy-MM-dd HH:mm:ss,SSS"
+          }
+         }
+       }
+     }
+   ]
+ }
+    </value>
+    <value-attributes>
+      <type>content</type>
+      <show-property-name>false</show-property-name>
+    </value-attributes>
+    <on-ambari-upgrade add="true"/>
+  </property>
+</configuration>

http://git-wip-us.apache.org/repos/asf/ambari/blob/559fc2e4/ambari-server/src/main/resources/common-services/RANGER/0.4.0/configuration/ranger-logsearch-conf.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/RANGER/0.4.0/configuration/ranger-logsearch-conf.xml b/ambari-server/src/main/resources/common-services/RANGER/0.4.0/configuration/ranger-logsearch-conf.xml
new file mode 100644
index 0000000..fc26336
--- /dev/null
+++ b/ambari-server/src/main/resources/common-services/RANGER/0.4.0/configuration/ranger-logsearch-conf.xml
@@ -0,0 +1,111 @@
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
+<!--
+/**
+ * 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.
+ */
+-->
+<configuration supports_final="false" supports_adding_forbidden="true">
+  <property>
+    <name>service_name</name>
+    <display-name>Service name</display-name>
+    <description>Service name for Logsearch Portal (label)</description>
+    <value>Ranger</value>
+    <on-ambari-upgrade add="true"/>
+  </property>
+  <property>
+    <name>component_mappings</name>
+    <display-name>Component mapping</display-name>
+    <description>Logsearch component logid mapping list (e.g.: COMPONENT1:logid1,logid2;COMPONENT2:logid3)</description>
+    <value>RANGER_SERVER:ranger_admin,ranger_dbpatch;RANGER_USERSYNC:ranger_usersync;</value>
+    <on-ambari-upgrade add="true"/>
+  </property>
+  <property>
+    <name>content</name>
+    <display-name>Logfeeder Config</display-name>
+    <description>Metadata jinja template for Logfeeder which contains grok patterns for reading service specific logs.</description>
+    <value>
+{
+  "input":[
+    {
+      "type":"ranger_admin",
+      "rowtype":"service",
+      "path":"{{default('/configurations/ranger-env/ranger_admin_log_dir', '/var/log/ranger/admin')}}/xa_portal.log"
+    },
+    {
+      "type":"ranger_dbpatch",
+      "is_enabled":"true",
+      "path":"{{default('/configurations/ranger-env/ranger_admin_log_dir', '/var/log/ranger/admin')}}/ranger_db_patch.log"
+    },
+    {
+      "type":"ranger_usersync",
+      "rowtype":"service",
+      "path":"{{default('/configurations/ranger-env/ranger_usersync_log_dir', '/var/log/ranger/usersync')}}/usersync.log"
+    }
+   ],
+  "filter":[
+    {
+      "filter":"grok",
+      "conditions":{
+        "fields":{
+          "type":[
+            "ranger_admin",
+            "ranger_dbpatch"
+          ]
+         }
+       },
+      "log4j_format":"%d [%t] %-5p %C{6} (%F:%L) - %m%n",
+      "multiline_pattern":"^(%{TIMESTAMP_ISO8601:logtime})",
+      "message_pattern":"(?m)^%{TIMESTAMP_ISO8601:logtime}%{SPACE}\\[%{DATA:thread_name}\\]%{SPACE}%{LOGLEVEL:level}%{SPACE}%{JAVACLASS:logger_name}%{SPACE}\\(%{JAVAFILE:file}:%{INT:line_number}\\)%{SPACE}-%{SPACE}%{GREEDYDATA:log_message}",
+      "post_map_values":{
+        "logtime":{
+          "map_date":{
+            "target_date_pattern":"yyyy-MM-dd HH:mm:ss,SSS"
+          }
+         }
+       }
+     },
+    {
+      "filter":"grok",
+      "conditions":{
+        "fields":{
+          "type":[
+            "ranger_usersync"
+          ]
+         }
+       },
+      "log4j_format":"%d{dd MMM yyyy HH:mm:ss} %5p %c{1} [%t] - %m%n",
+      "multiline_pattern":"^(%{USER_SYNC_DATE:logtime})",
+      "message_pattern":"(?m)^%{USER_SYNC_DATE:logtime}%{SPACE}%{LOGLEVEL:level}%{SPACE}%{JAVACLASS:logger_name}%{SPACE}\\[%{DATA:thread_name}\\]%{SPACE}-%{SPACE}%{GREEDYDATA:log_message}",
+      "post_map_values":{
+        "logtime":{
+          "map_date":{
+            "target_date_pattern":"dd MMM yyyy HH:mm:ss"
+          }
+         }
+       }
+     }
+   ]
+ }
+    </value>
+    <value-attributes>
+      <type>content</type>
+      <show-property-name>false</show-property-name>
+    </value-attributes>
+    <on-ambari-upgrade add="true"/>
+  </property>
+</configuration>

http://git-wip-us.apache.org/repos/asf/ambari/blob/559fc2e4/ambari-server/src/main/resources/common-services/RANGER_KMS/0.5.0.2.3/configuration/ranger-kms-logsearch-conf.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/RANGER_KMS/0.5.0.2.3/configuration/ranger-kms-logsearch-conf.xml b/ambari-server/src/main/resources/common-services/RANGER_KMS/0.5.0.2.3/configuration/ranger-kms-logsearch-conf.xml
new file mode 100644
index 0000000..226d2b0
--- /dev/null
+++ b/ambari-server/src/main/resources/common-services/RANGER_KMS/0.5.0.2.3/configuration/ranger-kms-logsearch-conf.xml
@@ -0,0 +1,80 @@
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
+<!--
+/**
+ * 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.
+ */
+-->
+<configuration supports_final="false" supports_adding_forbidden="true">
+  <property>
+    <name>service_name</name>
+    <display-name>Service name</display-name>
+    <description>Service name for Logsearch Portal (label)</description>
+    <value>Ranger KMS</value>
+    <on-ambari-upgrade add="true"/>
+  </property>
+  <property>
+    <name>component_mappings</name>
+    <display-name>Component mapping</display-name>
+    <description>Logsearch component logid mapping list (e.g.: COMPONENT1:logid1,logid2;COMPONENT2:logid3)</description>
+    <value>RANGER_KMS:ranger_kms</value>
+    <on-ambari-upgrade add="true"/>
+  </property>
+  <property>
+    <name>content</name>
+    <display-name>Logfeeder Config</display-name>
+    <description>Metadata jinja template for Logfeeder which contains grok patterns for reading service specific logs.</description>
+    <value>
+{
+  "input":[
+    {
+      "type":"ranger_kms",
+      "rowtype":"service",
+      "path":"{{default('/configurations/kms-env/kms_log_dir', '/var/log/ranger/kms')}}/kms.log"
+    }
+   ],
+  "filter":[
+    {
+      "filter":"grok",
+      "conditions":{
+        "fields":{
+          "type":[
+            "ranger_kms"
+          ]
+         }
+       },
+      "log4j_format":"%d{ISO8601} %-5p %c{1} - %m%n",
+      "multiline_pattern":"^(%{TIMESTAMP_ISO8601:logtime})",
+      "message_pattern":"(?m)^%{TIMESTAMP_ISO8601:logtime}%{SPACE}%{LOGLEVEL:level}%{SPACE}%{JAVACLASS:logger_name}%{SPACE}-%{SPACE}%{GREEDYDATA:log_message}",
+      "post_map_values":{
+        "logtime":{
+          "map_date":{
+            "target_date_pattern":"yyyy-MM-dd HH:mm:ss,SSS"
+          }
+         }
+       }
+     }
+   ]
+ }
+    </value>
+    <value-attributes>
+      <type>content</type>
+      <show-property-name>false</show-property-name>
+    </value-attributes>
+    <on-ambari-upgrade add="true"/>
+  </property>
+</configuration>

http://git-wip-us.apache.org/repos/asf/ambari/blob/559fc2e4/ambari-server/src/main/resources/common-services/SPARK/1.2.1/configuration/spark-logsearch-conf.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/SPARK/1.2.1/configuration/spark-logsearch-conf.xml b/ambari-server/src/main/resources/common-services/SPARK/1.2.1/configuration/spark-logsearch-conf.xml
new file mode 100644
index 0000000..63201ef
--- /dev/null
+++ b/ambari-server/src/main/resources/common-services/SPARK/1.2.1/configuration/spark-logsearch-conf.xml
@@ -0,0 +1,98 @@
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
+<!--
+/**
+ * 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.
+ */
+-->
+<configuration supports_final="false" supports_adding_forbidden="true">
+  <property>
+    <name>service_name</name>
+    <display-name>Service name</display-name>
+    <description>Service name for Logsearch Portal (label)</description>
+    <value>Spark</value>
+    <on-ambari-upgrade add="true"/>
+  </property>
+  <property>
+    <name>component_mappings</name>
+    <display-name>Component mapping</display-name>
+    <description>Logsearch component logid mapping list (e.g.: COMPONENT1:logid1,logid2;COMPONENT2:logid3)</description>
+    <value>SPARK_JOBHISTORYSERVER:spark_jobhistory_server;SPARK_THRIFTSERVER:spark_thriftserver;LIVY_SERVER:livy_server</value>
+    <on-ambari-upgrade add="true"/>
+  </property>
+  <property>
+    <name>content</name>
+    <display-name>Logfeeder Config</display-name>
+    <description>Metadata jinja template for Logfeeder which contains grok patterns for reading service specific logs.</description>
+    <value>
+{
+   "input":[
+      {
+       "type":"spark_jobhistory_server",
+       "rowtype":"service",
+       "path":"{{default('/configurations/spark-env/spark_log_dir', '/var/log/spark')}}/spark-*-org.apache.spark.deploy.history.HistoryServer*.out"
+     },
+     {
+       "type":"spark_thriftserver",
+       "rowtype":"service",
+       "path":"{{default('/configurations/spark-env/spark_log_dir', '/var/log/spark')}}/spark-*-org.apache.spark.sql.hive.thriftserver.HiveThriftServer2*.out"
+     },
+     {
+       "type":"livy_server",
+       "rowtype":"service",
+       "path":"{{default('/configurations/livy-env/livy_log_dir', '/var/log/livy')}}/livy-livy-server.out"
+     }
+   ],
+   "filter":[
+       {
+          "filter":"grok",
+          "conditions":{
+            "fields":{
+              "type":[
+                "spark_jobhistory_server",
+                "spark_thriftserver",
+                "livy_server"
+              ]
+             }
+          },
+          "log4j_format":"",
+          "multiline_pattern":"^(%{SPARK_DATESTAMP:logtime}%{SPACE}%{LOGLEVEL:level})",
+          "message_pattern":"(?m)^%{SPARK_DATESTAMP:logtime}%{SPACE}%{LOGLEVEL:level}%{SPACE}%{JAVAFILE:file}:%{SPACE}%{GREEDYDATA:log_message}",
+          "post_map_values":{
+            "logtime":{
+              "map_date":{
+                "target_date_pattern":"yy/MM/dd HH:mm:ss"
+              }
+             },
+            "level":{
+              "map_fieldvalue":{
+                "pre_value":"WARNING",
+                "post_value":"WARN"
+              }
+             }
+           }
+      }
+   ]
+}
+    </value>
+    <value-attributes>
+      <type>content</type>
+      <show-property-name>false</show-property-name>
+    </value-attributes>
+    <on-ambari-upgrade add="true"/>
+  </property>
+</configuration>

http://git-wip-us.apache.org/repos/asf/ambari/blob/559fc2e4/ambari-server/src/main/resources/common-services/SPARK2/2.0.0/configuration/spark2-logsearch-conf.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/SPARK2/2.0.0/configuration/spark2-logsearch-conf.xml b/ambari-server/src/main/resources/common-services/SPARK2/2.0.0/configuration/spark2-logsearch-conf.xml
new file mode 100644
index 0000000..3b00d51
--- /dev/null
+++ b/ambari-server/src/main/resources/common-services/SPARK2/2.0.0/configuration/spark2-logsearch-conf.xml
@@ -0,0 +1,92 @@
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
+<!--
+/**
+ * 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.
+ */
+-->
+<configuration supports_final="false" supports_adding_forbidden="true">
+  <property>
+    <name>service_name</name>
+    <display-name>Service name</display-name>
+    <description>Service name for Logsearch Portal (label)</description>
+    <value>Spark2</value>
+    <on-ambari-upgrade add="true"/>
+  </property>
+  <property>
+    <name>component_mappings</name>
+    <display-name>Component mapping</display-name>
+    <description>Logsearch component logid mapping list (e.g.: COMPONENT1:logid1,logid2;COMPONENT2:logid3)</description>
+    <value>SPARK2_JOBHISTORYSERVER:spark2_jobhistory_server;SPARK2_THRIFTSERVER:spark2_thriftserver</value>
+    <on-ambari-upgrade add="true"/>
+  </property>
+  <property>
+    <name>content</name>
+    <display-name>Logfeeder Config</display-name>
+    <description>Metadata jinja template for Logfeeder which contains grok patterns for reading service specific logs.</description>
+    <value>
+{
+   "input":[
+      {
+       "type":"spark2_jobhistory_server",
+       "rowtype":"service",
+       "path":"{{default('/configurations/spark2-env/spark_log_dir', '/var/log/spark2')}}/spark-*-org.apache.spark.deploy.history.HistoryServer*.out"
+     },
+     {
+       "type":"spark2_thriftserver",
+       "rowtype":"service",
+       "path":"{{default('/configurations/spark2-env/spark_log_dir', '/var/log/spark2')}}/spark-*-org.apache.spark.sql.hive.thriftserver.HiveThriftServer2*.out"
+     }
+   ],
+   "filter":[
+      {
+          "filter":"grok",
+          "conditions":{
+            "fields":{
+              "type":[
+                "spark2_jobhistory_server",
+                "spark2_thriftserver"
+              ]
+             }
+          },
+          "log4j_format":"",
+          "multiline_pattern":"^(%{SPARK_DATESTAMP:logtime}%{SPACE}%{LOGLEVEL:level})",
+          "message_pattern":"(?m)^%{SPARK_DATESTAMP:logtime}%{SPACE}%{LOGLEVEL:level}%{SPACE}%{JAVAFILE:file}:%{SPACE}%{GREEDYDATA:log_message}",
+          "post_map_values":{
+            "logtime":{
+              "map_date":{
+                "target_date_pattern":"yy/MM/dd HH:mm:ss"
+              }
+             },
+            "level":{
+              "map_fieldvalue":{
+                "pre_value":"WARNING",
+                "post_value":"WARN"
+              }
+             }
+           }
+      }
+   ]
+}
+    </value>
+    <value-attributes>
+      <type>content</type>
+      <show-property-name>false</show-property-name>
+    </value-attributes>
+    <on-ambari-upgrade add="true"/>
+  </property>
+</configuration>

http://git-wip-us.apache.org/repos/asf/ambari/blob/559fc2e4/ambari-server/src/main/resources/common-services/STORM/0.9.1/configuration/storm-logsearch-conf.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/STORM/0.9.1/configuration/storm-logsearch-conf.xml b/ambari-server/src/main/resources/common-services/STORM/0.9.1/configuration/storm-logsearch-conf.xml
new file mode 100644
index 0000000..d485017
--- /dev/null
+++ b/ambari-server/src/main/resources/common-services/STORM/0.9.1/configuration/storm-logsearch-conf.xml
@@ -0,0 +1,110 @@
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
+<!--
+/**
+ * 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.
+ */
+-->
+<configuration supports_final="false" supports_adding_forbidden="true">
+  <property>
+    <name>service_name</name>
+    <display-name>Service name</display-name>
+    <description>Service name for Logsearch Portal (label)</description>
+    <value>Storm</value>
+    <on-ambari-upgrade add="true"/>
+  </property>
+  <property>
+    <name>component_mappings</name>
+    <display-name>Component mapping</display-name>
+    <description>Logsearch component logid mapping list (e.g.: COMPONENT1:logid1,logid2;COMPONENT2:logid3)</description>
+    <value>NIMBUS:storm_nimbus;SUPERVISOR:storm_supervisor,storm_worker,storm_logviewer;STORM_UI_SERVER:storm_ui;DRPC_SERVER:storm_drpc</value>
+    <on-ambari-upgrade add="true"/>
+  </property>
+  <property>
+    <name>content</name>
+    <display-name>Logfeeder Config</display-name>
+    <description>Metadata jinja template for Logfeeder which contains grok patterns for reading service specific logs.</description>
+    <value>
+{
+  "input":[
+    {
+      "type":"storm_drpc",
+      "rowtype":"service",
+      "path":"{{default('/configurations/storm-env/storm_log_dir', '/var/log/storm')}}/drpc.log"
+    },
+    {
+      "type":"storm_logviewer",
+      "rowtype":"service",
+      "path":"{{default('/configurations/storm-env/storm_log_dir', '/var/log/storm')}}/logviewer.log"
+    },
+    {
+      "type":"storm_nimbus",
+      "rowtype":"service",
+      "path":"{{default('/configurations/storm-env/storm_log_dir', '/var/log/storm')}}/nimbus.log"
+    },
+    {
+      "type":"storm_supervisor",
+      "rowtype":"service",
+      "path":"{{default('/configurations/storm-env/storm_log_dir', '/var/log/storm')}}/supervisor.log"
+    },
+    {
+      "type":"storm_ui",
+      "rowtype":"service",
+      "path":"{{default('/configurations/storm-env/storm_log_dir', '/var/log/storm')}}/ui.log"
+    },
+    {
+      "type":"storm_worker",
+      "rowtype":"service",
+      "path":"{{default('/configurations/storm-env/storm_log_dir', '/var/log/storm')}}/*worker*.log"
+    }
+   ],
+  "filter":[
+    {
+      "filter":"grok",
+      "conditions":{
+        "fields":{
+          "type":[
+            "storm_drpc",
+            "storm_logviewer",
+            "storm_nimbus",
+            "storm_supervisor",
+            "storm_ui",
+            "storm_worker"
+          ]
+         }
+       },
+      "log4j_format":"",
+      "multiline_pattern":"^(%{TIMESTAMP_ISO8601:logtime})",
+      "message_pattern":"(?m)^%{TIMESTAMP_ISO8601:logtime}%{SPACE}%{JAVACLASS:logger_name}%{SPACE}\\[%{LOGLEVEL:level}\\]%{SPACE}%{SPACE}%{GREEDYDATA:log_message}",
+      "post_map_values":{
+        "logtime":{
+          "map_date":{
+            "target_date_pattern":"yyyy-MM-dd HH:mm:ss.SSS"
+          }
+         }
+       }
+     }
+   ]
+ }
+    </value>
+    <value-attributes>
+      <type>content</type>
+      <show-property-name>false</show-property-name>
+    </value-attributes>
+    <on-ambari-upgrade add="true"/>
+  </property>
+</configuration>

http://git-wip-us.apache.org/repos/asf/ambari/blob/559fc2e4/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/configuration-mapred/mapred-logsearch-conf.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/configuration-mapred/mapred-logsearch-conf.xml b/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/configuration-mapred/mapred-logsearch-conf.xml
new file mode 100644
index 0000000..3c0abbf
--- /dev/null
+++ b/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/configuration-mapred/mapred-logsearch-conf.xml
@@ -0,0 +1,80 @@
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
+<!--
+/**
+ * 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.
+ */
+-->
+<configuration supports_final="false" supports_adding_forbidden="true">
+  <property>
+    <name>service_name</name>
+    <display-name>Service name</display-name>
+    <description>Service name for Logsearch Portal (label)</description>
+    <value>MapReduce</value>
+    <on-ambari-upgrade add="true"/>
+  </property>
+  <property>
+    <name>component_mappings</name>
+    <display-name>Component mapping</display-name>
+    <description>Logsearch component logid mapping list (e.g.: COMPONENT1:logid1,logid2;COMPONENT2:logid3)</description>
+    <value>HISTORYSERVER:mapred_historyserver</value>
+    <on-ambari-upgrade add="true"/>
+  </property>
+  <property>
+    <name>content</name>
+    <display-name>Logfeeder Config</display-name>
+    <description>Metadata jinja template for Logfeeder which contains grok patterns for reading service specific logs.</description>
+    <value>
+{
+  "input":[
+    {
+      "type":"mapred_historyserver",
+      "rowtype":"service",
+      "path":"{{default('/configurations/mapred-env/mapred_log_dir_prefix', '/var/log/hadoop')}}/{{default('configurations/mapred-env/mapred_user', 'mapred')}}/mapred-{{default('configurations/mapred-env/mapred_user', 'mapred')}}-historyserver*.log"
+    }
+   ],
+  "filter":[
+    {
+      "filter":"grok",
+      "conditions":{
+        "fields":{
+          "type":[
+            "mapred_historyserver"
+          ]
+         }
+       },
+      "log4j_format":"%d{ISO8601} %-5p %c{2} (%F:%M(%L)) - %m%n",
+      "multiline_pattern":"^(%{TIMESTAMP_ISO8601:logtime})",
+      "message_pattern":"(?m)^%{TIMESTAMP_ISO8601:logtime}%{SPACE}%{LOGLEVEL:level}%{SPACE}%{JAVACLASS:logger_name}%{SPACE}\\(%{JAVAFILE:file}:%{JAVAMETHOD:method}\\(%{INT:line_number}\\)\\)%{SPACE}-%{SPACE}%{GREEDYDATA:log_message}",
+      "post_map_values":{
+        "logtime":{
+          "map_date":{
+            "target_date_pattern":"yyyy-MM-dd HH:mm:ss,SSS"
+          }
+         }
+       }
+     }
+   ]
+ }
+    </value>
+    <value-attributes>
+      <type>content</type>
+      <show-property-name>false</show-property-name>
+    </value-attributes>
+    <on-ambari-upgrade add="true"/>
+  </property>
+</configuration>

http://git-wip-us.apache.org/repos/asf/ambari/blob/559fc2e4/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/configuration/yarn-logsearch-conf.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/configuration/yarn-logsearch-conf.xml b/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/configuration/yarn-logsearch-conf.xml
new file mode 100644
index 0000000..95cf0c9
--- /dev/null
+++ b/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/configuration/yarn-logsearch-conf.xml
@@ -0,0 +1,104 @@
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
+<!--
+/**
+ * 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.
+ */
+-->
+<configuration supports_final="false" supports_adding_forbidden="true">
+  <property>
+    <name>service_name</name>
+    <display-name>Service name</display-name>
+    <description>Service name for Logsearch Portal (label)</description>
+    <value>YARN</value>
+    <on-ambari-upgrade add="true"/>
+  </property>
+  <property>
+    <name>component_mappings</name>
+    <display-name>Component mapping</display-name>
+    <description>Logsearch component logid mapping list (e.g.: COMPONENT1:logid1,logid2;COMPONENT2:logid3)</description>
+    <value>RESOURCEMANAGER:yarn_resourcemanager,yarn_historyserver,yarn_jobsummary;NODEMANAGER:yarn_nodemanager;APP_TIMELINE_SERVER:yarn_timelineserver</value>
+    <on-ambari-upgrade add="true"/>
+  </property>
+  <property>
+    <name>content</name>
+    <display-name>Logfeeder Config</display-name>
+    <description>Metadata jinja template for Logfeeder which contains grok patterns for reading service specific logs.</description>
+    <value>
+{
+  "input":[
+    {
+      "type":"yarn_nodemanager",
+      "rowtype":"service",
+      "path":"{{default('/configurations/yarn-env/yarn_log_dir_prefix', '/var/log/hadoop')}}/{{default('configurations/yarn-env/yarn_user', 'yarn')}}/yarn-{{default('configurations/yarn-env/yarn_user', 'yarn')}}-nodemanager-*.log"
+    },
+    {
+      "type":"yarn_resourcemanager",
+      "rowtype":"service",
+      "path":"{{default('/configurations/yarn-env/yarn_log_dir_prefix', '/var/log/hadoop')}}/{{default('configurations/yarn-env/yarn_user', 'yarn')}}/yarn-{{default('configurations/yarn-env/yarn_user', 'yarn')}}-resourcemanager-*.log"
+    },
+    {
+      "type":"yarn_timelineserver",
+      "rowtype":"service",
+      "path":"{{default('/configurations/yarn-env/yarn_log_dir_prefix', '/var/log/hadoop')}}/{{default('configurations/yarn-env/yarn_user', 'yarn')}}/yarn-{{default('configurations/yarn-env/yarn_user', 'yarn')}}-timelineserver-*.log"
+    },
+    {
+      "type":"yarn_historyserver",
+      "rowtype":"service",
+      "path":"{{default('/configurations/yarn-env/yarn_log_dir_prefix', '/var/log/hadoop')}}/{{default('configurations/yarn-env/yarn_user', 'yarn')}}/yarn-{{default('configurations/yarn-env/yarn_user', 'yarn')}}-historyserver-*.log"
+    },
+    {
+      "type":"yarn_jobsummary",
+      "rowtype":"service",
+      "path":"{{default('/configurations/yarn-env/yarn_log_dir_prefix', '/var/log/hadoop')}}/{{default('configurations/yarn-env/yarn_user', 'yarn')}}/hadoop-mapreduce.jobsummary.log"
+    }
+   ],
+  "filter":[
+    {
+      "filter":"grok",
+      "conditions":{
+        "fields":{
+          "type":[
+            "yarn_historyserver",
+            "yarn_jobsummary",
+            "yarn_nodemanager",
+            "yarn_resourcemanager",
+            "yarn_timelineserver"
+          ]
+         }
+       },
+      "log4j_format":"%d{ISO8601} %-5p %c{2} (%F:%M(%L)) - %m%n",
+      "multiline_pattern":"^(%{TIMESTAMP_ISO8601:logtime})",
+      "message_pattern":"(?m)^%{TIMESTAMP_ISO8601:logtime}%{SPACE}%{LOGLEVEL:level}%{SPACE}%{JAVACLASS:logger_name}%{SPACE}\\(%{JAVAFILE:file}:%{JAVAMETHOD:method}\\(%{INT:line_number}\\)\\)%{SPACE}-%{SPACE}%{GREEDYDATA:log_message}",
+      "post_map_values":{
+        "logtime":{
+          "map_date":{
+            "target_date_pattern":"yyyy-MM-dd HH:mm:ss,SSS"
+          }
+         }
+       }
+     }
+   ]
+}
+    </value>
+    <value-attributes>
+      <type>content</type>
+      <show-property-name>false</show-property-name>
+    </value-attributes>
+    <on-ambari-upgrade add="true"/>
+  </property>
+</configuration>

http://git-wip-us.apache.org/repos/asf/ambari/blob/559fc2e4/ambari-server/src/main/resources/common-services/ZEPPELIN/0.6.0.2.5/configuration/zeppelin-logsearch-conf.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/ZEPPELIN/0.6.0.2.5/configuration/zeppelin-logsearch-conf.xml b/ambari-server/src/main/resources/common-services/ZEPPELIN/0.6.0.2.5/configuration/zeppelin-logsearch-conf.xml
new file mode 100644
index 0000000..0b8ab7a
--- /dev/null
+++ b/ambari-server/src/main/resources/common-services/ZEPPELIN/0.6.0.2.5/configuration/zeppelin-logsearch-conf.xml
@@ -0,0 +1,80 @@
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
+<!--
+/**
+ * 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.
+ */
+-->
+<configuration supports_final="false" supports_adding_forbidden="true">
+  <property>
+    <name>service_name</name>
+    <display-name>Service name</display-name>
+    <description>Service name for Logsearch Portal (label)</description>
+    <value>Zeppelin</value>
+    <on-ambari-upgrade add="true"/>
+  </property>
+  <property>
+    <name>component_mappings</name>
+    <display-name>Component mapping</display-name>
+    <description>Logsearch component logid mapping list (e.g.: COMPONENT1:logid1,logid2;COMPONENT2:logid3)</description>
+    <value>ZEPPELIN_MASTER:zeppelin</value>
+    <on-ambari-upgrade add="true"/>
+  </property>
+  <property>
+    <name>content</name>
+    <display-name>Logfeeder Config</display-name>
+    <description>Metadata jinja template for Logfeeder which contains grok patterns for reading service specific logs.</description>
+    <value>
+{
+  "input":[
+    {
+      "type":"zeppelin",
+      "rowtype":"service",
+      "path":"{{default('/configurations/zeppelin-env/zeppelin_log_dir', '/var/log/zeppelin')}}/zeppelin-zeppelin-*.log"
+    }
+   ],
+  "filter":[
+    {
+      "filter":"grok",
+      "conditions":{
+        "fields":{
+          "type":[
+            "zeppelin"
+          ]
+         }
+       },
+      "log4j_format":"",
+      "multiline_pattern":"^(%{SPACE}%{LOGLEVEL:level}%{SPACE}\\[%{TIMESTAMP_ISO8601:logtime}\\])",
+      "message_pattern":"(?m)^%{SPACE}%{LOGLEVEL:level}%{SPACE}\\[%{TIMESTAMP_ISO8601:logtime}\\]%{SPACE}\\(\\{{"{"}}%{DATA:thread_name}\\{{"}"}}%{SPACE}%{JAVAFILE:file}\\[%{JAVAMETHOD:method}\\]:%{INT:line_number}\\)%{SPACE}-%{SPACE}%{GREEDYDATA:log_message}",
+      "post_map_values":{
+        "logtime":{
+          "map_date":{
+            "target_date_pattern":"yyyy-MM-dd HH:mm:ss,SSS"
+          }
+         }
+       }
+     }
+   ]
+ }
+    </value>
+    <value-attributes>
+      <type>content</type>
+      <show-property-name>false</show-property-name>
+    </value-attributes>
+    <on-ambari-upgrade add="true"/>
+  </property>
+</configuration>

http://git-wip-us.apache.org/repos/asf/ambari/blob/559fc2e4/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5/configuration/zookeeper-logsearch-conf.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5/configuration/zookeeper-logsearch-conf.xml b/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5/configuration/zookeeper-logsearch-conf.xml
new file mode 100644
index 0000000..325af14
--- /dev/null
+++ b/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5/configuration/zookeeper-logsearch-conf.xml
@@ -0,0 +1,76 @@
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
+<!--
+/**
+ * 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.
+ */
+-->
+<configuration supports_final="false" supports_adding_forbidden="true">
+  <property>
+    <name>service_name</name>
+    <display-name>Service name</display-name>
+    <description>Service name for Logsearch Portal (label)</description>
+    <value>Zookeeper</value>
+    <on-ambari-upgrade add="true"/>
+  </property>
+  <property>
+    <name>component_mappings</name>
+    <display-name>Component mapping</display-name>
+    <description>Logsearch component logid mapping list (e.g.: COMPONENT1:logid1,logid2;COMPONENT2:logid3)</description>
+    <value>ZOOKEEPER_SERVER:zookeeper</value>
+    <on-ambari-upgrade add="true"/>
+  </property>
+  <property>
+    <name>content</name>
+    <display-name>Logfeeder Config</display-name>
+    <description>Metadata jinja template for Logfeeder which contains grok patterns for reading service specific logs.</description>
+    <value>
+{
+  "input":[
+    {
+     "type":"zookeeper",
+     "rowtype":"service",
+     "path":"{{default('/configurations/zookeeper-env/zk_log_dir', '/var/log/zookeeper')}}/zookeeper*.log"
+    }
+  ],
+  "filter":[
+   {
+      "filter":"grok",
+      "conditions":{
+        "fields":{"type":["zookeeper"]}
+      },
+     "log4j_format":"%d{ISO8601} - %-5p [%t:%C{1}@%L] - %m%n",
+     "multiline_pattern":"^(%{TIMESTAMP_ISO8601:logtime})",
+     "message_pattern":"(?m)^%{TIMESTAMP_ISO8601:logtime}%{SPACE}-%{SPACE}%{LOGLEVEL:level}%{SPACE}\\[%{DATA:thread_name}\\@%{INT:line_number}\\]%{SPACE}-%{SPACE}%{GREEDYDATA:log_message}",
+     "post_map_values": {
+       "logtime": {
+         "map_date":{
+           "target_date_pattern":"yyyy-MM-dd HH:mm:ss,SSS"
+         }
+       }
+     }
+    }
+   ]
+}
+    </value>
+    <value-attributes>
+      <type>content</type>
+      <show-property-name>false</show-property-name>
+    </value-attributes>
+    <on-ambari-upgrade add="true"/>
+  </property>
+</configuration>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/559fc2e4/ambari-server/src/test/python/stacks/2.4/LOGSEARCH/test_logfeeder.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.4/LOGSEARCH/test_logfeeder.py b/ambari-server/src/test/python/stacks/2.4/LOGSEARCH/test_logfeeder.py
index ba070fe..7a13637 100644
--- a/ambari-server/src/test/python/stacks/2.4/LOGSEARCH/test_logfeeder.py
+++ b/ambari-server/src/test/python/stacks/2.4/LOGSEARCH/test_logfeeder.py
@@ -62,7 +62,7 @@ class TestLogFeeder(RMFTestCase):
                               )
     self.assertResourceCalled('PropertiesFile', '/etc/ambari-logsearch-logfeeder/conf/logfeeder.properties',
                               properties={'logfeeder.checkpoint.folder': '/etc/ambari-logsearch-logfeeder/conf/checkpoints',
-                                          'logfeeder.config.files': 'global.config.json,output.config.json,input.config-accumulo.json,input.config-ambari.json,input.config-ams.json,input.config-atlas.json,input.config-falcon.json,input.config-flume.json,input.config-hbase.json,input.config-hdfs.json,input.config-hive.json,input.config-hst.json,input.config-infra.json,input.config-kafka.json,input.config-knox.json,input.config-logsearch.json,input.config-nifi.json,input.config-oozie.json,input.config-ranger.json,input.config-spark.json,input.config-spark2.json,input.config-storm.json,input.config-yarn.json,input.config-zeppelin.json,input.config-zookeeper.json',
+                                          'logfeeder.config.files': 'global.config.json,output.config.json,input.config-ambari.json,input.config-logsearch.json,input.config-zookeeper.json',
                                           'logfeeder.metrics.collector.hosts': '',
                                           'logfeeder.solr.core.config.name': 'history',
                                           'logfeeder.solr.zk_connect_string': 'c6401.ambari.apache.org:2181/infra-solr'
@@ -80,9 +80,7 @@ class TestLogFeeder(RMFTestCase):
                               encoding='utf-8'
                               )
 
-    logfeeder_supported_services = ['accumulo', 'ambari', 'ams', 'atlas', 'falcon', 'flume', 'hbase', 'hdfs', 'hive', 'hst',
-                                    'infra', 'kafka', 'knox', 'logsearch', 'nifi', 'oozie', 'ranger', 'spark', 'spark2', 'storm',
-                                    'yarn', 'zeppelin', 'zookeeper']
+    logfeeder_supported_services = ['ambari','logsearch']
 
     logfeeder_config_file_names = ['global.config.json', 'output.config.json'] + \
                                   ['input.config-%s.json' % (tag) for tag in logfeeder_supported_services]
@@ -91,6 +89,9 @@ class TestLogFeeder(RMFTestCase):
       self.assertResourceCalled('File', '/etc/ambari-logsearch-logfeeder/conf/' + file_name,
                                 content=Template(file_name + ".j2")
                                 )
+    self.assertResourceCalled('File', '/etc/ambari-logsearch-logfeeder/conf/input.config-zookeeper.json',
+                              content=InlineTemplate("pattern content")
+                              )
 
   def test_configure_default(self):
     self.executeScript(self.COMMON_SERVICES_PACKAGE_DIR + "/scripts/logfeeder.py",

http://git-wip-us.apache.org/repos/asf/ambari/blob/559fc2e4/ambari-server/src/test/python/stacks/2.4/LOGSEARCH/test_logsearch.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.4/LOGSEARCH/test_logsearch.py b/ambari-server/src/test/python/stacks/2.4/LOGSEARCH/test_logsearch.py
index 8c0ed16..6b4fab8 100644
--- a/ambari-server/src/test/python/stacks/2.4/LOGSEARCH/test_logsearch.py
+++ b/ambari-server/src/test/python/stacks/2.4/LOGSEARCH/test_logsearch.py
@@ -173,7 +173,6 @@ class TestLogSearch(RMFTestCase):
                        stack_version = self.STACK_VERSION,
                        target = RMFTestCase.TARGET_COMMON_SERVICES
     )
-
     self.configureResourcesCalled()
     self.assertNoMoreResources()
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/559fc2e4/ambari-server/src/test/python/stacks/2.4/configs/default.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.4/configs/default.json b/ambari-server/src/test/python/stacks/2.4/configs/default.json
index a2c4791..c3eba53 100644
--- a/ambari-server/src/test/python/stacks/2.4/configs/default.json
+++ b/ambari-server/src/test/python/stacks/2.4/configs/default.json
@@ -229,6 +229,11 @@
       "zoo.cfg": {
         "clientPort": "2181"
       },
+      "zookeeper-logsearch-conf" : {
+        "service_name": "Zookeeper",
+        "component_mappings" : "ZOOKEEPER_SERVER:zookeeper",
+        "content" : "pattern content"
+      },
       "logsearch-admin-json" : {
         "logsearch_admin_username" : "admin",
         "logsearch_admin_password" : "admin",
@@ -314,9 +319,6 @@
       },
       "logfeeder-log4j": {
         "content": "&lt;?xml version=\"1.0\" encoding=\"UTF-8\" ?&gt;\n&lt;!--\n  Licensed to the Apache Software Foundation (ASF) under one or more\n  contributor license agreements.  See the NOTICE file distributed with\n  this work for additional information regarding copyright ownership.\n  The ASF licenses this file to You under the Apache License, Version 2.0\n  (the \"License\"); you may not use this file except in compliance with\n  the License.  You may obtain a copy of the License at\n\n      http://www.apache.org/licenses/LICENSE-2.0\n\n  Unless required by applicable law or agreed to in writing, software\n  distributed under the License is distributed on an \"AS IS\" BASIS,\n  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  See the License for the specific language governing permissions and\n  limitations under the License.\n--&gt;\n&lt;!DOCTYPE log4j:configuration SYSTEM \"log4j.dtd\"&gt;\n&lt;log4j:configuration xmlns:log4j=\"http://jakarta.
 apache.org/log4j/\"&gt;\n  &lt;appender name=\"console\" class=\"org.apache.log4j.ConsoleAppender\"&gt;\n    &lt;param name=\"Target\" value=\"System.out\" /&gt;\n    &lt;layout class=\"org.apache.log4j.PatternLayout\"&gt;\n      &lt;param name=\"ConversionPattern\" value=\"%d [%t] %-5p %C{6} (%F:%L) - %m%n\" /&gt;\n    &lt;/layout&gt;\n  &lt;/appender&gt;\n\n  &lt;appender name=\"rolling_file\" class=\"org.apache.log4j.RollingFileAppender\"&gt; \n    &lt;param name=\"file\" value=\"{{logfeeder_log_dir}}/logfeeder.log\" /&gt;\n    &lt;param name=\"append\" value=\"true\" /&gt; \n    &lt;param name=\"maxFileSize\" value=\"10MB\" /&gt; \n    &lt;param name=\"maxBackupIndex\" value=\"10\" /&gt; \n    &lt;layout class=\"org.apache.log4j.PatternLayout\"&gt; \n      &lt;param name=\"ConversionPattern\" value=\"%d [%t] %-5p %C{6} (%F:%L) - %m%n\"/&gt; \n    &lt;/layout&gt; \n  &lt;/appender&gt; \n\n  &lt;category name=\"org.apache.ambari.logfeeder\" additivity=\"false\"&gt;\n    &lt;priori
 ty value=\"info\" /&gt;\n    &lt;appender-ref ref=\"rolling_file\" /&gt;\n  &lt;/category&gt;\n\n  &lt;root&gt;\n    &lt;priority value=\"warn\" /&gt;\n    &lt;appender-ref ref=\"rolling_file\" /&gt;\n  &lt;/root&gt;\n&lt;/log4j:configuration&gt;"
-      },
-      "logfeeder-input-configs": {
-        "content": "{\n  \"global\":{\n    \"add_fields\":{\n      \"cluster\":\"{{cluster_name}}\"\n    },\n    \"source\":\"file\",\n    \"tail\":\"true\",\n    \"gen_event_md5\":\"true\",\n    \"start_position\":\"beginning\"\n  },\n  \"input\":[\n    {\n      \"type\":\"accumulo_gc\",\n      \"rowtype\":\"service\",\n      \"path\":\"{{accumulo_log_dir}}/gc_*.log\"\n    },\n    {\n      \"type\":\"accumulo_master\",\n      \"rowtype\":\"service\",\n      \"path\":\"{{accumulo_log_dir}}/master_*.log\"\n    },\n    {\n      \"type\":\"accumulo_monitor\",\n      \"rowtype\":\"service\",\n      \"path\":\"{{accumulo_log_dir}}/monitor_*.log\"\n    },\n    {\n      \"type\":\"accumulo_tracer\",\n      \"rowtype\":\"service\",\n      \"path\":\"{{accumulo_log_dir}}/tracer_*.log\"\n    },\n    {\n      \"type\":\"accumulo_tserver\",\n      \"rowtype\":\"service\",\n      \"path\":\"{{accumulo_log_dir}}/tserver_*.log\"\n    },\n    {\n      \"type\":\"atlas_app\",\n      \"rowtype\":\"se
 rvice\",\n      \"path\":\"{{atlas_log_dir}}/application.log\"\n    },\n    {\n      \"type\":\"ambari_agent\",\n      \"rowtype\":\"service\",\n      \"path\":\"{{ambari_agent_log_dir}}/ambari-agent.log\"\n    },\n    {\n      \"type\":\"ambari_server\",\n      \"rowtype\":\"service\",\n      \"path\":\"{{ambari_server_log_dir}}/ambari-server.log\"\n    },\n    {\n      \"type\":\"ams_hbase_master\",\n      \"rowtype\":\"service\",\n      \"path\":\"{{metrics_collector_log_dir}}/hbase-ams-master-*.log\"\n    },\n    {\n      \"type\":\"ams_hbase_regionserver\",\n      \"rowtype\":\"service\",\n      \"path\":\"{{metrics_collector_log_dir}}/hbase-ams-regionserver-*.log\"\n    },\n    {\n      \"type\":\"ams_collector\",\n      \"rowtype\":\"service\",\n      \"path\":\"{{metrics_collector_log_dir}}/ambari-metrics-collector.log\"\n    },\n    {\n      \"type\":\"falcon_app\",\n      \"rowtype\":\"service\",\n      \"path\":\"{{falcon_log_dir}}/falcon.application.log\"\n    },\n    {\
 n      \"type\":\"hbase_master\",\n      \"rowtype\":\"service\",\n      \"path\":\"{{hbase_log_dir}}/hbase-hbase-master-*.log\"\n    },\n    {\n      \"type\":\"hbase_regionserver\",\n      \"rowtype\":\"service\",\n      \"path\":\"{{hbase_log_dir}}/hbase-hbase-regionserver-*.log\"\n    },\n    {\n      \"type\":\"hdfs_datanode\",\n      \"rowtype\":\"service\",\n      \"path\":\"{{hdfs_log_dir_prefix}}/hdfs/hadoop-hdfs-datanode-*.log\"\n    },\n    {\n      \"type\":\"hdfs_namenode\",\n      \"rowtype\":\"service\",\n      \"path\":\"{{hdfs_log_dir_prefix}}/hdfs/hadoop-hdfs-namenode-*.log\"\n    },\n    {\n      \"type\":\"hdfs_journalnode\",\n      \"rowtype\":\"service\",\n      \"path\":\"{{hdfs_log_dir_prefix}}/hdfs/hadoop-hdfs-journalnode-*.log\"\n    },\n    {\n      \"type\":\"hdfs_secondarynamenode\",\n      \"rowtype\":\"service\",\n      \"path\":\"{{hdfs_log_dir_prefix}}/hdfs/hadoop-hdfs-secondarynamenode-*.log\"\n    },\n    {\n      \"type\":\"hdfs_zkfc\",\n      \"r
 owtype\":\"service\",\n      \"path\":\"{{hdfs_log_dir_prefix}}/hdfs/hadoop-hdfs-zkfc-*.log\"\n    },\n    {\n      \"type\":\"hive_hiveserver2\",\n      \"rowtype\":\"service\",\n      \"path\":\"{{hive_log_dir}}/hiveserver2.log\"\n    },\n    {\n      \"type\":\"hive_metastore\",\n      \"rowtype\":\"service\",\n      \"path\":\"{{hive_log_dir}}/hivemetastore.log\"\n    },\n    {\n      \"type\":\"kafka_controller\",\n      \"rowtype\":\"service\",\n      \"path\":\"{{kafka_log_dir}}/controller.log\"\n    },\n    {\n      \"type\":\"kafka_request\",\n      \"rowtype\":\"service\",\n      \"path\":\"{{kafka_log_dir}}/kafka-request.log\"\n    },\n    {\n      \"type\":\"kafka_logcleaner\",\n      \"rowtype\":\"service\",\n      \"path\":\"{{kafka_log_dir}}/log-cleaner.log\"\n    },\n    {\n      \"type\":\"kafka_server\",\n      \"rowtype\":\"service\",\n      \"path\":\"{{kafka_log_dir}}/server.log\"\n    },\n    {\n      \"type\":\"kafka_statechange\",\n      \"rowtype\":\"service
 \",\n      \"path\":\"{{kafka_log_dir}}/state-change.log\"\n    },\n    {\n      \"type\":\"knox_gateway\",\n      \"rowtype\":\"service\",\n      \"path\":\"{{knox_log_dir}}/gateway.log\"\n    },\n    {\n      \"type\":\"knox_cli\",\n      \"rowtype\":\"service\",\n      \"path\":\"{{knox_log_dir}}/knoxcli.log\"\n    },\n    {\n      \"type\":\"knox_ldap\",\n      \"rowtype\":\"service\",\n      \"path\":\"{{knox_log_dir}}/ldap.log\"\n    },\n    {\n      \"type\":\"mapred_historyserver\",\n      \"rowtype\":\"service\",\n      \"path\":\"{{mapred_log_dir_prefix}}/mapred/mapred-mapred-historyserver*.log\"\n    },\n    {\n      \"type\":\"logsearch_app\",\n      \"rowtype\":\"service\",\n      \"path\":\"{{logsearch_log_dir}}/logsearch.log\"\n    },\n    {\n      \"type\":\"logsearch_feeder\",\n      \"rowtype\":\"service\",\n      \"path\":\"{{logfeeder_log_dir}}/logfeeder.log\"\n    },\n    {\n      \"type\":\"logsearch_perf\",\n      \"rowtype\":\"service\",\n      \"path\":\"{{l
 ogsearch_log_dir}}/logsearch-performance.log\"\n    },\n    {\n      \"type\":\"ranger_admin\",\n      \"rowtype\":\"service\",\n      \"path\":\"{{ranger_admin_log_dir}}/xa_portal.log\"\n    },\n    {\n      \"type\":\"ranger_dbpatch\",\n      \"is_enabled\":\"true\",\n      \"path\":\"{{ranger_admin_log_dir}}/ranger_db_patch.log\"\n    },\n    {\n      \"type\":\"ranger_kms\",\n      \"rowtype\":\"service\",\n      \"path\":\"{{ranger_kms_log_dir}}/kms.log\"\n    },\n    {\n      \"type\":\"ranger_usersync\",\n      \"rowtype\":\"service\",\n      \"path\":\"{{ranger_usersync_log_dir}}/usersync.log\"\n    },\n    {\n      \"type\":\"oozie_app\",\n      \"rowtype\":\"service\",\n      \"path\":\"{{oozie_log_dir}}/oozie.log\"\n    },\n    {\n      \"type\":\"yarn_nodemanager\",\n      \"rowtype\":\"service\",\n      \"path\":\"{{yarn_log_dir_prefix}}/yarn/yarn-yarn-nodemanager-*.log\"\n    },\n    {\n      \"type\":\"yarn_resourcemanager\",\n      \"rowtype\":\"service\",\n      \"p
 ath\":\"{{yarn_log_dir_prefix}}/yarn/yarn-yarn-resourcemanager-*.log\"\n    },\n    {\n      \"type\":\"yarn_timelineserver\",\n      \"rowtype\":\"service\",\n      \"path\":\"{{yarn_log_dir_prefix}}/yarn/yarn-yarn-timelineserver-*.log\"\n    },\n    {\n      \"type\":\"yarn_historyserver\",\n      \"rowtype\":\"service\",\n      \"path\":\"{{yarn_log_dir_prefix}}/yarn/yarn-yarn-historyserver-*.log\"\n    },\n    {\n      \"type\":\"yarn_jobsummary\",\n      \"rowtype\":\"service\",\n      \"path\":\"{{yarn_log_dir_prefix}}/yarn/hadoop-mapreduce.jobsummary.log\"\n    },\n    {\n      \"type\":\"storm_drpc\",\n      \"rowtype\":\"service\",\n      \"path\":\"{{storm_log_dir}}/drpc.log\"\n    },\n    {\n      \"type\":\"storm_logviewer\",\n      \"rowtype\":\"service\",\n      \"path\":\"{{storm_log_dir}}/logviewer.log\"\n    },\n    {\n      \"type\":\"storm_nimbus\",\n      \"rowtype\":\"service\",\n      \"path\":\"{{storm_log_dir}}/nimbus.log\"\n    },\n    {\n      \"type\":\"st
 orm_supervisor\",\n      \"rowtype\":\"service\",\n      \"path\":\"{{storm_log_dir}}/supervisor.log\"\n    },\n    {\n      \"type\":\"storm_ui\",\n      \"rowtype\":\"service\",\n      \"path\":\"{{storm_log_dir}}/ui.log\"\n    },\n    {\n      \"type\":\"storm_worker\",\n      \"rowtype\":\"service\",\n      \"path\":\"{{storm_log_dir}}/*worker*.log\"\n    },\n    {\n      \"type\":\"zookeeper\",\n      \"rowtype\":\"service\",\n      \"path\":\"{{zk_log_dir}}/zookeeper/zookeeper*.out\"\n    },\n    {\n      \"type\":\"hdfs_audit\",\n      \"rowtype\":\"audit\",\n      \"is_enabled\":\"true\",\n      \"add_fields\":{\n        \"logType\":\"HDFSAudit\",\n        \"enforcer\":\"hadoop-acl\",\n        \"repoType\":\"1\",\n        \"repo\":\"hdfs\"\n      },\n      \"path\":\"{{hdfs_log_dir_prefix}}/hdfs/hdfs-audit.log\"\n    }\n    \n  ],\n  \"filter\":[\n    {\n      \"filter\":\"grok\",\n      \"conditions\":{\n        \"fields\":{\n          \"type\":[\n            \"accumulo_mas
 ter\"\n          ]\n          \n        }\n        \n      },\n      \"log4j_format\":\"%d{ISO8601} [%-8c{2}] %-5p: %m%n\",\n      \"multiline_pattern\":\"^(%{TIMESTAMP_ISO8601:logtime})\",\n      \"message_pattern\":\"(?m)^%{TIMESTAMP_ISO8601:logtime}%{SPACE}\\[%{JAVACLASS:logger_name}\\]%{SPACE}%{LOGLEVEL:level}:%{SPACE}%{GREEDYDATA:log_message}\",\n      \"post_map_values\":{\n        \"logtime\":{\n          \"map_date\":{\n            \"date_pattern\":\"yyyy-MM-dd HH:mm:ss,SSS\"\n          }\n          \n        }\n        \n      }\n      \n    },\n    {\n      \"filter\":\"grok\",\n      \"comment\":\"This one has one extra space after LEVEL\",\n      \"conditions\":{\n        \"fields\":{\n          \"type\":[\n            \"accumulo_gc\",\n            \"accumulo_monitor\",\n            \"accumulo_tracer\",\n            \"accumulo_tserver\"\n          ]\n          \n        }\n        \n      },\n      \"log4j_format\":\"%d{ISO8601} [%-8c{2}] %-5p: %X{application} %m%n\",\n 
      \"multiline_pattern\":\"^(%{TIMESTAMP_ISO8601:logtime})\",\n      \"message_pattern\":\"(?m)^%{TIMESTAMP_ISO8601:logtime}%{SPACE}\\[%{JAVACLASS:logger_name}\\]%{SPACE}%{LOGLEVEL:level}%{SPACE}:%{SPACE}%{GREEDYDATA:log_message}\",\n      \"post_map_values\":{\n        \"logtime\":{\n          \"map_date\":{\n            \"date_pattern\":\"yyyy-MM-dd HH:mm:ss,SSS\"\n          }\n          \n        }\n        \n      }\n      \n    },\n    {\n      \"filter\":\"grok\",\n      \"conditions\":{\n        \"fields\":{\n          \"type\":[\n            \"atlas_app\",\n            \"falcon_app\"\n          ]\n          \n        }\n        \n      },\n      \"log4j_format\":\"%d %-5p - [%t:%x] ~ %m (%c{1}:%L)%n\",\n      \"multiline_pattern\":\"^(%{TIMESTAMP_ISO8601:logtime})\",\n      \"message_pattern\":\"(?m)^%{TIMESTAMP_ISO8601:logtime}%{SPACE}%{LOGLEVEL:level}%{SPACE}%{SPACE}-%{SPACE}\\[%{DATA:thread_name}\\]%{SPACE}~%{SPACE}%{GREEDYDATA:log_message}\",\n      \"post_map_values\"
 :{\n        \"logtime\":{\n          \"map_date\":{\n            \"date_pattern\":\"yyyy-MM-dd HH:mm:ss,SSS\"\n          }\n          \n        }\n        \n      }\n      \n    },\n    {\n      \"filter\":\"grok\",\n      \"conditions\":{\n        \"fields\":{\n          \"type\":[\n            \"ams_collector\"\n          ]\n          \n        }\n        \n      },\n      \"log4j_format\":\"%d{ISO8601} %p %c: %m%n\",\n      \"multiline_pattern\":\"^(%{TIMESTAMP_ISO8601:logtime})\",\n      \"message_pattern\":\"(?m)^%{TIMESTAMP_ISO8601:logtime}%{SPACE}%{LOGLEVEL:level}%{SPACE}%{JAVACLASS:logger_name}:%{SPACE}%{GREEDYDATA:log_message}\",\n      \"post_map_values\":{\n        \"logtime\":{\n          \"map_date\":{\n            \"date_pattern\":\"yyyy-MM-dd HH:mm:ss,SSS\"\n          }\n          \n        }\n        \n      }\n      \n    },\n    {\n      \"filter\":\"grok\",\n      \"conditions\":{\n        \"fields\":{\n          \"type\":[\n            \"ams_hbase_master\",\n    
         \"ams_hbase_regionserver\",\n            \"hbase_master\",\n            \"hbase_regionserver\"\n          ]\n          \n        }\n        \n      },\n      \"log4j_format\":\"%d{ISO8601} %-5p [%t] %c{2}: %m%n\",\n      \"multiline_pattern\":\"^(%{TIMESTAMP_ISO8601:logtime})\",\n      \"message_pattern\":\"(?m)^%{TIMESTAMP_ISO8601:logtime}%{SPACE}%{LOGLEVEL:level}%{SPACE}\\[%{DATA:thread_name}\\]%{SPACE}%{JAVACLASS:logger_name}:%{SPACE}%{GREEDYDATA:log_message}\",\n      \"post_map_values\":{\n        \"logtime\":{\n          \"map_date\":{\n            \"date_pattern\":\"yyyy-MM-dd HH:mm:ss,SSS\"\n          }\n          \n        }\n        \n      }\n      \n    },\n    {\n      \"filter\":\"grok\",\n      \"conditions\":{\n        \"fields\":{\n          \"type\":[\n            \"ambari_agent\"\n          ]\n          \n        }\n        \n      },\n      \"log4j_format\":\"\",\n      \"multiline_pattern\":\"^(%{LOGLEVEL:level} %{TIMESTAMP_ISO8601:logtime})\",\n      \"
 message_pattern\":\"(?m)^%{LOGLEVEL:level} %{TIMESTAMP_ISO8601:logtime} %{JAVAFILE:file}:%{INT:line_number} - %{GREEDYDATA:log_message}\",\n      \"post_map_values\":{\n        \"logtime\":{\n          \"map_date\":{\n            \"date_pattern\":\"yyyy-MM-dd HH:mm:ss,SSS\"\n          }\n          \n        },\n        \"level\":{\n          \"map_fieldvalue\":{\n            \"pre_value\":\"WARNING\",\n            \"post_value\":\"WARN\"\n          }\n          \n        }\n        \n      }\n      \n    },\n    {\n      \"filter\":\"grok\",\n      \"conditions\":{\n        \"fields\":{\n          \"type\":[\n            \"ambari_server\"\n          ]\n          \n        }\n        \n      },\n      \"log4j_format\":\"%d{DATE} %5p [%t] %c{1}:%L - %m%n\",\n      \"multiline_pattern\":\"^(%{USER_SYNC_DATE:logtime})\",\n      \"message_pattern\":\"(?m)^%{USER_SYNC_DATE:logtime}%{SPACE}%{LOGLEVEL:level}%{SPACE}\\[%{DATA:thread_name}\\]%{SPACE}%{JAVACLASS:logger_name}:%{INT:line_number}
 %{SPACE}-%{SPACE}%{GREEDYDATA:log_message}\",\n      \"post_map_values\":{\n        \"logtime\":{\n          \"map_date\":{\n            \"date_pattern\":\"dd MMM yyyy HH:mm:ss\"\n          }\n          \n        }\n        \n      }\n      \n    },\n    {\n      \"filter\":\"grok\",\n      \"conditions\":{\n        \"fields\":{\n          \"type\":[\n            \"hdfs_datanode\",\n            \"hdfs_journalnode\",\n            \"hdfs_secondarynamenode\",\n            \"hdfs_namenode\",\n            \"hdfs_zkfc\",\n            \"knox_gateway\",\n            \"knox_cli\",\n            \"knox_ldap\",\n            \"mapred_historyserver\",\n            \"yarn_historyserver\",\n            \"yarn_jobsummary\",\n            \"yarn_nodemanager\",\n            \"yarn_resourcemanager\",\n            \"yarn_timelineserver\"\n          ]\n          \n        }\n        \n      },\n      \"log4j_format\":\"%d{ISO8601} %-5p %c{2} (%F:%M(%L)) - %m%n\",\n      \"multiline_pattern\":\"^(%{TIMESTA
 MP_ISO8601:logtime})\",\n      \"message_pattern\":\"(?m)^%{TIMESTAMP_ISO8601:logtime}%{SPACE}%{LOGLEVEL:level}%{SPACE}%{JAVACLASS:logger_name}%{SPACE}\\(%{JAVAFILE:file}:%{JAVAMETHOD:method}\\(%{INT:line_number}\\)\\)%{SPACE}-%{SPACE}%{GREEDYDATA:log_message}\",\n      \"post_map_values\":{\n        \"logtime\":{\n          \"map_date\":{\n            \"date_pattern\":\"yyyy-MM-dd HH:mm:ss,SSS\"\n          }\n          \n        }\n        \n      }\n      \n    },\n    {\n      \"filter\":\"grok\",\n      \"conditions\":{\n        \"fields\":{\n          \"type\":[\n            \"hive_hiveserver2\",\n            \"hive_metastore\"\n          ]\n          \n        }\n        \n      },\n      \"log4j_format\":\"%d{ISO8601} %-5p [%t]: %c{2} (%F:%M(%L)) - %m%n\",\n      \"multiline_pattern\":\"^(%{TIMESTAMP_ISO8601:logtime})\",\n      \"message_pattern\":\"(?m)^%{TIMESTAMP_ISO8601:logtime}%{SPACE}%{LOGLEVEL:level}%{SPACE}\\[%{DATA:thread_name}\\]:%{SPACE}%{JAVACLASS:logger_name}%{SP
 ACE}\\(%{JAVAFILE:file}:%{JAVAMETHOD:method}\\(%{INT:line_number}\\)\\)%{SPACE}-%{SPACE}%{GREEDYDATA:log_message}\",\n      \"post_map_values\":{\n        \"logtime\":{\n          \"map_date\":{\n            \"date_pattern\":\"yyyy-MM-dd HH:mm:ss,SSS\"\n          }\n          \n        }\n        \n      }\n      \n    },\n    {\n      \"filter\":\"grok\",\n      \"conditions\":{\n        \"fields\":{\n          \"type\":[\n            \"kafka_controller\",\n            \"kafka_request\",\n            \"kafka_logcleaner\"\n          ]\n          \n        }\n        \n      },\n      \"log4j_format\":\"[%d] %p %m (%c)%n\",\n      \"multiline_pattern\":\"^(\\[%{TIMESTAMP_ISO8601:logtime}\\])\",\n      \"message_pattern\":\"(?m)^\\[%{TIMESTAMP_ISO8601:logtime}\\]%{SPACE}%{LOGLEVEL:level}%{SPACE}\\[%{DATA:thread_name}\\]%{SPACE}%{GREEDYDATA:log_message}\",\n      \"post_map_values\":{\n        \"logtime\":{\n          \"map_date\":{\n            \"date_pattern\":\"yyyy-MM-dd HH:mm:ss,S
 SS\"\n          }\n          \n        }\n        \n      }\n      \n    },\n    {\n      \"filter\":\"grok\",\n      \"comment\":\"Suppose to be same log4j pattern as other kafka processes, but some reason thread is not printed\",\n      \"conditions\":{\n        \"fields\":{\n          \"type\":[\n            \"kafka_server\",\n            \"kafka_statechange\"\n          ]\n          \n        }\n        \n      },\n      \"log4j_format\":\"[%d] %p %m (%c)%n\",\n      \"multiline_pattern\":\"^(\\[%{TIMESTAMP_ISO8601:logtime}\\])\",\n      \"message_pattern\":\"(?m)^\\[%{TIMESTAMP_ISO8601:logtime}\\]%{SPACE}%{LOGLEVEL:level}%{SPACE}%{GREEDYDATA:log_message}\",\n      \"post_map_values\":{\n        \"logtime\":{\n          \"map_date\":{\n            \"date_pattern\":\"yyyy-MM-dd HH:mm:ss,SSS\"\n          }\n          \n        }\n        \n      }\n      \n    },\n    {\n      \"filter\":\"grok\",\n      \"conditions\":{\n        \"fields\":{\n          \"type\":[\n            \"o
 ozie_app\"\n          ]\n          \n        }\n        \n      },\n      \"log4j_format\":\"%d{ISO8601} %5p %c{1}:%L - SERVER[${oozie.instance.id}] %m%n\",\n      \"multiline_pattern\":\"^(%{TIMESTAMP_ISO8601:logtime})\",\n      \"message_pattern\":\"(?m)^%{TIMESTAMP_ISO8601:logtime}%{SPACE}%{LOGLEVEL:level}%{SPACE}%{DATA:logger_name}:%{INT:line_number}%{SPACE}-%{SPACE}%{GREEDYDATA:log_message}\",\n      \"post_map_values\":{\n        \"logtime\":{\n          \"map_date\":{\n            \"date_pattern\":\"yyyy-MM-dd HH:mm:ss,SSS\"\n          }\n          \n        }\n        \n      }\n      \n    },\n    {\n      \"filter\":\"grok\",\n      \"conditions\":{\n        \"fields\":{\n          \"type\":[\n            \"logsearch_app\",\n            \"logsearch_feeder\",\n            \"logsearch_perf\",\n            \"ranger_admin\",\n            \"ranger_dbpatch\"\n          ]\n          \n        }\n        \n      },\n      \"log4j_format\":\"%d [%t] %-5p %C{6} (%F:%L) - %m%n\",\n  
     \"multiline_pattern\":\"^(%{TIMESTAMP_ISO8601:logtime})\",\n      \"message_pattern\":\"(?m)^%{TIMESTAMP_ISO8601:logtime}%{SPACE}\\[%{DATA:thread_name}\\]%{SPACE}%{LOGLEVEL:level}%{SPACE}%{JAVACLASS:logger_name}%{SPACE}\\(%{JAVAFILE:file}:%{INT:line_number}\\)%{SPACE}-%{SPACE}%{GREEDYDATA:log_message}\",\n      \"post_map_values\":{\n        \"logtime\":{\n          \"map_date\":{\n            \"date_pattern\":\"yyyy-MM-dd HH:mm:ss,SSS\"\n          }\n          \n        }\n        \n      }\n      \n    },\n    {\n      \"filter\":\"grok\",\n      \"conditions\":{\n        \"fields\":{\n          \"type\":[\n            \"ranger_kms\"\n          ]\n          \n        }\n        \n      },\n      \"log4j_format\":\"%d{ISO8601} %-5p %c{1} - %m%n\",\n      \"multiline_pattern\":\"^(%{TIMESTAMP_ISO8601:logtime})\",\n      \"message_pattern\":\"(?m)^%{TIMESTAMP_ISO8601:logtime}%{SPACE}%{LOGLEVEL:level}%{SPACE}%{JAVACLASS:logger_name}%{SPACE}-%{SPACE}%{GREEDYDATA:log_message}\",\n  
     \"post_map_values\":{\n        \"logtime\":{\n          \"map_date\":{\n            \"date_pattern\":\"yyyy-MM-dd HH:mm:ss,SSS\"\n          }\n          \n        }\n        \n      }\n      \n    },\n    {\n      \"filter\":\"grok\",\n      \"conditions\":{\n        \"fields\":{\n          \"type\":[\n            \"ranger_usersync\"\n          ]\n          \n        }\n        \n      },\n      \"log4j_format\":\"%d{dd MMM yyyy HH:mm:ss} %5p %c{1} [%t] - %m%n\",\n      \"multiline_pattern\":\"^(%{USER_SYNC_DATE:logtime})\",\n      \"message_pattern\":\"(?m)^%{USER_SYNC_DATE:logtime}%{SPACE}%{LOGLEVEL:level}%{SPACE}%{JAVACLASS:logger_name}%{SPACE}\\[%{DATA:thread_name}\\]%{SPACE}-%{SPACE}%{GREEDYDATA:log_message}\",\n      \"post_map_values\":{\n        \"logtime\":{\n          \"map_date\":{\n            \"date_pattern\":\"dd MMM yyyy HH:mm:ss\"\n          }\n          \n        }\n        \n      }\n      \n    },\n    {\n      \"filter\":\"grok\",\n      \"conditions\":{\n   
      \"fields\":{\n          \"type\":[\n            \"storm_drpc\",\n            \"storm_logviewer\",\n            \"storm_nimbus\",\n            \"storm_supervisor\",\n            \"storm_ui\",\n            \"storm_worker\"\n          ]\n          \n        }\n        \n      },\n      \"log4j_format\":\"\",\n      \"multiline_pattern\":\"^(%{TIMESTAMP_ISO8601:logtime})\",\n      \"message_pattern\":\"(?m)^%{TIMESTAMP_ISO8601:logtime}%{SPACE}%{JAVACLASS:logger_name}%{SPACE}\\[%{LOGLEVEL:level}\\]%{SPACE}%{SPACE}%{GREEDYDATA:log_message}\",\n      \"post_map_values\":{\n        \"logtime\":{\n          \"map_date\":{\n            \"date_pattern\":\"yyyy-MM-dd HH:mm:ss.SSS\"\n          }\n          \n        }\n        \n      }\n      \n    },\n    {\n      \"filter\":\"grok\",\n      \"conditions\":{\n        \"fields\":{\n          \"type\":[\n            \"zookeeper\"\n          ]\n          \n        }\n        \n      },\n      \"log4j_format\":\"%d{ISO8601} - %-5p [%t:%C{1}@%
 L] - %m%n\",\n      \"multiline_pattern\":\"^(%{TIMESTAMP_ISO8601:logtime})\",\n      \"message_pattern\":\"(?m)^%{TIMESTAMP_ISO8601:logtime}%{SPACE}-%{SPACE}%{LOGLEVEL:level}%{SPACE}\\[%{DATA:thread_name}\\@%{INT:line_number}\\]%{SPACE}-%{SPACE}%{GREEDYDATA:log_message}\",\n      \"post_map_values\":{\n        \"logtime\":{\n          \"map_date\":{\n            \"date_pattern\":\"yyyy-MM-dd HH:mm:ss,SSS\"\n          }\n          \n        }\n        \n      }\n      \n    },\n    {\n      \"filter\":\"grok\",\n      \"conditions\":{\n        \"fields\":{\n          \"type\":[\n            \"hdfs_audit\"\n          ]\n          \n        }\n        \n      },\n      \"log4j_format\":\"%d{ISO8601} %-5p %c{2} (%F:%M(%L)) - %m%n\",\n      \"multiline_pattern\":\"^(%{TIMESTAMP_ISO8601:evtTime})\",\n      \"message_pattern\":\"(?m)^%{TIMESTAMP_ISO8601:evtTime}%{SPACE}%{LOGLEVEL:level}%{SPACE}%{JAVACLASS:logger_name}:%{SPACE}%{GREEDYDATA:log_message}\",\n      \"post_map_values\":{\n    
     \"evtTime\":{\n          \"map_date\":{\n            \"date_pattern\":\"yyyy-MM-dd HH:mm:ss,SSS\"\n          }\n          \n        }\n        \n      }\n      \n    },\n    {\n      \"filter\":\"keyvalue\",\n      \"sort_order\":1,\n      \"conditions\":{\n        \"fields\":{\n          \"type\":[\n            \"hdfs_audit\"\n          ]\n          \n        }\n        \n      },\n      \"source_field\":\"log_message\",\n      \"value_split\":\"=\",\n      \"field_split\":\"\t\",\n      \"post_map_values\":{\n        \"src\":{\n          \"map_fieldname\":{\n            \"new_fieldname\":\"resource\"\n          }\n          \n        },\n        \"ip\":{\n          \"map_fieldname\":{\n            \"new_fieldname\":\"cliIP\"\n          }\n          \n        },\n        \"allowed\":[\n          {\n            \"map_fieldvalue\":{\n              \"pre_value\":\"true\",\n              \"post_value\":\"1\"\n            }\n            \n          },\n          {\n            \"map
 _fieldvalue\":{\n              \"pre_value\":\"false\",\n              \"post_value\":\"0\"\n            }\n            \n          },\n          {\n            \"map_fieldname\":{\n              \"new_fieldname\":\"result\"\n            }\n            \n          }\n          \n        ],\n        \"cmd\":{\n          \"map_fieldname\":{\n            \"new_fieldname\":\"action\"\n          }\n          \n        },\n        \"proto\":{\n          \"map_fieldname\":{\n            \"new_fieldname\":\"cliType\"\n          }\n          \n        },\n        \"callerContext\":{\n          \"map_fieldname\":{\n            \"new_fieldname\":\"req_caller_id\"\n          }\n          \n        }\n        \n      }\n      \n    },\n    {\n      \"filter\":\"grok\",\n      \"sort_order\":2,\n      \"source_field\":\"ugi\",\n      \"remove_source_field\":\"false\",\n      \"conditions\":{\n        \"fields\":{\n          \"type\":[\n            \"hdfs_audit\"\n          ]\n          \n        
 }\n        \n      },\n      \"message_pattern\":\"%{USERNAME:p_user}.+auth:%{USERNAME:p_authType}.+via %{USERNAME:k_user}.+auth:%{USERNAME:k_authType}|%{USERNAME:user}.+auth:%{USERNAME:authType}|%{USERNAME:x_user}\",\n      \"post_map_values\":{\n        \"user\":{\n          \"map_fieldname\":{\n            \"new_fieldname\":\"reqUser\"\n          }\n          \n        },\n        \"x_user\":{\n          \"map_fieldname\":{\n            \"new_fieldname\":\"reqUser\"\n          }\n          \n        },\n        \"p_user\":{\n          \"map_fieldname\":{\n            \"new_fieldname\":\"reqUser\"\n          }\n          \n        },\n        \"k_user\":{\n          \"map_fieldname\":{\n            \"new_fieldname\":\"proxyUsers\"\n          }\n          \n        },\n        \"p_authType\":{\n          \"map_fieldname\":{\n            \"new_fieldname\":\"authType\"\n          }\n          \n        },\n        \"k_authType\":{\n          \"map_fieldname\":{\n            \"new_fie
 ldname\":\"proxyAuthType\"\n          }\n          \n        }\n        \n      }\n      \n    }\n    \n  ],\n  \"output\":[\n    {\n      \"is_enabled\":\"{{solr_service_logs_enable}}\",\n      \"comment\":\"Output to solr for service logs\",\n      \"destination\":\"solr\",\n      \"zk_connect_string\":\"{{zookeeper_quorum}}{{solr_znode}}\",\n      \"collection\":\"{{solr_collection_service_logs}}\",\n      \"number_of_shards\": \"{{logsearch_collection_service_logs_numshards}}\",\n      \"splits_interval_mins\": \"{{logsearch_service_logs_split_interval_mins}}\",\n      \"conditions\":{\n        \"fields\":{\n          \"rowtype\":[\n            \"service\"\n          ]\n          \n        }\n        \n      }\n      \n    },\n    {\n      \"comment\":\"Output to solr for audit records\",\n      \"is_enabled\":\"{{solr_audit_logs_enable}}\",\n      \"destination\":\"solr\",\n      \"zk_connect_string\":\"{{zookeeper_quorum}}{{solr_znode}}\",\n      \"collection\":\"{{solr_collec
 tion_audit_logs}}\",\n      \"number_of_shards\": \"{{logsearch_collection_audit_logs_numshards}}\",\n      \"splits_interval_mins\": \"{{logsearch_audit_logs_split_interval_mins}}\",\n      \"conditions\":{\n        \"fields\":{\n          \"rowtype\":[\n            \"audit\"\n          ]\n          \n        }\n        \n      }\n      \n    },\n    {\n      \"is_enabled\":\"{{kafka_service_logs_enable}}\",\n      \"destination\":\"kafka\",\n      \"broker_list\":\"{{kafka_broker_list}}\",\n      \"topic\":\"{{kafka_topic_service_logs}}\",\n      \"kafka.security.protocol\":\"{{kafka_security_protocol}}\",\n      \"kafka.sasl.kerberos.service.name\":\"{{kafka_kerberos_service_name}}\",\n      \"conditions\":{\n        \"fields\":{\n          \"rowtype\":[\n            \"service\"\n          ]\n          \n        }\n        \n      }\n      \n    },\n    {\n      \"is_enabled\":\"{{kafka_audit_logs_enable}}\",\n      \"destination\":\"kafka\",\n      \"broker_list\":\"{{kafka_brok
 er_list}}\",\n      \"topic\":\"{{kafka_topic_audit_logs}}\",\n      \"kafka.security.protocol\":\"{{kafka_security_protocol}}\",\n      \"kafka.sasl.kerberos.service.name\":\"{{kafka_kerberos_service_name}}\",\n      \"conditions\":{\n        \"fields\":{\n          \"rowtype\":[\n            \"audit\"\n          ]\n          \n        }\n        \n      }\n      \n    }\n    \n  ]\n  \n}"
       }
     },
     "configuration_attributes": {


[53/58] [abbrv] ambari git commit: AMBARI-18548. Declarative Logsearch/Logfeeder Component Metadata for Stack Component (oleewere)

Posted by ol...@apache.org.
AMBARI-18548. Declarative Logsearch/Logfeeder Component Metadata for Stack Component (oleewere)

Change-Id: Ic29344f7714b89b01affade0f0d3e1c3c58942dd


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

Branch: refs/heads/branch-2.5
Commit: 559fc2e479944feb2cfca46adee7b43f686baff0
Parents: f9e6db4
Author: oleewere <ol...@gmail.com>
Authored: Thu Oct 27 14:39:09 2016 +0200
Committer: oleewere <ol...@gmail.com>
Committed: Sat Nov 5 14:46:47 2016 +0100

----------------------------------------------------------------------
 .../AbstractLogRequestFacetQueryConverter.java  |   1 +
 .../AuditComponentsRequestQueryConverter.java   |  31 +-
 .../AuditServiceLoadRequestQueryConverter.java  |   1 +
 .../BaseServiceLogRequestQueryConverter.java    |   5 -
 .../ambari/logsearch/dao/SolrDaoBase.java       |   1 +
 .../request/impl/AuditComponentRequest.java     |   2 +-
 .../main/webapp/scripts/views/common/Header.js  |   2 +-
 .../scripts/views/dashboard/MainLayoutView.js   |   8 +-
 .../scripts/views/tabs/ComparisonLayoutView.js  |   6 +-
 ...AuditComponentRequestQueryConverterTest.java |   4 +-
 ...BaseServiceLogRequestQueryConverterTest.java |   5 +-
 .../ServiceLogAnyGraphRequestConverterTest.java |   4 +-
 ...ComponentLevelRequestQueryConverterTest.java |   4 +-
 ...ComponentRequestFacetQueryConverterTest.java |   4 +-
 ...eLogLevelCountRequestQueryConverterTest.java |   4 +-
 ...ceLogTreeRequestFacetQueryConverterTest.java |   4 +-
 .../UserExportRequestQueryConverterTest.java    |   4 +-
 .../configuration/accumulo-logsearch-conf.xml   | 124 ++++
 .../configuration/infra-logsearch-conf.xml      |  80 +++
 .../0.1.0/configuration/ams-logsearch-conf.xml  | 201 +++++++
 .../configuration/atlas-logsearch-conf.xml      |  80 +++
 .../configuration/falcon-logsearch-conf.xml     |  80 +++
 .../configuration/flume-logsearch-conf.xml      |  80 +++
 .../configuration/hbase-logsearch-conf.xml      | 111 ++++
 .../configuration/hdfs-logsearch-conf.xml       | 248 ++++++++
 .../configuration/hive-logsearch-conf.xml       | 117 ++++
 .../configuration/kafka-logsearch-conf.xml      | 124 ++++
 .../configuration/knox-logsearch-conf.xml       |  93 +++
 .../configuration/logfeeder-system_log-env.xml  |  59 ++
 .../0.5.0/package/scripts/logfeeder.py          |   1 -
 .../0.5.0/package/scripts/logsearch.py          |   1 -
 .../scripts/logsearch_config_aggregator.py      |  67 +++
 .../LOGSEARCH/0.5.0/package/scripts/params.py   |  59 +-
 .../0.5.0/package/scripts/setup_logfeeder.py    |  17 +-
 .../templates/HadoopServiceConfig.json.j2       | 582 +++----------------
 .../templates/input.config-accumulo.json.j2     | 105 ----
 .../templates/input.config-ambari.json.j2       |   2 +-
 .../package/templates/input.config-ams.json.j2  | 191 ------
 .../templates/input.config-atlas.json.j2        |  55 --
 .../templates/input.config-falcon.json.j2       |  55 --
 .../templates/input.config-flume.json.j2        |  56 --
 .../templates/input.config-hbase.json.j2        |  91 ---
 .../package/templates/input.config-hdfs.json.j2 | 251 --------
 .../package/templates/input.config-hive.json.j2 |  97 ----
 .../templates/input.config-infra.json.j2        |  56 --
 .../templates/input.config-kafka.json.j2        | 105 ----
 .../package/templates/input.config-knox.json.j2 |  68 ---
 .../templates/input.config-oozie.json.j2        |  56 --
 .../templates/input.config-ranger.json.j2       | 122 ----
 .../templates/input.config-spark.json.j2        |  72 ---
 .../templates/input.config-spark2.json.j2       |  66 ---
 .../templates/input.config-storm.json.j2        |  86 ---
 .../package/templates/input.config-yarn.json.j2 |  86 ---
 .../templates/input.config-zeppelin.json.j2     |  56 --
 .../templates/input.config-zookeeper.json.j2    |  56 --
 .../LOGSEARCH/0.5.0/properties/secure_log.json  |  31 +
 .../0.5.0/properties/system_messages.json       |  31 +
 .../configuration/oozie-logsearch-conf.xml      |  80 +++
 .../configuration/ranger-logsearch-conf.xml     | 111 ++++
 .../configuration/ranger-kms-logsearch-conf.xml |  80 +++
 .../configuration/spark-logsearch-conf.xml      |  98 ++++
 .../configuration/spark2-logsearch-conf.xml     |  92 +++
 .../configuration/storm-logsearch-conf.xml      | 110 ++++
 .../mapred-logsearch-conf.xml                   |  80 +++
 .../configuration/yarn-logsearch-conf.xml       | 104 ++++
 .../configuration/zeppelin-logsearch-conf.xml   |  80 +++
 .../configuration/zookeeper-logsearch-conf.xml  |  76 +++
 .../stacks/2.4/LOGSEARCH/test_logfeeder.py      |   9 +-
 .../stacks/2.4/LOGSEARCH/test_logsearch.py      |   1 -
 .../test/python/stacks/2.4/configs/default.json |   8 +-
 70 files changed, 2597 insertions(+), 2340 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/559fc2e4/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/AbstractLogRequestFacetQueryConverter.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/AbstractLogRequestFacetQueryConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/AbstractLogRequestFacetQueryConverter.java
index 9dbab24..b377968 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/AbstractLogRequestFacetQueryConverter.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/AbstractLogRequestFacetQueryConverter.java
@@ -48,6 +48,7 @@ public abstract class AbstractLogRequestFacetQueryConverter<SOURCE extends BaseL
     FacetOptions facetOptions = new FacetOptions();
     facetOptions.setFacetMinCount(1);
     facetOptions.setFacetSort(getFacetSort());
+    facetOptions.setFacetLimit(-1);
     appendFacetOptions(facetOptions, request);
     addIncludeFieldValues(facetQuery, StringEscapeUtils.unescapeXml(request.getIncludeQuery()));
     addExcludeFieldValues(facetQuery, StringEscapeUtils.unescapeXml(request.getExcludeQuery()));

http://git-wip-us.apache.org/repos/asf/ambari/blob/559fc2e4/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/AuditComponentsRequestQueryConverter.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/AuditComponentsRequestQueryConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/AuditComponentsRequestQueryConverter.java
index d81bdbf..bf77444 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/AuditComponentsRequestQueryConverter.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/AuditComponentsRequestQueryConverter.java
@@ -18,45 +18,36 @@
  */
 package org.apache.ambari.logsearch.converter;
 
-import org.apache.ambari.logsearch.common.LogSearchConstants;
 import org.apache.ambari.logsearch.common.LogType;
 import org.apache.ambari.logsearch.model.request.impl.AuditComponentRequest;
-import org.apache.commons.lang3.StringUtils;
-import org.springframework.data.domain.Sort;
 import org.springframework.data.solr.core.query.FacetOptions;
-import org.springframework.data.solr.core.query.SimpleFacetQuery;
 
 import javax.inject.Named;
 
 import static org.apache.ambari.logsearch.solr.SolrConstants.AuditLogConstants.AUDIT_COMPONENT;
+import static org.apache.ambari.logsearch.solr.SolrConstants.AuditLogConstants.AUDIT_EVTTIME;
 
 @Named
-public class AuditComponentsRequestQueryConverter extends AbstractSearchRequestQueryConverter<AuditComponentRequest, SimpleFacetQuery> {
+public class AuditComponentsRequestQueryConverter extends AbstractLogRequestFacetQueryConverter<AuditComponentRequest> {
 
   @Override
-  public SimpleFacetQuery extendSolrQuery(AuditComponentRequest request, SimpleFacetQuery query) {
-    FacetOptions facetOptions = new FacetOptions(); // TODO: check that date filtering is needed or not
-    facetOptions.addFacetOnField(AUDIT_COMPONENT);
-    facetOptions.setFacetSort(FacetOptions.FacetSort.INDEX);
-    facetOptions.setFacetLimit(-1);
-    query.setFacetOptions(facetOptions);
-    return query;
+  public FacetOptions.FacetSort getFacetSort() {
+    return FacetOptions.FacetSort.INDEX;
   }
 
   @Override
-  public Sort sort(AuditComponentRequest request) {
-    Sort.Direction direction = StringUtils.equals(request.getSortType(), LogSearchConstants.DESCENDING_ORDER)
-      ? Sort.Direction.DESC : Sort.Direction.ASC;
-    return new Sort(new Sort.Order(direction, AUDIT_COMPONENT));
+  public String getDateTimeField() {
+    return AUDIT_EVTTIME;
   }
 
   @Override
-  public SimpleFacetQuery createQuery() {
-    return new SimpleFacetQuery();
+  public LogType getLogType() {
+    return LogType.AUDIT;
   }
 
   @Override
-  public LogType getLogType() {
-    return LogType.AUDIT;
+  public void appendFacetOptions(FacetOptions facetOptions, AuditComponentRequest request) {
+    facetOptions.addFacetOnField(AUDIT_COMPONENT);
+    facetOptions.setFacetLimit(-1);
   }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/559fc2e4/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/AuditServiceLoadRequestQueryConverter.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/AuditServiceLoadRequestQueryConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/AuditServiceLoadRequestQueryConverter.java
index fb1c763..d88ec6d 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/AuditServiceLoadRequestQueryConverter.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/AuditServiceLoadRequestQueryConverter.java
@@ -48,5 +48,6 @@ public class AuditServiceLoadRequestQueryConverter extends AbstractLogRequestFac
   @Override
   public void appendFacetOptions(FacetOptions facetOptions, AuditServiceLoadRequest request) {
     facetOptions.addFacetOnField(AUDIT_COMPONENT);
+    facetOptions.setFacetLimit(10);
   }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/559fc2e4/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/BaseServiceLogRequestQueryConverter.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/BaseServiceLogRequestQueryConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/BaseServiceLogRequestQueryConverter.java
index 8270f2d..2601f72 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/BaseServiceLogRequestQueryConverter.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/BaseServiceLogRequestQueryConverter.java
@@ -81,9 +81,4 @@ public class BaseServiceLogRequestQueryConverter extends AbstractServiceLogReque
   public LogType getLogType() {
     return LogType.SERVICE;
   }
-
-  @Override
-  public void addComponentFilters(BaseServiceLogRequest request, SimpleQuery query) {
-
-  }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/559fc2e4/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/SolrDaoBase.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/SolrDaoBase.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/SolrDaoBase.java
index 77eb51f..39b65ae 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/SolrDaoBase.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/SolrDaoBase.java
@@ -51,6 +51,7 @@ public abstract class SolrDaoBase {
 
   public QueryResponse process(SolrQuery solrQuery, String event) {
     SolrUtil.removeDoubleOrTripleEscapeFromFilters(solrQuery);
+    LOG.info("Solr query will be processed: " + solrQuery);
     if (getSolrClient() != null) {
       event = event == null ? solrQuery.get("event") : event;
       solrQuery.remove("event");

http://git-wip-us.apache.org/repos/asf/ambari/blob/559fc2e4/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/AuditComponentRequest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/AuditComponentRequest.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/AuditComponentRequest.java
index 94cb255..636c492 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/AuditComponentRequest.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/AuditComponentRequest.java
@@ -21,5 +21,5 @@ package org.apache.ambari.logsearch.model.request.impl;
 import org.apache.ambari.logsearch.common.Marker;
 
 @Marker
-public class AuditComponentRequest extends CommonSearchRequest {
+public class AuditComponentRequest extends BaseLogRequest {
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/559fc2e4/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/common/Header.js
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/common/Header.js b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/common/Header.js
index 1e469d5..deb0e28 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/common/Header.js
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/common/Header.js
@@ -168,7 +168,7 @@ define(['require',
                 require(['views/filter/CreateLogfeederFilterView'],function(CreateLogfeederFilter){
                     var view = new CreateLogfeederFilter({});
                     var options = {
-                        title: "Log Feeder Log Levels",
+                        title: "Log Feeder Log Levels Filter",
                         content: view,
                         viewType: 'Filter',
                         resizable: false,

http://git-wip-us.apache.org/repos/asf/ambari/blob/559fc2e4/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/dashboard/MainLayoutView.js
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/dashboard/MainLayoutView.js b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/dashboard/MainLayoutView.js
index aa79ead..2333c53 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/dashboard/MainLayoutView.js
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/dashboard/MainLayoutView.js
@@ -174,8 +174,8 @@ define(['require',
 			require(['views/tabs/ComparisonLayoutView'], function(ComparisonLayoutView){
 				var tabName = "";
 				_.each(view.componetList,function(object){
-					if(object.host && object.component){
-						tabName += (object.host + object.component).replace(/\./g,"_");
+					if(object.host_name && object.component_name){
+						tabName += (object.host_name + object.component_name).replace(/\./g,"_");
 					}
 				});
 				if(_.isUndefined(that[tabName])){
@@ -511,10 +511,10 @@ define(['require',
 			        var component = dataValue.component || dataValue.node;
 			        var spanLength = this.$('.compare .panel-body span.hasNode');
 			        if (spanLength.length != 0 && spanLength.length >= 1) {
-			            this.componetList.push({ 'host': host, 'component': component, id: clickedId });
+			            this.componetList.push({ 'host_name': host, 'component_name': component, id: clickedId });
 			            this.$('.compare .panel-body .hostCompList').append('<span class="hasNode" data-id="' + clickedId + '"><i class=" closeComponent fa fa-times-circle"></i>' + host.split(".")[0] + ' <i class="fa fa-angle-double-right"></i><br> ' + component + '</span>');
 			        } else {
-			            this.componetList.push({ 'host': host, 'component': component, id: clickedId });
+			            this.componetList.push({ 'host_name': host, 'component_name': component, id: clickedId });
 			            this.$('.compare .panel-body .hostCompList').html('<span class="hasNode" data-id="' + clickedId + '"><i class=" closeComponent fa fa-times-circle"></i>' + host.split(".")[0] + ' <i class="fa fa-angle-double-right"></i><br> ' + component + '</span>');
 			        }
 			    }

http://git-wip-us.apache.org/repos/asf/ambari/blob/559fc2e4/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/tabs/ComparisonLayoutView.js
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/tabs/ComparisonLayoutView.js b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/tabs/ComparisonLayoutView.js
index 526e3c1..73cca56 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/tabs/ComparisonLayoutView.js
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/tabs/ComparisonLayoutView.js
@@ -61,7 +61,7 @@ define(['require',
                     if (that.componetList) {
                         var $parent = that.ui.comparisonTab;
                         _.each(that.componetList, function(object,i) {
-                            var id = (object.host + '_' + object.component).replace(/\./g, "_");
+                            var id = (object.host_name + '_' + object.component_name).replace(/\./g, "_");
                             if(i % 2 == 0 && i > 0){
                                 var $div = $("<div class='row comparisonTab'></div>");
                                 that.ui.comparisonTab.parent().append($div);
@@ -76,8 +76,8 @@ define(['require',
                             region.show(new ComparisonView({
                                 globalVent: that.globalVent,
                                 params: _.extend({},that.params, {
-                                    'host': object.host,
-                                    'component': object.component
+                                    'host_name': object.host_name,
+                                    'component_name': object.component_name
                                 }),
                                 datePickerPosition:(((i+1) % 2 == 0)?("left"):("right"))
                             }));

http://git-wip-us.apache.org/repos/asf/ambari/blob/559fc2e4/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/AuditComponentRequestQueryConverterTest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/AuditComponentRequestQueryConverterTest.java b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/AuditComponentRequestQueryConverterTest.java
index d6ecdd5..0c6e975 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/AuditComponentRequestQueryConverterTest.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/AuditComponentRequestQueryConverterTest.java
@@ -46,7 +46,7 @@ public class AuditComponentRequestQueryConverterTest extends AbstractRequestConv
     SimpleFacetQuery facetQuery = underTest.convert(request);
     SolrQuery query = new DefaultQueryParser().doConstructSolrQuery(facetQuery);
     // THEN
-    assertEquals("?q=*%3A*&start=0&rows=25&sort=repo+asc&facet=true&facet.mincount=1&facet.limit=-1&facet.sort=index&facet.field=repo",
+    assertEquals("?q=*%3A*&rows=0&fq=evtTime%3A%5B*+TO+*%5D&facet=true&facet.mincount=1&facet.limit=-1&facet.sort=index&facet.field=repo",
       query.toQueryString());
   }
 
@@ -59,7 +59,7 @@ public class AuditComponentRequestQueryConverterTest extends AbstractRequestConv
     SolrQuery query = new DefaultQueryParser().doConstructSolrQuery(facetQuery);
     // THEN
     assertNotNull(facetQuery);
-    assertEquals("?q=*%3A*&start=0&rows=99999&sort=repo+asc&facet=true&facet.mincount=1&facet.limit=-1&facet.sort=index&facet.field=repo",
+    assertEquals("?q=*%3A*&rows=0&fq=evtTime%3A%5B*+TO+*%5D&facet=true&facet.mincount=1&facet.limit=-1&facet.sort=index&facet.field=repo",
       query.toQueryString());
   }
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/559fc2e4/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/BaseServiceLogRequestQueryConverterTest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/BaseServiceLogRequestQueryConverterTest.java b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/BaseServiceLogRequestQueryConverterTest.java
index a75037b..3775a2d 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/BaseServiceLogRequestQueryConverterTest.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/BaseServiceLogRequestQueryConverterTest.java
@@ -52,8 +52,9 @@ public class BaseServiceLogRequestQueryConverterTest extends AbstractRequestConv
     SolrQuery solrQuery = defaultQueryParser.doConstructSolrQuery(query);
     SolrUtil.removeDoubleOrTripleEscapeFromFilters(solrQuery);
     // THEN
-    assertEquals("?q=*%3A*&start=0&rows=25&fq=log_message%3A*myincludemessage*&fq=-log_message%3A*myexcludemessage*" +
-      "&fq=host%3Alogsearch.com&fq=path%3A%5C%2Fvar%5C%2Flog%5C%2Fmyfile%5C-%5C*%5C-hdfs.log&fq=type%3Acomponent&fq=level%3A%28FATAL+ERROR+WARN+UNKNOWN%29" +
+    assertEquals("?q=*%3A*&start=0&rows=25&fq=type%3A%28logsearch_app+secure_log%29&fq=-type%3A%28hst_agent+system_message%29" +
+      "&fq=log_message%3A*myincludemessage*&fq=-log_message%3A*myexcludemessage*&fq=host%3Alogsearch.com" +
+      "&fq=path%3A%5C%2Fvar%5C%2Flog%5C%2Fmyfile%5C-%5C*%5C-hdfs.log&fq=type%3Acomponent&fq=level%3A%28FATAL+ERROR+WARN+UNKNOWN%29" +
       "&fq=logtime%3A%5B2016-09-13T22%3A00%3A01.000Z+TO+2016-09-14T22%3A00%3A01.000Z%5D&sort=logtime+desc%2Cseq_num+desc",
       solrQuery.toQueryString());
   }

http://git-wip-us.apache.org/repos/asf/ambari/blob/559fc2e4/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/ServiceLogAnyGraphRequestConverterTest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/ServiceLogAnyGraphRequestConverterTest.java b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/ServiceLogAnyGraphRequestConverterTest.java
index 487ad11..63dc733 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/ServiceLogAnyGraphRequestConverterTest.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/ServiceLogAnyGraphRequestConverterTest.java
@@ -46,7 +46,7 @@ public class ServiceLogAnyGraphRequestConverterTest extends AbstractRequestConve
     // THEN
     assertEquals("?q=*%3A*&rows=0&fq=logtime%3A%5B2016-09-13T22%3A00%3A01.000Z+TO+2016-09-14T22%3A00%3A01.000Z%5D&fq=log_message%3A*myincludemessage*" +
       "&fq=-log_message%3A*myexcludemessage*&fq=type%3A%28logsearch_app+secure_log%29&fq=-type%3A%28hst_agent+system_message%29" +
-      "&facet=true&facet.mincount=1&facet.limit=10&facet.field=level", query.toQueryString());
+      "&facet=true&facet.mincount=1&facet.limit=-1&facet.field=level", query.toQueryString());
   }
 
   @Test
@@ -56,7 +56,7 @@ public class ServiceLogAnyGraphRequestConverterTest extends AbstractRequestConve
     // WHEN
     SolrQuery query = new DefaultQueryParser().doConstructSolrQuery(underTest.convert(request));
     // THEN
-    assertEquals("?q=*%3A*&rows=0&fq=logtime%3A%5B*+TO+*%5D&facet=true&facet.mincount=1&facet.limit=10&facet.field=level",
+    assertEquals("?q=*%3A*&rows=0&fq=logtime%3A%5B*+TO+*%5D&facet=true&facet.mincount=1&facet.limit=-1&facet.field=level",
       query.toQueryString());
   }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/559fc2e4/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/ServiceLogComponentLevelRequestQueryConverterTest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/ServiceLogComponentLevelRequestQueryConverterTest.java b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/ServiceLogComponentLevelRequestQueryConverterTest.java
index 47f7a6d..2a7cc16 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/ServiceLogComponentLevelRequestQueryConverterTest.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/ServiceLogComponentLevelRequestQueryConverterTest.java
@@ -47,7 +47,7 @@ public class ServiceLogComponentLevelRequestQueryConverterTest extends AbstractR
     // THEN
     assertEquals("?q=*%3A*&rows=0&fq=logtime%3A%5B2016-09-13T22%3A00%3A01.000Z+TO+2016-09-14T22%3A00%3A01.000Z%5D&fq=log_message%3A*myincludemessage*" +
       "&fq=-log_message%3A*myexcludemessage*&fq=type%3A%28logsearch_app+secure_log%29&fq=-type%3A%28hst_agent+system_message%29" +
-      "&fq=level%3A%28WARN+ERROR+FATAL%29&facet=true&facet.mincount=1&facet.limit=10&facet.sort=index&facet.pivot=type%2Clevel",
+      "&fq=level%3A%28WARN+ERROR+FATAL%29&facet=true&facet.mincount=1&facet.limit=-1&facet.sort=index&facet.pivot=type%2Clevel",
       query.toQueryString());
   }
 
@@ -60,6 +60,6 @@ public class ServiceLogComponentLevelRequestQueryConverterTest extends AbstractR
     SolrQuery query = new DefaultQueryParser().doConstructSolrQuery(underTest.convert(request));
     // THEN
     assertEquals("?q=*%3A*&rows=0&fq=logtime%3A%5B*+TO+*%5D&fq=level%3A%28WARN+ERROR+FATAL%29&facet=true" +
-      "&facet.mincount=1&facet.limit=10&facet.sort=index&facet.pivot=type%2Clevel", query.toQueryString());
+      "&facet.mincount=1&facet.limit=-1&facet.sort=index&facet.pivot=type%2Clevel", query.toQueryString());
   }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/559fc2e4/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/ServiceLogComponentRequestFacetQueryConverterTest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/ServiceLogComponentRequestFacetQueryConverterTest.java b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/ServiceLogComponentRequestFacetQueryConverterTest.java
index d40bda0..a5ea683 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/ServiceLogComponentRequestFacetQueryConverterTest.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/ServiceLogComponentRequestFacetQueryConverterTest.java
@@ -47,7 +47,7 @@ public class ServiceLogComponentRequestFacetQueryConverterTest extends AbstractR
     // THEN
     assertEquals("?q=*%3A*&rows=0&fq=logtime%3A%5B2016-09-13T22%3A00%3A01.000Z+TO+2016-09-14T22%3A00%3A01.000Z%5D" +
       "&fq=log_message%3A*myincludemessage*&fq=-log_message%3A*myexcludemessage*&fq=type%3A%28logsearch_app+secure_log%29" +
-      "&fq=-type%3A%28hst_agent+system_message%29&fq=level%3A%28WARN+ERROR+FATAL%29&facet=true&facet.mincount=1&facet.limit=10" +
+      "&fq=-type%3A%28hst_agent+system_message%29&fq=level%3A%28WARN+ERROR+FATAL%29&facet=true&facet.mincount=1&facet.limit=-1" +
       "&facet.sort=index&facet.pivot=type%2Chost%2Clevel&facet.pivot=type%2Clevel",
       query.toQueryString());
   }
@@ -61,7 +61,7 @@ public class ServiceLogComponentRequestFacetQueryConverterTest extends AbstractR
     SolrQuery query = new DefaultQueryParser().doConstructSolrQuery(underTest.convert(request));
     // THEN
     assertEquals("?q=*%3A*&rows=0&fq=logtime%3A%5B*+TO+*%5D&fq=level%3A%28WARN+ERROR+FATAL%29" +
-      "&facet=true&facet.mincount=1&facet.limit=10&facet.sort=index&facet.pivot=type%2Chost%2Clevel&facet.pivot=type%2Clevel",
+      "&facet=true&facet.mincount=1&facet.limit=-1&facet.sort=index&facet.pivot=type%2Chost%2Clevel&facet.pivot=type%2Clevel",
       query.toQueryString());
   }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/559fc2e4/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/ServiceLogLevelCountRequestQueryConverterTest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/ServiceLogLevelCountRequestQueryConverterTest.java b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/ServiceLogLevelCountRequestQueryConverterTest.java
index a4a3256..b79ff91 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/ServiceLogLevelCountRequestQueryConverterTest.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/ServiceLogLevelCountRequestQueryConverterTest.java
@@ -45,7 +45,7 @@ public class ServiceLogLevelCountRequestQueryConverterTest extends AbstractReque
     // THEN
     assertEquals("?q=*%3A*&rows=0&fq=logtime%3A%5B2016-09-13T22%3A00%3A01.000Z+TO+2016-09-14T22%3A00%3A01.000Z%5D" +
       "&fq=log_message%3A*myincludemessage*&fq=-log_message%3A*myexcludemessage*&fq=type%3A%28logsearch_app+secure_log%29" +
-      "&fq=-type%3A%28hst_agent+system_message%29&facet=true&facet.mincount=1&facet.limit=10&facet.field=level",
+      "&fq=-type%3A%28hst_agent+system_message%29&facet=true&facet.mincount=1&facet.limit=-1&facet.field=level",
       query.toQueryString());
   }
 
@@ -56,7 +56,7 @@ public class ServiceLogLevelCountRequestQueryConverterTest extends AbstractReque
     // WHEN
     SolrQuery query = new DefaultQueryParser().doConstructSolrQuery(underTest.convert(request));
     // THEN
-    assertEquals("?q=*%3A*&rows=0&fq=logtime%3A%5B*+TO+*%5D&facet=true&facet.mincount=1&facet.limit=10&facet.field=level",
+    assertEquals("?q=*%3A*&rows=0&fq=logtime%3A%5B*+TO+*%5D&facet=true&facet.mincount=1&facet.limit=-1&facet.field=level",
       query.toQueryString());
   }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/559fc2e4/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 481bfeb..634ac19 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
@@ -46,7 +46,7 @@ public class ServiceLogTreeRequestFacetQueryConverterTest extends AbstractReques
     // THEN
     assertEquals("?q=*%3A*&rows=0&fq=logtime%3A%5B2016-09-13T22%3A00%3A01.000Z+TO+2016-09-14T22%3A00%3A01.000Z%5D&fq=log_message%3A*myincludemessage*" +
       "&fq=-log_message%3A*myexcludemessage*&fq=type%3A%28logsearch_app+secure_log%29&fq=-type%3A%28hst_agent+system_message%29&fq=level%3A%28WARN+ERROR+FATAL%29" +
-      "&facet=true&facet.mincount=1&facet.limit=10&facet.sort=index&facet.pivot=host%2Ctype%2Clevel&facet.pivot=host%2Clevel",
+      "&facet=true&facet.mincount=1&facet.limit=-1&facet.sort=index&facet.pivot=host%2Ctype%2Clevel&facet.pivot=host%2Clevel",
       query.toQueryString());
   }
 
@@ -59,7 +59,7 @@ public class ServiceLogTreeRequestFacetQueryConverterTest extends AbstractReques
     SolrQuery query = new DefaultQueryParser().doConstructSolrQuery(underTest.convert(request));
     // THEN
     assertEquals("?q=*%3A*&rows=0&fq=logtime%3A%5B*+TO+*%5D&fq=level%3A%28WARN+ERROR+FATAL%29&facet=true&facet.mincount=1" +
-      "&facet.limit=10&facet.sort=index&facet.pivot=host%2Ctype%2Clevel&facet.pivot=host%2Clevel",
+      "&facet.limit=-1&facet.sort=index&facet.pivot=host%2Ctype%2Clevel&facet.pivot=host%2Clevel",
       query.toQueryString());
   }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/559fc2e4/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/UserExportRequestQueryConverterTest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/UserExportRequestQueryConverterTest.java b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/UserExportRequestQueryConverterTest.java
index 7728876..6644ca1 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/UserExportRequestQueryConverterTest.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/UserExportRequestQueryConverterTest.java
@@ -45,7 +45,7 @@ public class UserExportRequestQueryConverterTest extends AbstractRequestConverte
     // THEN
     assertEquals("?q=*%3A*&rows=0&fq=evtTime%3A%5B2016-09-13T22%3A00%3A01.000Z+TO+2016-09-14T22%3A00%3A01.000Z%5D" +
       "&fq=log_message%3A*myincludemessage*&fq=-log_message%3A*myexcludemessage*&fq=repo%3A%28logsearch_app+secure_log%29" +
-      "&fq=-repo%3A%28hst_agent+system_message%29&facet=true&facet.mincount=1&facet.limit=10&facet.pivot=reqUser%2Crepo&facet.pivot=resource%2Crepo",
+      "&fq=-repo%3A%28hst_agent+system_message%29&facet=true&facet.mincount=1&facet.limit=-1&facet.pivot=reqUser%2Crepo&facet.pivot=resource%2Crepo",
       query.toQueryString());
   }
 
@@ -56,7 +56,7 @@ public class UserExportRequestQueryConverterTest extends AbstractRequestConverte
     // WHEN
     SolrQuery query = new DefaultQueryParser().doConstructSolrQuery(underTest.convert(request));
     // THEN
-    assertEquals("?q=*%3A*&rows=0&fq=evtTime%3A%5B*+TO+*%5D&facet=true&facet.mincount=1&facet.limit=10" +
+    assertEquals("?q=*%3A*&rows=0&fq=evtTime%3A%5B*+TO+*%5D&facet=true&facet.mincount=1&facet.limit=-1" +
       "&facet.pivot=reqUser%2Crepo&facet.pivot=resource%2Crepo",
       query.toQueryString());
   }

http://git-wip-us.apache.org/repos/asf/ambari/blob/559fc2e4/ambari-server/src/main/resources/common-services/ACCUMULO/1.6.1.2.2.0/configuration/accumulo-logsearch-conf.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/ACCUMULO/1.6.1.2.2.0/configuration/accumulo-logsearch-conf.xml b/ambari-server/src/main/resources/common-services/ACCUMULO/1.6.1.2.2.0/configuration/accumulo-logsearch-conf.xml
new file mode 100644
index 0000000..ff4f695
--- /dev/null
+++ b/ambari-server/src/main/resources/common-services/ACCUMULO/1.6.1.2.2.0/configuration/accumulo-logsearch-conf.xml
@@ -0,0 +1,124 @@
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
+<!--
+/**
+ * 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.
+ */
+-->
+<configuration supports_final="false" supports_adding_forbidden="true">
+  <property>
+    <name>service_name</name>
+    <display-name>Service name</display-name>
+    <description>Service name for Logsearch Portal (label)</description>
+    <value>Accumulo</value>
+    <on-ambari-upgrade add="true"/>
+  </property>
+  <property>
+    <name>component_mappings</name>
+    <display-name>Component mapping</display-name>
+    <description>Logsearch component logid mapping list (e.g.: COMPONENT1:logid1,logid2;COMPONENT2:logid3)</description>
+    <value>ACCUMULO_MASTER:accumulo_master;ACCUMULO_MONITOR:accumulo_monitor;ACCUMULO_GC:accumulo_gc;ACCUMULO_TRACER:accumulo_tracer;ACCUMULO_TSERVER:accumulo_tserver</value>
+    <on-ambari-upgrade add="true"/>
+  </property>
+  <property>
+    <name>content</name>
+    <display-name>Logfeeder config</display-name>
+    <description>Metadata jinja template for Logfeeder which contains grok patterns for reading service specific logs.</description>
+    <value>
+{
+  "input":[
+    {
+      "type":"accumulo_gc",
+      "rowtype":"service",
+      "path":"{{default('/configurations/accumulo-env/accumulo_log_dir', '/var/log/accumulo')}}/gc_*.log"
+    },
+    {
+      "type":"accumulo_master",
+      "rowtype":"service",
+      "path":"{{default('/configurations/accumulo-env/accumulo_log_dir', '/var/log/accumulo')}}/master_*.log"
+    },
+    {
+      "type":"accumulo_monitor",
+      "rowtype":"service",
+      "path":"{{default('/configurations/accumulo-env/accumulo_log_dir', '/var/log/accumulo')}}/monitor_*.log"
+    },
+    {
+      "type":"accumulo_tracer",
+      "rowtype":"service",
+      "path":"{{default('/configurations/accumulo-env/accumulo_log_dir', '/var/log/accumulo')}}/tracer_*.log"
+    },
+    {
+      "type":"accumulo_tserver",
+      "rowtype":"service",
+      "path":"{{default('/configurations/accumulo-env/accumulo_log_dir', '/var/log/accumulo')}}/tserver_*.log"
+    }
+   ],
+  "filter":[
+    {
+      "filter":"grok",
+      "conditions":{
+        "fields":{
+          "type":[
+            "accumulo_master"
+          ]
+         }
+       },
+      "log4j_format":"%d{ISO8601} [%-8c{2}] %-5p: %m%n",
+      "multiline_pattern":"^(%{TIMESTAMP_ISO8601:logtime})",
+      "message_pattern":"(?m)^%{TIMESTAMP_ISO8601:logtime}%{SPACE}\\[%{JAVACLASS:logger_name}\\]%{SPACE}%{LOGLEVEL:level}:%{SPACE}%{GREEDYDATA:log_message}",
+      "post_map_values":{
+        "logtime":{
+          "map_date":{
+            "target_date_pattern":"yyyy-MM-dd HH:mm:ss,SSS"
+          }
+         }
+       }
+     },
+    {
+      "filter":"grok",
+      "comment":"This one has one extra space after LEVEL",
+      "conditions":{
+        "fields":{
+          "type":[
+            "accumulo_gc",
+            "accumulo_monitor",
+            "accumulo_tracer",
+            "accumulo_tserver"
+          ]
+         }
+       },
+      "log4j_format":"%d{ISO8601} [%-8c{2}] %-5p: %X{application} %m%n",
+      "multiline_pattern":"^(%{TIMESTAMP_ISO8601:logtime})",
+      "message_pattern":"(?m)^%{TIMESTAMP_ISO8601:logtime}%{SPACE}\\[%{JAVACLASS:logger_name}\\]%{SPACE}%{LOGLEVEL:level}%{SPACE}:%{SPACE}%{GREEDYDATA:log_message}",
+      "post_map_values":{
+        "logtime":{
+          "map_date":{
+            "target_date_pattern":"yyyy-MM-dd HH:mm:ss,SSS"
+          }
+        }
+       }
+     }
+   ]
+ }
+    </value>
+    <value-attributes>
+      <type>content</type>
+      <show-property-name>false</show-property-name>
+    </value-attributes>
+    <on-ambari-upgrade add="true"/>
+  </property>
+</configuration>

http://git-wip-us.apache.org/repos/asf/ambari/blob/559fc2e4/ambari-server/src/main/resources/common-services/AMBARI_INFRA/0.1.0/configuration/infra-logsearch-conf.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/AMBARI_INFRA/0.1.0/configuration/infra-logsearch-conf.xml b/ambari-server/src/main/resources/common-services/AMBARI_INFRA/0.1.0/configuration/infra-logsearch-conf.xml
new file mode 100644
index 0000000..1de8c46
--- /dev/null
+++ b/ambari-server/src/main/resources/common-services/AMBARI_INFRA/0.1.0/configuration/infra-logsearch-conf.xml
@@ -0,0 +1,80 @@
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
+<!--
+/**
+ * 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.
+ */
+-->
+<configuration supports_final="false" supports_adding_forbidden="true">
+  <property>
+    <name>service_name</name>
+    <display-name>Service name</display-name>
+    <description>Service name for Logsearch Portal (label)</description>
+    <value>Infra</value>
+    <on-ambari-upgrade add="true"/>
+  </property>
+  <property>
+    <name>component_mappings</name>
+    <display-name>Component mapping</display-name>
+    <description>Logsearch component logid mapping list (e.g.: COMPONENT1:logid1,logid2;COMPONENT2:logid3)</description>
+    <value>INFRA_SOLR:infra_solr</value>
+    <on-ambari-upgrade add="true"/>
+  </property>
+  <property>
+    <name>content</name>
+    <display-name>Logfeeder config</display-name>
+    <description>Metadata jinja template for Logfeeder which contains grok patterns for reading service specific logs.</description>
+    <value>
+{
+  "input":[
+    {
+      "type":"infra_solr",
+      "rowtype":"service",
+      "path":"{{default('/configurations/infra-solr-env/infra_solr_log_dir', '/var/log/ambari-infra-solr')}}/solr.log"
+    }
+  ],
+  "filter":[
+    {
+      "filter":"grok",
+      "conditions":{
+        "fields":{
+          "type":[
+            "infra_solr"
+          ]
+        }
+      },
+      "log4j_format":"",
+      "multiline_pattern":"^(%{TIMESTAMP_ISO8601:logtime})",
+      "message_pattern":"(?m)^%{TIMESTAMP_ISO8601:logtime}%{SPACE}\\[%{DATA:thread_name}\\]%{SPACE}%{LOGLEVEL:level}%{SPACE}%{GREEDYDATA:log_message}",
+      "post_map_values":{
+        "logtime":{
+          "map_date":{
+            "target_date_pattern":"yyyy-MM-dd HH:mm:ss,SSS"
+          }
+        }
+      }
+    }
+  ]
+}
+  </value>
+    <value-attributes>
+      <type>content</type>
+      <show-property-name>false</show-property-name>
+    </value-attributes>
+    <on-ambari-upgrade add="true"/>
+  </property>
+</configuration>

http://git-wip-us.apache.org/repos/asf/ambari/blob/559fc2e4/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/configuration/ams-logsearch-conf.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/configuration/ams-logsearch-conf.xml b/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/configuration/ams-logsearch-conf.xml
new file mode 100644
index 0000000..72d44db
--- /dev/null
+++ b/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/configuration/ams-logsearch-conf.xml
@@ -0,0 +1,201 @@
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
+<!--
+/**
+ * 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.
+ */
+-->
+<configuration supports_final="false" supports_adding_forbidden="true">
+  <property>
+    <name>service_name</name>
+    <display-name>Service name</display-name>
+    <description>Service name for Logsearch Portal (label)</description>
+    <value>AMS</value>
+    <on-ambari-upgrade add="true"/>
+  </property>
+  <property>
+    <name>component_mappings</name>
+    <display-name>Component mapping</display-name>
+    <description>Logsearch component logid mapping list (e.g.: COMPONENT1:logid1,logid2;COMPONENT2:logid3)</description>
+    <value>METRICS_COLLECTOR:ams_collector,ams_hbase_master,ams_hbase_regionserver;METRICS_MONITOR:ams_monitor;METRICS_GRAFANA:ams_grafana</value>
+    <on-ambari-upgrade add="true"/>
+  </property>
+  <property>
+    <name>content</name>
+    <display-name>Logfeeder config</display-name>
+    <description>Metadata jinja template for Logfeeder which contains grok patterns for reading service specific logs.</description>
+    <value>
+{
+  "input":[
+    {
+      "type":"ams_hbase_master",
+      "rowtype":"service",
+      "path":"{{default('/configurations/ams-env/metrics_collector_log_dir', '/var/log/ambari-metrics-collector')}}/hbase-ams-master-*.log"
+    },
+    {
+      "type":"ams_hbase_regionserver",
+      "rowtype":"service",
+      "path":"{{default('/configurations/ams-env/metrics_collector_log_dir', '/var/log/ambari-metrics-collector')}}/hbase-ams-regionserver-*.log"
+    },
+    {
+      "type":"ams_collector",
+      "rowtype":"service",
+      "path":"{{default('/configurations/ams-env/metrics_collector_log_dir', '/var/log/ambari-metrics-collector')}}/ambari-metrics-collector.log"
+    },
+    {
+      "type":"ams_monitor",
+      "rowtype":"service",
+      "path":"{{default('/configurations/ams-env/metrics_monitor_log_dir', '/var/log/ambari-metrics-monitor')}}/ambari-metrics-monitor.out"
+    },
+    {
+      "type":"ams_grafana",
+      "rowtype":"service",
+      "path":"{{default('/configurations/ams-grafana-env/metrics_grafana_log_dir', '/var/log/ambari-metrics-grafana')}}/grafana.log"
+    }
+  ],
+  "filter":[
+    {
+      "filter":"grok",
+      "conditions":{
+        "fields":{
+          "type":[
+            "ams_collector"
+          ]
+         }
+       },
+      "log4j_format":"%d{ISO8601} %p %c: %m%n",
+      "multiline_pattern":"^(%{TIMESTAMP_ISO8601:logtime})",
+      "message_pattern":"(?m)^%{TIMESTAMP_ISO8601:logtime}%{SPACE}%{LOGLEVEL:level}%{SPACE}%{JAVACLASS:logger_name}:%{SPACE}%{GREEDYDATA:log_message}",
+      "post_map_values":{
+        "logtime":{
+          "map_date":{
+            "target_date_pattern":"yyyy-MM-dd HH:mm:ss,SSS"
+          }
+         }
+       }
+     },
+    {
+      "filter":"grok",
+      "conditions":{
+        "fields":{
+          "type":[
+            "ams_hbase_master",
+            "ams_hbase_regionserver"
+          ]
+         }
+       },
+      "log4j_format":"%d{ISO8601} %-5p [%t] %c{2}: %m%n",
+      "multiline_pattern":"^(%{TIMESTAMP_ISO8601:logtime})",
+      "message_pattern":"(?m)^%{TIMESTAMP_ISO8601:logtime}%{SPACE}%{LOGLEVEL:level}%{SPACE}\\[%{DATA:thread_name}\\]%{SPACE}%{JAVACLASS:logger_name}:%{SPACE}%{GREEDYDATA:log_message}",
+      "post_map_values":{
+        "logtime":{
+          "map_date":{
+            "target_date_pattern":"yyyy-MM-dd HH:mm:ss,SSS"
+          }
+         }
+       }
+     },
+    {
+      "filter":"grok",
+      "conditions":{
+        "fields":{
+          "type":[
+            "ams_grafana"
+          ]
+         }
+       },
+      "log4j_format":"%d{ISO8601} %-5p [%t] %c{2}: %m%n",
+      "multiline_pattern":"^(%{DATESTAMP:logtime})",
+      "message_pattern":"(?m)^%{DATESTAMP:logtime}%{SPACE}\\[%{WORD:level}\\]%{SPACE}%{GREEDYDATA:log_message}",
+      "post_map_values":{
+        "logtime":{
+          "map_date":{
+            "target_date_pattern":"yyyy/MM/dd HH:mm:ss"
+          }
+         },
+        "level":[
+          {
+            "map_fieldvalue":{
+              "pre_value":"I",
+              "post_value":"INFO"
+            }
+          },
+          {
+            "map_fieldvalue":{
+              "pre_value":"W",
+              "post_value":"WARN"
+            }
+          },
+          {
+            "map_fieldvalue":{
+              "pre_value":"D",
+              "post_value":"DEBUG"
+             }
+           },
+           {
+             "map_fieldvalue":{
+               "pre_value":"E",
+               "post_value":"ERROR"
+             }
+           },
+           {
+             "map_fieldvalue":{
+               "pre_value":"F",
+               "post_value":"FATAL"
+             }
+           }
+         ]
+       }
+     },
+    {
+      "filter":"grok",
+      "conditions":{
+        "fields":{
+          "type":[
+            "ams_monitor"
+          ]
+        }
+      },
+      "log4j_format":"",
+      "multiline_pattern":"^(%{TIMESTAMP_ISO8601:logtime})",
+      "message_pattern":"(?m)^%{TIMESTAMP_ISO8601:logtime}%{SPACE}\\[%{LOGLEVEL:level}\\]%{SPACE}%{JAVAFILE:file}:%{INT:line_number}%{SPACE}-%{SPACE}%{GREEDYDATA:log_message}",
+      "post_map_values":{
+        "logtime":{
+          "map_date":{
+            "target_date_pattern":"yyyy-MM-dd HH:mm:ss,SSS"
+          }
+         }
+       },
+      "level":[
+        {
+          "map_fieldvalue":{
+            "pre_value":"WARNING",
+            "post_value":"WARN"
+          }
+        }
+      ]
+     }
+   ]
+ }
+    </value>
+    <value-attributes>
+      <type>content</type>
+      <show-property-name>false</show-property-name>
+    </value-attributes>
+    <on-ambari-upgrade add="true"/>
+  </property>
+</configuration>

http://git-wip-us.apache.org/repos/asf/ambari/blob/559fc2e4/ambari-server/src/main/resources/common-services/ATLAS/0.1.0.2.3/configuration/atlas-logsearch-conf.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/ATLAS/0.1.0.2.3/configuration/atlas-logsearch-conf.xml b/ambari-server/src/main/resources/common-services/ATLAS/0.1.0.2.3/configuration/atlas-logsearch-conf.xml
new file mode 100644
index 0000000..71a08fb
--- /dev/null
+++ b/ambari-server/src/main/resources/common-services/ATLAS/0.1.0.2.3/configuration/atlas-logsearch-conf.xml
@@ -0,0 +1,80 @@
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
+<!--
+/**
+ * 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.
+ */
+-->
+<configuration supports_final="false" supports_adding_forbidden="true">
+  <property>
+    <name>service_name</name>
+    <display-name>Service name</display-name>
+    <description>Service name for Logsearch Portal (label)</description>
+    <value>Atlas</value>
+    <on-ambari-upgrade add="true"/>
+  </property>
+  <property>
+    <name>component_mappings</name>
+    <display-name>Component mapping</display-name>
+    <description>Logsearch component logid mapping list (e.g.: COMPONENT1:logid1,logid2;COMPONENT2:logid3)</description>
+    <value>ATLAS_SERVER:atlas_app</value>
+    <on-ambari-upgrade add="true"/>
+  </property>
+  <property>
+    <name>content</name>
+    <display-name>Logfeeder Config</display-name>
+    <description>Metadata jinja template for Logfeeder which contains grok patterns for reading service specific logs.</description>
+    <value>
+{
+  "input":[
+    {
+      "type":"atlas_app",
+      "rowtype":"service",
+      "path":"{{default('/configurations/atlas-env/metadata_log_dir', '/var/log/atlas')}}/application.log"
+    }
+  ],
+  "filter":[
+    {
+      "filter":"grok",
+      "conditions":{
+        "fields":{
+          "type":[
+            "atlas_app"
+          ]
+         }
+       },
+      "log4j_format":"%d %-5p - [%t:%x] ~ %m (%c{1}:%L)%n",
+      "multiline_pattern":"^(%{TIMESTAMP_ISO8601:logtime})",
+      "message_pattern":"(?m)^%{TIMESTAMP_ISO8601:logtime}%{SPACE}%{LOGLEVEL:level}%{SPACE}%{SPACE}-%{SPACE}\\[%{DATA:thread_name}\\]%{SPACE}~%{SPACE}%{GREEDYDATA:log_message}",
+      "post_map_values":{
+        "logtime":{
+          "map_date":{
+            "target_date_pattern":"yyyy-MM-dd HH:mm:ss,SSS"
+          }
+         }
+       }
+     }
+   ]
+ }
+    </value>
+    <value-attributes>
+      <type>content</type>
+      <show-property-name>false</show-property-name>
+    </value-attributes>
+    <on-ambari-upgrade add="true"/>
+  </property>
+</configuration>

http://git-wip-us.apache.org/repos/asf/ambari/blob/559fc2e4/ambari-server/src/main/resources/common-services/FALCON/0.5.0.2.1/configuration/falcon-logsearch-conf.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/FALCON/0.5.0.2.1/configuration/falcon-logsearch-conf.xml b/ambari-server/src/main/resources/common-services/FALCON/0.5.0.2.1/configuration/falcon-logsearch-conf.xml
new file mode 100644
index 0000000..6b43ba6
--- /dev/null
+++ b/ambari-server/src/main/resources/common-services/FALCON/0.5.0.2.1/configuration/falcon-logsearch-conf.xml
@@ -0,0 +1,80 @@
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
+<!--
+/**
+ * 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.
+ */
+-->
+<configuration supports_final="false" supports_adding_forbidden="true">
+  <property>
+    <name>service_name</name>
+    <display-name>Service name</display-name>
+    <description>Service name for Logsearch Portal (label)</description>
+    <value>Falcon</value>
+    <on-ambari-upgrade add="true"/>
+  </property>
+  <property>
+    <name>component_mappings</name>
+    <display-name>Component mapping</display-name>
+    <description>Logsearch component logid mapping list (e.g.: COMPONENT1:logid1,logid2;COMPONENT2:logid3)</description>
+    <value>FALCON_SERVER:falcon_app</value>
+    <on-ambari-upgrade add="true"/>
+  </property>
+  <property>
+    <name>content</name>
+    <display-name>Logfeeder Config</display-name>
+    <description>Metadata jinja template for Logfeeder which contains grok patterns for reading service specific logs.</description>
+    <value>
+{
+  "input":[
+    {
+      "type":"falcon_app",
+      "rowtype":"service",
+      "path":"{{default('/configurations/falcon-env/falcon_log_dir', '/var/log/falcon')}}/falcon.application.log"
+    }
+  ],
+  "filter":[
+    {
+      "filter":"grok",
+      "conditions":{
+        "fields":{
+          "type":[
+            "falcon_app"
+          ]
+         }
+       },
+      "log4j_format":"%d %-5p - [%t:%x] ~ %m (%c{1}:%L)%n",
+      "multiline_pattern":"^(%{TIMESTAMP_ISO8601:logtime})",
+      "message_pattern":"(?m)^%{TIMESTAMP_ISO8601:logtime}%{SPACE}%{LOGLEVEL:level}%{SPACE}%{SPACE}-%{SPACE}\\[%{DATA:thread_name}\\]%{SPACE}~%{SPACE}%{GREEDYDATA:log_message}",
+      "post_map_values":{
+        "logtime":{
+          "map_date":{
+            "target_date_pattern":"yyyy-MM-dd HH:mm:ss,SSS"
+          }
+         }
+       }
+     }
+   ]
+ }
+    </value>
+    <value-attributes>
+      <type>content</type>
+      <show-property-name>false</show-property-name>
+    </value-attributes>
+    <on-ambari-upgrade add="true"/>
+  </property>
+</configuration>

http://git-wip-us.apache.org/repos/asf/ambari/blob/559fc2e4/ambari-server/src/main/resources/common-services/FLUME/1.4.0.2.0/configuration/flume-logsearch-conf.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/FLUME/1.4.0.2.0/configuration/flume-logsearch-conf.xml b/ambari-server/src/main/resources/common-services/FLUME/1.4.0.2.0/configuration/flume-logsearch-conf.xml
new file mode 100644
index 0000000..98e6db8
--- /dev/null
+++ b/ambari-server/src/main/resources/common-services/FLUME/1.4.0.2.0/configuration/flume-logsearch-conf.xml
@@ -0,0 +1,80 @@
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
+<!--
+/**
+ * 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.
+ */
+-->
+<configuration supports_final="false" supports_adding_forbidden="true">
+  <property>
+    <name>service_name</name>
+    <display-name>Service name</display-name>
+    <description>Service name for Logsearch Portal (label)</description>
+    <value>Flume</value>
+    <on-ambari-upgrade add="true"/>
+  </property>
+  <property>
+    <name>component_mappings</name>
+    <display-name>Component mapping</display-name>
+    <description>Logsearch component logid mapping list (e.g.: COMPONENT1:logid1,logid2;COMPONENT2:logid3)</description>
+    <value>FLUME:flume_handler</value>
+    <on-ambari-upgrade add="true"/>
+  </property>
+  <property>
+    <name>content</name>
+    <display-name>Logfeeder Config</display-name>
+    <description>Metadata jinja template for Logfeeder which contains grok patterns for reading service specific logs.</description>
+    <value>
+{
+  "input":[
+    {
+      "type":"flume_handler",
+      "rowtype":"service",
+      "path":"{{default('/configurations/flume-env/flume_log_dir', '/var/log/flume')}}/flume.log"
+    }
+   ],
+  "filter":[
+    {
+      "filter":"grok",
+      "conditions":{
+        "fields":{
+          "type":[
+            "flume_handler"
+          ]
+         }
+       },
+      "log4j_format":"",
+      "multiline_pattern":"^(%{USER_SYNC_DATE:logtime})",
+      "message_pattern":"(?m)^%{USER_SYNC_DATE:logtime}%{SPACE}%{LOGLEVEL:level}%{SPACE}\\[%{DATA:thread_name}\\]%{SPACE}\\(%{JAVACLASS:class}\\.%{JAVAMETHOD:method}:%{INT:line_number}\\)%{SPACE}-%{SPACE}%{GREEDYDATA:log_message}",
+      "post_map_values":{
+        "logtime":{
+          "map_date":{
+            "target_date_pattern":"dd MMM yyyy HH:mm:ss,SSS"
+          }
+         }
+       }
+     }
+   ]
+ }
+    </value>
+    <value-attributes>
+      <type>content</type>
+      <show-property-name>false</show-property-name>
+    </value-attributes>
+    <on-ambari-upgrade add="true"/>
+  </property>
+</configuration>

http://git-wip-us.apache.org/repos/asf/ambari/blob/559fc2e4/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/configuration/hbase-logsearch-conf.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/configuration/hbase-logsearch-conf.xml b/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/configuration/hbase-logsearch-conf.xml
new file mode 100644
index 0000000..321ea4e
--- /dev/null
+++ b/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/configuration/hbase-logsearch-conf.xml
@@ -0,0 +1,111 @@
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
+<!--
+/**
+ * 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.
+ */
+-->
+<configuration supports_final="false" supports_adding_forbidden="true">
+  <property>
+    <name>service_name</name>
+    <display-name>Service name</display-name>
+    <description>Service name for Logsearch Portal (label)</description>
+    <value>HBase</value>
+    <on-ambari-upgrade add="true"/>
+  </property>
+  <property>
+    <name>component_mappings</name>
+    <display-name>Component mapping</display-name>
+    <description>Logsearch component logid mapping list (e.g.: COMPONENT1:logid1,logid2;COMPONENT2:logid3)</description>
+    <value>HBASE_MASTER:hbase_master;HBASE_REGIONSERVER:hbase_regionserver;PHOENIX_QUERY_SERVER:hbase_phoenix_server</value>
+    <on-ambari-upgrade add="true"/>
+  </property>
+  <property>
+    <name>content</name>
+    <display-name>Logfeeder Config</display-name>
+    <description>Metadata jinja template for Logfeeder which contains grok patterns for reading service specific logs.</description>
+    <value>
+{
+  "input":[
+    {
+      "type":"hbase_master",
+      "rowtype":"service",
+      "path":"{{default('/configurations/hbase-env/hbase_log_dir', '/var/log/hbase')}}/hbase-*-master-*.log"
+    },
+    {
+      "type":"hbase_regionserver",
+      "rowtype":"service",
+      "path":"{{default('/configurations/hbase-env/hbase_log_dir', '/var/log/hbase')}}/hbase-*-regionserver-*.log"
+    },
+    {
+      "type":"hbase_phoenix_server",
+      "rowtype":"service",
+      "path":"{{default('/configurations/hbase-env/hbase_log_dir', '/var/log/hbase')}}/phoenix-*-server.log"
+    }
+   ],
+  "filter":[
+    {
+      "filter":"grok",
+      "conditions":{
+        "fields":{
+          "type":[
+            "hbase_master",
+            "hbase_regionserver"
+          ]
+         }
+       },
+      "log4j_format":"%d{ISO8601} %-5p [%t] %c{2}: %m%n",
+      "multiline_pattern":"^(%{TIMESTAMP_ISO8601:logtime})",
+      "message_pattern":"(?m)^%{TIMESTAMP_ISO8601:logtime}%{SPACE}%{LOGLEVEL:level}%{SPACE}\\[%{DATA:thread_name}\\]%{SPACE}%{JAVACLASS:logger_name}:%{SPACE}%{GREEDYDATA:log_message}",
+      "post_map_values":{
+        "logtime":{
+          "map_date":{
+            "target_date_pattern":"yyyy-MM-dd HH:mm:ss,SSS"
+          }
+         }
+       }
+     },
+    {
+      "filter":"grok",
+      "conditions":{
+        "fields":{
+          "type":[
+            "hbase_phoenix_server"
+          ]
+         }
+      },
+      "log4j_format":"%d{ISO8601} %-5p [%t] %c{2}: %m%n",
+      "multiline_pattern":"^(%{TIMESTAMP_ISO8601:logtime})",
+      "message_pattern":"(?m)^%{TIMESTAMP_ISO8601:logtime}%{SPACE}%{LOGLEVEL:level}%{SPACE}%{JAVACLASS:logger_name}:%{SPACE}%{GREEDYDATA:log_message}",
+      "post_map_values":{
+        "logtime":{
+          "map_date":{
+            "target_date_pattern":"yyyy-MM-dd HH:mm:ss,SSS"
+          }
+         }
+       }
+     }
+   ]
+ }
+    </value>
+    <value-attributes>
+      <type>content</type>
+      <show-property-name>false</show-property-name>
+    </value-attributes>
+    <on-ambari-upgrade add="true"/>
+  </property>
+</configuration>

http://git-wip-us.apache.org/repos/asf/ambari/blob/559fc2e4/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/configuration/hdfs-logsearch-conf.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/configuration/hdfs-logsearch-conf.xml b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/configuration/hdfs-logsearch-conf.xml
new file mode 100644
index 0000000..d85a028
--- /dev/null
+++ b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/configuration/hdfs-logsearch-conf.xml
@@ -0,0 +1,248 @@
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
+<!--
+/**
+ * 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.
+ */
+-->
+<configuration supports_final="false" supports_adding_forbidden="true">
+  <property>
+    <name>service_name</name>
+    <display-name>Service name</display-name>
+    <description>Service name for Logsearch Portal (label)</description>
+    <value>HDFS</value>
+    <on-ambari-upgrade add="true"/>
+  </property>
+  <property>
+    <name>component_mappings</name>
+    <display-name>Component mapping</display-name>
+    <description>Logsearch component logid mapping list (e.g.: COMPONENT1:logid1,logid2;COMPONENT2:logid3)</description>
+    <value>NAMENODE:hdfs_namenode;DATANODE:hdfs_datanode;SECONDARY_NAMENODE:hdfs_secondarynamenode;JOURNALNODE:hdfs_journalnode;ZKFC:hdfs_zkfc;NFS_GATEWAY:hdfs_nfs3</value>
+    <on-ambari-upgrade add="true"/>
+  </property>
+  <property>
+    <name>content</name>
+    <display-name>Logfeeder Config</display-name>
+    <description>Metadata jinja template for Logfeeder which contains grok patterns for reading service specific logs.</description>
+    <value>
+{
+  "input":[
+    {
+      "type":"hdfs_datanode",
+      "rowtype":"service",
+      "path":"{{default('/configurations/hadoop-env/hdfs_log_dir_prefix', '/var/log/hadoop')}}/{{default('configurations/hadoop-env/hdfs_user', 'hdfs')}}/hadoop-{{default('configurations/hadoop-env/hdfs_user', 'hdfs')}}-datanode-*.log"
+    },
+    {
+      "type":"hdfs_namenode",
+      "rowtype":"service",
+      "path":"{{default('/configurations/hadoop-env/hdfs_log_dir_prefix', '/var/log/hadoop')}}/{{default('configurations/hadoop-env/hdfs_user', 'hdfs')}}/hadoop-{{default('configurations/hadoop-env/hdfs_user', 'hdfs')}}-namenode-*.log"
+    },
+    {
+      "type":"hdfs_journalnode",
+      "rowtype":"service",
+      "path":"{{default('/configurations/hadoop-env/hdfs_log_dir_prefix', '/var/log/hadoop')}}/{{default('configurations/hadoop-env/hdfs_user', 'hdfs')}}/hadoop-{{default('configurations/hadoop-env/hdfs_user', 'hdfs')}}-journalnode-*.log"
+    },
+    {
+      "type":"hdfs_secondarynamenode",
+      "rowtype":"service",
+      "path":"{{default('/configurations/hadoop-env/hdfs_log_dir_prefix', '/var/log/hadoop')}}/{{default('configurations/hadoop-env/hdfs_user', 'hdfs')}}/hadoop-{{default('configurations/hadoop-env/hdfs_user', 'hdfs')}}-secondarynamenode-*.log"
+    },
+    {
+      "type":"hdfs_zkfc",
+      "rowtype":"service",
+      "path":"{{default('/configurations/hadoop-env/hdfs_log_dir_prefix', '/var/log/hadoop')}}/{{default('configurations/hadoop-env/hdfs_user', 'hdfs')}}/hadoop-{{default('configurations/hadoop-env/hdfs_user', 'hdfs')}}-zkfc-*.log"
+    },
+    {
+      "type":"hdfs_nfs3",
+      "rowtype":"service",
+      "path":"{{default('/configurations/hadoop-env/hdfs_log_dir_prefix', '/var/log/hadoop')}}/{{default('configurations/hadoop-env/hdfs_user', 'hdfs')}}/hadoop-{{default('configurations/hadoop-env/hdfs_user', 'hdfs')}}-nfs3-*.log"
+    },
+    {
+      "type":"hdfs_audit",
+      "rowtype":"audit",
+      "is_enabled":"true",
+      "add_fields":{
+        "logType":"HDFSAudit",
+        "enforcer":"hadoop-acl",
+        "repoType":"1",
+        "repo":"hdfs"
+      },
+      "path":"{{default('/configurations/hadoop-env/hdfs_log_dir_prefix', '/var/log/hadoop')}}/{{default('configurations/hadoop-env/hdfs_user', 'hdfs')}}/hdfs-audit.log"
+    }
+   ],
+  "filter":[
+    {
+      "filter":"grok",
+      "conditions":{
+        "fields":{
+          "type":[
+            "hdfs_datanode",
+            "hdfs_journalnode",
+            "hdfs_secondarynamenode",
+            "hdfs_namenode",
+            "hdfs_zkfc",
+            "hdfs_nfs3"
+          ]
+         }
+       },
+      "log4j_format":"%d{ISO8601} %-5p %c{2} (%F:%M(%L)) - %m%n",
+      "multiline_pattern":"^(%{TIMESTAMP_ISO8601:logtime})",
+      "message_pattern":"(?m)^%{TIMESTAMP_ISO8601:logtime}%{SPACE}%{LOGLEVEL:level}%{SPACE}%{JAVACLASS:logger_name}%{SPACE}\\(%{JAVAFILE:file}:%{JAVAMETHOD:method}\\(%{INT:line_number}\\)\\)%{SPACE}-%{SPACE}%{GREEDYDATA:log_message}",
+      "post_map_values":{
+        "logtime":{
+          "map_date":{
+            "target_date_pattern":"yyyy-MM-dd HH:mm:ss,SSS"
+          }
+        }
+       }
+     },
+    {
+      "filter":"grok",
+      "conditions":{
+        "fields":{
+          "type":[
+            "hdfs_audit"
+          ]
+         }
+       },
+      "log4j_format":"%d{ISO8601} %-5p %c{2} (%F:%M(%L)) - %m%n",
+      "multiline_pattern":"^(%{TIMESTAMP_ISO8601:evtTime})",
+      "message_pattern":"(?m)^%{TIMESTAMP_ISO8601:evtTime}%{SPACE}%{LOGLEVEL:level}%{SPACE}%{JAVACLASS:logger_name}:%{SPACE}%{GREEDYDATA:log_message}",
+      "post_map_values":{
+        "evtTime":{
+          "map_date":{
+            "target_date_pattern":"yyyy-MM-dd HH:mm:ss,SSS"
+          }
+         }
+       }
+     },
+    {
+      "filter":"keyvalue",
+      "sort_order":1,
+      "conditions":{
+        "fields":{
+          "type":[
+            "hdfs_audit"
+          ]
+         }
+       },
+      "source_field":"log_message",
+      "value_split":"=",
+      "field_split":"\t",
+      "post_map_values":{
+        "src":{
+          "map_fieldname":{
+            "new_fieldname":"resource"
+          }
+         },
+        "ip":{
+          "map_fieldname":{
+            "new_fieldname":"cliIP"
+          }
+         },
+        "allowed":[
+          {
+            "map_fieldvalue":{
+              "pre_value":"true",
+              "post_value":"1"
+            }
+           },
+          {
+            "map_fieldvalue":{
+              "pre_value":"false",
+              "post_value":"0"
+            }
+           },
+          {
+            "map_fieldname":{
+              "new_fieldname":"result"
+            }
+           }
+         ],
+        "cmd":{
+          "map_fieldname":{
+            "new_fieldname":"action"
+          }
+         },
+        "proto":{
+          "map_fieldname":{
+            "new_fieldname":"cliType"
+          }
+         },
+        "callerContext":{
+          "map_fieldname":{
+            "new_fieldname":"req_caller_id"
+          }
+         }
+       }
+     },
+    {
+      "filter":"grok",
+      "sort_order":2,
+      "source_field":"ugi",
+      "remove_source_field":"false",
+      "conditions":{
+        "fields":{
+          "type":[
+            "hdfs_audit"
+          ]
+         }
+       },
+      "message_pattern":"%{USERNAME:p_user}.+auth:%{USERNAME:p_authType}.+via %{USERNAME:k_user}.+auth:%{USERNAME:k_authType}|%{USERNAME:user}.+auth:%{USERNAME:authType}|%{USERNAME:x_user}",
+      "post_map_values":{
+        "user":{
+          "map_fieldname":{
+            "new_fieldname":"reqUser"
+          }
+         },
+        "x_user":{
+          "map_fieldname":{
+            "new_fieldname":"reqUser"
+          }
+         },
+        "p_user":{
+          "map_fieldname":{
+            "new_fieldname":"reqUser"
+          }
+         },
+        "k_user":{
+          "map_fieldname":{
+            "new_fieldname":"proxyUsers"
+          }
+         },
+        "p_authType":{
+          "map_fieldname":{
+            "new_fieldname":"authType"
+          }
+         },
+        "k_authType":{
+          "map_fieldname":{
+            "new_fieldname":"proxyAuthType"
+          }
+         }
+       }
+     }
+   ]
+ }
+    </value>
+    <value-attributes>
+      <type>content</type>
+      <show-property-name>false</show-property-name>
+    </value-attributes>
+    <on-ambari-upgrade add="true"/>
+  </property>
+</configuration>

http://git-wip-us.apache.org/repos/asf/ambari/blob/559fc2e4/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/configuration/hive-logsearch-conf.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/configuration/hive-logsearch-conf.xml b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/configuration/hive-logsearch-conf.xml
new file mode 100644
index 0000000..c1b971c
--- /dev/null
+++ b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/configuration/hive-logsearch-conf.xml
@@ -0,0 +1,117 @@
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
+<!--
+/**
+ * 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.
+ */
+-->
+<configuration supports_final="false" supports_adding_forbidden="true">
+  <property>
+    <name>service_name</name>
+    <display-name>Service name</display-name>
+    <description>Service name for Logsearch Portal (label)</description>
+    <value>Hive</value>
+    <on-ambari-upgrade add="true"/>
+  </property>
+  <property>
+    <name>component_mappings</name>
+    <display-name>Component mapping</display-name>
+    <description>Logsearch component logid mapping list (e.g.: COMPONENT1:logid1,logid2;COMPONENT2:logid3)</description>
+    <value>HIVE_METASTORE:hive_metastore;HIVE_SERVER:hive_hiveserver2;WEBHCAT_SERVER:webhcat_server</value>
+    <on-ambari-upgrade add="true"/>
+  </property>
+  <property>
+    <name>content</name>
+    <display-name>Logfeeder Config</display-name>
+    <description>Metadata jinja template for Logfeeder which contains grok patterns for reading service specific logs.</description>
+    <value>
+{
+  "input":[
+    {
+      "type":"hive_hiveserver2",
+      "rowtype":"service",
+      "path":"{{default('/configurations/hive-env/hive_log_dir', '/var/log/hive')}}/hiveserver2.log"
+    },
+    {
+      "type":"hive_metastore",
+      "rowtype":"service",
+      "path":"{{default('/configurations/hive-env/hive_log_dir', '/var/log/hive')}}/hivemetastore.log"
+    },
+    {
+      "type": "webhcat_server",
+      "rowntype":"service",
+      "path":"{{default('configurations/hive-env/hcat_log_dir', '/var/log/webhcat')}}/webhcat.log"
+    }
+  ],
+  "filter":[
+    {
+      "filter":"grok",
+      "conditions":{
+        "fields":{
+          "type":[
+            "hive_hiveserver2",
+            "hive_metastore"
+          ]
+         }
+       },
+      "log4j_format":"%d{ISO8601} %-5p [%t]: %c{2} (%F:%M(%L)) - %m%n",
+      "multiline_pattern":"^(%{TIMESTAMP_ISO8601:logtime})",
+      "message_pattern":"(?m)^%{TIMESTAMP_ISO8601:logtime}%{SPACE}%{LOGLEVEL:level}%{SPACE}\\[%{DATA:thread_name}\\]:%{SPACE}%{JAVACLASS:logger_name}%{SPACE}\\(%{JAVAFILE:file}:%{JAVAMETHOD:method}\\(%{INT:line_number}\\)\\)%{SPACE}-%{SPACE}%{GREEDYDATA:log_message}",
+      "post_map_values":{
+        "logtime":{
+          "map_date":{
+            "target_date_pattern":"yyyy-MM-dd HH:mm:ss,SSS"
+          }
+         }
+       }
+     },
+    {
+      "filter":"grok",
+      "conditions":{
+        "fields":{
+          "type":[
+            "webhcat_server"
+          ]
+         }
+       },
+      "log4j_format":" %-5p | %d{DATE} | %c | %m%n",
+      "multiline_pattern":"^(%{SPACE}%{LOGLEVEL:level}%{CUSTOM_SEPARATOR}%{CUSTOM_DATESTAMP:logtime})",
+      "message_pattern":"(?m)^%{SPACE}%{LOGLEVEL:level}%{CUSTOM_SEPARATOR}%{CUSTOM_DATESTAMP:logtime}%{CUSTOM_SEPARATOR}%{JAVACLASS:file}%{CUSTOM_SEPARATOR}%{GREEDYDATA:log_message}",
+      "post_map_values":{
+        "logtime":{
+          "map_date":{
+            "target_date_pattern":"dd MMM yyyy HH:mm:ss,SSS"
+          }
+         },
+        "level":{
+           "map_fieldvalue":{
+             "pre_value":"WARNING",
+             "post_value":"WARN"
+            }
+        }
+       }
+     }
+   ]
+ }
+    </value>
+    <value-attributes>
+      <type>content</type>
+      <show-property-name>false</show-property-name>
+    </value-attributes>
+    <on-ambari-upgrade add="true"/>
+  </property>
+</configuration>

http://git-wip-us.apache.org/repos/asf/ambari/blob/559fc2e4/ambari-server/src/main/resources/common-services/KAFKA/0.8.1/configuration/kafka-logsearch-conf.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/KAFKA/0.8.1/configuration/kafka-logsearch-conf.xml b/ambari-server/src/main/resources/common-services/KAFKA/0.8.1/configuration/kafka-logsearch-conf.xml
new file mode 100644
index 0000000..29a8b36
--- /dev/null
+++ b/ambari-server/src/main/resources/common-services/KAFKA/0.8.1/configuration/kafka-logsearch-conf.xml
@@ -0,0 +1,124 @@
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
+<!--
+/**
+ * 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.
+ */
+-->
+<configuration supports_final="false" supports_adding_forbidden="true">
+  <property>
+    <name>service_name</name>
+    <display-name>Service name</display-name>
+    <description>Service name for Logsearch Portal (label)</description>
+    <value>Kafka</value>
+    <on-ambari-upgrade add="true"/>
+  </property>
+  <property>
+    <name>component_mappings</name>
+    <display-name>Component mapping</display-name>
+    <description>Logsearch component logid mapping list (e.g.: COMPONENT1:logid1,logid2;COMPONENT2:logid3)</description>
+    <value>KAFKA_BROKER:kafka_server,kafka_request,kafka_logcleaner,kafka_controller,kafka_statechange</value>
+    <on-ambari-upgrade add="true"/>
+  </property>
+  <property>
+    <name>content</name>
+    <display-name>Logfeeder Config</display-name>
+    <description>Metadata jinja template for Logfeeder which contains grok patterns for reading service specific logs.</description>
+    <value>
+{
+  "input":[
+    {
+      "type":"kafka_controller",
+      "rowtype":"service",
+      "path":"{{default('/configurations/kafka-env/kafka_log_dir', '/var/log/kafka')}}/controller.log"
+    },
+    {
+      "type":"kafka_request",
+      "rowtype":"service",
+      "path":"{{default('/configurations/kafka-env/kafka_log_dir', '/var/log/kafka')}}/kafka-request.log"
+    },
+    {
+      "type":"kafka_logcleaner",
+      "rowtype":"service",
+      "path":"{{default('/configurations/kafka-env/kafka_log_dir', '/var/log/kafka')}}/log-cleaner.log"
+    },
+    {
+      "type":"kafka_server",
+      "rowtype":"service",
+      "path":"{{default('/configurations/kafka-env/kafka_log_dir', '/var/log/kafka')}}/server.log"
+    },
+    {
+      "type":"kafka_statechange",
+      "rowtype":"service",
+      "path":"{{kafka_log_dir}}/state-change.log"
+    }
+   ],
+  "filter":[
+    {
+      "filter":"grok",
+      "conditions":{
+        "fields":{
+          "type":[
+            "kafka_controller",
+            "kafka_request",
+            "kafka_logcleaner"
+          ]
+         }
+       },
+      "log4j_format":"[%d] %p %m (%c)%n",
+      "multiline_pattern":"^(\\[%{TIMESTAMP_ISO8601:logtime}\\])",
+      "message_pattern":"(?m)^\\[%{TIMESTAMP_ISO8601:logtime}\\]%{SPACE}%{LOGLEVEL:level}%{SPACE}\\[%{DATA:thread_name}\\]%{SPACE}%{GREEDYDATA:log_message}",
+      "post_map_values":{
+        "logtime":{
+          "map_date":{
+            "target_date_pattern":"yyyy-MM-dd HH:mm:ss,SSS"
+          }
+         }
+       }
+     },
+    {
+      "filter":"grok",
+      "comment":"Suppose to be same log4j pattern as other kafka processes, but some reason thread is not printed",
+      "conditions":{
+        "fields":{
+          "type":[
+            "kafka_server",
+            "kafka_statechange"
+          ]
+         }
+       },
+      "log4j_format":"[%d] %p %m (%c)%n",
+      "multiline_pattern":"^(\\[%{TIMESTAMP_ISO8601:logtime}\\])",
+      "message_pattern":"(?m)^\\[%{TIMESTAMP_ISO8601:logtime}\\]%{SPACE}%{LOGLEVEL:level}%{SPACE}%{GREEDYDATA:log_message}",
+      "post_map_values":{
+        "logtime":{
+          "map_date":{
+            "target_date_pattern":"yyyy-MM-dd HH:mm:ss,SSS"
+          }
+         }
+       }
+     }
+   ]
+ }
+    </value>
+    <value-attributes>
+      <type>content</type>
+      <show-property-name>false</show-property-name>
+    </value-attributes>
+    <on-ambari-upgrade add="true"/>
+  </property>
+</configuration>


[11/58] [abbrv] ambari git commit: AMBARI-18310. Refactor logsearch portal side code (oleewere)

Posted by ol...@apache.org.
http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/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 0ceb76b..8e14452 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
@@ -26,18 +26,25 @@ public class DocConstants {
     public static final String STACK_BY_D = "The graph property for stacking the plot";
     public static final String EXCLUDE_QUERY_D = "Exclude the values in query result e.g.: [{message:*timeout*}]";
     public static final String INCLUDE_QUERY_D = "Include the values in query result e.g.: [{message:*exception*}]";
-    public static final String MUST_BE_D = "Include the components, comman separated values";
-    public static final String MUST_NOT_D = "Exclude the components, comman separated values";
+    public static final String MUST_BE_D = "Include the components, comma separated values";
+    public static final String MUST_NOT_D = "Exclude the components, comma separated values";
     public static final String FROM_D = "Date range param, start date";
     public static final String TO_D = "Date range param, end date";
+    public static final String START_TIME_D = "Date range param which is suportted from browser url";
+    public static final String END_TIME_D = "Date range param which is supported from browser url";
+    public static final String START_INDEX_D = "Start index of the queried result";
+    public static final String SORT_TYPE_D = "Type of sorting (osc, desc)";
+    public static final String SORT_BY_D = "Sorting the results based on this field";
+    public static final String PAGE_D = "Number of pages for the results";
+    public static final String PAGE_SIZE_D = "Page size of the results";
     public static final String UNIT_D = "Aggregate the data with time gap as unit i.e 1MINUTE";
     public static final String QUERY_D = "not required";
     public static final String COLUMN_QUERY_D = "not required";
-    public static final String I_MESSAGE_D = "Include query which will query againt message column";
+    public static final String I_MESSAGE_D = "Include query which will query against message column";
     public static final String G_E_MESSAGE_D = "not required";
-    public static final String E_MESSAGE_D = "Exclude query which will query againt message column";
-    public static final String IS_LAST_PAGE_D = "";
-    public static final String FIELD_D = "Get top ten values for particular field";
+    public static final String E_MESSAGE_D = "Exclude query which will query against message column";
+    public static final String IS_LAST_PAGE_D = "Show last page (true/false)";
+    public static final String FIELD_D = "Get values for particular field";
     public static final String FORMAT_D = "File Export format, can be 'txt' or 'json'";
   }
 
@@ -48,7 +55,6 @@ public class DocConstants {
     public static final String GET_AUDIT_LINE_GRAPH_DATA_OD = "Get the data required for line graph";
     public static final String GET_TOP_AUDIT_USERS_OD = "Get the top audit users having maximum access";
     public static final String GET_TOP_AUDIT_RESOURCES_OD = "Get the top audit resources having maximum access";
-    public static final String GET_TOP_AUDIT_COMPONENTS_OD = "not required";
     public static final String GET_LIVE_LOGS_COUNT_OD = "not required";
     public static final String GET_REQUEST_USER_LINE_GRAPH_OD = "not required";
     public static final String GET_ANY_GRAPH_DATA_OD = "Get the data generic enough to use for graph plots";
@@ -59,11 +65,11 @@ public class DocConstants {
   public class ServiceDescriptions {
     public static final String LEVEL_D = "filter for log level";
     public static final String ADVANCED_SEARCH_D = "not required";
-    public static final String TREE_PARAMS_D = "Host hierarchy shown on UI,filtering there is supported by this param";
-    public static final String START_TIME_D = "Date range param which is suportted from browser url";
-    public static final String END_TIME_D = "Date range param which is supported from browser url";
+    public static final String BUNDLE_ID = "filter for host";
+    public static final String TREE_PARAMS_D = "Host hierarchy shown on UI, filtering there is supported by this param";
     public static final String FILE_NAME_D = "File name filter which is supported from browser url";
     public static final String HOST_NAME_D = "Host name filter which is supported from browser url";
+    public static final String DATE_RANGE_LABEL_D = "Date range label (e.g.: Today)";
     public static final String COMPONENT_NAME_D = "Component name filter which is supported from browser url";
     public static final String FIND_D = "Finding particular text on subsequent pages in case of table view with pagination";
     public static final String ID_D = "Log id value for traversing to that particular record with that log id";

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/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
index d84b7b9..bc377e5 100644
--- 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
@@ -26,14 +26,14 @@ import java.util.List;
 
 import org.apache.ambari.logsearch.common.LogSearchConstants;
 import org.apache.ambari.logsearch.common.MessageEnums;
-import org.apache.ambari.logsearch.common.SearchCriteria;
+import org.apache.ambari.logsearch.model.response.BarGraphData;
+import org.apache.ambari.logsearch.model.response.BarGraphDataListResponse;
+import org.apache.ambari.logsearch.model.response.NameValueData;
+import org.apache.ambari.logsearch.query.model.SearchCriteria;
 import org.apache.ambari.logsearch.dao.SolrDaoBase;
 import org.apache.ambari.logsearch.query.QueryGeneration;
 import org.apache.ambari.logsearch.util.RESTErrorUtil;
 import org.apache.ambari.logsearch.util.SolrUtil;
-import org.apache.ambari.logsearch.view.VBarDataList;
-import org.apache.ambari.logsearch.view.VBarGraphData;
-import org.apache.ambari.logsearch.view.VNameValue;
 import org.apache.commons.lang.StringUtils;
 import org.apache.log4j.Logger;
 import org.apache.solr.client.solrj.SolrQuery;
@@ -44,18 +44,19 @@ import org.apache.solr.client.solrj.response.QueryResponse;
 import org.apache.solr.client.solrj.response.RangeFacet;
 import org.apache.solr.common.SolrException;
 import org.apache.solr.common.util.SimpleOrderedMap;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
+import javax.inject.Inject;
+
 @Component
 public class GraphDataGenerator extends GraphDataGeneratorBase {
 
   private static final Logger logger = Logger.getLogger(GraphDataGenerator.class);
 
-  @Autowired
+  @Inject
   private QueryGeneration queryGenerator;
 
-  public VBarDataList getAnyGraphData(SearchCriteria searchCriteria, SolrDaoBase solrDaoBase, SolrQuery solrQuery) {
+  public BarGraphDataListResponse getAnyGraphData(SearchCriteria searchCriteria, SolrDaoBase solrDaoBase, SolrQuery solrQuery) {
     // X axis credentials
     String xAxisField = (String) searchCriteria.getParamValue("xAxis");
     String stackField = (String) searchCriteria.getParamValue("stackBy");
@@ -119,12 +120,12 @@ public class GraphDataGenerator extends GraphDataGeneratorBase {
   }
 
   @SuppressWarnings("unchecked")
-  private VBarDataList normalGraph(String xAxisField, String yAxisField, String from, String to, SolrDaoBase solrDaoBase,
+  private BarGraphDataListResponse normalGraph(String xAxisField, String yAxisField, String from, String to, SolrDaoBase solrDaoBase,
       String typeXAxis, String fieldTime, SolrQuery solrQuery) {
-    VBarDataList dataList = new VBarDataList();
-    Collection<VBarGraphData> vBarGraphDatas = new ArrayList<VBarGraphData>();
-    VBarGraphData vBarGraphData = new VBarGraphData();
-    Collection<VNameValue> vNameValues = new ArrayList<VNameValue>();
+    BarGraphDataListResponse dataList = new BarGraphDataListResponse();
+    Collection<BarGraphData> vBarGraphDatas = new ArrayList<BarGraphData>();
+    BarGraphData vBarGraphData = new BarGraphData();
+    Collection<NameValueData> vNameValues = new ArrayList<NameValueData>();
     SolrUtil.setMainQuery(solrQuery, null);
     queryGenerator.setSingleIncludeFilter(solrQuery, fieldTime, "[" + from + " TO " + to + "]");
     if (typeXAxis.contains("string") || typeXAxis.contains("key_lower_case") || typeXAxis.contains("text")) {
@@ -140,7 +141,7 @@ public class GraphDataGenerator extends GraphDataGeneratorBase {
               if (countValues != null) {
                 for (Count countValue : countValues) {
                   if (countValue != null) {
-                    VNameValue vNameValue = new VNameValue();
+                    NameValueData vNameValue = new NameValueData();
                     vNameValue.setName(countValue.getName());
                     vNameValue.setValue("" + countValue.getCount());
                     vNameValues.add(vNameValue);
@@ -154,12 +155,12 @@ public class GraphDataGenerator extends GraphDataGeneratorBase {
           }
         }
         if (xAxisField.equalsIgnoreCase(LogSearchConstants.SOLR_LEVEL)) {
-          Collection<VNameValue> sortedVNameValues = new ArrayList<VNameValue>();
+          Collection<NameValueData> sortedVNameValues = new ArrayList<NameValueData>();
           for (String level : LogSearchConstants.SUPPORTED_LOG_LEVEL) {
-            VNameValue value = new VNameValue();
+            NameValueData value = new NameValueData();
             value.setName(level);
             String val = "0";
-            for (VNameValue valueLevel : vNameValues) {
+            for (NameValueData valueLevel : vNameValues) {
               if (valueLevel.getName().equalsIgnoreCase(level)) {
                 val = valueLevel.getValue();
                 break;
@@ -168,9 +169,9 @@ public class GraphDataGenerator extends GraphDataGeneratorBase {
             value.setValue(val);
             sortedVNameValues.add(value);
           }
-          vBarGraphData.setDataCounts(sortedVNameValues);
+          vBarGraphData.setDataCount(sortedVNameValues);
         } else {
-          vBarGraphData.setDataCounts(vNameValues);
+          vBarGraphData.setDataCount(vNameValues);
         }
         return dataList;
       } catch (SolrException | SolrServerException | IOException e) {
@@ -188,12 +189,12 @@ public class GraphDataGenerator extends GraphDataGeneratorBase {
         if (jsonFacetResponse.toString().equals("{count=0}")) {
           return dataList;
         }
-        VNameValue value = new VNameValue();
+        NameValueData value = new NameValueData();
         String sum = (String) jsonFacetResponse.getVal(1);
         value.setName(xAxisField);
         value.setValue(sum != null ? sum.substring(0, sum.indexOf(".")) : "");
         vNameValues.add(value);
-        vBarGraphData.setDataCounts(vNameValues);
+        vBarGraphData.setDataCount(vNameValues);
         vBarGraphData.setName(xAxisField);
         vBarGraphDatas.add(vBarGraphData);
         dataList.setGraphData(vBarGraphDatas);
@@ -207,10 +208,10 @@ public class GraphDataGenerator extends GraphDataGeneratorBase {
   }
 
   @SuppressWarnings("unchecked")
-  private VBarDataList nonRangeStackGraph(String xAxisField, String yAxisField, String stackField, String from, String to,
+  private BarGraphDataListResponse nonRangeStackGraph(String xAxisField, String yAxisField, String stackField, String from, String to,
       SolrDaoBase solrDaoBase, String typeXAxis, String fieldTime, SolrQuery solrQuery) {
-    VBarDataList dataList = new VBarDataList();
-    Collection<VBarGraphData> vGraphData = new ArrayList<VBarGraphData>();
+    BarGraphDataListResponse dataList = new BarGraphDataListResponse();
+    Collection<BarGraphData> vGraphData = new ArrayList<BarGraphData>();
     String mainQuery = queryGenerator.buildInclusiveRangeFilterQuery(fieldTime, from, to);
     SolrUtil.setMainQuery(solrQuery, mainQuery);
     SolrUtil.setFacetSort(solrQuery, LogSearchConstants.FACET_INDEX);
@@ -238,24 +239,24 @@ public class GraphDataGenerator extends GraphDataGeneratorBase {
       }
       extractNonRangeStackValuesFromBucket(jsonFacetResponse, stackField, vGraphData, typeXAxis);
       if (LogSearchConstants.SOLR_LEVEL.equalsIgnoreCase(stackField) && LogSearchConstants.SOLR_LEVEL.equalsIgnoreCase(xAxisField)) {
-        Collection<VBarGraphData> levelVGraphData = dataList.getGraphData();
-        for (VBarGraphData garphData : levelVGraphData) {
-          Collection<VNameValue> valueList = garphData.getDataCount();
-          Collection<VNameValue> valueListSorted = new ArrayList<VNameValue>();
+        Collection<BarGraphData> levelVGraphData = dataList.getGraphData();
+        for (BarGraphData graphData : levelVGraphData) {
+          Collection<NameValueData> valueList = graphData.getDataCount();
+          Collection<NameValueData> valueListSorted = new ArrayList<NameValueData>();
           for (String level : LogSearchConstants.SUPPORTED_LOG_LEVEL) {
             String val = "0";
-            for (VNameValue value : valueList) {
+            for (NameValueData value : valueList) {
               if (value.getName().equalsIgnoreCase(level)) {
                 val = value.getValue();
                 break;
               }
             }
-            VNameValue v1 = new VNameValue();
+            NameValueData v1 = new NameValueData();
             v1.setName(level.toUpperCase());
             v1.setValue(val);
             valueListSorted.add(v1);
           }
-          garphData.setDataCounts(valueListSorted);
+          graphData.setDataCount(valueListSorted);
         }
       }
       return dataList;
@@ -267,12 +268,12 @@ public class GraphDataGenerator extends GraphDataGeneratorBase {
   }
 
   @SuppressWarnings("unchecked")
-  private VBarDataList rangeNonStackGraph(String xAxisField, String yAxisField, String from, String to, String unit,
+  private BarGraphDataListResponse rangeNonStackGraph(String xAxisField, String yAxisField, String from, String to, String unit,
       SolrDaoBase solrDaoBase, String typeXAxis, String fieldTime, SolrQuery solrQuery) {
-    VBarDataList dataList = new VBarDataList();
-    Collection<VBarGraphData> vBarGraphDatas = new ArrayList<VBarGraphData>();
-    VBarGraphData vBarGraphData = new VBarGraphData();
-    Collection<VNameValue> vNameValues = new ArrayList<VNameValue>();
+    BarGraphDataListResponse dataList = new BarGraphDataListResponse();
+    Collection<BarGraphData> vBarGraphDatas = new ArrayList<BarGraphData>();
+    BarGraphData vBarGraphData = new BarGraphData();
+    Collection<NameValueData> vNameValues = new ArrayList<NameValueData>();
     SolrUtil.setMainQuery(solrQuery, null);
     if (SolrUtil.isSolrFieldNumber(typeXAxis,solrDaoBase)) {
       queryGenerator.setSingleRangeFilter(solrQuery, fieldTime, from, to);
@@ -290,12 +291,12 @@ public class GraphDataGenerator extends GraphDataGeneratorBase {
               List<RangeFacet.Count> listCount = rangeFacet.get(0).getCounts();
               if (listCount != null) {
                 for (RangeFacet.Count cnt : listCount) {
-                  VNameValue vNameValue = new VNameValue();
+                  NameValueData vNameValue = new NameValueData();
                   vNameValue.setName(cnt.getValue());
                   vNameValue.setValue("" + cnt.getCount());
                   vNameValues.add(vNameValue);
                 }
-                vBarGraphData.setDataCounts(vNameValues);
+                vBarGraphData.setDataCount(vNameValues);
                 vBarGraphDatas.add(vBarGraphData);
                 vBarGraphData.setName(xAxisField);
                 dataList.setGraphData(vBarGraphDatas);
@@ -312,10 +313,10 @@ public class GraphDataGenerator extends GraphDataGeneratorBase {
   }
 
   @SuppressWarnings("unchecked")
-  private VBarDataList rangeStackGraph(String xAxisField, String stackField, String from, String to, String unit,
+  private BarGraphDataListResponse rangeStackGraph(String xAxisField, String stackField, String from, String to, String unit,
       SolrDaoBase solrDaoBase, SolrQuery solrQuery) {
-    VBarDataList dataList = new VBarDataList();
-    List<VBarGraphData> histogramData = new ArrayList<VBarGraphData>();
+    BarGraphDataListResponse dataList = new BarGraphDataListResponse();
+    List<BarGraphData> histogramData = new ArrayList<BarGraphData>();
     SolrUtil.setMainQuery(solrQuery, null);
     SolrUtil.setFacetSort(solrQuery, LogSearchConstants.FACET_INDEX);
     String jsonHistogramQuery =

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/graph/GraphDataGeneratorBase.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/graph/GraphDataGeneratorBase.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/graph/GraphDataGeneratorBase.java
index e7fab9a..c57e0e9 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/graph/GraphDataGeneratorBase.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/graph/GraphDataGeneratorBase.java
@@ -23,15 +23,15 @@ import java.util.Collection;
 import java.util.Date;
 import java.util.List;
 
-import org.apache.ambari.logsearch.manager.MgrBase;
+import org.apache.ambari.logsearch.manager.ManagerBase;
+import org.apache.ambari.logsearch.model.response.BarGraphData;
+import org.apache.ambari.logsearch.model.response.NameValueData;
 import org.apache.ambari.logsearch.util.DateUtil;
-import org.apache.ambari.logsearch.view.VBarGraphData;
-import org.apache.ambari.logsearch.view.VNameValue;
 import org.apache.commons.lang.StringUtils;
 import org.apache.solr.common.util.NamedList;
 import org.apache.solr.common.util.SimpleOrderedMap;
 
-class GraphDataGeneratorBase extends MgrBase {
+class GraphDataGeneratorBase {
 
   private static final String BUCKETS = "buckets";
   
@@ -62,19 +62,19 @@ class GraphDataGeneratorBase extends MgrBase {
 
   @SuppressWarnings("unchecked")
   protected void extractRangeStackValuesFromBucket(SimpleOrderedMap<Object> jsonFacetResponse, String outerField,
-      String innerField, List<VBarGraphData> histogramData) {
+      String innerField, List<BarGraphData> histogramData) {
     if (jsonFacetResponse != null) {
       NamedList<Object> stack = (NamedList<Object>) jsonFacetResponse.get(outerField);
       if (stack != null) {
         ArrayList<Object> stackBuckets = (ArrayList<Object>) stack.get(BUCKETS);
         if (stackBuckets != null) {
           for (Object stackBucket : stackBuckets) {
-            VBarGraphData vBarGraphData = new VBarGraphData();
+            BarGraphData vBarGraphData = new BarGraphData();
             SimpleOrderedMap<Object> level = (SimpleOrderedMap<Object>) stackBucket;
             if (level != null) {
               String name = level.getVal(0) != null ? level.getVal(0).toString().toUpperCase() : "";
               vBarGraphData.setName(name);
-              Collection<VNameValue> vNameValues = new ArrayList<VNameValue>();
+              Collection<NameValueData> vNameValues = new ArrayList<NameValueData>();
               NamedList<Object> innerFiledValue = (NamedList<Object>) level.get(innerField);
               if (innerFiledValue != null) {
                 ArrayList<Object> levelBuckets = (ArrayList<Object>) innerFiledValue.get(BUCKETS);
@@ -84,13 +84,15 @@ class GraphDataGeneratorBase extends MgrBase {
                     if (countValue != null) {
                       String innerName = DateUtil.convertDateWithMillisecondsToSolrDate((Date) countValue.getVal(0));
                       String innerValue = countValue.getVal(1) != null ? countValue.getVal(1).toString() : "";
-                      VNameValue vNameValue = new VNameValue(innerName, innerValue);
+                      NameValueData vNameValue = new NameValueData();
+                      vNameValue.setName(innerName);
+                      vNameValue.setValue(innerValue);
                       vNameValues.add(vNameValue);
                     }
                   }
                 }
               }
-              vBarGraphData.setDataCounts(vNameValues);
+              vBarGraphData.setDataCount(vNameValues);
             }
             histogramData.add(vBarGraphData);
           }
@@ -101,7 +103,7 @@ class GraphDataGeneratorBase extends MgrBase {
 
   @SuppressWarnings("unchecked")
   protected boolean extractNonRangeStackValuesFromBucket(SimpleOrderedMap<Object> jsonFacetResponse, String level,
-      Collection<VBarGraphData> vGraphDatas, String typeXAxis) {
+      Collection<BarGraphData> vGraphDatas, String typeXAxis) {
     boolean zeroFlag = true;
     if (jsonFacetResponse == null || jsonFacetResponse.get(level) == null
         || jsonFacetResponse.get(level).toString().equals("{count=0}")) {
@@ -114,11 +116,11 @@ class GraphDataGeneratorBase extends MgrBase {
         for (int index = 0; index < bucketList.size(); index++) {
           SimpleOrderedMap<Object> valueCount = (SimpleOrderedMap<Object>) bucketList.get(index);
           if (valueCount != null && valueCount.size() > 2) {
-            VBarGraphData vGraphData = new VBarGraphData();
-            Collection<VNameValue> levelCounts = new ArrayList<VNameValue>();
+            BarGraphData vGraphData = new BarGraphData();
+            Collection<NameValueData> levelCounts = new ArrayList<NameValueData>();
             String name = valueCount.getVal(0) != null ? valueCount.getVal(0).toString().trim() : "";
             if (isTypeNumber(typeXAxis)) {
-              VNameValue nameValue = new VNameValue();
+              NameValueData nameValue = new NameValueData();
               Double sumValue = (Double) valueCount.getVal(2);
               String value = "0";// default is zero
               if (sumValue != null) {
@@ -137,7 +139,9 @@ class GraphDataGeneratorBase extends MgrBase {
                     if (innerValueCount != null) {
                       String innerName = innerValueCount.getVal(0) != null ? innerValueCount.getVal(0).toString().trim() : "";
                       String innerValue = innerValueCount.getVal(1) != null ? innerValueCount.getVal(1).toString().trim() : "";
-                      VNameValue nameValue = new VNameValue(innerName, innerValue);
+                      NameValueData nameValue = new NameValueData();
+                      nameValue.setValue(innerValue);
+                      nameValue.setName(innerName);
                       levelCounts.add(nameValue);
                     }
                   }
@@ -145,7 +149,7 @@ class GraphDataGeneratorBase extends MgrBase {
               }
             }
             vGraphData.setName(name);
-            vGraphData.setDataCounts(levelCounts);
+            vGraphData.setDataCount(levelCounts);
             vGraphDatas.add(vGraphData);
           }
         }

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/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
new file mode 100644
index 0000000..7affc5a
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/manager/AuditLogsManager.java
@@ -0,0 +1,597 @@
+/*
+ * 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.manager;
+
+import javax.inject.Inject;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.text.ParseException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+
+import org.apache.ambari.logsearch.common.ConfigHelper;
+import org.apache.ambari.logsearch.common.LogSearchConstants;
+import org.apache.ambari.logsearch.common.ManageStartEndTime;
+import org.apache.ambari.logsearch.common.MessageEnums;
+import org.apache.ambari.logsearch.conf.SolrAuditLogConfig;
+import org.apache.ambari.logsearch.dao.AuditSolrDao;
+import org.apache.ambari.logsearch.graph.GraphDataGenerator;
+import org.apache.ambari.logsearch.model.response.AuditLogResponse;
+import org.apache.ambari.logsearch.model.response.BarGraphData;
+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.model.response.LogSearchResponse;
+import org.apache.ambari.logsearch.model.response.NameValueData;
+import org.apache.ambari.logsearch.model.response.NameValueDataListResponse;
+import org.apache.ambari.logsearch.solr.model.SolrAuditLogData;
+import org.apache.ambari.logsearch.solr.model.SolrComponentTypeLogData;
+import org.apache.ambari.logsearch.util.BizUtil;
+import org.apache.ambari.logsearch.util.DateUtil;
+import org.apache.ambari.logsearch.util.RESTErrorUtil;
+import org.apache.ambari.logsearch.util.SolrUtil;
+import org.apache.ambari.logsearch.view.VResponse;
+import org.apache.ambari.logsearch.query.model.AuditLogSearchCriteria;
+import org.apache.ambari.logsearch.query.model.SearchCriteria;
+import org.apache.log4j.Logger;
+import org.apache.solr.client.solrj.SolrQuery;
+import org.apache.solr.client.solrj.SolrServerException;
+import org.apache.solr.client.solrj.response.FacetField;
+import org.apache.solr.client.solrj.response.FacetField.Count;
+import org.apache.solr.client.solrj.response.QueryResponse;
+import org.apache.solr.client.solrj.response.RangeFacet;
+import org.apache.solr.common.SolrException;
+import org.apache.solr.common.util.NamedList;
+import org.apache.solr.common.util.SimpleOrderedMap;
+import org.springframework.stereotype.Component;
+
+@Component
+public class AuditLogsManager extends ManagerBase<SolrAuditLogData, AuditLogResponse> {
+  private static final Logger logger = Logger.getLogger(AuditLogsManager.class);
+
+  @Inject
+  private AuditSolrDao auditSolrDao;
+  @Inject
+  private GraphDataGenerator graphDataGenerator;
+  @Inject
+  private SolrAuditLogConfig solrAuditLogConfig;
+
+  public AuditLogResponse getLogs(AuditLogSearchCriteria searchCriteria) {
+    Boolean isLastPage = (Boolean) searchCriteria.getParamValue("isLastPage");
+    if (isLastPage) {
+      SolrQuery lastPageQuery = queryGenerator.commonAuditFilterQuery(searchCriteria);
+      LogSearchResponse logResponse = getLastPage(searchCriteria, LogSearchConstants.AUDIT_EVTTIME, auditSolrDao, lastPageQuery);
+      if (logResponse == null) {
+        logResponse = new AuditLogResponse();
+      }
+      return (AuditLogResponse) logResponse;
+    }
+    SolrQuery solrQuery = queryGenerator.commonAuditFilterQuery(searchCriteria);
+    return getLogAsPaginationProvided(solrQuery, auditSolrDao);
+  }
+
+  private List<LogData> getComponents(SearchCriteria searchCriteria) {
+    SolrQuery solrQuery = queryGenerator.commonAuditFilterQuery(searchCriteria);
+    List<LogData> docList = new ArrayList<>();
+    try {
+      SolrUtil.setFacetField(solrQuery, LogSearchConstants.AUDIT_COMPONENT);
+      SolrUtil.setFacetSort(solrQuery, LogSearchConstants.FACET_INDEX);
+      List<FacetField> facetFields = null;
+      List<Count> componentsCount = new ArrayList<Count>();
+      FacetField facetField = null;
+
+      QueryResponse queryResponse = auditSolrDao.process(solrQuery);
+      if (queryResponse == null) {
+        return docList;
+      }
+
+      facetFields = queryResponse.getFacetFields();
+      if (facetFields == null) {
+        return docList;
+      }
+      if (!facetFields.isEmpty()) {
+        facetField = facetFields.get(0);
+      }
+      if (facetField != null) {
+        componentsCount = facetField.getValues();
+      }
+
+      for (Count component : componentsCount) {
+        SolrComponentTypeLogData logData = new SolrComponentTypeLogData();
+        logData.setType(component.getName());
+        docList.add(logData);
+      }
+      return docList;
+    } catch (SolrException | SolrServerException | IOException e) {
+      logger.error("Error during solrQuery=" + solrQuery, e);
+      throw RESTErrorUtil.createRESTException(MessageEnums.SOLR_ERROR.getMessage().getMessage(), MessageEnums.ERROR_SYSTEM);
+    }
+  }
+
+  public GroupListResponse getAuditComponents(SearchCriteria searchCriteria) {
+    GroupListResponse componentResponse = new GroupListResponse();
+    List<LogData> docList = getComponents(searchCriteria);
+    componentResponse.setGroupList(docList);
+    return componentResponse;
+  }
+
+  @SuppressWarnings("unchecked")
+  public BarGraphDataListResponse getAuditBarGraphData(SearchCriteria searchCriteria) {
+    BarGraphDataListResponse dataList = new BarGraphDataListResponse();
+    SolrQuery solrQuery = queryGenerator.commonAuditFilterQuery(searchCriteria);
+
+    String from = getFrom((String) searchCriteria.getParamValue("startTime"));
+    String to = getTo((String) searchCriteria.getParamValue("endTime"));
+    String unit = getUnit((String) searchCriteria.getParamValue("unit"));
+
+    List<BarGraphData> histogramData = new ArrayList<BarGraphData>();
+    String jsonHistogramQuery = queryGenerator.buildJSONFacetTermTimeRangeQuery(LogSearchConstants.AUDIT_COMPONENT,
+      LogSearchConstants.AUDIT_EVTTIME, from, to, unit).replace("\\", "");
+
+    try {
+      SolrUtil.setJSONFacet(solrQuery, jsonHistogramQuery);
+      SolrUtil.setRowCount(solrQuery, 0);
+      QueryResponse response = auditSolrDao.process(solrQuery);
+      if (response == null) {
+        return dataList;
+      }
+      SimpleOrderedMap<Object> jsonFacetResponse = (SimpleOrderedMap<Object>) response.getResponse().get("facets");
+
+      if (jsonFacetResponse == null || jsonFacetResponse.toString().equals("{count=0}")) {
+        return dataList;
+      }
+
+      extractValuesFromBucket(jsonFacetResponse, "x", "y", histogramData);
+
+      dataList.setGraphData(histogramData);
+      return dataList;
+
+    } catch (SolrServerException | SolrException | IOException e) {
+      logger.error(e);
+      throw RESTErrorUtil.createRESTException(MessageEnums.SOLR_ERROR.getMessage().getMessage(), MessageEnums.ERROR_SYSTEM);
+
+    }
+  }
+
+  @SuppressWarnings({"unchecked", "rawtypes"})
+  public NameValueDataListResponse getLiveLogCounts() {
+    NameValueDataListResponse nameValueList = new NameValueDataListResponse();
+    SolrQuery solrQuery = new SolrQuery();
+    solrQuery.setParam("event", "/audit/logs/live/count");
+    try {
+      Date[] timeRange = ManageStartEndTime.getStartEndTime();
+      String startDate = DateUtil.convertGivenDateFormatToSolrDateFormat(timeRange[0]);
+      String endDate = DateUtil.convertGivenDateFormatToSolrDateFormat(timeRange[1]);
+
+      SolrUtil.setMainQuery(solrQuery, null);
+      SolrUtil.setFacetRange(solrQuery, LogSearchConstants.AUDIT_EVTTIME, startDate, endDate, "+2MINUTE");
+      List<RangeFacet.Count> listCount;
+
+      QueryResponse response = auditSolrDao.process(solrQuery);
+
+      List<RangeFacet> rangeFacet = response.getFacetRanges();
+      if (rangeFacet == null) {
+        return nameValueList;
+      }
+      RangeFacet range = rangeFacet.get(0);
+
+      if (range == null) {
+        return nameValueList;
+      }
+
+      listCount = range.getCounts();
+
+      List<NameValueData> nameValues = new ArrayList<>();
+      int count = 0;
+      for (RangeFacet.Count cnt : listCount) {
+        NameValueData nameValue = new NameValueData();
+        nameValue.setName("" + count);
+        nameValue.setValue("" + cnt.getCount());
+        nameValues.add(nameValue);
+        count++;
+      }
+      nameValueList.setvNameValues(nameValues);
+      return nameValueList;
+
+    } catch (SolrException | SolrServerException | ParseException
+      | IOException e) {
+      logger.error("Error during solrQuery=" + solrQuery, e);
+      throw RESTErrorUtil.createRESTException(MessageEnums.SOLR_ERROR.getMessage().getMessage(), MessageEnums.ERROR_SYSTEM);
+    }
+  }
+
+  public BarGraphDataListResponse topTenUsers(SearchCriteria searchCriteria) {
+
+    String jsonUserQuery =
+      "{Users:{type:terms, field:reqUser, facet:{ Repo:{ type:terms, field:repo, facet:{eventCount:\"sum(event_count)\"}}}}}";
+    SolrQuery solrQuery = queryGenerator.commonAuditFilterQuery(searchCriteria);
+    SolrUtil.setJSONFacet(solrQuery, jsonUserQuery);
+    SolrUtil.setRowCount(solrQuery, 0);
+    try {
+      BarGraphDataListResponse barGraphDataListResponse = new BarGraphDataListResponse();
+      QueryResponse queryResponse = auditSolrDao.process(solrQuery);
+      if (queryResponse == null) {
+        return barGraphDataListResponse;
+      }
+
+      NamedList<Object> namedList = queryResponse.getResponse();
+
+      if (namedList == null) {
+        return barGraphDataListResponse;
+      }
+
+      @SuppressWarnings("unchecked")
+      SimpleOrderedMap<Object> jsonFacetResponse = (SimpleOrderedMap<Object>) namedList.get("facets");
+      if (jsonFacetResponse == null) {
+        return barGraphDataListResponse;
+      }
+      if (jsonFacetResponse.toString().equals("{count=0}")) {
+        return barGraphDataListResponse;
+      }
+      barGraphDataListResponse = BizUtil.buildSummaryForTopCounts(jsonFacetResponse, "Repo", "Users");
+      return barGraphDataListResponse;
+
+    } catch (SolrServerException | SolrException | IOException e) {
+      logger.error("Error during solrQuery=" + e);
+      throw RESTErrorUtil.createRESTException(MessageEnums.SOLR_ERROR.getMessage().getMessage(), MessageEnums.ERROR_SYSTEM);
+    }
+  }
+
+  public BarGraphDataListResponse topTenResources(SearchCriteria searchCriteria) {
+
+    String jsonUserQuery =
+      "{Users:{type:terms,field:resource,facet:{Repo:{type:terms,field:repo,facet:{eventCount:\"sum(event_count)\"}}}}}";
+    SolrQuery solrQuery = queryGenerator.commonAuditFilterQuery(searchCriteria);
+    SolrUtil.setJSONFacet(solrQuery, jsonUserQuery);
+    SolrUtil.setRowCount(solrQuery, 0);
+    try {
+      BarGraphDataListResponse barGraphDataListResponse = new BarGraphDataListResponse();
+      QueryResponse queryResponse = auditSolrDao.process(solrQuery);
+      if (queryResponse == null) {
+        return barGraphDataListResponse;
+      }
+
+      NamedList<Object> namedList = queryResponse.getResponse();
+      if (namedList == null) {
+        return barGraphDataListResponse;
+      }
+
+      @SuppressWarnings("unchecked")
+      SimpleOrderedMap<Object> jsonFacetResponse = (SimpleOrderedMap<Object>) namedList.get("facets");
+
+      barGraphDataListResponse = BizUtil.buildSummaryForTopCounts(jsonFacetResponse, "Repo", "Users");
+      return barGraphDataListResponse;
+
+    } catch (SolrServerException | SolrException | IOException e) {
+      logger.error("Error during solrQuery=" + solrQuery, e);
+      throw RESTErrorUtil.createRESTException(MessageEnums.SOLR_ERROR.getMessage().getMessage(), MessageEnums.ERROR_SYSTEM);
+    }
+  }
+
+  @SuppressWarnings("unchecked")
+  public BarGraphDataListResponse getRequestUserLineGraph(SearchCriteria searchCriteria) {
+
+    String from = getFrom((String) searchCriteria.getParamValue("startTime"));
+    String to = getTo((String) searchCriteria.getParamValue("endTime"));
+    String unit = getUnit((String) searchCriteria.getParamValue("unit"));
+
+    SolrQuery solrQuery = queryGenerator.commonAuditFilterQuery(searchCriteria);
+
+    BarGraphDataListResponse dataList = new BarGraphDataListResponse();
+    List<BarGraphData> histogramData = new ArrayList<BarGraphData>();
+
+    SolrUtil.setFacetSort(solrQuery, LogSearchConstants.FACET_INDEX);
+
+    String jsonHistogramQuery = queryGenerator.buildJSONFacetTermTimeRangeQuery(LogSearchConstants.AUDIT_REQUEST_USER,
+      LogSearchConstants.AUDIT_EVTTIME, from, to, unit).replace("\\", "");
+
+    try {
+      SolrUtil.setJSONFacet(solrQuery, jsonHistogramQuery);
+      SolrUtil.setRowCount(solrQuery, 0);
+      QueryResponse response = auditSolrDao.process(solrQuery);
+      if (response == null) {
+        return dataList;
+      }
+      SimpleOrderedMap<Object> jsonFacetResponse = (SimpleOrderedMap<Object>) response.getResponse().get("facets");
+
+      if (jsonFacetResponse == null || jsonFacetResponse.toString().equals("{count=0}")) {
+        return dataList;
+      }
+      extractValuesFromBucket(jsonFacetResponse, "x", "y", histogramData);
+
+      dataList.setGraphData(histogramData);
+      return dataList;
+
+    } catch (SolrException | IOException | SolrServerException e) {
+      logger.error("Error during solrQuery=" + solrQuery, e);
+      throw RESTErrorUtil.createRESTException(MessageEnums.SOLR_ERROR.getMessage().getMessage(), MessageEnums.ERROR_SYSTEM);
+    }
+
+  }
+
+  public String getAuditLogsSchemaFieldsName() {
+    String excludeArray[] = Arrays.copyOf(solrAuditLogConfig.getExcludeColumnList().toArray(),
+      solrAuditLogConfig.getExcludeColumnList().size(), String[].class);
+    List<String> fieldNames = new ArrayList<String>();
+    HashMap<String, String> uiFieldColumnMapping = new HashMap<String, String>();
+    ConfigHelper.getSchemaFieldsName(excludeArray, fieldNames, auditSolrDao);
+
+    for (String fieldName : fieldNames) {
+      String uiField = solrAuditLogConfig.getSolrAndUiColumns().get(fieldName + LogSearchConstants.SOLR_SUFFIX);
+      if (uiField == null) {
+        uiFieldColumnMapping.put(fieldName, fieldName);
+      } else {
+        uiFieldColumnMapping.put(fieldName, uiField);
+      }
+    }
+
+    uiFieldColumnMapping = BizUtil.sortHashMapByValues(uiFieldColumnMapping);
+    return convertObjToString(uiFieldColumnMapping);
+
+  }
+
+  public BarGraphDataListResponse getAnyGraphData(SearchCriteria searchCriteria) {
+    searchCriteria.addParam("fieldTime", LogSearchConstants.AUDIT_EVTTIME);
+    SolrQuery solrQuery = queryGenerator.commonAuditFilterQuery(searchCriteria);
+    BarGraphDataListResponse result = graphDataGenerator.getAnyGraphData(searchCriteria, auditSolrDao, solrQuery);
+    if (result == null) {
+      result = new BarGraphDataListResponse();
+    }
+    return result;
+
+  }
+
+  @SuppressWarnings("unchecked")
+  private void extractValuesFromBucket(SimpleOrderedMap<Object> jsonFacetResponse, String outerField, String innerField,
+                                       List<BarGraphData> histogramData) {
+    NamedList<Object> stack = (NamedList<Object>) jsonFacetResponse.get(outerField);
+    ArrayList<Object> stackBuckets = (ArrayList<Object>) stack.get("buckets");
+    for (Object temp : stackBuckets) {
+      BarGraphData vBarGraphData = new BarGraphData();
+
+      SimpleOrderedMap<Object> level = (SimpleOrderedMap<Object>) temp;
+      String name = ((String) level.getVal(0)).toUpperCase();
+      vBarGraphData.setName(name);
+
+      Collection<NameValueData> vNameValues = new ArrayList<NameValueData>();
+      vBarGraphData.setDataCount(vNameValues);
+      ArrayList<Object> levelBuckets = (ArrayList<Object>) ((NamedList<Object>) level.get(innerField)).get("buckets");
+      for (Object temp1 : levelBuckets) {
+        SimpleOrderedMap<Object> countValue = (SimpleOrderedMap<Object>) temp1;
+        String value = DateUtil.convertDateWithMillisecondsToSolrDate((Date) countValue.getVal(0));
+
+        String count = "" + countValue.getVal(1);
+        NameValueData vNameValue = new NameValueData();
+        vNameValue.setName(value);
+        vNameValue.setValue(count);
+        vNameValues.add(vNameValue);
+      }
+      histogramData.add(vBarGraphData);
+    }
+  }
+
+  @SuppressWarnings({"unchecked"})
+  public Response exportUserTableToTextFile(SearchCriteria searchCriteria) {
+    String jsonUserQuery =
+      "{ Users: { type: terms, field: reqUser, facet:  {Repo: {  type: terms, field: repo, facet: {  eventCount: \"sum(event_count)\"}}}},x:{ type: terms,field: resource, facet: {y: {  type: terms, field: repo,facet: {  eventCount: \"sum(event_count)\"}}}}}";
+
+    SolrQuery solrQuery = queryGenerator.commonAuditFilterQuery(searchCriteria);
+    String startTime = (String) searchCriteria.getParamValue("startTime");
+    String endTime = (String) searchCriteria.getParamValue("endTime");
+
+    startTime = startTime == null ? "" : startTime;
+    endTime = endTime == null ? "" : "_" + endTime;
+
+    SolrUtil.setJSONFacet(solrQuery, jsonUserQuery);
+    SolrUtil.setRowCount(solrQuery, 0);
+
+    String dataFormat = (String) searchCriteria.getParamValue("format");
+    FileOutputStream fis = null;
+    try {
+      QueryResponse queryResponse = auditSolrDao.process(solrQuery);
+      if (queryResponse == null) {
+        VResponse response = new VResponse();
+        response.setMsgDesc("Query was not able to execute " + solrQuery);
+        throw RESTErrorUtil.createRESTException(response);
+      }
+
+      NamedList<Object> namedList = queryResponse.getResponse();
+      if (namedList == null) {
+        VResponse response = new VResponse();
+        response.setMsgDesc("Query was not able to execute " + solrQuery);
+        throw RESTErrorUtil.createRESTException(response);
+      }
+      BarGraphDataListResponse vBarUserDataList = new BarGraphDataListResponse();
+      BarGraphDataListResponse vBarResourceDataList = new BarGraphDataListResponse();
+
+      SimpleOrderedMap<Object> jsonFacetResponse = (SimpleOrderedMap<Object>) namedList.get("facets");
+      vBarUserDataList = BizUtil.buildSummaryForTopCounts(jsonFacetResponse, "Repo", "Users");
+      vBarResourceDataList = BizUtil.buildSummaryForTopCounts(jsonFacetResponse, "y", "x");
+      String data = "";
+      String summary = "";
+      if ("text".equals(dataFormat)) {
+        int users = 0;
+        int resources = 0;
+        summary += "\n\n\n\n";
+        data += addBlank("Users") + "Components/Access" + "\n";
+        data += "--------------------------------------------------------------------------\n";
+        Collection<BarGraphData> tableUserData = vBarUserDataList.getGraphData();
+        for (BarGraphData graphData : tableUserData) {
+          String userName = graphData.getName();
+          String largeUserName = "";
+
+          if (userName.length() > 45) {
+            largeUserName = userName.substring(0, 45);
+            data += addBlank(largeUserName);
+          } else
+            data += addBlank(userName);
+
+          Collection<NameValueData> vnameValueList = graphData.getDataCount();
+          int count = 0;
+          String blank = "";
+          for (NameValueData vNameValue : vnameValueList) {
+            data += blank + vNameValue.getName() + " " + vNameValue.getValue() + "\n";
+            if (count == 0)
+              blank = addBlank(blank);
+            count++;
+
+          }
+          while (largeUserName.length() > 0) {
+            data += largeUserName.substring(0, 45) + "\n";
+          }
+
+          users += 1;
+        }
+        data += "\n\n\n\n\n\n";
+        data += addBlank("Resources") + "Components/Access" + "\n";
+        data += "--------------------------------------------------------------------------\n";
+        Collection<BarGraphData> tableResourceData = vBarResourceDataList.getGraphData();
+        for (BarGraphData graphData : tableResourceData) {
+          String resourceName = graphData.getName();
+          String largeResourceName = resourceName;
+          if (largeResourceName.length() > 45) {
+            resourceName = largeResourceName.substring(0, 45);
+            largeResourceName = largeResourceName.substring(45, largeResourceName.length());
+          } else {
+            largeResourceName = "";
+          }
+
+          //resourceName = resourceName.replaceAll("(.{45})", resourceName.substring(0, 45)+"\n");
+          data += addBlank(resourceName);
+          Collection<NameValueData> vnameValueList = graphData.getDataCount();
+          int count = 0;
+          String blank = "";
+          for (NameValueData vNameValue : vnameValueList) {
+            data += blank + vNameValue.getName() + " " + vNameValue.getValue() + "\n";
+            if (count == 0)
+              blank = addBlank(blank);
+            count++;
+          }
+          String tempLargeResourceName = largeResourceName;
+          while (largeResourceName.length() > 45) {
+            largeResourceName = tempLargeResourceName.substring(0, 45);
+            tempLargeResourceName = tempLargeResourceName.substring(45, tempLargeResourceName.length());
+            data += largeResourceName + "\n";
+          }
+          if (largeResourceName.length() < 45 && !largeResourceName.isEmpty()) {
+            data += largeResourceName + "\n";
+          }
+          resources += 1;
+        }
+        String header = "--------------------------------SUMMARY-----------------------------------\n";
+        summary = header + "Users  = " + users + "\nResources  = " + resources + "\n" + summary;
+        data = summary + data;
+      } else {
+        data = "{" + convertObjToString(vBarUserDataList) + "," + convertObjToString(vBarResourceDataList) + "}";
+        dataFormat = "json";
+      }
+      String fileName = "Users_Resource" + startTime + endTime + ".";
+      File file = File.createTempFile(fileName, dataFormat);
+
+      fis = new FileOutputStream(file);
+      fis.write(data.getBytes());
+      return Response
+        .ok(file, MediaType.APPLICATION_OCTET_STREAM)
+        .header("Content-Disposition", "attachment;filename=" + fileName + dataFormat)
+        .build();
+
+    } catch (SolrServerException | SolrException | IOException e) {
+      logger.error("Error during solrQuery=" + e);
+      throw RESTErrorUtil.createRESTException(MessageEnums.SOLR_ERROR.getMessage().getMessage(), MessageEnums.ERROR_SYSTEM);
+    } finally {
+      if (fis != null) {
+        try {
+          fis.close();
+        } catch (IOException e) {
+        }
+      }
+    }
+  }
+
+  private String addBlank(String field) {
+    int blanks = 50;
+    int strSize = field.length();
+    String fieldWithBlank = field;
+    for (int i = 0; i < blanks - strSize; i++) {
+      fieldWithBlank += " ";
+    }
+    return fieldWithBlank;
+  }
+
+  public BarGraphDataListResponse getServiceLoad(SearchCriteria searchCriteria) {
+    BarGraphDataListResponse dataList = new BarGraphDataListResponse();
+    Collection<BarGraphData> vaDatas = new ArrayList<BarGraphData>();
+    dataList.setGraphData(vaDatas);
+
+    SolrQuery serivceLoadQuery = queryGenerator.commonAuditFilterQuery(searchCriteria);
+
+    try {
+      SolrUtil.setFacetField(serivceLoadQuery, LogSearchConstants.AUDIT_COMPONENT);
+      QueryResponse serviceLoadResponse = auditSolrDao.process(serivceLoadQuery);
+      if (serviceLoadResponse == null) {
+        return dataList;
+      }
+      FacetField serviceFacetField = serviceLoadResponse.getFacetField(LogSearchConstants.AUDIT_COMPONENT);
+      if (serviceFacetField == null) {
+        return dataList;
+      }
+
+      List<Count> serviceLoadFacets = serviceFacetField.getValues();
+      if (serviceLoadFacets == null) {
+        return dataList;
+      }
+      for (Count cnt : serviceLoadFacets) {
+        List<NameValueData> valueList = new ArrayList<NameValueData>();
+        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;
+
+    } catch (SolrException | SolrServerException | IOException e) {
+      logger.error("Error during solrQuery=" + e);
+      throw RESTErrorUtil.createRESTException(MessageEnums.SOLR_ERROR.getMessage().getMessage(), MessageEnums.ERROR_SYSTEM);
+    }
+  }
+
+  @Override
+  protected List<SolrAuditLogData> convertToSolrBeans(QueryResponse response) {
+    return response.getBeans(SolrAuditLogData.class);
+  }
+
+  @Override
+  protected AuditLogResponse createLogSearchResponse() {
+    return new AuditLogResponse();
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/manager/AuditMgr.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/manager/AuditMgr.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/manager/AuditMgr.java
deleted file mode 100644
index 172ec81..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/manager/AuditMgr.java
+++ /dev/null
@@ -1,630 +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.manager;
-
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.text.ParseException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-
-import org.apache.ambari.logsearch.common.ConfigHelper;
-import org.apache.ambari.logsearch.common.LogSearchConstants;
-import org.apache.ambari.logsearch.common.ManageStartEndTime;
-import org.apache.ambari.logsearch.common.MessageEnums;
-import org.apache.ambari.logsearch.common.PropertiesHelper;
-import org.apache.ambari.logsearch.common.SearchCriteria;
-import org.apache.ambari.logsearch.dao.AuditSolrDao;
-import org.apache.ambari.logsearch.graph.GraphDataGenerator;
-import org.apache.ambari.logsearch.util.BizUtil;
-import org.apache.ambari.logsearch.util.DateUtil;
-import org.apache.ambari.logsearch.util.RESTErrorUtil;
-import org.apache.ambari.logsearch.util.SolrUtil;
-import org.apache.ambari.logsearch.view.VBarDataList;
-import org.apache.ambari.logsearch.view.VBarGraphData;
-import org.apache.ambari.logsearch.view.VGroupList;
-import org.apache.ambari.logsearch.view.VNameValue;
-import org.apache.ambari.logsearch.view.VNameValueList;
-import org.apache.ambari.logsearch.view.VResponse;
-import org.apache.ambari.logsearch.view.VSolrLogList;
-import org.apache.log4j.Logger;
-import org.apache.solr.client.solrj.SolrQuery;
-import org.apache.solr.client.solrj.SolrServerException;
-import org.apache.solr.client.solrj.response.FacetField;
-import org.apache.solr.client.solrj.response.FacetField.Count;
-import org.apache.solr.client.solrj.response.QueryResponse;
-import org.apache.solr.client.solrj.response.RangeFacet;
-import org.apache.solr.common.SolrDocument;
-import org.apache.solr.common.SolrDocumentList;
-import org.apache.solr.common.SolrException;
-import org.apache.solr.common.util.NamedList;
-import org.apache.solr.common.util.SimpleOrderedMap;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-
-@Component
-public class AuditMgr extends MgrBase {
-  private static final Logger logger = Logger.getLogger(AuditMgr.class); 
-
-  @Autowired
-  private AuditSolrDao auditSolrDao;
-  @Autowired
-  private GraphDataGenerator graphDataGenerator;
-
-  public String getLogs(SearchCriteria searchCriteria) {
-    String lastPage = (String)  searchCriteria.getParamValue("isLastPage");
-    Boolean isLastPage = Boolean.parseBoolean(lastPage);
-     if (isLastPage) {
-       SolrQuery lastPageQuery = queryGenerator.commonAuditFilterQuery(searchCriteria);
-      VSolrLogList collection = getLastPage(searchCriteria, LogSearchConstants.AUDIT_EVTTIME, auditSolrDao, lastPageQuery);
-      if(collection == null){
-        collection = new VSolrLogList();
-      }
-      return convertObjToString(collection);
-    }
-    SolrQuery solrQuery = queryGenerator.commonAuditFilterQuery(searchCriteria);
-    VSolrLogList collection = getLogAsPaginationProvided(solrQuery, auditSolrDao);
-    return convertObjToString(collection);
-
-  }
-
-  private SolrDocumentList getComponents(SearchCriteria searchCriteria) {
-    SolrQuery solrQuery = queryGenerator.commonAuditFilterQuery(searchCriteria);
-    SolrDocumentList docList = new SolrDocumentList();
-    try {
-      SolrUtil.setFacetField(solrQuery, LogSearchConstants.AUDIT_COMPONENT);
-      SolrUtil.setFacetSort(solrQuery, LogSearchConstants.FACET_INDEX);
-      List<FacetField> facetFields = null;
-      List<Count> componentsCount = new ArrayList<Count>();
-      FacetField facetField = null;
-
-      QueryResponse queryResponse = auditSolrDao.process(solrQuery);
-      if (queryResponse == null) {
-        return docList;
-      }
-
-      facetFields = queryResponse.getFacetFields();
-      if (facetFields == null) {
-        return docList;
-      }
-      if (!facetFields.isEmpty()) {
-        facetField = facetFields.get(0);
-      }
-      if (facetField != null) {
-        componentsCount = facetField.getValues();
-      }
-    
-      for (Count compnonet : componentsCount) {
-        SolrDocument solrDocument = new SolrDocument();
-        solrDocument.addField("type", compnonet.getName());
-        docList.add(solrDocument);
-      }
-      return docList;
-    } catch (SolrException | SolrServerException | IOException e) {
-      logger.error("Error during solrQuery=" + solrQuery, e);
-      throw RESTErrorUtil.createRESTException(MessageEnums.SOLR_ERROR.getMessage().getMessage(), MessageEnums.ERROR_SYSTEM);
-    }
-  }
-
-  public String getAuditComponents(SearchCriteria searchCriteria) {
-    VGroupList vGroupList = new VGroupList();
-    SolrDocumentList docList = getComponents(searchCriteria);
-
-    vGroupList.setGroupDocuments(docList);
-    return convertObjToString(vGroupList);
-  }
-
-  @SuppressWarnings("unchecked")
-  public String getAuditLineGraphData(SearchCriteria searchCriteria) {
-    VBarDataList dataList = new VBarDataList();
-    SolrQuery solrQuery = queryGenerator.commonAuditFilterQuery(searchCriteria);
-
-    String from = getFrom((String) searchCriteria.getParamValue("startTime"));
-    String to = getTo((String) searchCriteria.getParamValue("endTime"));
-    String unit = getUnit((String) searchCriteria.getParamValue("unit"));
-
-    List<VBarGraphData> histogramData = new ArrayList<VBarGraphData>();
-    String jsonHistogramQuery = queryGenerator.buildJSONFacetTermTimeRangeQuery(LogSearchConstants.AUDIT_COMPONENT,
-      LogSearchConstants.AUDIT_EVTTIME, from, to, unit).replace("\\", "");
-
-    try {
-      SolrUtil.setJSONFacet(solrQuery, jsonHistogramQuery);
-      SolrUtil.setRowCount(solrQuery, 0);
-      QueryResponse response = auditSolrDao.process(solrQuery);
-      if (response == null){
-        return convertObjToString(dataList);
-      }
-      SimpleOrderedMap<Object> jsonFacetResponse = (SimpleOrderedMap<Object>) response.getResponse().get("facets");
-
-      if (jsonFacetResponse == null || jsonFacetResponse.toString().equals("{count=0}")) {
-        return convertObjToString(dataList);
-      }
-
-      extractValuesFromBucket(jsonFacetResponse, "x", "y", histogramData);
-
-      dataList.setGraphData(histogramData);
-      return convertObjToString(dataList);
-
-    } catch (SolrServerException | SolrException | IOException e) {
-      logger.error(e);
-      throw RESTErrorUtil.createRESTException(MessageEnums.SOLR_ERROR.getMessage().getMessage(), MessageEnums.ERROR_SYSTEM);
-
-    }
-  }
-
-  public String getTopAuditFieldCount(SearchCriteria searchCriteria) {
-    int topCounts = 10;
-    Integer top = (Integer) searchCriteria.getParamValue("top");
-    String facetField = (String) searchCriteria.getParamValue("field");
-    if (top == null){
-      top = new Integer(topCounts);
-    }
-    SolrQuery solrQuery = queryGenerator.commonAuditFilterQuery(searchCriteria);
-    try {
-
-      List<VNameValue> nameValues = new ArrayList<VNameValue>();
-
-      VNameValueList nameValueList = new VNameValueList(nameValues);
-
-      SolrUtil.setFacetField(solrQuery, facetField);
-      SolrUtil.setFacetSort(solrQuery, LogSearchConstants.FACET_COUNT);
-      SolrUtil.setFacetLimit(solrQuery, top.intValue());
-
-      List<Count> countList = new ArrayList<FacetField.Count>();
-      QueryResponse queryResponse = auditSolrDao.process(solrQuery);
-      if (queryResponse == null) {
-        return convertObjToString(nameValueList);
-      }
-      
-      if (queryResponse.getFacetField(facetField) != null) {
-        FacetField queryFacetField = queryResponse.getFacetField(facetField);
-        if (queryFacetField != null) {
-          countList = queryFacetField.getValues();
-        }
-      }
-
-      for (Count cnt : countList) {
-        VNameValue nameValue = new VNameValue();
-        nameValue.setName(cnt.getName());
-
-        nameValue.setValue("" + cnt.getCount());
-        nameValues.add(nameValue);
-      }
-      return convertObjToString(nameValueList);
-
-    } catch (SolrException | IOException | SolrServerException e) {
-      logger.error("Error during solrQuery=" + solrQuery, e);
-      throw RESTErrorUtil.createRESTException(MessageEnums.SOLR_ERROR.getMessage().getMessage(), MessageEnums.ERROR_SYSTEM);
-    }
-  }
-
-  @SuppressWarnings({ "unchecked", "rawtypes" })
-  public String getLiveLogCounts() {
-    VNameValueList nameValueList = new VNameValueList();
-    SolrQuery solrQuery = new SolrQuery();
-    solrQuery.setParam("event", "/audit/logs/live/count");
-    try {
-      Date[] timeRange = ManageStartEndTime.getStartEndTime();
-      String startDate = DateUtil.convertGivenDateFormatToSolrDateFormat(timeRange[0]);
-      String endDate = DateUtil.convertGivenDateFormatToSolrDateFormat(timeRange[1]);
-
-      SolrUtil.setMainQuery(solrQuery, null);
-      SolrUtil.setFacetRange(solrQuery, LogSearchConstants.AUDIT_EVTTIME, startDate, endDate, "+2MINUTE");
-      List<RangeFacet.Count> listCount;
-
-      QueryResponse response = auditSolrDao.process(solrQuery);
- 
-      List<RangeFacet> rangeFacet = response.getFacetRanges();
-      if (rangeFacet == null){
-        return convertObjToString(nameValueList);
-      }
-      RangeFacet range=rangeFacet.get(0);
-      
-      if(range == null){
-        return convertObjToString(nameValueList);
-      }
-      
-      listCount = range.getCounts();
-
-      List<VNameValue> nameValues = new ArrayList<VNameValue>();
-      int count = 0;
-      for (RangeFacet.Count cnt : listCount) {
-        VNameValue nameValue = new VNameValue();
-        nameValue.setName("" + count);
-        nameValue.setValue("" + cnt.getCount());
-        nameValues.add(nameValue);
-        count++;
-      }
-      nameValueList.setVNameValues(nameValues);
-      return convertObjToString(nameValueList);
-
-    } catch (SolrException | SolrServerException | ParseException
-      | IOException e) {
-      logger.error("Error during solrQuery=" + solrQuery, e);
-      throw RESTErrorUtil.createRESTException(MessageEnums.SOLR_ERROR.getMessage().getMessage(), MessageEnums.ERROR_SYSTEM);
-    }
-  }
-
-  public String topTenUsers(SearchCriteria searchCriteria) {
-
-    String jsonUserQuery =
-        "{Users:{type:terms, field:reqUser, facet:{ Repo:{ type:terms, field:repo, facet:{eventCount:\"sum(event_count)\"}}}}}";
-    SolrQuery solrQuery = queryGenerator.commonAuditFilterQuery(searchCriteria);
-    SolrUtil.setJSONFacet(solrQuery, jsonUserQuery);
-    SolrUtil.setRowCount(solrQuery, 0);
-    try {
-      VBarDataList vBarDataList = new VBarDataList();
-      QueryResponse queryResponse = auditSolrDao.process(solrQuery);
-      if (queryResponse == null) {
-        return convertObjToString(vBarDataList);
-      }
-
-      NamedList<Object> namedList = queryResponse.getResponse();
-      
-      if (namedList == null) {
-        return convertObjToString(vBarDataList);
-      }
-
-      @SuppressWarnings("unchecked")
-      SimpleOrderedMap<Object> jsonFacetResponse = (SimpleOrderedMap<Object>) namedList.get("facets");
-      if (jsonFacetResponse == null) {
-        return convertObjToString(vBarDataList);
-      }
-      if (jsonFacetResponse.toString().equals("{count=0}")) {
-        return convertObjToString(vBarDataList);
-      }
-      vBarDataList = BizUtil.buildSummaryForTopCounts(jsonFacetResponse,"Repo","Users");
-      return convertObjToString(vBarDataList);
-
-    } catch (SolrServerException | SolrException | IOException e) {
-      logger.error("Error during solrQuery=" + e);
-      throw RESTErrorUtil.createRESTException(MessageEnums.SOLR_ERROR.getMessage().getMessage(), MessageEnums.ERROR_SYSTEM);
-    }
-  }
-
-  public String topTenResources(SearchCriteria searchCriteria) {
-
-    String jsonUserQuery =
-        "{Users:{type:terms,field:resource,facet:{Repo:{type:terms,field:repo,facet:{eventCount:\"sum(event_count)\"}}}}}";
-    SolrQuery solrQuery = queryGenerator.commonAuditFilterQuery(searchCriteria);
-    SolrUtil.setJSONFacet(solrQuery, jsonUserQuery);
-    SolrUtil.setRowCount(solrQuery, 0);
-    try {
-      VBarDataList vBarDataList = new VBarDataList();
-      QueryResponse queryResponse = auditSolrDao.process(solrQuery);
-      if(queryResponse == null){
-        return convertObjToString(vBarDataList);
-      }
-
-      NamedList<Object> namedList = queryResponse.getResponse();
-      if (namedList == null) {
-        return convertObjToString(vBarDataList);
-      }
-
-      @SuppressWarnings("unchecked")
-      SimpleOrderedMap<Object> jsonFacetResponse = (SimpleOrderedMap<Object>) namedList.get("facets");
-
-      vBarDataList = BizUtil.buildSummaryForTopCounts(jsonFacetResponse,"Repo","Users");
-      return convertObjToString(vBarDataList);
-
-    } catch (SolrServerException | SolrException | IOException e) {
-      logger.error("Error during solrQuery=" + solrQuery, e);
-      throw RESTErrorUtil.createRESTException(MessageEnums.SOLR_ERROR.getMessage().getMessage(), MessageEnums.ERROR_SYSTEM);
-    }
-  }
-
-  @SuppressWarnings("unchecked")
-  public String getRequestUserLineGraph(SearchCriteria searchCriteria) {
-
-    String from = getFrom((String) searchCriteria.getParamValue("startTime"));
-    String to = getTo((String) searchCriteria.getParamValue("endTime"));
-    String unit = getUnit((String) searchCriteria.getParamValue("unit"));
-    
-    SolrQuery solrQuery = queryGenerator.commonAuditFilterQuery(searchCriteria);
-
-    VBarDataList dataList = new VBarDataList();
-    List<VBarGraphData> histogramData = new ArrayList<VBarGraphData>();
-
-    SolrUtil.setFacetSort(solrQuery, LogSearchConstants.FACET_INDEX);
-
-    String jsonHistogramQuery = queryGenerator.buildJSONFacetTermTimeRangeQuery(LogSearchConstants.AUDIT_REQUEST_USER,
-        LogSearchConstants.AUDIT_EVTTIME, from, to, unit).replace("\\", "");
-
-    try {
-      SolrUtil.setJSONFacet(solrQuery, jsonHistogramQuery);
-      SolrUtil.setRowCount(solrQuery, 0);
-      QueryResponse response = auditSolrDao.process(solrQuery);
-      if (response == null){
-        return convertObjToString(dataList);
-      }
-      SimpleOrderedMap<Object> jsonFacetResponse = (SimpleOrderedMap<Object>) response.getResponse().get("facets");
-
-      if (jsonFacetResponse == null || jsonFacetResponse.toString().equals("{count=0}")) {
-        return convertObjToString(dataList);
-      }
-      extractValuesFromBucket(jsonFacetResponse, "x", "y", histogramData);
-
-      dataList.setGraphData(histogramData);
-      return convertObjToString(dataList);
-
-    } catch (SolrException | IOException | SolrServerException e) {
-      logger.error("Error during solrQuery=" + solrQuery, e);
-      throw RESTErrorUtil.createRESTException(MessageEnums.SOLR_ERROR.getMessage().getMessage(), MessageEnums.ERROR_SYSTEM);
-    }
-
-  }
-
-  public String getAuditLogsSchemaFieldsName() {
-    String excludeArray[] = PropertiesHelper.getPropertyStringList("logsearch.solr.audit.logs.exclude.columnlist");
-    List<String> fieldNames = new ArrayList<String>();
-    HashMap<String, String> uiFieldColumnMapping = new HashMap<String, String>();
-    ConfigHelper.getSchemaFieldsName(excludeArray, fieldNames,auditSolrDao);
-
-    for (String fieldName : fieldNames) {
-      String uiField = ConfigHelper.auditLogsColumnMapping.get(fieldName + LogSearchConstants.SOLR_SUFFIX);
-      if (uiField == null) {
-        uiFieldColumnMapping.put(fieldName, fieldName);
-      } else {
-        uiFieldColumnMapping.put(fieldName, uiField);
-      }
-    }
-
-    uiFieldColumnMapping = BizUtil.sortHashMapByValues(uiFieldColumnMapping);
-    return convertObjToString(uiFieldColumnMapping);
-
-  }
-
-  public String getAnyGraphData(SearchCriteria searchCriteria) {
-    searchCriteria.addParam("fieldTime", LogSearchConstants.AUDIT_EVTTIME);
-    SolrQuery solrQuery = queryGenerator.commonAuditFilterQuery(searchCriteria);
-    VBarDataList result = graphDataGenerator.getAnyGraphData(searchCriteria, auditSolrDao, solrQuery);
-    if (result == null) {
-      result = new VBarDataList();
-    }
-    return convertObjToString(result);
-
-  }
-
-  @SuppressWarnings("unchecked")
-  private void extractValuesFromBucket(SimpleOrderedMap<Object> jsonFacetResponse, String outerField, String innerField,
-      List<VBarGraphData> histogramData) {
-    NamedList<Object> stack = (NamedList<Object>) jsonFacetResponse.get(outerField);
-    ArrayList<Object> stackBuckets = (ArrayList<Object>) stack.get("buckets");
-    for (Object temp : stackBuckets) {
-      VBarGraphData vBarGraphData = new VBarGraphData();
-
-      SimpleOrderedMap<Object> level = (SimpleOrderedMap<Object>) temp;
-      String name = ((String) level.getVal(0)).toUpperCase();
-      vBarGraphData.setName(name);
-
-      Collection<VNameValue> vNameValues = new ArrayList<VNameValue>();
-      vBarGraphData.setDataCounts(vNameValues);
-      ArrayList<Object> levelBuckets = (ArrayList<Object>) ((NamedList<Object>) level.get(innerField)).get("buckets");
-      for (Object temp1 : levelBuckets) {
-        SimpleOrderedMap<Object> countValue = (SimpleOrderedMap<Object>) temp1;
-        String value = DateUtil.convertDateWithMillisecondsToSolrDate((Date) countValue.getVal(0));
-
-        String count = "" + countValue.getVal(1);
-        VNameValue vNameValue = new VNameValue();
-        vNameValue.setName(value);
-        vNameValue.setValue(count);
-        vNameValues.add(vNameValue);
-      }
-      histogramData.add(vBarGraphData);
-    }
-  }
-
-  @SuppressWarnings({"unchecked"})
-  public Response exportUserTableToTextFile(SearchCriteria searchCriteria) {
-    String jsonUserQuery =
-        "{ Users: { type: terms, field: reqUser, facet:  {Repo: {  type: terms, field: repo, facet: {  eventCount: \"sum(event_count)\"}}}},x:{ type: terms,field: resource, facet: {y: {  type: terms, field: repo,facet: {  eventCount: \"sum(event_count)\"}}}}}";
-
-    SolrQuery solrQuery = queryGenerator.commonAuditFilterQuery(searchCriteria);
-    String startTime = (String) searchCriteria.getParamValue("startTime");
-    String endTime = (String) searchCriteria.getParamValue("endTime");
-
-    startTime = startTime == null ? "" : startTime;
-    endTime = endTime == null ? "" : "_" + endTime;
-
-    SolrUtil.setJSONFacet(solrQuery, jsonUserQuery);
-    SolrUtil.setRowCount(solrQuery, 0);
-
-    String dataFormat = (String) searchCriteria.getParamValue("format");
-    FileOutputStream fis = null;
-    try {
-      QueryResponse queryResponse = auditSolrDao.process(solrQuery);
-      if(queryResponse == null){
-        VResponse response = new VResponse();
-        response.setMsgDesc("Query was not able to execute "+solrQuery);
-        throw RESTErrorUtil.createRESTException(response);
-      }
-
-      NamedList<Object> namedList = queryResponse.getResponse();
-      if (namedList == null) {
-        VResponse response = new VResponse();
-        response.setMsgDesc("Query was not able to execute "+solrQuery);
-        throw RESTErrorUtil.createRESTException(response);
-      }
-      VBarDataList vBarUserDataList = new VBarDataList();
-      VBarDataList vBarResourceDataList = new VBarDataList();
-
-      SimpleOrderedMap<Object> jsonFacetResponse = (SimpleOrderedMap<Object>) namedList.get("facets");
-      vBarUserDataList = BizUtil.buildSummaryForTopCounts(jsonFacetResponse,"Repo","Users");
-      vBarResourceDataList = BizUtil.buildSummaryForTopCounts(jsonFacetResponse,"y","x");
-      String data = "";
-      String summary = "";
-      if ("text".equals(dataFormat)) {
-        int users = 0;
-        int resources = 0;
-        summary += "\n\n\n\n";
-        data += addBlank("Users") + "Components/Access" + "\n";
-        data += "--------------------------------------------------------------------------\n";
-        Collection<VBarGraphData> tableUserData = vBarUserDataList.getGraphData();
-        for (VBarGraphData graphData : tableUserData) {
-          String userName = graphData.getName();
-          String largeUserName = "";
-
-          if (userName.length() > 45) {
-            largeUserName = userName.substring(0, 45);
-            data += addBlank(largeUserName);
-          } else
-            data += addBlank(userName);
-
-          Collection<VNameValue> vnameValueList = graphData.getDataCount();
-          int count = 0;
-          String blank = "";
-          for (VNameValue vNameValue : vnameValueList) {
-            data += blank + vNameValue.getName() + " " + vNameValue.getValue() + "\n";
-            if (count == 0)
-              blank = addBlank(blank);
-            count++;
-
-          }
-          while (largeUserName.length() > 0) {
-            data += largeUserName.substring(0, 45) + "\n";
-          }
-
-          users += 1;
-        }
-        data += "\n\n\n\n\n\n";
-        data += addBlank("Resources") + "Components/Access" + "\n";
-        data += "--------------------------------------------------------------------------\n";
-        Collection<VBarGraphData> tableResourceData = vBarResourceDataList.getGraphData();
-        for (VBarGraphData graphData : tableResourceData) {
-          String resourceName = graphData.getName();
-          String largeResourceName = resourceName;
-          if (largeResourceName.length() > 45) {
-            resourceName = largeResourceName.substring(0, 45);
-            largeResourceName = largeResourceName.substring(45, largeResourceName.length());
-          } else {
-            largeResourceName = "";
-          }
-
-          //resourceName = resourceName.replaceAll("(.{45})", resourceName.substring(0, 45)+"\n");
-          data += addBlank(resourceName);
-          Collection<VNameValue> vnameValueList = graphData.getDataCount();
-          int count = 0;
-          String blank = "";
-          for (VNameValue vNameValue : vnameValueList) {
-            data += blank + vNameValue.getName() + " " + vNameValue.getValue() + "\n";
-            if (count == 0)
-              blank = addBlank(blank);
-            count++;
-          }
-          String tempLargeResourceName = largeResourceName;
-          while (largeResourceName.length() > 45) {
-            largeResourceName = tempLargeResourceName.substring(0, 45);
-            tempLargeResourceName = tempLargeResourceName.substring(45, tempLargeResourceName.length());
-            data += largeResourceName + "\n";
-          }
-          if (largeResourceName.length() < 45 && !largeResourceName.isEmpty()) {
-            data += largeResourceName + "\n";
-          }
-          resources += 1;
-        }
-        String header = "--------------------------------SUMMARY-----------------------------------\n";
-        summary = header + "Users  = " + users + "\nResources  = " + resources + "\n" + summary;
-        data = summary + data;
-      } else {
-        data = "{" + convertObjToString(vBarUserDataList) + "," + convertObjToString(vBarResourceDataList) + "}";
-        dataFormat = "json";
-      }
-      String fileName = "Users_Resource" + startTime + endTime + ".";
-      File file = File.createTempFile(fileName, dataFormat);
-
-      fis = new FileOutputStream(file);
-      fis.write(data.getBytes());
-      return Response
-        .ok(file, MediaType.APPLICATION_OCTET_STREAM)
-        .header("Content-Disposition", "attachment;filename=" + fileName + dataFormat)
-        .build();
-
-    } catch (SolrServerException | SolrException | IOException e) {
-      logger.error("Error during solrQuery=" + e);
-      throw RESTErrorUtil.createRESTException(MessageEnums.SOLR_ERROR.getMessage().getMessage(), MessageEnums.ERROR_SYSTEM);
-    } finally {
-      if (fis != null) {
-        try {
-          fis.close();
-        } catch (IOException e) {
-        }
-      }
-    }
-  }
-
-  private String addBlank(String field) {
-    int blanks = 50;
-    int strSize = field.length();
-    String fieldWithBlank = field;
-    for (int i = 0; i < blanks - strSize; i++) {
-      fieldWithBlank += " ";
-    }
-    return fieldWithBlank;
-  }
-
-  public String getServiceLoad(SearchCriteria searchCriteria) {
-    VBarDataList dataList = new VBarDataList();
-    Collection<VBarGraphData> vaDatas = new ArrayList<VBarGraphData>();
-    dataList.setGraphData(vaDatas);
-
-    SolrQuery serivceLoadQuery = queryGenerator.commonAuditFilterQuery(searchCriteria);
-
-    try {
-      SolrUtil.setFacetField(serivceLoadQuery, LogSearchConstants.AUDIT_COMPONENT);
-      QueryResponse serviceLoadResponse = auditSolrDao.process(serivceLoadQuery);
-      if (serviceLoadResponse == null){
-        return convertObjToString(dataList);
-      }
-      FacetField serviceFacetField =serviceLoadResponse.getFacetField(LogSearchConstants.AUDIT_COMPONENT);
-      if (serviceFacetField == null) {
-        return convertObjToString(dataList);
-      }
-      
-      List<Count> serviceLoadFacets = serviceFacetField.getValues();
-      if (serviceLoadFacets == null) {
-        return convertObjToString(dataList);
-      }
-      for (Count cnt : serviceLoadFacets) {
-        List<VNameValue> valueList = new ArrayList<VNameValue>();
-        VBarGraphData vBarGraphData = new VBarGraphData();
-        vaDatas.add(vBarGraphData);
-        VNameValue vNameValue = new VNameValue();
-        vNameValue.setName(cnt.getName());
-        vBarGraphData.setName(cnt.getName().toUpperCase());
-        vNameValue.setValue("" + cnt.getCount());
-        valueList.add(vNameValue);
-        vBarGraphData.setDataCounts(valueList);
-      }
-
-      return convertObjToString(dataList);
-
-    } catch (SolrException | SolrServerException | IOException e) {
-      logger.error("Error during solrQuery=" + e);
-      throw RESTErrorUtil.createRESTException(MessageEnums.SOLR_ERROR.getMessage().getMessage(), MessageEnums.ERROR_SYSTEM);
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/manager/JsonManagerBase.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/manager/JsonManagerBase.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/manager/JsonManagerBase.java
new file mode 100644
index 0000000..94191e0
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/manager/JsonManagerBase.java
@@ -0,0 +1,69 @@
+/*
+ * 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.manager;
+
+import com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
+import com.google.gson.JsonDeserializationContext;
+import com.google.gson.JsonDeserializer;
+import com.google.gson.JsonElement;
+import com.google.gson.JsonParseException;
+import com.google.gson.JsonPrimitive;
+import com.google.gson.JsonSerializationContext;
+import com.google.gson.JsonSerializer;
+
+import java.util.Date;
+
+public class JsonManagerBase {
+
+  private JsonSerializer<Date> jsonDateSerialiazer = null;
+  private JsonDeserializer<Date> jsonDateDeserialiazer = null;
+
+  public JsonManagerBase() {
+    jsonDateSerialiazer = new JsonSerializer<Date>() {
+
+      @Override
+      public JsonElement serialize(Date paramT, java.lang.reflect.Type paramType, JsonSerializationContext paramJsonSerializationContext) {
+        return paramT == null ? null : new JsonPrimitive(paramT.getTime());
+      }
+    };
+
+    jsonDateDeserialiazer = new JsonDeserializer<Date>() {
+
+      @Override
+      public Date deserialize(JsonElement json, java.lang.reflect.Type typeOfT, JsonDeserializationContext context)
+        throws JsonParseException {
+        return json == null ? null : new Date(json.getAsLong());
+      }
+
+    };
+  }
+
+  protected String convertObjToString(Object obj) {
+    if (obj == null) {
+      return "";
+    }
+
+    Gson gson = new GsonBuilder()
+      .registerTypeAdapter(Date.class, jsonDateSerialiazer)
+      .registerTypeAdapter(Date.class, jsonDateDeserialiazer).create();
+
+    return gson.toJson(obj);
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/manager/LogFileManager.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/manager/LogFileManager.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/manager/LogFileManager.java
new file mode 100644
index 0000000..405eaef
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/manager/LogFileManager.java
@@ -0,0 +1,155 @@
+/*
+ * 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.manager;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.ambari.logsearch.common.LogSearchConstants;
+import org.apache.ambari.logsearch.common.MessageEnums;
+import org.apache.ambari.logsearch.model.response.LogFileData;
+import org.apache.ambari.logsearch.model.response.LogFileDataListResponse;
+import org.apache.ambari.logsearch.model.response.LogListResponse;
+import org.apache.ambari.logsearch.model.response.ServiceLogData;
+import org.apache.ambari.logsearch.model.response.ServiceLogResponse;
+import org.apache.ambari.logsearch.query.model.SearchCriteria;
+import org.apache.ambari.logsearch.dao.AuditSolrDao;
+import org.apache.ambari.logsearch.dao.ServiceLogsSolrDao;
+import org.apache.ambari.logsearch.dao.SolrDaoBase;
+import org.apache.ambari.logsearch.util.RESTErrorUtil;
+import org.apache.ambari.logsearch.util.SolrUtil;
+import org.apache.commons.io.FilenameUtils;
+import org.apache.commons.lang.StringUtils;
+import org.apache.log4j.Logger;
+import org.apache.solr.client.solrj.SolrQuery;
+import org.apache.solr.client.solrj.SolrServerException;
+import org.apache.solr.client.solrj.response.FacetField;
+import org.apache.solr.client.solrj.response.FacetField.Count;
+import org.apache.solr.client.solrj.response.QueryResponse;
+import org.apache.solr.common.SolrException;
+import org.springframework.stereotype.Component;
+
+import javax.inject.Inject;
+
+
+@Component
+public class LogFileManager extends ManagerBase<ServiceLogData, ServiceLogResponse> {
+
+  private static final Logger logger = Logger.getLogger(LogFileManager.class);
+
+  @Inject
+  private ServiceLogsSolrDao serviceLogsSolrDao;
+  @Inject
+  private AuditSolrDao auditSolrDao;
+
+  public LogFileDataListResponse searchLogFiles(SearchCriteria searchCriteria) {
+    LogFileDataListResponse logFileList = new LogFileDataListResponse();
+    List<LogFileData> logFiles = new ArrayList<LogFileData>();
+    String componentName = (String) searchCriteria.getParamValue("component");
+    String host = (String) searchCriteria.getParamValue("host");
+    int minCount = 1;// to remove zero count facet
+    SolrQuery solrQuery = new SolrQuery();
+    SolrUtil.setMainQuery(solrQuery, null);
+    SolrUtil.setFacetFieldWithMincount(solrQuery, LogSearchConstants.SOLR_PATH, minCount);
+    // adding filter
+    queryGenerator.setSingleIncludeFilter(solrQuery, LogSearchConstants.SOLR_COMPONENT, componentName);
+    queryGenerator.setSingleIncludeFilter(solrQuery, LogSearchConstants.SOLR_HOST, host);
+    try {
+      String logType = (String) searchCriteria.getParamValue("logType");
+      if (StringUtils.isBlank(logType)) {
+        logType = LogType.SERVICE.name();// default is service Log
+      }
+      SolrDaoBase daoMgr = null;
+      if (logType.equalsIgnoreCase(LogType.SERVICE.name())) {
+        daoMgr = serviceLogsSolrDao;
+      } else if (logType.equalsIgnoreCase(LogType.AUDIT.name())) {
+        daoMgr = auditSolrDao;
+      } else {
+        throw RESTErrorUtil.createRESTException(logType + " is not a valid logType", MessageEnums.INVALID_INPUT_DATA);
+      }
+      QueryResponse queryResponse = daoMgr.process(solrQuery);
+      if (queryResponse.getFacetField(LogSearchConstants.SOLR_PATH) != null) {
+        FacetField queryFacetField = queryResponse.getFacetField(LogSearchConstants.SOLR_PATH);
+        if (queryFacetField != null) {
+          List<Count> countList = queryFacetField.getValues();
+          for (Count count : countList) {
+            LogFileData vLogFile = new LogFileData();
+            String filePath = count.getName();
+            String fileName = FilenameUtils.getName(filePath);
+            vLogFile.setPath(filePath);
+            vLogFile.setName(fileName);
+            logFiles.add(vLogFile);
+          }
+        }
+      }
+    } catch (SolrException | SolrServerException | IOException e) {
+      logger.error("Error in solr query  :" + e.getLocalizedMessage() + "\n Query :" + solrQuery.toQueryString(), e.getCause());
+      throw RESTErrorUtil.createRESTException(MessageEnums.SOLR_ERROR.getMessage().getMessage(), MessageEnums.ERROR_SYSTEM);
+    }
+    logFileList.setLogFiles(logFiles);
+
+    return logFileList;
+  }
+
+  public LogListResponse getLogFileTail(SearchCriteria searchCriteria) {
+    String host = (String) searchCriteria.getParamValue("host");
+    String logFile = (String) searchCriteria.getParamValue("name");
+    String component = (String) searchCriteria.getParamValue("component");
+    String tailSize = (String) searchCriteria.getParamValue("tailSize");
+    if (StringUtils.isBlank(host)) {
+      throw RESTErrorUtil.createRESTException("missing Host Name", MessageEnums.ERROR_SYSTEM);
+    }
+    tailSize = (StringUtils.isBlank(tailSize)) ? "10" : tailSize;
+    SolrQuery logFileTailQuery = new SolrQuery();
+    try {
+      int tail = Integer.parseInt(tailSize);
+      tail = tail > 100 ? 100 : tail;
+      SolrUtil.setMainQuery(logFileTailQuery, null);
+      queryGenerator.setSingleIncludeFilter(logFileTailQuery, LogSearchConstants.SOLR_HOST, host);
+      if (!StringUtils.isBlank(logFile)) {
+        queryGenerator.setSingleIncludeFilter(logFileTailQuery, LogSearchConstants.SOLR_PATH, SolrUtil.makeSolrSearchString(logFile));
+      } else if (!StringUtils.isBlank(component)) {
+        queryGenerator.setSingleIncludeFilter(logFileTailQuery, LogSearchConstants.SOLR_COMPONENT, component);
+      } else {
+        throw RESTErrorUtil.createRESTException("component or logfile parameter must be present", MessageEnums.ERROR_SYSTEM);
+      }
+
+      SolrUtil.setRowCount(logFileTailQuery, tail);
+      queryGenerator.setSortOrderDefaultServiceLog(logFileTailQuery, new SearchCriteria());
+      return getLogAsPaginationProvided(logFileTailQuery, serviceLogsSolrDao);
+
+    } catch (NumberFormatException ne) {
+
+      throw RESTErrorUtil.createRESTException(ne.getMessage(),
+        MessageEnums.ERROR_SYSTEM);
+
+    }
+  }
+
+  @Override
+  protected List<ServiceLogData> convertToSolrBeans(QueryResponse response) {
+    throw new UnsupportedOperationException();
+  }
+
+  @Override
+  protected ServiceLogResponse createLogSearchResponse() {
+    throw new UnsupportedOperationException();
+  }
+}


[38/58] [abbrv] ambari git commit: AMBARI-18310. Logsearch - Refactor solr query layer (oleewere)

Posted by ol...@apache.org.
http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/QueryGeneration.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/QueryGeneration.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/QueryGeneration.java
deleted file mode 100644
index 8095faf..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/QueryGeneration.java
+++ /dev/null
@@ -1,340 +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.query;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Locale;
-
-import org.apache.ambari.logsearch.common.LogSearchConstants;
-import org.apache.ambari.logsearch.common.PropertiesHelper;
-import org.apache.ambari.logsearch.conf.SolrAuditLogPropsConfig;
-import org.apache.ambari.logsearch.conf.SolrServiceLogPropsConfig;
-import org.apache.ambari.logsearch.query.model.CommonSearchCriteria;
-import org.apache.ambari.logsearch.query.model.CommonServiceLogSearchCriteria;
-import org.apache.ambari.logsearch.query.model.SearchCriteria;
-import org.apache.ambari.logsearch.dao.SolrDaoBase;
-import org.apache.ambari.logsearch.manager.ManagerBase.LogType;
-import org.apache.ambari.logsearch.util.JSONUtil;
-import org.apache.ambari.logsearch.util.SolrUtil;
-import org.apache.commons.lang.StringUtils;
-import org.apache.log4j.Logger;
-import org.apache.lucene.analysis.core.KeywordTokenizerFactory;
-import org.apache.lucene.analysis.path.PathHierarchyTokenizerFactory;
-import org.apache.lucene.analysis.standard.StandardTokenizerFactory;
-import org.apache.solr.client.solrj.SolrQuery;
-import org.apache.solr.schema.TrieDoubleField;
-import org.apache.solr.schema.TrieFloatField;
-import org.apache.solr.schema.TrieLongField;
-import org.springframework.stereotype.Component;
-
-import javax.inject.Inject;
-
-@Component
-public class QueryGeneration extends QueryGenerationBase {
-
-  private static Logger logger = Logger.getLogger(QueryGeneration.class);
-
-  @Inject
-  private SolrServiceLogPropsConfig solrServiceLogPropsConfig;
-
-  @Inject
-  private SolrAuditLogPropsConfig solrAuditLogPropsConfig;
-
-  public SolrQuery commonServiceFilterQuery(CommonServiceLogSearchCriteria searchCriteria) {
-    LogType logType = LogType.SERVICE;
-    SolrQuery solrQuery = new SolrQuery();
-    // TODO: check these are used from the UI or not
-    String globalExcludeComp = (String) searchCriteria.getParamValue("gMustNot");
-    String unselectedComp = (String) searchCriteria.getParamValue("unselectComp");
-
-    String givenQuery = (String) searchCriteria.getParamValue("q");
-    String level = searchCriteria.getLevel();
-    String startTime = searchCriteria.getFrom();
-    String endTime = searchCriteria.getTo();
-    String iMessage = searchCriteria.getIncludeMessage();
-    String eMessage = searchCriteria.getExcludeMessage();
-    String selectedComp = searchCriteria.getSelectComp();
-    String bundleId = searchCriteria.getBundleId();
-    String urlHostName = searchCriteria.getHostName();
-    String urlComponentName = searchCriteria.getComponentName();
-    String file_name = searchCriteria.getFileName();
-
-    SolrUtil.setMainQuery(solrQuery, givenQuery);
-
-    setSingleRangeFilter(solrQuery, LogSearchConstants.LOGTIME, startTime, endTime);
-    addFilter(solrQuery, selectedComp, LogSearchConstants.SOLR_COMPONENT, Condition.OR);
-
-    setFilterClauseWithFieldName(solrQuery, level, LogSearchConstants.SOLR_LEVEL, LogSearchConstants.NO_OPERATOR, Condition.OR);
-
-    setFilterClauseForSolrSearchableString(solrQuery, iMessage, Condition.OR, LogSearchConstants.NO_OPERATOR, LogSearchConstants.SOLR_KEY_LOG_MESSAGE);
-    setFilterClauseForSolrSearchableString(solrQuery, eMessage, Condition.AND, LogSearchConstants.MINUS_OPERATOR, LogSearchConstants.SOLR_KEY_LOG_MESSAGE);
-
-    applyLogFileFilter(solrQuery, searchCriteria);
-
-    setFilterClauseWithFieldName(solrQuery, globalExcludeComp, LogSearchConstants.SOLR_COMPONENT, LogSearchConstants.MINUS_OPERATOR, Condition.AND);
-    setFilterClauseWithFieldName(solrQuery, unselectedComp, LogSearchConstants.SOLR_COMPONENT, LogSearchConstants.MINUS_OPERATOR, Condition.AND);
-
-    urlHostName = SolrUtil.escapeQueryChars(urlHostName);
-    setSingleIncludeFilter(solrQuery, LogSearchConstants.SOLR_HOST, urlHostName);
-    urlComponentName = SolrUtil.escapeQueryChars(urlComponentName);
-    setSingleIncludeFilter(solrQuery, LogSearchConstants.SOLR_COMPONENT, urlComponentName);
-
-    setPagination(solrQuery, searchCriteria);
-    setSortOrderDefaultServiceLog(solrQuery, searchCriteria);
-    setSingleIncludeFilter(solrQuery, LogSearchConstants.BUNDLE_ID, bundleId);
-    file_name = SolrUtil.escapeQueryChars(file_name);
-    setSingleIncludeFilter(solrQuery, LogSearchConstants.SOLR_PATH, file_name);
-    setUserSpecificFilter(searchCriteria, solrQuery, LogSearchConstants.INCLUDE_QUERY, LogSearchConstants.INCLUDE_QUERY, logType);
-    setUserSpecificFilter(searchCriteria, solrQuery, LogSearchConstants.EXCLUDE_QUERY, LogSearchConstants.EXCLUDE_QUERY, logType);
-    
-    return solrQuery;
-  }
-
-  public void applyLogFileFilter(SolrQuery solrQuery, SearchCriteria searchCriteria) {
-    String hostLogFile = (String) searchCriteria.getParamValue("hostLogFile");
-    String compLogFile = (String) searchCriteria.getParamValue("compLogFile");
-    String givenQuery = (String) searchCriteria.getParamValue("q");
-    String logfileQuery = "";
-    if (!StringUtils.isBlank(hostLogFile) && !StringUtils.isBlank(compLogFile)) {
-      logfileQuery = LogSearchConstants.SOLR_HOST + ":" + hostLogFile + " " + Condition.AND + " " +
-          LogSearchConstants.SOLR_COMPONENT + ":" + compLogFile;
-      if (!StringUtils.isBlank(givenQuery)) {
-        logfileQuery = "(" + givenQuery + ") " + Condition.AND + " (" + logfileQuery + ")";
-      }
-      if (!StringUtils.isBlank(logfileQuery)) {
-        solrQuery.addFilterQuery(logfileQuery);
-      }
-    }
-  }
-
-  private void setUserSpecificFilter(SearchCriteria searchCriteria, SolrQuery solrQuery, String paramName, String operation,
-      LogType logType) {
-    String queryString = (String) searchCriteria.getParamValue(paramName);
-    if (StringUtils.isBlank(queryString)) {
-      queryString = null;
-    }
-    List<String> conditionQuries = new ArrayList<String>();
-    List<String> referalConditionQuries = new ArrayList<String>();
-    List<String> elments = new ArrayList<String>();
-    List<HashMap<String, Object>> queryList = JSONUtil.jsonToMapObjectList(queryString);
-    if (queryList != null && queryList.size() > 0) {
-      for (HashMap<String, Object> columnListMap : queryList) {
-        String orQuery = "";
-        StringBuilder field = new StringBuilder();
-        if (columnListMap != null) {
-          for (String key : columnListMap.keySet()) {
-            if (!StringUtils.isBlank(key)) {;
-              String value = getOriginalValue(key, "" + columnListMap.get(key));
-              orQuery = putWildCardByType(value, key, logType);
-              if (StringUtils.isBlank(orQuery)) {
-                logger.debug("Removing invalid filter for key :"+key +" and value :" +value );
-                continue;
-              }
-              boolean isSame = false;
-              if (elments.contains(key)) {
-                isSame = true;
-              }
-              if (isSame && !operation.equals(LogSearchConstants.EXCLUDE_QUERY)) {
-                for (String tempCondition : conditionQuries) {
-                  if (tempCondition.contains(key)) {
-                    String newCondtion = tempCondition + " " + Condition.OR.name() + " " + orQuery;
-                    referalConditionQuries.remove(tempCondition);
-                    referalConditionQuries.add(newCondtion);
-                  }
-                }
-                conditionQuries.clear();
-                conditionQuries.addAll(referalConditionQuries);
-              } else {
-                conditionQuries.add(orQuery);
-                referalConditionQuries.add(orQuery);
-              }
-              field.append(key);
-              elments.add(field.toString());
-            }
-          }
-        }
-      }
-    }
-    if (!referalConditionQuries.isEmpty() && !StringUtils.isBlank(operation)) {
-      if (operation.equals(LogSearchConstants.INCLUDE_QUERY)) {
-        for (String filter : referalConditionQuries) {
-          if (!StringUtils.isBlank(filter)) {
-            solrQuery.addFilterQuery(filter);
-          }
-        }
-      } else if (operation.equals(LogSearchConstants.EXCLUDE_QUERY)) {
-        for (String filter : referalConditionQuries) {
-          if (!StringUtils.isBlank(filter)) {
-            filter = LogSearchConstants.MINUS_OPERATOR + filter;
-            solrQuery.addFilterQuery(filter);
-          }
-        }
-      }
-    }
-  }
-
-  public SolrQuery commonAuditFilterQuery(CommonSearchCriteria searchCriteria) {
-    LogType logType = LogType.AUDIT;
-    SolrQuery solrQuery = new SolrQuery();
-    solrQuery.setQuery("*:*");
-
-    String startTime = searchCriteria.getStartTime();
-    String endTime = searchCriteria.getEndTime();
-    String selectedComp = searchCriteria.getMustBe();
-    setFilterClauseWithFieldName(solrQuery, selectedComp, LogSearchConstants.AUDIT_COMPONENT, LogSearchConstants.NO_OPERATOR, Condition.OR);
-    setUserSpecificFilter(searchCriteria, solrQuery, LogSearchConstants.INCLUDE_QUERY, LogSearchConstants.INCLUDE_QUERY, logType);
-    setUserSpecificFilter(searchCriteria, solrQuery, LogSearchConstants.EXCLUDE_QUERY, LogSearchConstants.EXCLUDE_QUERY, logType);
-    setSingleRangeFilter(solrQuery, LogSearchConstants.AUDIT_EVTTIME, startTime, endTime);
-    setPagination(solrQuery, searchCriteria);
-    try {
-      if (searchCriteria.getSortBy() == null || searchCriteria.getSortBy().isEmpty()) {
-        searchCriteria.setSortBy(LogSearchConstants.AUDIT_EVTTIME);
-        searchCriteria.setSortType(SolrQuery.ORDER.desc.toString());
-      }
-    } catch (Exception e) {
-      searchCriteria.setSortBy(LogSearchConstants.AUDIT_EVTTIME);
-      searchCriteria.setSortType(SolrQuery.ORDER.desc.toString());
-    }
-    setSortOrderDefaultServiceLog(solrQuery, searchCriteria);
-    return solrQuery;
-  }
-
-  private String putWildCardByType(String str, String key, LogType logType) {
-    String fieldType;
-    SolrDaoBase solrDaoBase = null;
-    switch (logType) {
-    case AUDIT:
-      fieldType = auditSolrDao.schemaFieldNameMap.get(key);
-      solrDaoBase = auditSolrDao;
-      break;
-    case SERVICE:
-      fieldType = serviceLogsSolrDao.schemaFieldNameMap.get(key);
-      solrDaoBase = serviceLogsSolrDao;
-      if (key.equalsIgnoreCase(LogSearchConstants.SOLR_LOG_MESSAGE)) {
-        return SolrUtil.escapeForLogMessage(key, str);
-      }
-      break;
-    default:
-      // set as null
-      logger.error("Invalid logtype :" + logType);
-      fieldType = null;
-    }
-    if (!StringUtils.isBlank(fieldType)) {
-      if (SolrUtil.isSolrFieldNumber(fieldType, solrDaoBase)) {
-        String value = putEscapeCharacterForNumber(str, fieldType,solrDaoBase);
-        if (!StringUtils.isBlank(value)) {
-          return key + ":" + value;
-        } else {
-          return null;
-        }
-      } else if (checkTokenizer(fieldType, StandardTokenizerFactory.class,solrDaoBase)) {
-        return key + ":" + SolrUtil.escapeForStandardTokenizer(str);
-      } else if (checkTokenizer(fieldType, KeywordTokenizerFactory.class,solrDaoBase)|| "string".equalsIgnoreCase(fieldType)) {
-        return key + ":" + SolrUtil.makeSolrSearchStringWithoutAsterisk(str);
-      } else if (checkTokenizer(fieldType, PathHierarchyTokenizerFactory.class,solrDaoBase)) {
-        return key + ":" + str;
-      }
-    }
-   return key + ":" + "*" + str + "*";
-  }
-
-  private String putEscapeCharacterForNumber(String str,String fieldType,SolrDaoBase solrDaoBase) {
-    if (!StringUtils.isBlank(str)) {
-      str = str.replace("*", "");
-    }
-    String escapeCharSting = parseInputValueAsPerFieldType(str,fieldType,solrDaoBase);
-    if (escapeCharSting == null || escapeCharSting.isEmpty()) {
-      return null;
-    }
-    escapeCharSting = escapeCharSting.replace("-", "\\-");
-    return escapeCharSting;
-  }
-
-  private String parseInputValueAsPerFieldType(String str,String fieldType,SolrDaoBase solrDaoBase ) {
-    try {
-      HashMap<String, Object> fieldTypeInfoMap= SolrUtil.getFieldTypeInfoMap(fieldType,solrDaoBase);
-      String className = (String) fieldTypeInfoMap.get("class");
-      if( className.equalsIgnoreCase(TrieDoubleField.class.getSimpleName())){
-        return ""+ Double.parseDouble(str);
-      }else if(className.equalsIgnoreCase(TrieFloatField.class.getSimpleName())){
-        return ""+ Float.parseFloat(str);
-      }else if(className.equalsIgnoreCase(TrieLongField.class.getSimpleName())){
-        return ""+ Long.parseLong(str);
-      }else {
-        return "" + Integer.parseInt(str);
-      }
-    } catch (Exception e) {
-      logger.debug("Invaid input str: " + str + " For fieldType :" + fieldType);
-      return null;
-    }
-  }
-
-  private String getOriginalValue(String name, String value) {
-    String solrValue = PropertiesHelper.getProperty(name);
-    if (StringUtils.isBlank(solrValue)) {
-      return value;
-    }
-    try {
-      String propertyFieldMappings[] = solrValue.split(LogSearchConstants.LIST_SEPARATOR);
-      if (propertyFieldMappings.length > 0) {
-        HashMap<String, String> propertyFieldValue = new HashMap<String, String>();
-        for (String temp : propertyFieldMappings) {
-          if (!StringUtils.isBlank(temp)) {
-            String arrayValue[] = temp.split(":");
-            if (arrayValue.length > 1) {
-              propertyFieldValue.put(arrayValue[0].toLowerCase(Locale.ENGLISH), arrayValue[1].toLowerCase(Locale.ENGLISH));
-            } else {
-              logger.warn("array length is less than required length 1");
-            }
-          }
-        }
-        String originalValue = propertyFieldValue.get(value.toLowerCase(Locale.ENGLISH));
-        if (!StringUtils.isBlank(originalValue)) {
-          return originalValue;
-        }
-      }
-    } catch (Exception e) {
-      // do nothing
-    }
-    return value;
-  }
-
-
-  private boolean checkTokenizer(String fieldType, Class tokenizerFactoryClass, SolrDaoBase solrDaoBase) {
-    HashMap<String, Object> fieldTypeMap = SolrUtil.getFieldTypeInfoMap(fieldType,solrDaoBase);
-    HashMap<String, Object> analyzer = (HashMap<String, Object>) fieldTypeMap.get("analyzer");
-    if (analyzer != null) {
-      HashMap<String, Object> tokenizerMap = (HashMap<String, Object>) analyzer.get("tokenizer");
-      if (tokenizerMap != null) {
-        String tokenizerClass = (String) tokenizerMap.get("class");
-        if (!StringUtils.isEmpty(tokenizerClass)) {
-          tokenizerClass =tokenizerClass.replace("solr.", "");
-          if (tokenizerClass.equalsIgnoreCase(tokenizerFactoryClass
-              .getSimpleName())) {
-            return true;
-          }
-        }
-      }
-    }
-    return false;
-  }
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/QueryGenerationBase.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/QueryGenerationBase.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/QueryGenerationBase.java
deleted file mode 100644
index 536f41c..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/QueryGenerationBase.java
+++ /dev/null
@@ -1,282 +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.query;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.ambari.logsearch.common.LogSearchConstants;
-import org.apache.ambari.logsearch.query.model.SearchCriteria;
-import org.apache.ambari.logsearch.dao.AuditSolrDao;
-import org.apache.ambari.logsearch.dao.ServiceLogsSolrDao;
-import org.apache.ambari.logsearch.util.SolrUtil;
-import org.apache.commons.lang.StringUtils;
-import org.apache.log4j.Logger;
-import org.apache.solr.client.solrj.SolrQuery;
-import org.apache.solr.client.solrj.SolrQuery.ORDER;
-
-import com.google.gson.Gson;
-
-import javax.inject.Inject;
-
-public abstract class QueryGenerationBase {
-
-  private static final Logger logger = Logger.getLogger(QueryGenerationBase.class);
-  
-  @Inject
-  protected AuditSolrDao auditSolrDao;
-  
-  @Inject
-  protected ServiceLogsSolrDao serviceLogsSolrDao;
-
-  public enum Condition {
-    OR, AND
-  }
-
-  // SetMethods to apply to the query
-  protected void setFilterClauseForSolrSearchableString(SolrQuery solrQuery, String commaSepratedString, Condition condition,
-      String operator, String messageField) {
-    String filterQuery = "";
-    if (!StringUtils.isBlank(commaSepratedString)) {
-      StringBuilder queryMsg = new StringBuilder();
-      operator = (operator == null ? LogSearchConstants.NO_OPERATOR : operator);
-      String[] msgList = commaSepratedString.split(LogSearchConstants.I_E_SEPRATOR);
-      int count = 0;
-      for (String temp : msgList) {
-        count += 1;
-        if (LogSearchConstants.SOLR_LOG_MESSAGE.equalsIgnoreCase(messageField)) {
-          queryMsg.append(" " + operator + SolrUtil.escapeForLogMessage(messageField, temp));
-        } else {
-          temp = SolrUtil.escapeForStandardTokenizer(temp);
-          if(temp.startsWith("\"") && temp.endsWith("\"")){
-            temp = temp.substring(1);
-            temp = temp.substring(0, temp.length()-1);
-          }
-          temp = "*" + temp + "*";
-          queryMsg.append(" " + operator + messageField + ":" + temp);
-        }
-        if (msgList.length > count){
-          queryMsg.append(" " + condition.name() + " ");
-        }
-      }
-      filterQuery = queryMsg.toString();
-      solrQuery.addFilterQuery(filterQuery);
-      logger.debug("Filter added :- " + filterQuery);
-    }
-  }
-
-  public void setFilterClauseWithFieldName(SolrQuery solrQuery, String commaSepratedString, String field, String operator,
-      Condition condition) {
-    if (!StringUtils.isBlank(commaSepratedString)) {
-      String[] arrayOfSepratedString = commaSepratedString.split(LogSearchConstants.LIST_SEPARATOR);
-      String filterQuery = null;
-      if (Condition.OR.equals(condition)) {
-        filterQuery = SolrUtil.orList(operator + field, arrayOfSepratedString,"");
-      } else if (Condition.AND.equals(condition)) {
-        filterQuery = SolrUtil.andList(operator + field, arrayOfSepratedString,"");
-      }else{
-        logger.warn("Not a valid condition :" + condition.name());
-      }
-      //add
-      if (!StringUtils.isBlank(filterQuery)){
-        solrQuery.addFilterQuery(filterQuery);
-        logger.debug("Filter added :- " + filterQuery);
-      }
-    }
-  }
-
-  public void setSortOrderDefaultServiceLog(SolrQuery solrQuery, SearchCriteria searchCriteria) {
-    List<SolrQuery.SortClause> defaultSort = new ArrayList<SolrQuery.SortClause>();
-    if (!StringUtils.isBlank(searchCriteria.getSortBy())) {
-      ORDER order = SolrQuery.ORDER.asc;
-      if (!order.toString().equalsIgnoreCase(searchCriteria.getSortType())) {
-        order = SolrQuery.ORDER.desc;
-      }
-      SolrQuery.SortClause logtimeSortClause = SolrQuery.SortClause.create(searchCriteria.getSortBy(), order);
-      defaultSort.add(logtimeSortClause);
-    } else {
-      // by default sorting by logtime and sequence number in Descending order
-      SolrQuery.SortClause logtimeSortClause = SolrQuery.SortClause.create(LogSearchConstants.LOGTIME, SolrQuery.ORDER.desc);
-      defaultSort.add(logtimeSortClause);
-
-    }
-    SolrQuery.SortClause sequenceNumberSortClause = SolrQuery.SortClause.create(LogSearchConstants.SEQUNCE_ID, SolrQuery.ORDER.desc);
-    defaultSort.add(sequenceNumberSortClause);
-    solrQuery.setSorts(defaultSort);
-    logger.debug("Sort Order :-" + defaultSort);
-  }
-
-  public void setFilterFacetSort(SolrQuery solrQuery, SearchCriteria searchCriteria) {
-    if (!StringUtils.isBlank(searchCriteria.getSortBy())) {
-      solrQuery.setFacetSort(searchCriteria.getSortBy());
-      logger.info("Sorted By :- " + searchCriteria.getSortBy());
-    }
-  }
-
-  public void setSingleSortOrder(SolrQuery solrQuery, SearchCriteria searchCriteria) {
-    List<SolrQuery.SortClause> sort = new ArrayList<SolrQuery.SortClause>();
-    if (!StringUtils.isBlank(searchCriteria.getSortBy())) {
-      ORDER order = SolrQuery.ORDER.asc;
-      if (!order.toString().equalsIgnoreCase(searchCriteria.getSortType())) {
-        order = SolrQuery.ORDER.desc;
-      }
-      SolrQuery.SortClause sortOrder = SolrQuery.SortClause.create(searchCriteria.getSortBy(), order);
-      sort.add(sortOrder);
-      solrQuery.setSorts(sort);
-      logger.debug("Sort Order :-" + sort);
-    }
-  }
-
-  // Search Criteria has parameter "sort" from it can get list of Sort Order
-  // Example of list can be [logtime desc,seq_num desc]
-  @SuppressWarnings("unchecked")
-  public void setMultipleSortOrder(SolrQuery solrQuery, SearchCriteria searchCriteria) {
-    List<SolrQuery.SortClause> sort = new ArrayList<SolrQuery.SortClause>();
-    List<String> sortList = (List<String>) searchCriteria.getParamValue("sort");
-    if (sortList != null) {
-      for (String sortOrder : sortList) {
-        if (!StringUtils.isBlank(sortOrder)) {
-          String sortByAndOrder[] = sortOrder.split(" ");
-          if (sortByAndOrder.length > 1) {
-            ORDER order = sortByAndOrder[1].contains("asc") ? SolrQuery.ORDER.asc : SolrQuery.ORDER.desc;
-            SolrQuery.SortClause solrSortClause = SolrQuery.SortClause.create(sortByAndOrder[0], order);
-            sort.add(solrSortClause);
-            logger.debug("Sort Order :-" + sort);
-          } else {
-            logger.warn("Not a valid sort Clause " + sortOrder);
-          }
-        }
-      }
-      solrQuery.setSorts(sort);
-    }
-  }
-
-  public void setSingleIncludeFilter(SolrQuery solrQuery, String filterType, String filterValue) {
-    if (!StringUtils.isBlank(filterType) && !StringUtils.isBlank(filterValue)) {
-      String filterQuery = buildFilterQuery(filterType, filterValue);
-      solrQuery.addFilterQuery(filterQuery);
-      logger.debug("Filter added :- " + filterQuery);
-    }
-  }
-
-  public void setSingleExcludeFilter(SolrQuery solrQuery, String filterType, String filterValue) {
-    if (!StringUtils.isBlank(filterValue) && !StringUtils.isBlank(filterType)) {
-      String filterQuery = LogSearchConstants.MINUS_OPERATOR + buildFilterQuery(filterType, filterValue);
-      solrQuery.addFilterQuery(filterQuery);
-      logger.debug("Filter added :- " + filterQuery);
-    }
-  }
-
-  public void setSingleRangeFilter(SolrQuery solrQuery, String filterType, String filterFromValue, String filterToValue) {
-    if (!StringUtils.isBlank(filterToValue) && !StringUtils.isBlank(filterType) && !StringUtils.isBlank(filterFromValue)) {
-      String filterQuery = buildInclusiveRangeFilterQuery(filterType, filterFromValue, filterToValue);
-      if (!StringUtils.isBlank(filterQuery)) {
-        solrQuery.addFilterQuery(filterQuery);
-        logger.debug("Filter added :- " + filterQuery);
-      }
-    }
-  }
-
-  public void setPagination(SolrQuery solrQuery, SearchCriteria searchCriteria) {
-    Integer startIndex = null;
-    Integer maxRows = null;
-    try {
-      startIndex = (Integer) searchCriteria.getStartIndex();
-      SolrUtil.setStart(solrQuery, startIndex);
-    } catch (ClassCastException e) {
-      SolrUtil.setStart(solrQuery, 0);
-    }
-    try {
-      maxRows = (Integer) searchCriteria.getMaxRows();
-      SolrUtil.setRowCount(solrQuery, maxRows);
-    } catch (ClassCastException e) {
-      SolrUtil.setRowCount(solrQuery, 10);
-    }
-
-    if (startIndex != null && maxRows != null)
-      logger.info("Pagination was set from " + startIndex.intValue() + " to " + maxRows.intValue());
-  }
-
-  public void setSingleORFilter(SolrQuery solrQuery, String filterName1, String value1, String filterName2, String value2) {
-    String filterQuery = filterName1 + ":" + value1 + " " + Condition.OR.name() + " " + filterName2 + ":" + value2;
-    solrQuery.setFilterQueries(filterQuery);
-  }
-
-  // BuildMethods to prepare a particular format as required for solr
-  public String buildInclusiveRangeFilterQuery(String filterType, String filterFromValue, String filterToValue) {
-    String filterQuery = filterType + ":[" + filterFromValue + " TO " + filterToValue + "]";
-    logger.info("Build Filter was :- " + filterQuery);
-    return filterQuery;
-  }
-
-  public String buildFilterQuery(String filterType, String filterValue) {
-    String filterQuery = filterType + ":" + filterValue;
-    logger.info("Build Filter Query was :- " + filterQuery);
-    return filterQuery;
-  }
-
-  public String buildJSONFacetAggregatedFuncitonQuery(String function, String xAxisField) {
-    return "{x:'" + function + "(" + xAxisField + ")'}";
-  }
-
-  public String buildJSONFacetTermTimeRangeQuery(String fieldName, String fieldTime, String from, String to, String unit) {
-    String query = "{";
-    query += "x" + ":{type:terms,field:" + fieldName + ",facet:{y:{type:range,field:" + fieldTime + ",start:\"" + from + "\",end:\"" + to + "\",gap:\"" + unit + "\"}}}";
-    query += "}";
-    logger.info("Build JSONQuery is :- " + query);
-    return query;
-  }
-
-  public String buildJsonFacetTermsRangeQuery(String stackField, String xAxisField) {
-    String jsonQuery = "{ " + stackField + ": { type: terms,field:" + stackField + "," + "facet: {   x: { type: terms, field:" + xAxisField + ",mincount:0,sort:{index:asc}}}}}";
-    logger.info("Build JSONQuery is :- " + jsonQuery);
-    return jsonQuery;
-  }
-
-  public String buidlJSONFacetRangeQueryForNumber(String stackField, String xAxisField, String function) {
-    String jsonQuery = "{ " + stackField + ": { type: terms,field:" + stackField + "," + "facet: {   x:'" + function + "(" + xAxisField + ")'}}}}";
-    logger.info("Build JSONQuery is :- " + jsonQuery);
-    return jsonQuery;
-  }
-
-  private String buildListQuery(String paramValue, String solrFieldName, Condition condition) {
-    if (!StringUtils.isBlank(paramValue)) {
-      String[] values = paramValue.split(LogSearchConstants.LIST_SEPARATOR);
-      switch (condition) {
-      case OR:
-        return SolrUtil.orList(solrFieldName, values,"");
-      case AND:
-        return SolrUtil.andList(solrFieldName, values, "");
-      default:
-        logger.error("Invalid condition " + condition.name());
-      }
-    }
-    return "";
-  }
-
-  protected void addFilter(SolrQuery solrQuery, String paramValue, String solrFieldName, Condition condition) {
-    String filterQuery = buildListQuery(paramValue, solrFieldName, condition);
-    if (!StringUtils.isBlank(filterQuery)) {
-      if (solrQuery != null) {
-        solrQuery.addFilterQuery(filterQuery);
-      }
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/SearchCriteriaConstants.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/SearchCriteriaConstants.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/SearchCriteriaConstants.java
deleted file mode 100644
index 3c4df76..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/SearchCriteriaConstants.java
+++ /dev/null
@@ -1,70 +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.query;
-
-public class SearchCriteriaConstants {
-
-  private SearchCriteriaConstants() {
-  }
-
-  public static final String PARAM_FIELD = "field";
-  public static final String PARAM_UNIT = "unit";
-  public static final String PARAM_INCLUDE_MESSAGE = "iMessage";
-  public static final String PARAM_EXCLUDE_MESSAGE = "eMessage";
-  public static final String PARAM_MUST_BE_STRING = "includeString";
-  public static final String PARAM_MUST_NOT_STRING = "unselectComp";
-  public static final String PARAM_EXCLUDE_QUERY = "excludeQuery";
-  public static final String PARAM_INCLUDE_QUERY = "includeQuery";
-  public static final String PARAM_START_TIME = "startTime";
-  public static final String PARAM_END_TIME = "endTime";
-
-  public static final String PARAM_IS_LAST_PAGE = "isLastPage";
-
-  public static final String PARAM_GLOBAL_START_TIME = "globalStartTime";
-  public static final String PARAM_GLOBAL_END_TIME = "globalEndTime";
-
-  public static final String PARAM_X_AXIS = "xAxis";
-  public static final String PARAM_Y_AXIS = "yAxis";
-  public static final String PARAM_STACK_BY = "stackBy";
-  public static final String PARAM_FROM = "from";
-  public static final String PARAM_TO = "to";
-
-  public static final String PARAM_COMPONENT_NAME = "component_name";
-  public static final String PARAM_HOST_NAME = "host_name";
-  public static final String PARAM_FILE_NAME = "file_name";
-  public static final String PARAM_BUNDLE_ID = "bundle_id";
-  public static final String PARAM_SELECT_COMP = "selectComp";
-  public static final String PARAM_LEVEL = "level";
-
-  public static final String PARAM_ID = "id";
-  public static final String PARAM_SCROLL_TYPE = "scrollType";
-  public static final String PARAM_NUMBER_ROWS = "numberRows";
-
-  public static final String PARAM_FORMAT = "format";
-  public static final String PARAM_UTC_OFFSET = "utcOffset";
-  public static final String PARAM_KEYWORD = "keyword";
-  public static final String PARAM_SOURCE_LOG_ID = "sourceLogId";
-  public static final String PARAM_KEYWORD_TYPE = "keywordType";
-  public static final String PARAM_TOKEN = "token";
-
-  public static final String PARAM_USER_NAME = "username";
-  public static final String PARAM_FILTER_NAME = "filtername";
-  public static final String PARAM_ROW_TYPE = "rowtype";
-
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AbstractCommonAuditLogRequestConverter.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AbstractCommonAuditLogRequestConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AbstractCommonAuditLogRequestConverter.java
deleted file mode 100644
index d40c5a1..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AbstractCommonAuditLogRequestConverter.java
+++ /dev/null
@@ -1,44 +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.query.converter;
-
-import org.apache.ambari.logsearch.model.request.impl.BaseAuditLogRequest;
-import org.apache.ambari.logsearch.query.model.CommonSearchCriteria;
-import org.apache.commons.lang.StringEscapeUtils;
-import org.springframework.stereotype.Component;
-
-@Component
-public abstract class AbstractCommonAuditLogRequestConverter<SOURCE extends BaseAuditLogRequest, RESULT extends CommonSearchCriteria>
-  extends AbstractCommonSearchRequestConverter<SOURCE, RESULT> {
-
-  @Override
-  public RESULT convertToSearchCriteria(SOURCE request) {
-    RESULT criteria = createCriteria(request);
-    criteria.addParam("q", request.getQuery());
-    criteria.setMustBe(request.getMustBe());
-    criteria.setMustNot(request.getMustNot());
-    criteria.setExcludeQuery(StringEscapeUtils.unescapeXml(request.getExcludeQuery()));
-    criteria.setIncludeQuery(StringEscapeUtils.unescapeXml(request.getIncludeQuery()));
-    criteria.setStartTime(request.getFrom());
-    criteria.setEndTime(request.getTo());
-    return criteria;
-  }
-
-  public abstract RESULT createCriteria(SOURCE request);
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AbstractCommonSearchRequestConverter.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AbstractCommonSearchRequestConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AbstractCommonSearchRequestConverter.java
deleted file mode 100644
index ea2c28a..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AbstractCommonSearchRequestConverter.java
+++ /dev/null
@@ -1,55 +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.query.converter;
-
-import org.apache.ambari.logsearch.model.request.impl.CommonSearchRequest;
-import org.apache.ambari.logsearch.query.model.CommonSearchCriteria;
-import org.apache.commons.lang.StringUtils;
-
-import static org.apache.ambari.logsearch.query.SearchCriteriaConstants.PARAM_GLOBAL_END_TIME;
-import static org.apache.ambari.logsearch.query.SearchCriteriaConstants.PARAM_GLOBAL_START_TIME;
-
-public abstract class AbstractCommonSearchRequestConverter<SOURCE extends CommonSearchRequest, RESULT extends CommonSearchCriteria>
-  extends AbstractConverterAware<SOURCE, RESULT> {
-
-  @Override
-  public RESULT convert(SOURCE source) {
-    RESULT criteria = convertToSearchCriteria(source);
-    addDefaultParams(source, criteria);
-    return criteria;
-  }
-
-  public abstract RESULT convertToSearchCriteria(SOURCE source);
-
-  private void addDefaultParams(SOURCE request, RESULT criteria) {
-    criteria.setStartIndex(StringUtils.isNumeric(request.getStartIndex()) ? new Integer(request.getStartIndex()) : 0);
-    criteria.setPage(StringUtils.isNumeric(request.getPage()) ? new Integer(request.getPage()) : 0);
-    criteria.setMaxRows(StringUtils.isNumeric(request.getPageSize()) ? new Integer(request.getPageSize()) : 50);
-    criteria.setSortBy(request.getSortBy());
-    criteria.setSortType(request.getSortType());
-    if (StringUtils.isNotEmpty(request.getStartTime())){
-      criteria.setGlobalStartTime(request.getStartTime());
-      criteria.getUrlParamMap().put(PARAM_GLOBAL_START_TIME, request.getStartTime());
-    }
-    if (StringUtils.isNotEmpty(request.getEndTime())){
-      criteria.setGlobalEndTime(request.getEndTime());
-      criteria.getUrlParamMap().put(PARAM_GLOBAL_END_TIME, request.getEndTime());
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AbstractCommonServiceLogRequestConverter.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AbstractCommonServiceLogRequestConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AbstractCommonServiceLogRequestConverter.java
deleted file mode 100644
index 8e91584..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AbstractCommonServiceLogRequestConverter.java
+++ /dev/null
@@ -1,51 +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.query.converter;
-
-import org.apache.ambari.logsearch.model.request.impl.BaseServiceLogRequest;
-import org.apache.ambari.logsearch.query.model.CommonServiceLogSearchCriteria;
-import org.apache.commons.lang.StringEscapeUtils;
-
-public abstract class AbstractCommonServiceLogRequestConverter<SOURCE extends BaseServiceLogRequest, RESULT extends CommonServiceLogSearchCriteria>
-  extends AbstractCommonSearchRequestConverter<SOURCE, RESULT> {
-
-  @Override
-  public RESULT convertToSearchCriteria(SOURCE request) {
-    RESULT criteria = createCriteria(request);
-    // TODO: check are these used from the UI or not?
-    criteria.addParam("q", request.getQuery());
-    criteria.addParam("unselectComp", request.getMustNot());
-
-    criteria.setLevel(request.getLevel());
-    criteria.setFrom(request.getFrom());
-    criteria.setTo(request.getTo());
-    criteria.setSelectComp(request.getMustBe());
-    criteria.setBundleId(request.getBundleId());
-    criteria.setHostName(request.getHostName());
-    criteria.setComponentName(request.getComponentName());
-    criteria.setFileName(request.getFileName());
-    criteria.setStartTime(request.getStartTime());
-    criteria.setEndTime(request.getEndTime());
-    criteria.setExcludeQuery(StringEscapeUtils.unescapeXml(request.getExcludeQuery()));
-    criteria.setIncludeQuery(StringEscapeUtils.unescapeXml(request.getIncludeQuery()));
-    return criteria;
-  }
-
-  public abstract RESULT createCriteria(SOURCE request);
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AbstractConverterAware.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AbstractConverterAware.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AbstractConverterAware.java
deleted file mode 100644
index 18a71c1..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AbstractConverterAware.java
+++ /dev/null
@@ -1,47 +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.query.converter;
-
-import org.springframework.beans.factory.annotation.Qualifier;
-import org.springframework.core.convert.ConversionService;
-import org.springframework.core.convert.converter.Converter;
-import org.springframework.core.convert.converter.ConverterRegistry;
-
-import javax.annotation.PostConstruct;
-import javax.inject.Inject;
-
-public abstract class AbstractConverterAware<SOURCE, RESULT> implements Converter<SOURCE, RESULT> {
-
-  @Inject
-  @Qualifier("conversionService")
-  private ConversionService conversionService;
-
-  public ConversionService getConversionService() {
-    return conversionService;
-  }
-
-  @PostConstruct
-  private void register() {
-    if (conversionService instanceof ConverterRegistry) {
-      ((ConverterRegistry) conversionService).addConverter(this);
-    } else {
-      throw new IllegalStateException("Can't register Converter to ConverterRegistry");
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AnyGraphRequestConverter.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AnyGraphRequestConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AnyGraphRequestConverter.java
deleted file mode 100644
index 1639563..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AnyGraphRequestConverter.java
+++ /dev/null
@@ -1,39 +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.query.converter;
-
-import org.apache.ambari.logsearch.model.request.impl.AnyGraphRequest;
-import org.apache.ambari.logsearch.query.model.AnyGraphSearchCriteria;
-import org.springframework.stereotype.Component;
-
-@Component
-public class AnyGraphRequestConverter extends AbstractCommonSearchRequestConverter<AnyGraphRequest, AnyGraphSearchCriteria> {
-
-  @Override
-  public AnyGraphSearchCriteria convertToSearchCriteria(AnyGraphRequest anyGraphRequest) {
-    AnyGraphSearchCriteria criteria = new AnyGraphSearchCriteria();
-    criteria.setxAxis(anyGraphRequest.getxAxis());
-    criteria.setyAxis(anyGraphRequest.getyAxis());
-    criteria.setStackBy(anyGraphRequest.getStackBy());
-    criteria.setUnit(anyGraphRequest.getUnit());
-    criteria.setFrom(anyGraphRequest.getFrom());
-    criteria.setTo(anyGraphRequest.getTo());
-    return criteria;
-  }
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AuditBarGraphRequestConverter.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AuditBarGraphRequestConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AuditBarGraphRequestConverter.java
deleted file mode 100644
index ac74287..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AuditBarGraphRequestConverter.java
+++ /dev/null
@@ -1,34 +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.query.converter;
-
-import org.apache.ambari.logsearch.model.request.impl.AuditBarGraphRequest;
-import org.apache.ambari.logsearch.query.model.AuditBarGraphSearchCriteria;
-import org.springframework.stereotype.Component;
-
-@Component
-public class AuditBarGraphRequestConverter extends AbstractCommonAuditLogRequestConverter<AuditBarGraphRequest, AuditBarGraphSearchCriteria>{
-
-  @Override
-  public AuditBarGraphSearchCriteria createCriteria(AuditBarGraphRequest request) {
-    AuditBarGraphSearchCriteria criteria = new AuditBarGraphSearchCriteria();
-    criteria.setUnit(request.getUnit());
-    return criteria;
-  }
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AuditLogRequestConverter.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AuditLogRequestConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AuditLogRequestConverter.java
deleted file mode 100644
index 5ec7632..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AuditLogRequestConverter.java
+++ /dev/null
@@ -1,34 +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.query.converter;
-
-import org.apache.ambari.logsearch.model.request.impl.AuditLogRequest;
-import org.apache.ambari.logsearch.query.model.AuditLogSearchCriteria;
-import org.springframework.stereotype.Component;
-
-@Component
-public class AuditLogRequestConverter extends AbstractCommonAuditLogRequestConverter<AuditLogRequest, AuditLogSearchCriteria> {
-
-  @Override
-  public AuditLogSearchCriteria createCriteria(AuditLogRequest request) {
-    AuditLogSearchCriteria criteria = new AuditLogSearchCriteria();
-    criteria.setLastPage(request.isLastPage());
-    return criteria;
-  }
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/BaseAuditLogRequestConverter.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/BaseAuditLogRequestConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/BaseAuditLogRequestConverter.java
deleted file mode 100644
index 35aceb2..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/BaseAuditLogRequestConverter.java
+++ /dev/null
@@ -1,33 +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.query.converter;
-
-import org.apache.ambari.logsearch.model.request.impl.BaseAuditLogRequest;
-import org.apache.ambari.logsearch.query.model.CommonSearchCriteria;
-import org.springframework.stereotype.Component;
-
-@Component
-public class BaseAuditLogRequestConverter extends AbstractCommonAuditLogRequestConverter<BaseAuditLogRequest, CommonSearchCriteria> {
-
-  @Override
-  public CommonSearchCriteria createCriteria(BaseAuditLogRequest request) {
-    return new CommonSearchCriteria();
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/BaseServiceLogRequestConverter.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/BaseServiceLogRequestConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/BaseServiceLogRequestConverter.java
deleted file mode 100644
index efc9bc9..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/BaseServiceLogRequestConverter.java
+++ /dev/null
@@ -1,33 +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.query.converter;
-
-import org.apache.ambari.logsearch.model.request.impl.BaseServiceLogRequest;
-import org.apache.ambari.logsearch.query.model.CommonSearchCriteria;
-import org.apache.ambari.logsearch.query.model.CommonServiceLogSearchCriteria;
-import org.springframework.stereotype.Component;
-
-@Component
-public class BaseServiceLogRequestConverter extends AbstractCommonServiceLogRequestConverter<BaseServiceLogRequest, CommonServiceLogSearchCriteria> {
-
-  @Override
-  public CommonServiceLogSearchCriteria createCriteria(BaseServiceLogRequest request) {
-    return new CommonServiceLogSearchCriteria();
-  }
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/FieldAuditLogRequestConverter.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/FieldAuditLogRequestConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/FieldAuditLogRequestConverter.java
deleted file mode 100644
index 6197d48..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/FieldAuditLogRequestConverter.java
+++ /dev/null
@@ -1,34 +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.query.converter;
-
-import org.apache.ambari.logsearch.model.request.impl.FieldAuditLogRequest;
-import org.apache.ambari.logsearch.query.model.FieldAuditLogSearchCriteria;
-import org.springframework.stereotype.Component;
-
-@Component
-public class FieldAuditLogRequestConverter extends AbstractCommonAuditLogRequestConverter<FieldAuditLogRequest, FieldAuditLogSearchCriteria> {
-
-  @Override
-  public FieldAuditLogSearchCriteria createCriteria(FieldAuditLogRequest request) {
-    FieldAuditLogSearchCriteria criteria = new FieldAuditLogSearchCriteria();
-    criteria.setField(request.getField());
-    return criteria;
-  }
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/FieldBarGraphRequestConverter.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/FieldBarGraphRequestConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/FieldBarGraphRequestConverter.java
deleted file mode 100644
index 74b0dac..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/FieldBarGraphRequestConverter.java
+++ /dev/null
@@ -1,35 +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.query.converter;
-
-import org.apache.ambari.logsearch.model.request.impl.FieldAuditBarGraphRequest;
-import org.apache.ambari.logsearch.query.model.FieldAuditBarGraphSearchCriteria;
-import org.springframework.stereotype.Component;
-
-@Component
-public class FieldBarGraphRequestConverter extends AbstractCommonAuditLogRequestConverter<FieldAuditBarGraphRequest, FieldAuditBarGraphSearchCriteria> {
-
-  @Override
-  public FieldAuditBarGraphSearchCriteria createCriteria(FieldAuditBarGraphRequest request) {
-    FieldAuditBarGraphSearchCriteria criteria = new FieldAuditBarGraphSearchCriteria();
-    criteria.setUnit(request.getUnit());
-    criteria.setField(request.getField());
-    return criteria;
-  }
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceAnyGraphRequestConverter.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceAnyGraphRequestConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceAnyGraphRequestConverter.java
deleted file mode 100644
index 8f1aaf0..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceAnyGraphRequestConverter.java
+++ /dev/null
@@ -1,39 +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.query.converter;
-
-import org.apache.ambari.logsearch.model.request.impl.ServiceAnyGraphRequest;
-import org.apache.ambari.logsearch.query.model.ServiceAnyGraphSearchCriteria;
-import org.springframework.stereotype.Component;
-
-@Component
-public class ServiceAnyGraphRequestConverter extends AbstractCommonServiceLogRequestConverter<ServiceAnyGraphRequest, ServiceAnyGraphSearchCriteria> {
-
-  @Override
-  public ServiceAnyGraphSearchCriteria createCriteria(ServiceAnyGraphRequest anyGraphRequest) {
-    ServiceAnyGraphSearchCriteria criteria = new ServiceAnyGraphSearchCriteria();
-    criteria.setxAxis(anyGraphRequest.getxAxis());
-    criteria.setyAxis(anyGraphRequest.getyAxis());
-    criteria.setStackBy(anyGraphRequest.getStackBy());
-    criteria.setUnit(anyGraphRequest.getUnit());
-    criteria.setFrom(anyGraphRequest.getFrom());
-    criteria.setTo(anyGraphRequest.getTo());
-    return criteria;
-  }
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceExtremeDatesRequestConverter.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceExtremeDatesRequestConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceExtremeDatesRequestConverter.java
deleted file mode 100644
index 489e879..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceExtremeDatesRequestConverter.java
+++ /dev/null
@@ -1,34 +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.query.converter;
-
-import org.apache.ambari.logsearch.model.request.impl.ServiceExtremeDatesRequest;
-import org.apache.ambari.logsearch.query.model.ServiceExtremeDatesCriteria;
-import org.springframework.stereotype.Component;
-
-@Component
-public class ServiceExtremeDatesRequestConverter extends AbstractCommonSearchRequestConverter<ServiceExtremeDatesRequest, ServiceExtremeDatesCriteria> {
-
-  @Override
-  public ServiceExtremeDatesCriteria convertToSearchCriteria(ServiceExtremeDatesRequest request) {
-    ServiceExtremeDatesCriteria criteria = new ServiceExtremeDatesCriteria();
-    criteria.setBundleId(request.getBundleId());
-    return criteria;
-  }
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceGraphRequestConverter.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceGraphRequestConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceGraphRequestConverter.java
deleted file mode 100644
index 37ec7dc..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceGraphRequestConverter.java
+++ /dev/null
@@ -1,34 +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.query.converter;
-
-import org.apache.ambari.logsearch.model.request.impl.ServiceGraphRequest;
-import org.apache.ambari.logsearch.query.model.ServiceGraphSearchCriteria;
-import org.springframework.stereotype.Component;
-
-@Component
-public class ServiceGraphRequestConverter extends AbstractCommonServiceLogRequestConverter<ServiceGraphRequest, ServiceGraphSearchCriteria> {
-
-  @Override
-  public ServiceGraphSearchCriteria createCriteria(ServiceGraphRequest request) {
-    ServiceGraphSearchCriteria criteria = new ServiceGraphSearchCriteria();
-    criteria.setUnit(request.getUnit());
-    return criteria;
-  }
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceLogExportRequestConverter.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceLogExportRequestConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceLogExportRequestConverter.java
deleted file mode 100644
index 783b0e0..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceLogExportRequestConverter.java
+++ /dev/null
@@ -1,35 +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.query.converter;
-
-import org.apache.ambari.logsearch.model.request.impl.ServiceLogExportRequest;
-import org.apache.ambari.logsearch.query.model.ServiceLogExportSearchCriteria;
-import org.springframework.stereotype.Component;
-
-@Component
-public class ServiceLogExportRequestConverter extends AbstractCommonServiceLogRequestConverter<ServiceLogExportRequest, ServiceLogExportSearchCriteria> {
-
-  @Override
-  public ServiceLogExportSearchCriteria createCriteria(ServiceLogExportRequest request) {
-    ServiceLogExportSearchCriteria criteria = new ServiceLogExportSearchCriteria();
-    criteria.setFormat(request.getFormat());
-    criteria.setUtcOffset(request.getUtcOffset());
-    return criteria;
-  }
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceLogRequestConverter.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceLogRequestConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceLogRequestConverter.java
deleted file mode 100644
index 86d055d..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceLogRequestConverter.java
+++ /dev/null
@@ -1,39 +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.query.converter;
-
-import org.apache.ambari.logsearch.model.request.impl.ServiceLogRequest;
-import org.apache.ambari.logsearch.query.model.ServiceLogSearchCriteria;
-import org.apache.commons.lang.StringEscapeUtils;
-import org.springframework.stereotype.Component;
-
-@Component
-public class ServiceLogRequestConverter extends AbstractCommonServiceLogRequestConverter<ServiceLogRequest, ServiceLogSearchCriteria> {
-
-  @Override
-  public ServiceLogSearchCriteria createCriteria(ServiceLogRequest request) {
-    ServiceLogSearchCriteria criteria = new ServiceLogSearchCriteria();
-    criteria.setKeyword(StringEscapeUtils.unescapeXml(request.getKeyWord()));
-    criteria.setKeywordType(request.getKeywordType());
-    criteria.setSourceLogId(request.getSourceLogId());
-    criteria.setToken(request.getToken());
-    criteria.setLastPage(request.isLastPage());
-    return criteria;
-  }
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceLogTruncatedRequestConverter.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceLogTruncatedRequestConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceLogTruncatedRequestConverter.java
deleted file mode 100644
index 2154357..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceLogTruncatedRequestConverter.java
+++ /dev/null
@@ -1,36 +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.query.converter;
-
-import org.apache.ambari.logsearch.model.request.impl.ServiceLogTruncatedRequest;
-import org.apache.ambari.logsearch.query.model.ServiceLogTruncatedSearchCriteria;
-import org.springframework.stereotype.Component;
-
-@Component
-public class ServiceLogTruncatedRequestConverter extends AbstractCommonServiceLogRequestConverter<ServiceLogTruncatedRequest, ServiceLogTruncatedSearchCriteria> {
-
-  @Override
-  public ServiceLogTruncatedSearchCriteria createCriteria(ServiceLogTruncatedRequest request) {
-    ServiceLogTruncatedSearchCriteria criteria = new ServiceLogTruncatedSearchCriteria();
-    criteria.setId(request.getId());
-    criteria.setScrollType(request.getScrollType());
-    criteria.setNumberRows(request.getNumberRows());
-    return criteria;
-  }
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/SimpleQueryRequestConverter.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/SimpleQueryRequestConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/SimpleQueryRequestConverter.java
deleted file mode 100644
index 1f084fd..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/SimpleQueryRequestConverter.java
+++ /dev/null
@@ -1,35 +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.query.converter;
-
-import org.apache.ambari.logsearch.model.request.impl.SimpleQueryRequest;
-import org.apache.ambari.logsearch.query.model.CommonSearchCriteria;
-import org.springframework.stereotype.Component;
-
-@Component
-public class SimpleQueryRequestConverter extends AbstractConverterAware<SimpleQueryRequest, CommonSearchCriteria> {
-
-  @Override
-  public CommonSearchCriteria convert(SimpleQueryRequest simpleQueryRequest) {
-    CommonSearchCriteria searchCriteria = new CommonSearchCriteria();
-    searchCriteria.addParam("q", simpleQueryRequest.getQuery());
-    return searchCriteria;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/UserConfigRequestConverter.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/UserConfigRequestConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/UserConfigRequestConverter.java
deleted file mode 100644
index 8f2aaa0..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/UserConfigRequestConverter.java
+++ /dev/null
@@ -1,36 +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.query.converter;
-
-import org.apache.ambari.logsearch.model.request.impl.UserConfigRequest;
-import org.apache.ambari.logsearch.query.model.UserConfigSearchCriteria;
-import org.springframework.stereotype.Component;
-
-@Component
-public class UserConfigRequestConverter extends AbstractConverterAware<UserConfigRequest, UserConfigSearchCriteria> {
-
-  @Override
-  public UserConfigSearchCriteria convert(UserConfigRequest request) {
-    UserConfigSearchCriteria criteria = new UserConfigSearchCriteria();
-    criteria.setUserName(request.getUserId());
-    criteria.setFilterName(request.getFilterName());
-    criteria.setRowType(request.getRowType());
-    return criteria;
-  }
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/UserExportRequestConverter.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/UserExportRequestConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/UserExportRequestConverter.java
deleted file mode 100644
index c7f738e..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/UserExportRequestConverter.java
+++ /dev/null
@@ -1,36 +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.query.converter;
-
-import org.apache.ambari.logsearch.model.request.impl.UserExportRequest;
-import org.apache.ambari.logsearch.query.model.UserExportSearchCriteria;
-import org.springframework.stereotype.Component;
-
-@Component
-public class UserExportRequestConverter extends AbstractCommonAuditLogRequestConverter<UserExportRequest, UserExportSearchCriteria> {
-
-  @Override
-  public UserExportSearchCriteria createCriteria(UserExportRequest request) {
-    UserExportSearchCriteria criteria = new UserExportSearchCriteria();
-    criteria.setField(request.getField());
-    criteria.setFormat(request.getFormat());
-    return criteria;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/AnyGraphSearchCriteria.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/AnyGraphSearchCriteria.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/AnyGraphSearchCriteria.java
deleted file mode 100644
index aa61851..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/AnyGraphSearchCriteria.java
+++ /dev/null
@@ -1,77 +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.query.model;
-
-import static org.apache.ambari.logsearch.query.SearchCriteriaConstants.PARAM_FROM;
-import static org.apache.ambari.logsearch.query.SearchCriteriaConstants.PARAM_STACK_BY;
-import static org.apache.ambari.logsearch.query.SearchCriteriaConstants.PARAM_TO;
-import static org.apache.ambari.logsearch.query.SearchCriteriaConstants.PARAM_UNIT;
-import static org.apache.ambari.logsearch.query.SearchCriteriaConstants.PARAM_X_AXIS;
-import static org.apache.ambari.logsearch.query.SearchCriteriaConstants.PARAM_Y_AXIS;
-
-public class AnyGraphSearchCriteria extends CommonSearchCriteria {
-
-  public String getxAxis() {
-    return getParam(PARAM_X_AXIS, String.class);
-  }
-
-  public void setxAxis(String xAxis) {
-    addParam(PARAM_X_AXIS, xAxis);
-  }
-
-  public String getyAxis() {
-    return getParam(PARAM_Y_AXIS, String.class);
-  }
-
-  public void setyAxis(String yAxis) {
-    addParam(PARAM_Y_AXIS, yAxis);
-  }
-
-  public String getStackBy() {
-    return getParam(PARAM_STACK_BY, String.class);
-  }
-
-  public void setStackBy(String stackBy) {
-    addParam(PARAM_STACK_BY, stackBy);
-  }
-
-  public String getUnit() {
-    return getParam(PARAM_UNIT, String.class);
-  }
-
-  public void setUnit(String unit) {
-    addParam(PARAM_UNIT, unit);
-  }
-
-  public String getFrom() {
-    return getParam(PARAM_FROM, String.class);
-  }
-
-  public void setFrom(String from) {
-    addParam(PARAM_FROM, from);
-  }
-
-  public String getTo() {
-    return getParam(PARAM_TO, String.class);
-  }
-
-  public void setTo(String to) {
-    addParam(PARAM_TO, to);
-  }
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/AuditBarGraphSearchCriteria.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/AuditBarGraphSearchCriteria.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/AuditBarGraphSearchCriteria.java
deleted file mode 100644
index 49304c4..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/AuditBarGraphSearchCriteria.java
+++ /dev/null
@@ -1,33 +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.query.model;
-
-import static org.apache.ambari.logsearch.query.SearchCriteriaConstants.PARAM_UNIT;
-
-public class AuditBarGraphSearchCriteria extends CommonSearchCriteria {
-
-  public void setUnit(String unit) {
-    addParam(PARAM_UNIT, unit);
-  }
-
-  public String getUnit() {
-    return getParam(PARAM_UNIT, String.class);
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/AuditLogSearchCriteria.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/AuditLogSearchCriteria.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/AuditLogSearchCriteria.java
deleted file mode 100644
index 03df3ad..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/AuditLogSearchCriteria.java
+++ /dev/null
@@ -1,33 +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.query.model;
-
-import static org.apache.ambari.logsearch.query.SearchCriteriaConstants.PARAM_IS_LAST_PAGE;
-
-public class AuditLogSearchCriteria extends CommonSearchCriteria {
-
-  public void setLastPage(boolean lastPage) {
-    addParam(PARAM_IS_LAST_PAGE, lastPage);
-  }
-
-  public boolean isLastPage() {
-    return getParam(PARAM_IS_LAST_PAGE, Boolean.class);
-  }
-
-}


[24/58] [abbrv] ambari git commit: AMBARI-18246. Clean up Log Feeder (Miklos Gergely via oleewere)

Posted by ol...@apache.org.
http://git-wip-us.apache.org/repos/asf/ambari/blob/1b07a6dd/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/OutputFile.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/OutputFile.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/OutputFile.java
index 18a5a54..e1a0bb9 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/OutputFile.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/OutputFile.java
@@ -30,26 +30,27 @@ import org.apache.ambari.logfeeder.input.InputMarker;
 import org.apache.ambari.logfeeder.util.LogFeederUtil;
 import org.apache.commons.csv.CSVFormat;
 import org.apache.commons.csv.CSVPrinter;
+import org.apache.commons.lang3.StringUtils;
 import org.apache.log4j.Logger;
 
 public class OutputFile extends Output {
-  static Logger logger = Logger.getLogger(OutputFile.class);
+  private static final Logger LOG = Logger.getLogger(OutputFile.class);
 
-  PrintWriter outWriter = null;
-  String filePath = null;
-  String codec;
+  private PrintWriter outWriter;
+  private String filePath = null;
+  private String codec;
 
   @Override
   public void init() throws Exception {
     super.init();
 
     filePath = getStringValue("path");
-    if (filePath == null || filePath.isEmpty()) {
-      logger.error("Filepath config property <path> is not set in config file.");
+    if (StringUtils.isEmpty(filePath)) {
+      LOG.error("Filepath config property <path> is not set in config file.");
       return;
     }
     codec = getStringValue("codec");
-    if (codec == null || codec.trim().isEmpty()) {
+    if (StringUtils.isBlank(codec)) {
       codec = "json";
     } else {
       if (codec.trim().equalsIgnoreCase("csv")) {
@@ -57,12 +58,11 @@ public class OutputFile extends Output {
       } else if (codec.trim().equalsIgnoreCase("json")) {
         codec = "csv";
       } else {
-        logger.error("Unsupported codec type. codec=" + codec
-          + ", will use json");
+        LOG.error("Unsupported codec type. codec=" + codec + ", will use json");
         codec = "json";
       }
     }
-    logger.info("Out filePath=" + filePath + ", codec=" + codec);
+    LOG.info("Out filePath=" + filePath + ", codec=" + codec);
     File outFile = new File(filePath);
     if (outFile.getParentFile() != null) {
       File parentDir = outFile.getParentFile();
@@ -71,16 +71,14 @@ public class OutputFile extends Output {
       }
     }
 
-    outWriter = new PrintWriter(new BufferedWriter(new FileWriter(outFile,
-      true)));
+    outWriter = new PrintWriter(new BufferedWriter(new FileWriter(outFile, true)));
 
-    logger.info("init() is successfull. filePath="
-      + outFile.getAbsolutePath());
+    LOG.info("init() is successfull. filePath=" + outFile.getAbsolutePath());
   }
 
   @Override
   public void close() {
-    logger.info("Closing file." + getShortDescription());
+    LOG.info("Closing file." + getShortDescription());
     if (outWriter != null) {
       try {
         outWriter.close();
@@ -92,8 +90,7 @@ public class OutputFile extends Output {
   }
 
   @Override
-  public void write(Map<String, Object> jsonObj, InputMarker inputMarker)
-    throws Exception {
+  public void write(Map<String, Object> jsonObj, InputMarker inputMarker) throws Exception {
     String outStr = null;
     CSVPrinter csvPrinter = null;
     try {
@@ -104,7 +101,7 @@ public class OutputFile extends Output {
         outStr = LogFeederUtil.getGson().toJson(jsonObj);
       }
       if (outWriter != null && outStr != null) {
-        statMetric.count++;
+        statMetric.value++;
 
         outWriter.println(outStr);
         outWriter.flush();
@@ -122,7 +119,7 @@ public class OutputFile extends Output {
   @Override
   synchronized public void write(String block, InputMarker inputMarker) throws Exception {
     if (outWriter != null && block != null) {
-      statMetric.count++;
+      statMetric.value++;
 
       outWriter.println(block);
       outWriter.flush();
@@ -135,10 +132,7 @@ public class OutputFile extends Output {
   }
 
   @Override
-  public void copyFile(File inputFile, InputMarker inputMarker)
-      throws UnsupportedOperationException {
-    throw new UnsupportedOperationException(
-        "copyFile method is not yet supported for output=file");
+  public void copyFile(File inputFile, InputMarker inputMarker) throws UnsupportedOperationException {
+    throw new UnsupportedOperationException("copyFile method is not yet supported for output=file");
   }
-
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/1b07a6dd/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/OutputHDFSFile.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/OutputHDFSFile.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/OutputHDFSFile.java
index a360215..8f4b0b1 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/OutputHDFSFile.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/OutputHDFSFile.java
@@ -43,7 +43,8 @@ import java.util.concurrent.ConcurrentLinkedQueue;
  * The events are spooled on the local file system and uploaded in batches asynchronously.
  */
 public class OutputHDFSFile extends Output implements RolloverHandler, RolloverCondition {
-  private final static Logger logger = Logger.getLogger(OutputHDFSFile.class);
+  private static final Logger LOG = Logger.getLogger(OutputHDFSFile.class);
+  
   private static final long DEFAULT_ROLLOVER_THRESHOLD_TIME_SECONDS = 5 * 60L;// 5 min by default
 
   private ConcurrentLinkedQueue<File> localReadyFiles = new ConcurrentLinkedQueue<File>();
@@ -72,23 +73,20 @@ public class OutputHDFSFile extends Output implements RolloverHandler, RolloverC
     rolloverThresholdTimeMillis = rolloverThresholdTimeSeconds * 1000L;
     filenamePrefix = getStringValue("file_name_prefix", filenamePrefix);
     if (StringUtils.isEmpty(hdfsOutDir)) {
-      logger
-          .error("HDFS config property <hdfs_out_dir> is not set in config file.");
+      LOG.error("HDFS config property <hdfs_out_dir> is not set in config file.");
       return;
     }
     if (StringUtils.isEmpty(hdfsHost)) {
-      logger
-          .error("HDFS config property <hdfs_host> is not set in config file.");
+      LOG.error("HDFS config property <hdfs_host> is not set in config file.");
       return;
     }
     if (StringUtils.isEmpty(hdfsPort)) {
-      logger
-          .error("HDFS config property <hdfs_port> is not set in config file.");
+      LOG.error("HDFS config property <hdfs_port> is not set in config file.");
       return;
     }
     HashMap<String, String> contextParam = buildContextParam();
     hdfsOutDir = PlaceholderUtil.replaceVariables(hdfsOutDir, contextParam);
-    logger.info("hdfs Output dir=" + hdfsOutDir);
+    LOG.info("hdfs Output dir=" + hdfsOutDir);
     String localFileDir = LogFeederUtil.getLogfeederTempDir() + "hdfs/service/";
     logSpooler = new LogSpooler(localFileDir, filenamePrefix, this, this);
     this.startHDFSCopyThread();
@@ -96,18 +94,17 @@ public class OutputHDFSFile extends Output implements RolloverHandler, RolloverC
 
   @Override
   public void close() {
-    logger.info("Closing file." + getShortDescription());
+    LOG.info("Closing file." + getShortDescription());
     logSpooler.rollover();
     this.stopHDFSCopyThread();
     isClosed = true;
   }
 
   @Override
-  synchronized public void write(String block, InputMarker inputMarker)
-      throws Exception {
+  public synchronized void write(String block, InputMarker inputMarker) throws Exception {
     if (block != null) {
       logSpooler.add(block);
-      statMetric.count++;
+      statMetric.value++;
     }
   }
 
@@ -127,24 +124,19 @@ public class OutputHDFSFile extends Output implements RolloverHandler, RolloverC
             Iterator<File> localFileIterator = localReadyFiles.iterator();
             while (localFileIterator.hasNext()) {
               File localFile = localFileIterator.next();
-              fileSystem = LogfeederHDFSUtil.INSTANCE.buildFileSystem(hdfsHost,
-                  hdfsPort);
+              fileSystem = LogfeederHDFSUtil.buildFileSystem(hdfsHost, hdfsPort);
               if (fileSystem != null && localFile.exists()) {
                 String destFilePath = hdfsOutDir + "/" + localFile.getName();
                 String localPath = localFile.getAbsolutePath();
                 boolean overWrite = true;
                 boolean delSrc = true;
-                boolean isCopied = LogfeederHDFSUtil.INSTANCE.copyFromLocal(
-                    localFile.getAbsolutePath(), destFilePath, fileSystem,
+                boolean isCopied = LogfeederHDFSUtil.copyFromLocal(localFile.getAbsolutePath(), destFilePath, fileSystem,
                     overWrite, delSrc);
                 if (isCopied) {
-                  logger.debug("File copy to hdfs hdfspath :" + destFilePath
-                      + " and deleted local file :" + localPath);
+                  LOG.debug("File copy to hdfs hdfspath :" + destFilePath + " and deleted local file :" + localPath);
                 } else {
-                  // TODO Need to write retry logic, in next release we can
-                  // handle it
-                  logger.error("Hdfs file copy  failed for hdfspath :"
-                      + destFilePath + " and localpath :" + localPath);
+                  // TODO Need to write retry logic, in next release we can handle it
+                  LOG.error("Hdfs file copy  failed for hdfspath :" + destFilePath + " and localpath :" + localPath);
                 }
               }
               localFileIterator.remove();
@@ -157,14 +149,11 @@ public class OutputHDFSFile extends Output implements RolloverHandler, RolloverC
                 }
               }
             } catch (InterruptedException e) {
-              logger.error(e.getLocalizedMessage(),e);
+              LOG.error(e.getLocalizedMessage(),e);
             }
           }
         } catch (Exception e) {
-          logger
-              .error(
-                  "Exception in hdfsCopyThread errorMsg:"
-                      + e.getLocalizedMessage(), e);
+          LOG.error("Exception in hdfsCopyThread errorMsg:" + e.getLocalizedMessage(), e);
         }
       }
     };
@@ -174,24 +163,23 @@ public class OutputHDFSFile extends Output implements RolloverHandler, RolloverC
 
   private void stopHDFSCopyThread() {
     if (hdfsCopyThread != null) {
-      logger.info("waiting till copy all local files to hdfs.......");
+      LOG.info("waiting till copy all local files to hdfs.......");
       while (!localReadyFiles.isEmpty()) {
         try {
           Thread.sleep(1000);
         } catch (InterruptedException e) {
-          logger.error(e.getLocalizedMessage(), e);
+          LOG.error(e.getLocalizedMessage(), e);
         }
-        logger.debug("still waiting to copy all local files to hdfs.......");
+        LOG.debug("still waiting to copy all local files to hdfs.......");
       }
-      logger.info("calling interrupt method for hdfsCopyThread to stop it.");
+      LOG.info("calling interrupt method for hdfsCopyThread to stop it.");
       try {
         hdfsCopyThread.interrupt();
       } catch (SecurityException exception) {
-        logger.error(" Current thread : '" + Thread.currentThread().getName()
-            + "' does not have permission to interrupt the Thread: '"
-            + hdfsCopyThread.getName() + "'");
+        LOG.error(" Current thread : '" + Thread.currentThread().getName() +
+            "' does not have permission to interrupt the Thread: '" + hdfsCopyThread.getName() + "'");
       }
-      LogfeederHDFSUtil.INSTANCE.closeFileSystem(fileSystem);
+      LogfeederHDFSUtil.closeFileSystem(fileSystem);
     }
   }
 
@@ -208,15 +196,13 @@ public class OutputHDFSFile extends Output implements RolloverHandler, RolloverC
         readyMonitor.notifyAll();
       }
     } catch (Exception e) {
-      logger.error(e.getLocalizedMessage(),e);
+      LOG.error(e.getLocalizedMessage(),e);
     }
   }
 
   @Override
-  public void copyFile(File inputFile, InputMarker inputMarker)
-      throws UnsupportedOperationException {
-    throw new UnsupportedOperationException(
-        "copyFile method is not yet supported for output=hdfs");     
+  public void copyFile(File inputFile, InputMarker inputMarker) throws UnsupportedOperationException {
+    throw new UnsupportedOperationException("copyFile method is not yet supported for output=hdfs");
   }
 
   /**
@@ -242,8 +228,8 @@ public class OutputHDFSFile extends Output implements RolloverHandler, RolloverC
     long timeSinceCreation = new Date().getTime() - currentSpoolerContext.getActiveLogCreationTime().getTime();
     boolean shouldRollover = timeSinceCreation > rolloverThresholdTimeMillis;
     if (shouldRollover) {
-      logger.info("Detecting that time since file creation time " + currentSpoolerContext.getActiveLogCreationTime() +
-                    " has crossed threshold (msecs) " + rolloverThresholdTimeMillis);
+      LOG.info("Detecting that time since file creation time " + currentSpoolerContext.getActiveLogCreationTime() +
+          " has crossed threshold (msecs) " + rolloverThresholdTimeMillis);
     }
     return shouldRollover;
   }

http://git-wip-us.apache.org/repos/asf/ambari/blob/1b07a6dd/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/OutputKafka.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/OutputKafka.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/OutputKafka.java
index 2595d87..52fc6f8 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/OutputKafka.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/OutputKafka.java
@@ -56,6 +56,16 @@ public class OutputKafka extends Output {
   private boolean isKafkaBrokerUp = false;
 
   @Override
+  protected String getStatMetricName() {
+    return "output.kafka.write_logs";
+  }
+
+  @Override
+  protected String getWriteBytesMetricName() {
+    return "output.kafka.write_bytes";
+  }
+  
+  @Override
   public void init() throws Exception {
     super.init();
     Properties props = initProperties();
@@ -65,9 +75,6 @@ public class OutputKafka extends Output {
   }
 
   private Properties initProperties() throws Exception {
-    statMetric.metricsName = "output.kafka.write_logs";
-    writeBytesMetric.metricsName = "output.kafka.write_bytes";
-
     String brokerList = getStringValue("broker_list");
     if (StringUtils.isEmpty(brokerList)) {
       throw new Exception("For kafka output, bootstrap broker_list is needed");
@@ -124,17 +131,15 @@ public class OutputKafka extends Output {
             if (publishMessage(kafkaCallBack.message, kafkaCallBack.inputMarker)) {
               kafkaCallBack = null;
             } else {
-              LOG.error("Kafka is down. messageNumber=" + kafkaCallBack.thisMessageNumber + ". Going to sleep for "
-                  + FAILED_RETRY_INTERVAL + " seconds");
+              LOG.error("Kafka is down. messageNumber=" + kafkaCallBack.thisMessageNumber + ". Going to sleep for " +
+                  FAILED_RETRY_INTERVAL + " seconds");
               Thread.sleep(FAILED_RETRY_INTERVAL * 1000);
             }
 
           } catch (Throwable t) {
             String logMessageKey = this.getClass().getSimpleName() + "_KAFKA_RETRY_WRITE_ERROR";
-            LogFeederUtil.logErrorMessageByInterval(logMessageKey,
-                "Error sending message to Kafka during retry. message="
-                    + (kafkaCallBack == null ? null : kafkaCallBack.message),
-                t, LOG, Level.ERROR);
+            LogFeederUtil.logErrorMessageByInterval(logMessageKey, "Error sending message to Kafka during retry. message=" +
+                (kafkaCallBack == null ? null : kafkaCallBack.message), t, LOG, Level.ERROR);
           }
         }
 
@@ -160,8 +165,8 @@ public class OutputKafka extends Output {
           LOG.error("Kafka is down. Going to sleep for " + FAILED_RETRY_INTERVAL + " seconds");
           Thread.sleep(FAILED_RETRY_INTERVAL * 1000);
         } else {
-          LOG.warn("Kafka is still catching up from previous failed messages. outstanding messages="
-              + failedMessages.size() + " Going to sleep for " + CATCHUP_RETRY_INTERVAL + " seconds");
+          LOG.warn("Kafka is still catching up from previous failed messages. outstanding messages=" + failedMessages.size() +
+              " Going to sleep for " + CATCHUP_RETRY_INTERVAL + " seconds");
           Thread.sleep(CATCHUP_RETRY_INTERVAL * 1000);
         }
       } catch (Throwable t) {
@@ -198,16 +203,15 @@ public class OutputKafka extends Output {
 
   private boolean publishMessage(String block, InputMarker inputMarker) {
     if (isAsync && isKafkaBrokerUp) { // Send asynchronously
-      producer.send(new ProducerRecord<String, String>(topic, block),
-          new KafkaCallBack(this, block, inputMarker, ++messageCount));
+      producer.send(new ProducerRecord<String, String>(topic, block), new KafkaCallBack(this, block, inputMarker, ++messageCount));
       return true;
     } else { // Send synchronously
       try {
         // Not using key. Let it round robin
         RecordMetadata metadata = producer.send(new ProducerRecord<String, String>(topic, block)).get();
         if (metadata != null) {
-          statMetric.count++;
-          writeBytesMetric.count += block.length();
+          statMetric.value++;
+          writeBytesMetric.value += block.length();
         }
         if (!isKafkaBrokerUp) {
           LOG.info("Started writing to kafka. " + getShortDescription());
@@ -217,18 +221,18 @@ public class OutputKafka extends Output {
       } catch (InterruptedException e) {
         isKafkaBrokerUp = false;
         String logKeyMessage = this.getClass().getSimpleName() + "_KAFKA_INTERRUPT";
-        LogFeederUtil.logErrorMessageByInterval(logKeyMessage, "InterruptedException-Error sending message to Kafka", e,
-            LOG, Level.ERROR);
+        LogFeederUtil.logErrorMessageByInterval(logKeyMessage, "InterruptedException-Error sending message to Kafka", e, LOG,
+            Level.ERROR);
       } catch (ExecutionException e) {
         isKafkaBrokerUp = false;
         String logKeyMessage = this.getClass().getSimpleName() + "_KAFKA_EXECUTION";
-        LogFeederUtil.logErrorMessageByInterval(logKeyMessage, "ExecutionException-Error sending message to Kafka", e,
-            LOG, Level.ERROR);
+        LogFeederUtil.logErrorMessageByInterval(logKeyMessage, "ExecutionException-Error sending message to Kafka", e, LOG,
+            Level.ERROR);
       } catch (Throwable t) {
         isKafkaBrokerUp = false;
         String logKeyMessage = this.getClass().getSimpleName() + "_KAFKA_WRITE_ERROR";
-        LogFeederUtil.logErrorMessageByInterval(logKeyMessage, "GenericException-Error sending message to Kafka", t,
-            LOG, Level.ERROR);
+        LogFeederUtil.logErrorMessageByInterval(logKeyMessage, "GenericException-Error sending message to Kafka", t, LOG,
+            Level.ERROR);
       }
     }
     return false;
@@ -260,12 +264,12 @@ public class OutputKafka extends Output {
           output.isKafkaBrokerUp = true;
         }
         output.incrementStat(1);
-        output.writeBytesMetric.count += message.length();
+        output.writeBytesMetric.value += message.length();
       } else {
         output.isKafkaBrokerUp = false;
         String logKeyMessage = this.getClass().getSimpleName() + "_KAFKA_ASYNC_ERROR";
-        LogFeederUtil.logErrorMessageByInterval(logKeyMessage, "Error sending message to Kafka. Async Callback",
-            exception, LOG, Level.ERROR);
+        LogFeederUtil.logErrorMessageByInterval(logKeyMessage, "Error sending message to Kafka. Async Callback", exception, LOG,
+            Level.ERROR);
 
         output.failedMessages.add(this);
       }
@@ -273,9 +277,7 @@ public class OutputKafka extends Output {
   }
 
   @Override
-  public void copyFile(File inputFile, InputMarker inputMarker)
-      throws UnsupportedOperationException {
-    throw new UnsupportedOperationException(
-        "copyFile method is not yet supported for output=kafka");
+  public void copyFile(File inputFile, InputMarker inputMarker) throws UnsupportedOperationException {
+    throw new UnsupportedOperationException("copyFile method is not yet supported for output=kafka");
   }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/1b07a6dd/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/OutputManager.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/OutputManager.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/OutputManager.java
new file mode 100644
index 0000000..2c81c19
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/OutputManager.java
@@ -0,0 +1,250 @@
+/*
+ * 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.logfeeder.output;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+
+import org.apache.ambari.logfeeder.common.LogFeederConstants;
+import org.apache.ambari.logfeeder.input.Input;
+import org.apache.ambari.logfeeder.input.InputMarker;
+import org.apache.ambari.logfeeder.logconfig.FilterLogData;
+import org.apache.ambari.logfeeder.metrics.MetricData;
+import org.apache.ambari.logfeeder.util.LogFeederUtil;
+import org.apache.ambari.logfeeder.util.MurmurHash;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.log4j.Level;
+import org.apache.log4j.Logger;
+
+public class OutputManager {
+  private static final Logger LOG = Logger.getLogger(OutputManager.class);
+
+  private static final int HASH_SEED = 31174077;
+  private static final int MAX_OUTPUT_SIZE = 32765; // 32766-1
+
+  private List<Output> outputs = new ArrayList<Output>();
+
+  private boolean addMessageMD5 = true;
+
+  private static long docCounter = 0;
+  private MetricData messageTruncateMetric = new MetricData(null, false);
+
+  public List<Output> getOutputs() {
+    return outputs;
+  }
+
+  public void add(Output output) {
+    this.outputs.add(output);
+  }
+
+  public void retainUsedOutputs(Collection<Output> usedOutputs) {
+    outputs.retainAll(usedOutputs);
+  }
+
+  public void init() throws Exception {
+    for (Output output : outputs) {
+      output.init();
+    }
+  }
+
+  public void write(Map<String, Object> jsonObj, InputMarker inputMarker) {
+    Input input = inputMarker.input;
+
+    // Update the block with the context fields
+    for (Map.Entry<String, String> entry : input.getContextFields().entrySet()) {
+      if (jsonObj.get(entry.getKey()) == null) {
+        jsonObj.put(entry.getKey(), entry.getValue());
+      }
+    }
+
+    // TODO: Ideally most of the overrides should be configurable
+
+    if (jsonObj.get("type") == null) {
+      jsonObj.put("type", input.getStringValue("type"));
+    }
+    if (jsonObj.get("path") == null && input.getFilePath() != null) {
+      jsonObj.put("path", input.getFilePath());
+    }
+    if (jsonObj.get("path") == null && input.getStringValue("path") != null) {
+      jsonObj.put("path", input.getStringValue("path"));
+    }
+    if (jsonObj.get("host") == null && LogFeederUtil.hostName != null) {
+      jsonObj.put("host", LogFeederUtil.hostName);
+    }
+    if (jsonObj.get("ip") == null && LogFeederUtil.ipAddress != null) {
+      jsonObj.put("ip", LogFeederUtil.ipAddress);
+    }
+    if (jsonObj.get("level") == null) {
+      jsonObj.put("level", LogFeederConstants.LOG_LEVEL_UNKNOWN);
+    }
+    
+    if (input.isUseEventMD5() || input.isGenEventMD5()) {
+      String prefix = "";
+      Object logtimeObj = jsonObj.get("logtime");
+      if (logtimeObj != null) {
+        if (logtimeObj instanceof Date) {
+          prefix = "" + ((Date) logtimeObj).getTime();
+        } else {
+          prefix = logtimeObj.toString();
+        }
+      }
+      
+      Long eventMD5 = MurmurHash.hash64A(LogFeederUtil.getGson().toJson(jsonObj).getBytes(), HASH_SEED);
+      if (input.isGenEventMD5()) {
+        jsonObj.put("event_md5", prefix + eventMD5.toString());
+      }
+      if (input.isUseEventMD5()) {
+        jsonObj.put("id", prefix + eventMD5.toString());
+      }
+    }
+
+    jsonObj.put("seq_num", new Long(docCounter++));
+    if (jsonObj.get("id") == null) {
+      jsonObj.put("id", UUID.randomUUID().toString());
+    }
+    if (jsonObj.get("event_count") == null) {
+      jsonObj.put("event_count", new Integer(1));
+    }
+    if (inputMarker.lineNumber > 0) {
+      jsonObj.put("logfile_line_number", new Integer(inputMarker.lineNumber));
+    }
+    if (jsonObj.containsKey("log_message")) {
+      // TODO: Let's check size only for log_message for now
+      String logMessage = (String) jsonObj.get("log_message");
+      logMessage = truncateLongLogMessage(jsonObj, input, logMessage);
+      if (addMessageMD5) {
+        jsonObj.put("message_md5", "" + MurmurHash.hash64A(logMessage.getBytes(), 31174077));
+      }
+    }
+    
+    if (FilterLogData.INSTANCE.isAllowed(jsonObj)) {
+      for (Output output : input.getOutputList()) {
+        try {
+          output.write(jsonObj, inputMarker);
+        } catch (Exception e) {
+          LOG.error("Error writing. to " + output.getShortDescription(), e);
+        }
+      }
+    }
+  }
+
+  @SuppressWarnings("unchecked")
+  private String truncateLongLogMessage(Map<String, Object> jsonObj, Input input, String logMessage) {
+    if (logMessage != null && logMessage.getBytes().length > MAX_OUTPUT_SIZE) {
+      messageTruncateMetric.value++;
+      String logMessageKey = this.getClass().getSimpleName() + "_MESSAGESIZE";
+      LogFeederUtil.logErrorMessageByInterval(logMessageKey, "Message is too big. size=" + logMessage.getBytes().length +
+          ", input=" + input.getShortDescription() + ". Truncating to " + MAX_OUTPUT_SIZE + ", first upto 100 characters=" +
+          StringUtils.abbreviate(logMessage, 100), null, LOG, Level.WARN);
+      logMessage = new String(logMessage.getBytes(), 0, MAX_OUTPUT_SIZE);
+      jsonObj.put("log_message", logMessage);
+      List<String> tagsList = (List<String>) jsonObj.get("tags");
+      if (tagsList == null) {
+        tagsList = new ArrayList<String>();
+        jsonObj.put("tags", tagsList);
+      }
+      tagsList.add("error_message_truncated");
+    }
+    return logMessage;
+  }
+
+  public void write(String jsonBlock, InputMarker inputMarker) {
+    if (FilterLogData.INSTANCE.isAllowed(jsonBlock)) {
+      for (Output output : inputMarker.input.getOutputList()) {
+        try {
+          output.write(jsonBlock, inputMarker);
+        } catch (Exception e) {
+          LOG.error("Error writing. to " + output.getShortDescription(), e);
+        }
+      }
+    }
+  }
+
+  public void copyFile(File inputFile, InputMarker inputMarker) {
+    Input input = inputMarker.input;
+    for (Output output : input.getOutputList()) {
+      try {
+        output.copyFile(inputFile, inputMarker);
+      }catch (Exception e) {
+        LOG.error("Error coyping file . to " + output.getShortDescription(), e);
+      }
+    }
+  }
+
+  public void logStats() {
+    for (Output output : outputs) {
+      output.logStat();
+    }
+    LogFeederUtil.logStatForMetric(messageTruncateMetric, "Stat: Messages Truncated", "");
+  }
+
+  public void addMetricsContainers(List<MetricData> metricsList) {
+    metricsList.add(messageTruncateMetric);
+    for (Output output : outputs) {
+      output.addMetricsContainers(metricsList);
+    }
+  }
+
+  public void close() {
+    LOG.info("Close called for outputs ...");
+    for (Output output : outputs) {
+      try {
+        output.setDrain(true);
+        output.close();
+      } catch (Exception e) {
+        // Ignore
+      }
+    }
+    
+    // Need to get this value from property
+    int iterations = 30;
+    int waitTimeMS = 1000;
+    for (int i = 0; i < iterations; i++) {
+      boolean allClosed = true;
+      for (Output output : outputs) {
+        if (!output.isClosed()) {
+          try {
+            allClosed = false;
+            LOG.warn("Waiting for output to close. " + output.getShortDescription() + ", " + (iterations - i) + " more seconds");
+            Thread.sleep(waitTimeMS);
+          } catch (Throwable t) {
+            // Ignore
+          }
+        }
+      }
+      if (allClosed) {
+        LOG.info("All outputs are closed. Iterations=" + i);
+        return;
+      }
+    }
+
+    LOG.warn("Some outpus were not closed after " + iterations + "  iterations");
+    for (Output output : outputs) {
+      if (!output.isClosed()) {
+        LOG.warn("Output not closed. Will ignore it." + output.getShortDescription() + ", pendingCound=" + output.getPendingCount());
+      }
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/1b07a6dd/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/OutputMgr.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/OutputMgr.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/OutputMgr.java
deleted file mode 100644
index 0a6b7fa..0000000
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/OutputMgr.java
+++ /dev/null
@@ -1,263 +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.logfeeder.output;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
-import java.util.UUID;
-
-import org.apache.ambari.logfeeder.input.Input;
-import org.apache.ambari.logfeeder.input.InputMarker;
-import org.apache.ambari.logfeeder.logconfig.LogFeederConstants;
-import org.apache.ambari.logfeeder.logconfig.filter.FilterLogData;
-import org.apache.ambari.logfeeder.metrics.MetricCount;
-import org.apache.ambari.logfeeder.util.LogFeederUtil;
-import org.apache.log4j.Level;
-import org.apache.log4j.Logger;
-
-public class OutputMgr {
-  private static final Logger logger = Logger.getLogger(OutputMgr.class);
-
-  private Collection<Output> outputList = new ArrayList<Output>();
-
-  private boolean addMessageMD5 = true;
-
-  private int MAX_OUTPUT_SIZE = 32765; // 32766-1
-  private static long doc_counter = 0;
-  private MetricCount messageTruncateMetric = new MetricCount();
-
-  
-  public Collection<Output> getOutputList() {
-    return outputList;
-  }
-
-  public void setOutputList(Collection<Output> outputList) {
-    this.outputList = outputList;
-  }
-
-  public void write(Map<String, Object> jsonObj, InputMarker inputMarker) {
-    Input input = inputMarker.input;
-
-    // Update the block with the context fields
-    for (Map.Entry<String, String> entry : input.getContextFields()
-      .entrySet()) {
-      if (jsonObj.get(entry.getKey()) == null) {
-        jsonObj.put(entry.getKey(), entry.getValue());
-      }
-    }
-
-    // TODO: Ideally most of the overrides should be configurable
-
-    // Add the input type
-    if (jsonObj.get("type") == null) {
-      jsonObj.put("type", input.getStringValue("type"));
-    }
-    if (jsonObj.get("path") == null && input.getFilePath() != null) {
-      jsonObj.put("path", input.getFilePath());
-    }
-    if (jsonObj.get("path") == null && input.getStringValue("path") != null) {
-      jsonObj.put("path", input.getStringValue("path"));
-    }
-
-    // Add host if required
-    if (jsonObj.get("host") == null && LogFeederUtil.hostName != null) {
-      jsonObj.put("host", LogFeederUtil.hostName);
-    }
-    // Add IP if required
-    if (jsonObj.get("ip") == null && LogFeederUtil.ipAddress != null) {
-      jsonObj.put("ip", LogFeederUtil.ipAddress);
-    }
-    
-    //Add level
-    if (jsonObj.get("level") == null) {
-      jsonObj.put("level", LogFeederConstants.LOG_LEVEL_UNKNOWN);
-    }
-    if (input.isUseEventMD5() || input.isGenEventMD5()) {
-      String prefix = "";
-      Object logtimeObj = jsonObj.get("logtime");
-      if (logtimeObj != null) {
-        if (logtimeObj instanceof Date) {
-          prefix = "" + ((Date) logtimeObj).getTime();
-        } else {
-          prefix = logtimeObj.toString();
-        }
-      }
-      Long eventMD5 = LogFeederUtil.genHash(LogFeederUtil.getGson()
-        .toJson(jsonObj));
-      if (input.isGenEventMD5()) {
-        jsonObj.put("event_md5", prefix + eventMD5.toString());
-      }
-      if (input.isUseEventMD5()) {
-        jsonObj.put("id", prefix + eventMD5.toString());
-      }
-    }
-
-    // jsonObj.put("@timestamp", new Date());
-    jsonObj.put("seq_num", new Long(doc_counter++));
-    if (jsonObj.get("id") == null) {
-      jsonObj.put("id", UUID.randomUUID().toString());
-    }
-    if (jsonObj.get("event_count") == null) {
-      jsonObj.put("event_count", new Integer(1));
-    }
-    if (inputMarker.lineNumber > 0) {
-      jsonObj.put("logfile_line_number", new Integer(
-        inputMarker.lineNumber));
-    }
-    if (jsonObj.containsKey("log_message")) {
-      // TODO: Let's check size only for log_message for now
-      String logMessage = (String) jsonObj.get("log_message");
-      if (logMessage != null
-        && logMessage.getBytes().length > MAX_OUTPUT_SIZE) {
-        messageTruncateMetric.count++;
-        final String LOG_MESSAGE_KEY = this.getClass().getSimpleName()
-          + "_MESSAGESIZE";
-        LogFeederUtil.logErrorMessageByInterval(LOG_MESSAGE_KEY,
-          "Message is too big. size="
-            + logMessage.getBytes().length + ", input="
-            + input.getShortDescription()
-            + ". Truncating to " + MAX_OUTPUT_SIZE
-            + ", first upto 100 characters="
-            + LogFeederUtil.subString(logMessage, 100),
-          null, logger, Level.WARN);
-        logMessage = new String(logMessage.getBytes(), 0,
-          MAX_OUTPUT_SIZE);
-        jsonObj.put("log_message", logMessage);
-        // Add error tags
-        @SuppressWarnings("unchecked")
-        List<String> tagsList = (List<String>) jsonObj.get("tags");
-        if (tagsList == null) {
-          tagsList = new ArrayList<String>();
-          jsonObj.put("tags", tagsList);
-        }
-        tagsList.add("error_message_truncated");
-
-      }
-      if (addMessageMD5) {
-        jsonObj.put("message_md5",
-          "" + LogFeederUtil.genHash(logMessage));
-      }
-    }
-    //check log is allowed to send output
-    if (FilterLogData.INSTANCE.isAllowed(jsonObj)) {
-      for (Output output : input.getOutputList()) {
-        try {
-          output.write(jsonObj, inputMarker);
-        } catch (Exception e) {
-          logger.error("Error writing. to " + output.getShortDescription(), e);
-        }
-      }
-    }
-  }
-
-  public void write(String jsonBlock, InputMarker inputMarker) {
-    //check log is allowed to send output
-    if (FilterLogData.INSTANCE.isAllowed(jsonBlock)) {
-      for (Output output : inputMarker.input.getOutputList()) {
-        try {
-          output.write(jsonBlock, inputMarker);
-        } catch (Exception e) {
-          logger.error("Error writing. to " + output.getShortDescription(), e);
-        }
-      }
-    }
-  }
-
-  public void close() {
-    logger.info("Close called for outputs ...");
-    for (Output output : outputList) {
-      try {
-        output.setDrain(true);
-        output.close();
-      } catch (Exception e) {
-        // Ignore
-      }
-    }
-    // Need to get this value from property
-    int iterations = 30;
-    int waitTimeMS = 1000;
-    int i;
-    boolean allClosed = true;
-    for (i = 0; i < iterations; i++) {
-      allClosed = true;
-      for (Output output : outputList) {
-        if (!output.isClosed()) {
-          try {
-            allClosed = false;
-            logger.warn("Waiting for output to close. "
-              + output.getShortDescription() + ", "
-              + (iterations - i) + " more seconds");
-            Thread.sleep(waitTimeMS);
-          } catch (Throwable t) {
-            // Ignore
-          }
-        }
-      }
-      if (allClosed) {
-        break;
-      }
-    }
-
-    if (!allClosed) {
-      logger.warn("Some outpus were not closed. Iterations=" + i);
-      for (Output output : outputList) {
-        if (!output.isClosed()) {
-          logger.warn("Output not closed. Will ignore it."
-            + output.getShortDescription() + ", pendingCound="
-            + output.getPendingCount());
-        }
-      }
-    } else {
-      logger.info("All outputs are closed. Iterations=" + i);
-    }
-  }
-
-  public void logStats() {
-    for (Output output : outputList) {
-      output.logStat();
-    }
-    LogFeederUtil.logStatForMetric(messageTruncateMetric,
-      "Stat: Messages Truncated", null);
-  }
-
-  public void addMetricsContainers(List<MetricCount> metricsList) {
-    metricsList.add(messageTruncateMetric);
-    for (Output output : outputList) {
-      output.addMetricsContainers(metricsList);
-    }
-  }
-
-  
-  public void copyFile(File inputFile, InputMarker inputMarker) {
-    Input input = inputMarker.input;
-    for (Output output : input.getOutputList()) {
-      try {
-        output.copyFile(inputFile, inputMarker);
-      }catch (Exception e) {
-        logger.error("Error coyping file . to " + output.getShortDescription(),
-            e);
-      }
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/1b07a6dd/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/OutputS3File.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/OutputS3File.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/OutputS3File.java
index e95f8df..26f1ddb 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/OutputS3File.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/OutputS3File.java
@@ -22,6 +22,7 @@ import com.google.common.annotations.VisibleForTesting;
 import com.google.gson.Gson;
 import com.google.gson.GsonBuilder;
 import org.apache.ambari.logfeeder.LogFeeder;
+import org.apache.ambari.logfeeder.common.LogFeederConstants;
 import org.apache.ambari.logfeeder.filter.Filter;
 import org.apache.ambari.logfeeder.input.InputMarker;
 import org.apache.ambari.logfeeder.output.spool.LogSpooler;
@@ -47,10 +48,10 @@ import java.util.Map.Entry;
  * </ul>
  */
 public class OutputS3File extends Output implements RolloverCondition, RolloverHandler {
+  private static final Logger LOG = Logger.getLogger(OutputS3File.class);
 
   public static final String INPUT_ATTRIBUTE_TYPE = "type";
   public static final String GLOBAL_CONFIG_S3_PATH_SUFFIX = "global.config.json";
-  static private Logger logger = Logger.getLogger(OutputS3File.class);
 
   private LogSpooler logSpooler;
   private S3OutputConfiguration s3OutputConfiguration;
@@ -72,23 +73,21 @@ public class OutputS3File extends Output implements RolloverCondition, RolloverH
   @Override
   public void copyFile(File inputFile, InputMarker inputMarker) {
     String type = inputMarker.input.getStringValue(INPUT_ATTRIBUTE_TYPE);
-    S3Uploader s3Uploader = new S3Uploader(s3OutputConfiguration,
-        S3Util.INSTANCE, false, type);
-    String resolvedPath = s3Uploader.uploadFile(inputFile,
-        inputMarker.input.getStringValue(INPUT_ATTRIBUTE_TYPE));
+    S3Uploader s3Uploader = new S3Uploader(s3OutputConfiguration, false, type);
+    String resolvedPath = s3Uploader.uploadFile(inputFile, inputMarker.input.getStringValue(INPUT_ATTRIBUTE_TYPE));
 
     uploadConfig(inputMarker, type, s3OutputConfiguration, resolvedPath);
   }
 
-  private void uploadConfig(InputMarker inputMarker, String type,
-                            S3OutputConfiguration s3OutputConfiguration, String resolvedPath) {
+  private void uploadConfig(InputMarker inputMarker, String type, S3OutputConfiguration s3OutputConfiguration,
+      String resolvedPath) {
 
     ArrayList<Map<String, Object>> filters = new ArrayList<>();
     addFilters(filters, inputMarker.input.getFirstFilter());
     Map<String, Object> inputConfig = new HashMap<>();
     inputConfig.putAll(inputMarker.input.getConfigs());
-    String s3CompletePath = S3Util.S3_PATH_START_WITH + s3OutputConfiguration.getS3BucketName()
-        + S3Util.S3_PATH_SEPARATOR + resolvedPath;
+    String s3CompletePath = LogFeederConstants.S3_PATH_START_WITH + s3OutputConfiguration.getS3BucketName() +
+        LogFeederConstants.S3_PATH_SEPARATOR + resolvedPath;
     inputConfig.put("path", s3CompletePath);
 
     ArrayList<Map<String, Object>> inputConfigList = new ArrayList<>();
@@ -117,17 +116,15 @@ public class OutputS3File extends Output implements RolloverCondition, RolloverH
     }
   }
 
-  private void writeConfigToS3(Map<String, Object> configToWrite, String s3KeySuffix,
-                              S3OutputConfiguration s3OutputConfiguration) {
+  private void writeConfigToS3(Map<String, Object> configToWrite, String s3KeySuffix, S3OutputConfiguration s3OutputConfiguration) {
     Gson gson = new GsonBuilder().setPrettyPrinting().create();
     String configJson = gson.toJson(configToWrite);
 
-    String s3ResolvedKey = new S3LogPathResolver().
-        getResolvedPath(getStringValue("s3_config_dir"), s3KeySuffix, s3OutputConfiguration.getCluster());
+    String s3ResolvedKey = new S3LogPathResolver().getResolvedPath(getStringValue("s3_config_dir"), s3KeySuffix,
+        s3OutputConfiguration.getCluster());
 
-    S3Util.INSTANCE.writeIntoS3File(configJson, s3OutputConfiguration.getS3BucketName(),
-        s3ResolvedKey, s3OutputConfiguration.getS3AccessKey(),
-        s3OutputConfiguration.getS3SecretKey());
+    S3Util.writeIntoS3File(configJson, s3OutputConfiguration.getS3BucketName(), s3ResolvedKey,
+        s3OutputConfiguration.getS3AccessKey(), s3OutputConfiguration.getS3SecretKey());
   }
 
   private String getComponentConfigFileName(String componentName) {
@@ -136,7 +133,7 @@ public class OutputS3File extends Output implements RolloverCondition, RolloverH
 
 
   private Map<String, Object> getGlobalConfig() {
-    Map<String, Object> globalConfig = LogFeeder.globalMap;
+    Map<String, Object> globalConfig = LogFeeder.globalConfigs;
     if (globalConfig == null) {
       globalConfig = new HashMap<>();
     }
@@ -173,8 +170,7 @@ public class OutputS3File extends Output implements RolloverCondition, RolloverH
       globalConfig.put("copy_file", false);
       globalConfig.put("process_file", true);
       globalConfig.put("tail", false);
-      Map<String, Object> addFields = (Map<String, Object>) globalConfig
-          .get("add_fields");
+      Map<String, Object> addFields = (Map<String, Object>) globalConfig.get("add_fields");
       if (addFields == null) {
         addFields = new HashMap<>();
       }
@@ -216,7 +212,7 @@ public class OutputS3File extends Output implements RolloverCondition, RolloverH
 
   @VisibleForTesting
   protected S3Uploader createUploader(String logType) {
-    S3Uploader uploader = new S3Uploader(s3OutputConfiguration, S3Util.INSTANCE, true, logType);
+    S3Uploader uploader = new S3Uploader(s3OutputConfiguration, true, logType);
     uploader.startUploaderThread();
     return uploader;
   }
@@ -224,8 +220,7 @@ public class OutputS3File extends Output implements RolloverCondition, RolloverH
   @VisibleForTesting
   protected LogSpooler createSpooler(String filePath) {
     String spoolDirectory = LogFeederUtil.getLogfeederTempDir() + "/s3/service";
-    logger.info(String.format("Creating spooler with spoolDirectory=%s, filePath=%s",
-        spoolDirectory, filePath));
+    LOG.info(String.format("Creating spooler with spoolDirectory=%s, filePath=%s", spoolDirectory, filePath));
     return new LogSpooler(spoolDirectory, new File(filePath).getName()+"-", this, this,
         s3OutputConfiguration.getRolloverTimeThresholdSecs());
   }
@@ -244,7 +239,7 @@ public class OutputS3File extends Output implements RolloverCondition, RolloverH
     long currentSize = spoolFile.length();
     boolean result = (currentSize >= s3OutputConfiguration.getRolloverSizeThresholdBytes());
     if (result) {
-      logger.info(String.format("Rolling over %s, current size %d, threshold size %d", spoolFile, currentSize,
+      LOG.info(String.format("Rolling over %s, current size %d, threshold size %d", spoolFile, currentSize,
           s3OutputConfiguration.getRolloverSizeThresholdBytes()));
     }
     return result;

http://git-wip-us.apache.org/repos/asf/ambari/blob/1b07a6dd/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/OutputSolr.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/OutputSolr.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/OutputSolr.java
index cd9ce4d..47f139d 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/OutputSolr.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/OutputSolr.java
@@ -34,7 +34,8 @@ import java.util.concurrent.LinkedBlockingQueue;
 import java.util.concurrent.TimeUnit;
 
 import org.apache.ambari.logfeeder.input.InputMarker;
-import org.apache.ambari.logfeeder.logconfig.FetchConfigFromSolr;
+import org.apache.ambari.logfeeder.logconfig.LogConfigHandler;
+import org.apache.ambari.logfeeder.util.DateUtil;
 import org.apache.ambari.logfeeder.util.LogFeederUtil;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.log4j.Level;
@@ -76,7 +77,17 @@ public class OutputSolr extends Output {
 
   private BlockingQueue<OutputData> outgoingBuffer = null;
   private List<SolrWorkerThread> workerThreadList = new ArrayList<>();
-
+  
+  @Override
+  protected String getStatMetricName() {
+    return "output.solr.write_logs";
+  }
+  
+  @Override
+  protected String getWriteBytesMetricName() {
+    return "output.solr.write_bytes";
+  }
+  
   @Override
   public void init() throws Exception {
     super.init();
@@ -87,9 +98,6 @@ public class OutputSolr extends Output {
   }
 
   private void initParams() throws Exception {
-    statMetric.metricsName = "output.solr.write_logs";
-    writeBytesMetric.metricsName = "output.solr.write_bytes";
-
     splitMode = getStringValue("splits_interval_mins", "none");
     if (!splitMode.equalsIgnoreCase("none")) {
       splitInterval = getIntValue("split_interval_mins", DEFAULT_SPLIT_INTERVAL);
@@ -204,10 +212,8 @@ public class OutputSolr extends Output {
         LOG.info("Ping to Solr server is successful for worker=" + count);
       } else {
         LOG.warn(
-            String.format(
-                "Ping to Solr server failed. It would check again. worker=%d, "
-                    + "solrUrl=%s, zkConnectString=%s, collection=%s, response=%s",
-                count, solrUrl, zkConnectString, collection, response));
+            String.format("Ping to Solr server failed. It would check again. worker=%d, solrUrl=%s, zkConnectString=%s, " +
+                "collection=%s, response=%s", count, solrUrl, zkConnectString, collection, response));
       }
     } catch (Throwable t) {
       LOG.warn(String.format(
@@ -223,7 +229,7 @@ public class OutputSolr extends Output {
     
     while (true) {
       LOG.info("Checking if config is available");
-      if (FetchConfigFromSolr.isFilterAvailable()) {
+      if (LogConfigHandler.isFilterAvailable()) {
         LOG.info("Config is available");
         return;
       }
@@ -256,7 +262,7 @@ public class OutputSolr extends Output {
 
   private void useActualDateIfNeeded(Map<String, Object> jsonObj) {
     if (skipLogtime) {
-      jsonObj.put("logtime", LogFeederUtil.getActualDateStr());
+      jsonObj.put("logtime", DateUtil.getActualDateStr());
     }
   }
 
@@ -324,7 +330,7 @@ public class OutputSolr extends Output {
 
     private final SolrClient solrClient;
     private final Collection<SolrInputDocument> localBuffer = new ArrayList<>();
-    private final Map<String, InputMarker> latestInputMarkerList = new HashMap<>();
+    private final Map<String, InputMarker> latestInputMarkers = new HashMap<>();
 
     private long localBufferBytesSize = 0;
 
@@ -352,17 +358,16 @@ public class OutputSolr extends Output {
             }
           }
 
-          if (localBuffer.size() > 0 && ((outputData == null && isDrain())
-              || (nextDispatchDuration <= 0 || localBuffer.size() >= maxBufferSize))) {
+          if (localBuffer.size() > 0 && ((outputData == null && isDrain()) ||
+              (nextDispatchDuration <= 0 || localBuffer.size() >= maxBufferSize))) {
             boolean response = sendToSolr(outputData);
             if( isDrain() && !response) {
               //Since sending to Solr response failed and it is in draining mode, let's break;
-              LOG.warn("In drain mode and sending to Solr failed. So exiting. output=" 
-                  + getShortDescription());
+              LOG.warn("In drain mode and sending to Solr failed. So exiting. output=" + getShortDescription());
               break;
             }
           }
-          if( localBuffer.size() == 0 ) {
+          if (localBuffer.size() == 0) {
             //If localBuffer is empty, then reset the timer
             lastDispatchTime = currTimeMS;
           }
@@ -403,8 +408,7 @@ public class OutputSolr extends Output {
         } catch (IOException | SolrException exception) {
           // Transient error, lets block till it is available
           try {
-            LOG.warn("Solr is not reachable. Going to retry after "
-                + RETRY_INTERVAL + " seconds. " + "output="
+            LOG.warn("Solr is not reachable. Going to retry after " + RETRY_INTERVAL + " seconds. " + "output="
                 + getShortDescription(), exception);
             Thread.sleep(RETRY_INTERVAL * 1000);
           } catch (Throwable t) {
@@ -414,8 +418,8 @@ public class OutputSolr extends Output {
           // Something unknown happened. Let's not block because of this error. 
           // Clear the buffer
           String logMessageKey = this.getClass().getSimpleName() + "_SOLR_UPDATE_EXCEPTION";
-          LogFeederUtil.logErrorMessageByInterval(logMessageKey,
-              "Error sending log message to server. Dropping logs", serverException, LOG, Level.ERROR);
+          LogFeederUtil.logErrorMessageByInterval(logMessageKey, "Error sending log message to server. Dropping logs",
+              serverException, LOG, Level.ERROR);
           resetLocalBuffer();
           break;
         }
@@ -447,7 +451,7 @@ public class OutputSolr extends Output {
               Level.ERROR);
         }
       }
-      latestInputMarkerList.put(outputData.inputMarker.base64FileKey, outputData.inputMarker);
+      latestInputMarkers.put(outputData.inputMarker.base64FileKey, outputData.inputMarker);
       localBuffer.add(document);
     }
 
@@ -479,9 +483,9 @@ public class OutputSolr extends Output {
         LogFeederUtil.logErrorMessageByInterval(logMessageKey,
             String.format("Error writing to Solr. response=%s, log=%s", response, outputData), null, LOG, Level.ERROR);
       }
-      statMetric.count += localBuffer.size();
-      writeBytesMetric.count += localBufferBytesSize;
-      for (InputMarker inputMarker : latestInputMarkerList.values()) {
+      statMetric.value += localBuffer.size();
+      writeBytesMetric.value += localBufferBytesSize;
+      for (InputMarker inputMarker : latestInputMarkers.values()) {
         inputMarker.input.checkIn(inputMarker);
       }
     }
@@ -499,7 +503,7 @@ public class OutputSolr extends Output {
     public void resetLocalBuffer() {
       localBuffer.clear();
       localBufferBytesSize = 0;
-      latestInputMarkerList.clear();
+      latestInputMarkers.clear();
     }
 
     public boolean isDone() {
@@ -512,9 +516,7 @@ public class OutputSolr extends Output {
   }
 
   @Override
-  public void copyFile(File inputFile, InputMarker inputMarker)
-      throws UnsupportedOperationException {
-    throw new UnsupportedOperationException(
-        "copyFile method is not yet supported for output=solr");
+  public void copyFile(File inputFile, InputMarker inputMarker) throws UnsupportedOperationException {
+    throw new UnsupportedOperationException("copyFile method is not yet supported for output=solr");
   }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/1b07a6dd/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/S3LogPathResolver.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/S3LogPathResolver.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/S3LogPathResolver.java
index 58282e0..8c544cf 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/S3LogPathResolver.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/S3LogPathResolver.java
@@ -1,4 +1,4 @@
-/**
+/*
  * 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
@@ -18,9 +18,9 @@
 
 package org.apache.ambari.logfeeder.output;
 
+import org.apache.ambari.logfeeder.common.LogFeederConstants;
 import org.apache.ambari.logfeeder.util.LogFeederUtil;
 import org.apache.ambari.logfeeder.util.PlaceholderUtil;
-import org.apache.ambari.logfeeder.util.S3Util;
 
 import java.util.HashMap;
 
@@ -40,7 +40,7 @@ public class S3LogPathResolver {
   public String getResolvedPath(String baseKeyPrefix, String keySuffix, String cluster) {
     HashMap<String, String> contextParam = buildContextParam(cluster);
     String resolvedKeyPrefix = PlaceholderUtil.replaceVariables(baseKeyPrefix, contextParam);
-    return resolvedKeyPrefix + S3Util.S3_PATH_SEPARATOR + keySuffix;
+    return resolvedKeyPrefix + LogFeederConstants.S3_PATH_SEPARATOR + keySuffix;
   }
 
   private HashMap<String, String> buildContextParam(String cluster) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/1b07a6dd/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/S3OutputConfiguration.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/S3OutputConfiguration.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/S3OutputConfiguration.java
index 485b0d4..e5974c5 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/S3OutputConfiguration.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/S3OutputConfiguration.java
@@ -1,4 +1,4 @@
-/**
+/*
  * 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
@@ -103,8 +103,7 @@ public class S3OutputConfiguration {
     };
 
     for (int i = 0; i < longValuedKeysToCopy.length; i++) {
-      configs.put(longValuedKeysToCopy[i],
-          configBlock.getLongValue(longValuedKeysToCopy[i], defaultValuesForLongValuedKeys[i]));
+      configs.put(longValuedKeysToCopy[i], configBlock.getLongValue(longValuedKeysToCopy[i], defaultValuesForLongValuedKeys[i]));
     }
 
     configs.put(ADDITIONAL_FIELDS_KEY, configBlock.getNVList(ADDITIONAL_FIELDS_KEY));

http://git-wip-us.apache.org/repos/asf/ambari/blob/1b07a6dd/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/S3Uploader.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/S3Uploader.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/S3Uploader.java
index fd59c51..e95a663 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/S3Uploader.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/S3Uploader.java
@@ -1,4 +1,4 @@
-/**
+/*
  * 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
@@ -18,8 +18,12 @@
 
 package org.apache.ambari.logfeeder.output;
 
+import com.amazonaws.AmazonClientException;
+import com.amazonaws.services.s3.transfer.TransferManager;
+import com.amazonaws.services.s3.transfer.Upload;
 import com.google.common.annotations.VisibleForTesting;
 
+import org.apache.ambari.logfeeder.common.LogFeederConstants;
 import org.apache.ambari.logfeeder.util.CompressionUtil;
 import org.apache.ambari.logfeeder.util.S3Util;
 import org.apache.log4j.Logger;
@@ -39,20 +43,18 @@ import java.util.concurrent.atomic.AtomicBoolean;
  * {@link org.apache.ambari.logfeeder.input.InputFile}.
  */
 public class S3Uploader implements Runnable {
+  private static final Logger LOG = Logger.getLogger(S3Uploader.class);
+  
   public static final String POISON_PILL = "POISON-PILL";
-  private static Logger logger = Logger.getLogger(S3Uploader.class);
 
   private final S3OutputConfiguration s3OutputConfiguration;
-  private final S3Util s3UtilInstance;
   private final boolean deleteOnEnd;
-  private String logType;
+  private final String logType;
   private final BlockingQueue<String> fileContextsToUpload;
-  private AtomicBoolean stopRunningThread = new AtomicBoolean(false);
+  private final AtomicBoolean stopRunningThread = new AtomicBoolean(false);
 
-  public S3Uploader(S3OutputConfiguration s3OutputConfiguration, S3Util s3UtilInstance, boolean deleteOnEnd,
-                    String logType) {
+  public S3Uploader(S3OutputConfiguration s3OutputConfiguration, boolean deleteOnEnd, String logType) {
     this.s3OutputConfiguration = s3OutputConfiguration;
-    this.s3UtilInstance = s3UtilInstance;
     this.deleteOnEnd = deleteOnEnd;
     this.logType = logType;
     this.fileContextsToUpload = new LinkedBlockingQueue<>();
@@ -81,7 +83,7 @@ public class S3Uploader implements Runnable {
     stopRunningThread.set(true);
     boolean offerStatus = fileContextsToUpload.offer(POISON_PILL);
     if (!offerStatus) {
-      logger.warn("Could not add poison pill to interrupt uploader thread.");
+      LOG.warn("Could not add poison pill to interrupt uploader thread.");
     }
   }
 
@@ -92,7 +94,7 @@ public class S3Uploader implements Runnable {
   void addFileForUpload(String fileToUpload) {
     boolean offerStatus = fileContextsToUpload.offer(fileToUpload);
     if (!offerStatus) {
-      logger.error("Could not add file " + fileToUpload + " for upload.");
+      LOG.error("Could not add file " + fileToUpload + " for upload.");
     }
   }
 
@@ -102,12 +104,12 @@ public class S3Uploader implements Runnable {
       try {
         String fileNameToUpload = fileContextsToUpload.take();
         if (POISON_PILL.equals(fileNameToUpload)) {
-          logger.warn("Found poison pill while waiting for files to upload, exiting");
+          LOG.warn("Found poison pill while waiting for files to upload, exiting");
           return;
         }
         uploadFile(new File(fileNameToUpload), logType);
       } catch (InterruptedException e) {
-        logger.error("Interrupted while waiting for elements from fileContextsToUpload", e);
+        LOG.error("Interrupted while waiting for elements from fileContextsToUpload", e);
         return;
       }
     }
@@ -130,34 +132,44 @@ public class S3Uploader implements Runnable {
     String compressionAlgo = s3OutputConfiguration.getCompressionAlgo();
 
     String keySuffix = fileToUpload.getName() + "." + compressionAlgo;
-    String s3Path = new S3LogPathResolver().
-        getResolvedPath(s3OutputConfiguration.getS3Path()+S3Util.S3_PATH_SEPARATOR+logType,
-            keySuffix, s3OutputConfiguration.getCluster());
-    logger.info(String.format("keyPrefix=%s, keySuffix=%s, s3Path=%s",
-        s3OutputConfiguration.getS3Path(), keySuffix, s3Path));
+    String s3Path = new S3LogPathResolver().getResolvedPath(
+        s3OutputConfiguration.getS3Path() + LogFeederConstants.S3_PATH_SEPARATOR + logType, keySuffix,
+        s3OutputConfiguration.getCluster());
+    LOG.info(String.format("keyPrefix=%s, keySuffix=%s, s3Path=%s", s3OutputConfiguration.getS3Path(), keySuffix, s3Path));
     File sourceFile = createCompressedFileForUpload(fileToUpload, compressionAlgo);
 
-    logger.info("Starting S3 upload " + sourceFile + " -> " + bucketName + ", " + s3Path);
-    s3UtilInstance.uploadFileTos3(bucketName, s3Path, sourceFile, s3AccessKey,
-        s3SecretKey);
+    LOG.info("Starting S3 upload " + sourceFile + " -> " + bucketName + ", " + s3Path);
+    uploadFileToS3(bucketName, s3Path, sourceFile, s3AccessKey, s3SecretKey);
 
     // delete local compressed file
     sourceFile.delete();
     if (deleteOnEnd) {
-      logger.info("Deleting input file as required");
+      LOG.info("Deleting input file as required");
       if (!fileToUpload.delete()) {
-        logger.error("Could not delete file " + fileToUpload.getAbsolutePath() + " after upload to S3");
+        LOG.error("Could not delete file " + fileToUpload.getAbsolutePath() + " after upload to S3");
       }
     }
     return s3Path;
   }
 
   @VisibleForTesting
+  protected void uploadFileToS3(String bucketName, String s3Key, File localFile, String accessKey, String secretKey) {
+    TransferManager transferManager = S3Util.getTransferManager(accessKey, secretKey);
+    try {
+      Upload upload = transferManager.upload(bucketName, s3Key, localFile);
+      upload.waitForUploadResult();
+    } catch (AmazonClientException | InterruptedException e) {
+      LOG.error("s3 uploading failed for file :" + localFile.getAbsolutePath(), e);
+    } finally {
+      S3Util.shutdownTransferManager(transferManager);
+    }
+  }
+
+  @VisibleForTesting
   protected File createCompressedFileForUpload(File fileToUpload, String compressionAlgo) {
-    File outputFile = new File(fileToUpload.getParent(), fileToUpload.getName() + "_"
-        + new Date().getTime() + "." + compressionAlgo);
-    outputFile = CompressionUtil.compressFile(fileToUpload, outputFile,
-        compressionAlgo);
+    File outputFile = new File(fileToUpload.getParent(), fileToUpload.getName() + "_" + new Date().getTime() +
+        "." + compressionAlgo);
+    outputFile = CompressionUtil.compressFile(fileToUpload, outputFile, compressionAlgo);
     return outputFile;
   }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/1b07a6dd/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/spool/LogSpooler.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/spool/LogSpooler.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/spool/LogSpooler.java
index fb263ba..1f13357 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/spool/LogSpooler.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/spool/LogSpooler.java
@@ -1,4 +1,4 @@
-/**
+/*
  * 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
@@ -39,8 +39,9 @@ import java.util.concurrent.atomic.AtomicBoolean;
  * {@link RolloverHandler} to trigger the handling of the rolled over file.
  */
 public class LogSpooler {
+  
+  private static final Logger LOG = Logger.getLogger(LogSpooler.class);
   public static final long TIME_BASED_ROLLOVER_DISABLED_THRESHOLD = 0;
-  static private Logger logger = Logger.getLogger(LogSpooler.class);
   static final String fileDateFormat = "yyyy-MM-dd-HH-mm-ss";
 
   private String spoolDirectory;
@@ -98,7 +99,7 @@ public class LogSpooler {
   private void initializeSpoolDirectory() {
     File spoolDir = new File(spoolDirectory);
     if (!spoolDir.exists()) {
-      logger.info("Creating spool directory: " + spoolDir);
+      LOG.info("Creating spool directory: " + spoolDir);
       boolean result = spoolDir.mkdirs();
       if (!result) {
         throw new LogSpoolerException("Could not create spool directory: " + spoolDirectory);
@@ -116,7 +117,7 @@ public class LogSpooler {
           + ", error message: " + e.getLocalizedMessage(), e);
     }
     currentSpoolerContext = new LogSpoolerContext(currentSpoolFile);
-    logger.info("Initialized spool file at path: " + currentSpoolFile);
+    LOG.info("Initialized spool file at path: " + currentSpoolFile);
   }
 
   @VisibleForTesting
@@ -141,7 +142,7 @@ public class LogSpooler {
     currentSpoolBufferedWriter.println(logEvent);
     currentSpoolerContext.logEventSpooled();
     if (rolloverCondition.shouldRollover(currentSpoolerContext)) {
-      logger.info("Trying to rollover based on rollover condition");
+      LOG.info("Trying to rollover based on rollover condition");
       tryRollover();
     }
   }
@@ -154,19 +155,19 @@ public class LogSpooler {
    * rolled over file.
    */
   public void rollover() {
-    logger.info("Rollover condition detected, rolling over file: " + currentSpoolFile);
+    LOG.info("Rollover condition detected, rolling over file: " + currentSpoolFile);
     currentSpoolBufferedWriter.flush();
     if (currentSpoolFile.length()==0) {
-      logger.info("No data in file " + currentSpoolFile + ", not doing rollover");
+      LOG.info("No data in file " + currentSpoolFile + ", not doing rollover");
     } else {
       currentSpoolBufferedWriter.close();
       rolloverHandler.handleRollover(currentSpoolFile);
-      logger.info("Invoked rollover handler with file: " + currentSpoolFile);
+      LOG.info("Invoked rollover handler with file: " + currentSpoolFile);
       initializeSpoolState();
     }
     boolean status = rolloverInProgress.compareAndSet(true, false);
     if (!status) {
-      logger.error("Should have reset rollover flag!!");
+      LOG.error("Should have reset rollover flag!!");
     }
   }
 
@@ -174,7 +175,7 @@ public class LogSpooler {
     if (rolloverInProgress.compareAndSet(false, true)) {
       rollover();
     } else {
-      logger.warn("Ignoring rollover call as rollover already in progress for file " +
+      LOG.warn("Ignoring rollover call as rollover already in progress for file " +
           currentSpoolFile);
     }
   }
@@ -197,7 +198,7 @@ public class LogSpooler {
   private class LogSpoolerRolloverTimerTask extends TimerTask {
     @Override
     public void run() {
-      logger.info("Trying rollover based on time");
+      LOG.info("Trying rollover based on time");
       tryRollover();
     }
   }

http://git-wip-us.apache.org/repos/asf/ambari/blob/1b07a6dd/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/spool/LogSpoolerContext.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/spool/LogSpoolerContext.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/spool/LogSpoolerContext.java
index 084d6a2..616300f 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/spool/LogSpoolerContext.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/spool/LogSpoolerContext.java
@@ -1,4 +1,4 @@
-/**
+/*
  * 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

http://git-wip-us.apache.org/repos/asf/ambari/blob/1b07a6dd/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/spool/LogSpoolerException.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/spool/LogSpoolerException.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/spool/LogSpoolerException.java
index 1e12fb7..14bb139 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/spool/LogSpoolerException.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/spool/LogSpoolerException.java
@@ -1,4 +1,4 @@
-/**
+/*
  * 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

http://git-wip-us.apache.org/repos/asf/ambari/blob/1b07a6dd/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/spool/RolloverCondition.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/spool/RolloverCondition.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/spool/RolloverCondition.java
index 8279645..48ace11 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/spool/RolloverCondition.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/spool/RolloverCondition.java
@@ -1,4 +1,4 @@
-/**
+/*
  * 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

http://git-wip-us.apache.org/repos/asf/ambari/blob/1b07a6dd/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/spool/RolloverHandler.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/spool/RolloverHandler.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/spool/RolloverHandler.java
index 11308e4..2ec2708 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/spool/RolloverHandler.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/spool/RolloverHandler.java
@@ -1,4 +1,4 @@
-/**
+/*
  * 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

http://git-wip-us.apache.org/repos/asf/ambari/blob/1b07a6dd/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/util/AWSUtil.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/util/AWSUtil.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/util/AWSUtil.java
index 15f7594..f814a92 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/util/AWSUtil.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/util/AWSUtil.java
@@ -20,62 +20,20 @@ package org.apache.ambari.logfeeder.util;
 
 import org.apache.log4j.Logger;
 
-import com.amazonaws.AmazonServiceException;
 import com.amazonaws.auth.AWSCredentials;
 import com.amazonaws.auth.BasicAWSCredentials;
-import com.amazonaws.services.identitymanagement.AmazonIdentityManagementClient;
 
-public enum AWSUtil {
-  INSTANCE;
+public class AWSUtil {
   private static final Logger LOG = Logger.getLogger(AWSUtil.class);
 
-  public String getAwsUserName(String accessKey, String secretKey) {
-    String username = null;
-    AWSCredentials awsCredentials = createAWSCredentials(accessKey, secretKey);
-    AmazonIdentityManagementClient amazonIdentityManagementClient;
-    if (awsCredentials != null) {
-      amazonIdentityManagementClient = new AmazonIdentityManagementClient(
-          awsCredentials);
-    } else {
-      // create default client
-      amazonIdentityManagementClient = new AmazonIdentityManagementClient();
-    }
-    try {
-      username = amazonIdentityManagementClient.getUser().getUser()
-          .getUserName();
-    } catch (AmazonServiceException e) {
-      if (e.getErrorCode().compareTo("AccessDenied") == 0) {
-        String arn = null;
-        String msg = e.getMessage();
-        int arnIdx = msg.indexOf("arn:aws");
-        if (arnIdx != -1) {
-          int arnSpace = msg.indexOf(" ", arnIdx);
-          // should be similar to "arn:aws:iam::111111111111:user/username"
-          arn = msg.substring(arnIdx, arnSpace);
-        }
-        if (arn != null) {
-          String[] arnParts = arn.split(":");
-          if (arnParts != null && arnParts.length > 5) {
-            username = arnParts[5];
-            if (username != null) {
-              username = username.replace("user/", "");
-            }
-          }
-        }
-      }
-    } catch (Exception exception) {
-      LOG.error(
-          "Error in getting username :" + exception.getLocalizedMessage(),
-          exception.getCause());
-    }
-    return username;
+  private AWSUtil() {
+    throw new UnsupportedOperationException();
   }
 
-  public AWSCredentials createAWSCredentials(String accessKey, String secretKey) {
+  public static AWSCredentials createAWSCredentials(String accessKey, String secretKey) {
     if (accessKey != null && secretKey != null) {
       LOG.debug("Creating aws client as per new accesskey and secretkey");
-      AWSCredentials awsCredentials = new BasicAWSCredentials(accessKey,
-          secretKey);
+      AWSCredentials awsCredentials = new BasicAWSCredentials(accessKey, secretKey);
       return awsCredentials;
     } else {
       return null;

http://git-wip-us.apache.org/repos/asf/ambari/blob/1b07a6dd/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/util/AliasUtil.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/util/AliasUtil.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/util/AliasUtil.java
index a92ba29..5049b62 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/util/AliasUtil.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/util/AliasUtil.java
@@ -21,69 +21,90 @@ package org.apache.ambari.logfeeder.util;
 import java.io.File;
 import java.util.HashMap;
 
+import org.apache.ambari.logfeeder.filter.Filter;
+import org.apache.ambari.logfeeder.input.Input;
+import org.apache.ambari.logfeeder.mapper.Mapper;
+import org.apache.ambari.logfeeder.output.Output;
+import org.apache.commons.lang3.StringUtils;
 import org.apache.log4j.Logger;
 
 public class AliasUtil {
 
-  private static Logger logger = Logger.getLogger(AliasUtil.class);
+  private static final Logger LOG = Logger.getLogger(AliasUtil.class);
 
-  private static AliasUtil instance = null;
+  private static final String ALIAS_CONFIG_JSON = "alias_config.json";
+  private static HashMap<String, Object> aliasMap = null;
 
-  private static String aliasConfigJson = "alias_config.json";
-
-  private HashMap<String, Object> aliasMap = null;
-
-  public static enum ALIAS_TYPE {
-    INPUT, FILTER, MAPPER, OUTPUT
+  static {
+    File jsonFile = FileUtil.getFileFromClasspath(ALIAS_CONFIG_JSON);
+    if (jsonFile != null) {
+      aliasMap = FileUtil.readJsonFromFile(jsonFile);
+    }
   }
 
-  public static enum ALIAS_PARAM {
-    KLASS
+  public static enum AliasType {
+    INPUT, FILTER, MAPPER, OUTPUT
   }
 
   private AliasUtil() {
-    init();
+    throw new UnsupportedOperationException();
   }
 
-  public static AliasUtil getInstance() {
-    if (instance == null) {
-      synchronized (AliasUtil.class) {
-        if (instance == null) {
-          instance = new AliasUtil();
-        }
-      }
+  public static Object getClassInstance(String key, AliasType aliasType) {
+    String classFullName = getClassFullName(key, aliasType);
+    
+    Object instance = null;
+    try {
+      instance = (Object) Class.forName(classFullName).getConstructor().newInstance();
+    } catch (Exception exception) {
+      LOG.error("Unsupported class = " + classFullName, exception.getCause());
     }
-    return instance;
-  }
 
-  /**
-   */
-  private void init() {
-    File jsonFile = LogFeederUtil.getFileFromClasspath(aliasConfigJson);
-    if (jsonFile != null) {
-      this.aliasMap = LogFeederUtil.readJsonFromFile(jsonFile);
+    if (instance != null) {
+      boolean isValid = false;
+      switch (aliasType) {
+        case FILTER:
+          isValid = Filter.class.isAssignableFrom(instance.getClass());
+          break;
+        case INPUT:
+          isValid = Input.class.isAssignableFrom(instance.getClass());
+          break;
+        case OUTPUT:
+          isValid = Output.class.isAssignableFrom(instance.getClass());
+          break;
+        case MAPPER:
+          isValid = Mapper.class.isAssignableFrom(instance.getClass());
+          break;
+        default:
+          LOG.warn("Unhandled aliasType: " + aliasType);
+          isValid = true;
+      }
+      if (!isValid) {
+        LOG.error("Not a valid class :" + classFullName + " AliasType :" + aliasType.name());
+      }
     }
-
+    return instance;
   }
 
-
-  public String readAlias(String key, ALIAS_TYPE aliastype, ALIAS_PARAM aliasParam) {
-    String result = key;// key as a default value;
+  private static String getClassFullName(String key, AliasType aliastype) {
+    String className = null;// key as a default value;
+    
     HashMap<String, String> aliasInfo = getAliasInfo(key, aliastype);
-    String value = aliasInfo.get(aliasParam.name().toLowerCase());
-    if (value != null && !value.isEmpty()) {
-      result = value;
-      logger.debug("Alias found for key :" + key + ",  param :" + aliasParam.name().toLowerCase() + ", value :"
-        + value + " aliastype:" + aliastype.name());
+    String value = aliasInfo.get("klass");
+    if (!StringUtils.isEmpty(value)) {
+      className = value;
+      LOG.debug("Class name found for key :" + key + ", class name :" + className + " aliastype:" + aliastype.name());
     } else {
-      logger.debug("Alias not found for key :" + key + ", param :" + aliasParam.name().toLowerCase());
+      LOG.debug("Class name not found for key :" + key + " aliastype:" + aliastype.name());
     }
-    return result;
+    
+    return className;
   }
 
   @SuppressWarnings("unchecked")
-  private HashMap<String, String> getAliasInfo(String key, ALIAS_TYPE aliastype) {
-    HashMap<String, String> aliasInfo = null;
+  private static HashMap<String, String> getAliasInfo(String key, AliasType aliastype) {
+    HashMap<String, String> aliasInfo = new HashMap<String, String>();
+    
     if (aliasMap != null) {
       String typeKey = aliastype.name().toLowerCase();
       HashMap<String, Object> typeJson = (HashMap<String, Object>) aliasMap.get(typeKey);
@@ -91,9 +112,7 @@ public class AliasUtil {
         aliasInfo = (HashMap<String, String>) typeJson.get(key);
       }
     }
-    if (aliasInfo == null) {
-      aliasInfo = new HashMap<String, String>();
-    }
+    
     return aliasInfo;
   }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/1b07a6dd/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/util/CompressionUtil.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/util/CompressionUtil.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/util/CompressionUtil.java
index c2addbd..c460ab3 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/util/CompressionUtil.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/util/CompressionUtil.java
@@ -37,25 +37,20 @@ public class CompressionUtil {
     FileInputStream ios = null;
     try {
       if (!inputFile.exists()) {
-        throw new IllegalArgumentException("Input File:"
-            + inputFile.getAbsolutePath() + " is not exist.");
+        throw new IllegalArgumentException("Input File:" + inputFile.getAbsolutePath() + " is not exist.");
       }
       if (inputFile.isDirectory()) {
-        throw new IllegalArgumentException("Input File:"
-            + inputFile.getAbsolutePath() + " is a directory.");
+        throw new IllegalArgumentException("Input File:" + inputFile.getAbsolutePath() + " is a directory.");
       }
       File parent = outputFile.getParentFile();
       if (parent != null && !parent.exists()) {
         boolean isParentCreated = parent.mkdirs();
         if (!isParentCreated) {
-          throw new IllegalAccessException(
-              "User does not have permission to create parent directory :"
-                  + parent.getAbsolutePath());
+          throw new IllegalAccessException( "User does not have permission to create parent directory :" + parent.getAbsolutePath());
         }
       }
-      final OutputStream out = new FileOutputStream(outputFile);
-      cos = new CompressorStreamFactory().createCompressorOutputStream(
-          algoName, out);
+      OutputStream out = new FileOutputStream(outputFile);
+      cos = new CompressorStreamFactory().createCompressorOutputStream(algoName, out);
       ios = new FileInputStream(inputFile);
       IOUtils.copy(ios, cos);
     } catch (Exception e) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/1b07a6dd/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/util/DateUtil.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/util/DateUtil.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/util/DateUtil.java
index 2ca9353..6321e17 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/util/DateUtil.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/util/DateUtil.java
@@ -20,12 +20,17 @@ package org.apache.ambari.logfeeder.util;
 
 import java.text.SimpleDateFormat;
 import java.util.Date;
+import java.util.TimeZone;
 
 import org.apache.log4j.Logger;
 
 public class DateUtil {
-  private static final Logger logger = Logger.getLogger(DateUtil.class);
-
+  private static final Logger LOG = Logger.getLogger(DateUtil.class);
+  
+  private DateUtil() {
+    throw new UnsupportedOperationException();
+  }
+  
   public static String dateToString(Date date, String dateFormat) {
     if (date == null || dateFormat == null || dateFormat.isEmpty()) {
       return "";
@@ -34,8 +39,36 @@ public class DateUtil {
       SimpleDateFormat formatter = new SimpleDateFormat(dateFormat);
       return formatter.format(date).toString();
     } catch (Exception e) {
-      logger.error("Error in coverting dateToString  format :" + dateFormat, e);
+      LOG.error("Error in coverting dateToString  format :" + dateFormat, e);
     }
     return "";
   }
+
+  private final static String SOLR_DATE_FORMAT = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'";
+  private static ThreadLocal<SimpleDateFormat> dateFormatter = new ThreadLocal<SimpleDateFormat>() {
+    @Override
+    protected SimpleDateFormat initialValue() {
+      SimpleDateFormat sdf = new SimpleDateFormat(SOLR_DATE_FORMAT);
+      sdf.setTimeZone(TimeZone.getTimeZone("UTC"));
+      return sdf;
+    }
+  };
+
+  public static String getDate(String timeStampStr) {
+    try {
+      return dateFormatter.get().format(new Date(Long.parseLong(timeStampStr)));
+    } catch (Exception ex) {
+      LOG.error(ex);
+      return null;
+    }
+  }
+
+  public static String getActualDateStr() {
+    try {
+      return dateFormatter.get().format(new Date());
+    } catch (Exception ex) {
+      LOG.error(ex);
+      return null;
+    }
+  }
 }


[54/58] [abbrv] ambari git commit: AMBARI-18616. Fix Log Search User Config bug (Miklos Gergely via oleewere)

Posted by ol...@apache.org.
AMBARI-18616. Fix Log Search User Config bug (Miklos Gergely via oleewere)

Change-Id: I008c431c07ae61a2121b0addf6747b7d9b53c618


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

Branch: refs/heads/branch-2.5
Commit: f9e6db4a730104eafe5080e6d49dd14fff7caf0e
Parents: a9094ab
Author: Miklos Gergely <mg...@hortonworks.com>
Authored: Wed Oct 19 17:30:44 2016 +0200
Committer: oleewere <ol...@gmail.com>
Committed: Sat Nov 5 14:46:47 2016 +0100

----------------------------------------------------------------------
 .../common/HadoopServiceConfigHelper.java       |  80 ++++++++++++++
 .../ambari/logsearch/dao/UserConfigSolrDao.java | 107 +++++--------------
 .../ambari/logsearch/manager/ManagerBase.java   |  35 ------
 .../logsearch/manager/ServiceLogsManager.java   |  13 +++
 .../model/common/LogFeederDataMap.java          |   8 +-
 .../views/filter/CreateLogfeederFilterView.js   |  81 ++++++++------
 6 files changed, 175 insertions(+), 149 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/f9e6db4a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/common/HadoopServiceConfigHelper.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/common/HadoopServiceConfigHelper.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/common/HadoopServiceConfigHelper.java
new file mode 100644
index 0000000..0e2087f
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/common/HadoopServiceConfigHelper.java
@@ -0,0 +1,80 @@
+/*
+ * 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.common;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Iterator;
+import java.util.Set;
+import java.util.TreeSet;
+
+import org.apache.ambari.logsearch.util.JSONUtil;
+import org.apache.commons.io.FileUtils;
+import org.apache.log4j.Logger;
+import org.codehaus.jettison.json.JSONArray;
+import org.codehaus.jettison.json.JSONException;
+import org.codehaus.jettison.json.JSONObject;
+
+import com.google.gson.JsonParseException;
+
+public class HadoopServiceConfigHelper {
+  private static final Logger LOG = Logger.getLogger(HadoopServiceConfigHelper.class);
+  
+  public static String getHadoopServiceConfigJSON() {
+    String fileContent = null;
+
+    try {
+      ClassLoader classLoader = HadoopServiceConfigHelper.class.getClassLoader();
+      File file = new File(classLoader.getResource("HadoopServiceConfig.json").getFile());
+      fileContent = FileUtils.readFileToString(file);
+    } catch (IOException e) {
+      LOG.error("Unable to read HadoopServiceConfig.json", e);
+    }
+
+    return JSONUtil.isJSONValid(fileContent) ? fileContent : null;
+  }
+  
+  @SuppressWarnings("unchecked")
+  public static Set<String> getAllLogIds() {
+    Set<String> logIds = new TreeSet<>();
+    
+    String key = null;
+    JSONArray componentArray = null;
+    try {
+      String hadoopServiceConfigJSON = getHadoopServiceConfigJSON();
+      JSONObject hadoopServiceJsonObject = new JSONObject(hadoopServiceConfigJSON).getJSONObject("service");
+      Iterator<String> hadoopSerivceKeys = hadoopServiceJsonObject.keys();
+      while (hadoopSerivceKeys.hasNext()) {
+        key = hadoopSerivceKeys.next();
+        componentArray = hadoopServiceJsonObject.getJSONObject(key).getJSONArray("components");
+        for (int i = 0; i < componentArray.length(); i++) {
+          JSONObject componentJsonObject = (JSONObject) componentArray.get(i);
+          String logId = componentJsonObject.getString("name");
+          logIds.add(logId);
+        }
+      }
+    } catch (JsonParseException | JSONException je) {
+      LOG.error("Error parsing JSON. key=" + key + ", componentArray=" + componentArray, je);
+      return null;
+    }
+
+    return logIds;
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/f9e6db4a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/UserConfigSolrDao.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/UserConfigSolrDao.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/UserConfigSolrDao.java
index 58337f7..418a405 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/UserConfigSolrDao.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/UserConfigSolrDao.java
@@ -19,22 +19,22 @@
 
 package org.apache.ambari.logsearch.dao;
 
-import java.io.File;
 import java.io.IOException;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Iterator;
 import java.util.List;
-import java.util.Scanner;
+import java.util.Set;
+import java.util.TreeMap;
+
 import javax.annotation.PostConstruct;
 import javax.inject.Inject;
 import javax.inject.Named;
 
+import org.apache.ambari.logsearch.common.HadoopServiceConfigHelper;
 import org.apache.ambari.logsearch.common.LogSearchConstants;
 import org.apache.ambari.logsearch.common.LogSearchContext;
 import org.apache.ambari.logsearch.common.LogType;
 import org.apache.ambari.logsearch.conf.SolrUserPropsConfig;
 import org.apache.ambari.logsearch.model.common.LogFeederDataMap;
+import org.apache.ambari.logsearch.model.common.LogfeederFilterData;
 import org.apache.solr.client.solrj.SolrQuery;
 import org.apache.solr.client.solrj.SolrServerException;
 import org.apache.solr.client.solrj.response.QueryResponse;
@@ -43,15 +43,11 @@ import org.apache.solr.common.SolrDocument;
 import org.apache.solr.common.SolrDocumentList;
 import org.apache.solr.common.SolrException;
 import org.apache.solr.common.SolrInputDocument;
-import org.codehaus.jettison.json.JSONArray;
-import org.codehaus.jettison.json.JSONException;
-import org.codehaus.jettison.json.JSONObject;
-import com.google.gson.JsonParseException;
 
 import org.apache.ambari.logsearch.util.JSONUtil;
+import org.apache.commons.collections.CollectionUtils;
 import org.apache.log4j.Logger;
 import org.springframework.data.solr.core.SolrTemplate;
-import org.springframework.util.CollectionUtils;
 
 import static org.apache.ambari.logsearch.solr.SolrConstants.UserConfigConstants.ID;
 import static org.apache.ambari.logsearch.solr.SolrConstants.UserConfigConstants.USER_NAME;
@@ -147,61 +143,43 @@ public class UserConfigSolrDao extends SolrDaoBase {
     return updateResoponse;
   }
 
-	@SuppressWarnings("unchecked")
   public LogFeederDataMap getUserFilter() throws SolrServerException, IOException {
-
     SolrQuery solrQuery = new SolrQuery();
     solrQuery.setQuery("*:*");
-    String fq = ROW_TYPE + ":" + LogSearchConstants.LOGFEEDER_FILTER_NAME;
-    solrQuery.setFilterQueries(fq);
+    solrQuery.setFilterQueries(ROW_TYPE + ":" + LogSearchConstants.LOGFEEDER_FILTER_NAME);
 
     QueryResponse response = process(solrQuery);
     SolrDocumentList documentList = response.getResults();
     LogFeederDataMap logfeederDataMap = null;
-    if (!CollectionUtils.isEmpty(documentList)) {
+    if (CollectionUtils.isNotEmpty(documentList)) {
       SolrDocument configDoc = documentList.get(0);
-      String configJson = JSONUtil.objToJson(configDoc);
-      HashMap<String, Object> configMap = JSONUtil.jsonToMapObject(configJson);
-      String json = (String) configMap.get(VALUES);
+      String json = (String) configDoc.get(VALUES);
       logfeederDataMap = (LogFeederDataMap) JSONUtil.jsonToObj(json, LogFeederDataMap.class);
       logfeederDataMap.setId("" + configDoc.get(ID));
-
     } else {
+      logfeederDataMap = initUserFilter();
+    }
+    return logfeederDataMap;
+  }
+
+  private LogFeederDataMap initUserFilter() throws SolrServerException, IOException {
+    LogFeederDataMap logfeederDataMap = new LogFeederDataMap();
+    
+    Set<String> logIds = HadoopServiceConfigHelper.getAllLogIds();
+    if (logIds != null) {
+      logfeederDataMap.setFilter(new TreeMap<String, LogfeederFilterData>());
+      logfeederDataMap.setId(Long.toString(System.currentTimeMillis()));
       List<String> logfeederDefaultLevels = solrUserConfig.getLogLevels();
-      JSONArray levelJsonArray = new JSONArray(logfeederDefaultLevels);
-
-      String hadoopServiceString = getHadoopServiceConfigJSON();
-      String key = null;
-      JSONArray componentArray = null;
-      try {
-        JSONObject componentList = new JSONObject();
-        JSONObject jsonValue = new JSONObject();
-
-        JSONObject hadoopServiceJsonObject = new JSONObject(hadoopServiceString).getJSONObject("service");
-        Iterator<String> hadoopSerivceKeys = hadoopServiceJsonObject.keys();
-        while (hadoopSerivceKeys.hasNext()) {
-          key = hadoopSerivceKeys.next();
-          componentArray = hadoopServiceJsonObject.getJSONObject(key).getJSONArray("components");
-          for (int i = 0; i < componentArray.length(); i++) {
-            JSONObject compJsonObject = (JSONObject) componentArray.get(i);
-            String componentName = compJsonObject.getString("name");
-            JSONObject innerContent = new JSONObject();
-            innerContent.put("label", componentName);
-            innerContent.put("hosts", new JSONArray());
-            innerContent.put("defaultLevels", levelJsonArray);
-            componentList.put(componentName, innerContent);
-          }
-        }
-        jsonValue.put("filter", componentList);
-        logfeederDataMap = (LogFeederDataMap) JSONUtil.jsonToObj(jsonValue.toString(), LogFeederDataMap.class);
-        logfeederDataMap.setId(""+new Date().getTime());
-        saveUserFilter(logfeederDataMap);
-
-      } catch (JsonParseException | JSONException je) {
-        LOG.error("Error parsing JSON. key=" + key + ", componentArray=" + componentArray, je);
-        logfeederDataMap = new LogFeederDataMap();
+      
+      for (String logId : logIds) {
+        LogfeederFilterData logfeederFilterData = new LogfeederFilterData();
+        logfeederFilterData.setLabel(logId);
+        logfeederFilterData.setDefaultLevels(logfeederDefaultLevels);
+        logfeederDataMap.getFilter().put(logId, logfeederFilterData);
       }
+      saveUserFilter(logfeederDataMap);
     }
+    
     return logfeederDataMap;
   }
 
@@ -209,31 +187,4 @@ public class UserConfigSolrDao extends SolrDaoBase {
   public SolrSchemaFieldDao getSolrSchemaFieldDao() {
     return solrSchemaFieldDao;
   }
-
-  private String getHadoopServiceConfigJSON() {
-    StringBuilder result = new StringBuilder("");
-
-    // Get file from resources folder
-    ClassLoader classLoader = getClass().getClassLoader();
-    File file = new File(classLoader.getResource("HadoopServiceConfig.json").getFile());
-
-    try (Scanner scanner = new Scanner(file)) {
-
-      while (scanner.hasNextLine()) {
-        String line = scanner.nextLine();
-        result.append(line).append("\n");
-      }
-
-      scanner.close();
-
-    } catch (IOException e) {
-      LOG.error("Unable to read HadoopServiceConfig.json", e);
-    }
-
-    String hadoopServiceConfig = result.toString();
-    if (JSONUtil.isJSONValid(hadoopServiceConfig)) {
-      return hadoopServiceConfig;
-    }
-    return null;
-  }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/f9e6db4a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/manager/ManagerBase.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/manager/ManagerBase.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/manager/ManagerBase.java
index 6c280ac..89873f3 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/manager/ManagerBase.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/manager/ManagerBase.java
@@ -19,19 +19,13 @@
 
 package org.apache.ambari.logsearch.manager;
 
-import java.io.File;
-import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
-import java.util.Scanner;
 
-import org.apache.ambari.logsearch.common.MessageEnums;
 import org.apache.ambari.logsearch.model.response.LogData;
 import org.apache.ambari.logsearch.model.response.LogSearchResponse;
 import org.apache.ambari.logsearch.dao.SolrDaoBase;
-import org.apache.ambari.logsearch.util.JSONUtil;
-import org.apache.ambari.logsearch.util.RESTErrorUtil;
 import org.apache.commons.collections.CollectionUtils;
 import org.apache.log4j.Logger;
 import org.apache.solr.client.solrj.SolrQuery;
@@ -47,35 +41,6 @@ public abstract class ManagerBase<LOG_DATA_TYPE extends LogData, SEARCH_RESPONSE
   public ManagerBase() {
     super();
   }
-
-  public String getHadoopServiceConfigJSON() {
-    StringBuilder result = new StringBuilder("");
-
-    // Get file from resources folder
-    ClassLoader classLoader = getClass().getClassLoader();
-    File file = new File(classLoader.getResource("HadoopServiceConfig.json").getFile());
-
-    try (Scanner scanner = new Scanner(file)) {
-
-      while (scanner.hasNextLine()) {
-        String line = scanner.nextLine();
-        result.append(line).append("\n");
-      }
-
-      scanner.close();
-
-    } catch (IOException e) {
-      logger.error("Unable to read HadoopServiceConfig.json", e);
-      throw RESTErrorUtil.createRESTException(e.getMessage(), MessageEnums.ERROR_SYSTEM);
-    }
-
-    String hadoopServiceConfig = result.toString();
-    if (JSONUtil.isJSONValid(hadoopServiceConfig)) {
-      return hadoopServiceConfig;
-    }
-    throw RESTErrorUtil.createRESTException("Improper JSON", MessageEnums.ERROR_SYSTEM);
-
-  }
   
   protected SEARCH_RESPONSE getLastPage(SolrDaoBase solrDoaBase, SimpleQuery lastPageQuery, String event) {
     int maxRows = lastPageQuery.getRows();

http://git-wip-us.apache.org/repos/asf/ambari/blob/f9e6db4a/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 74c549a..44d0c00 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
@@ -28,6 +28,7 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Locale;
 import java.util.Map;
+import java.util.Scanner;
 
 import javax.inject.Inject;
 import javax.inject.Named;
@@ -38,6 +39,8 @@ import com.google.common.collect.Lists;
 import freemarker.template.Configuration;
 import freemarker.template.Template;
 import freemarker.template.TemplateException;
+
+import org.apache.ambari.logsearch.common.HadoopServiceConfigHelper;
 import org.apache.ambari.logsearch.common.LogSearchConstants;
 import org.apache.ambari.logsearch.common.MessageEnums;
 import org.apache.ambari.logsearch.dao.ServiceLogsSolrDao;
@@ -68,6 +71,7 @@ import org.apache.ambari.logsearch.solr.model.SolrComponentTypeLogData;
 import org.apache.ambari.logsearch.solr.model.SolrHostLogData;
 import org.apache.ambari.logsearch.solr.model.SolrServiceLogData;
 import org.apache.ambari.logsearch.util.DownloadUtil;
+import org.apache.ambari.logsearch.util.JSONUtil;
 import org.apache.ambari.logsearch.util.DateUtil;
 import org.apache.ambari.logsearch.util.RESTErrorUtil;
 import org.apache.ambari.logsearch.util.SolrUtil;
@@ -567,4 +571,13 @@ public class ServiceLogsManager extends ManagerBase<SolrServiceLogData, ServiceL
     }
     throw new UnsupportedOperationException();
   }
+  
+
+  public String getHadoopServiceConfigJSON() {
+    String hadoopServiceConfigJSON = HadoopServiceConfigHelper.getHadoopServiceConfigJSON();
+    if (hadoopServiceConfigJSON == null) {
+      throw RESTErrorUtil.createRESTException("Could not load HadoopServiceConfig.json", MessageEnums.ERROR_SYSTEM);
+    }
+    return hadoopServiceConfigJSON;
+  }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/f9e6db4a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/common/LogFeederDataMap.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/common/LogFeederDataMap.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/common/LogFeederDataMap.java
index b09610c..cc7d53d 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/common/LogFeederDataMap.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/common/LogFeederDataMap.java
@@ -21,7 +21,7 @@ package org.apache.ambari.logsearch.model.common;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 
-import java.util.HashMap;
+import java.util.TreeMap;
 
 @ApiModel
 public class LogFeederDataMap {
@@ -30,13 +30,13 @@ public class LogFeederDataMap {
   private String id;
 
   @ApiModelProperty
-  private HashMap<String, LogfeederFilterData> filter;
+  private TreeMap<String, LogfeederFilterData> filter;
 
-  public HashMap<String, LogfeederFilterData> getFilter() {
+  public TreeMap<String, LogfeederFilterData> getFilter() {
     return filter;
   }
 
-  public void setFilter(HashMap<String, LogfeederFilterData> filter) {
+  public void setFilter(TreeMap<String, LogfeederFilterData> filter) {
     this.filter = filter;
   }
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/f9e6db4a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/filter/CreateLogfeederFilterView.js
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/filter/CreateLogfeederFilterView.js b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/filter/CreateLogfeederFilterView.js
index 9bdf0fa..bcab975 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/filter/CreateLogfeederFilterView.js
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/filter/CreateLogfeederFilterView.js
@@ -133,14 +133,30 @@ define(['require',
             	this.ui.loader.hide();
             },
             renderComponents : function(){
-            	var that =this;
-            	_.each(that.componentsList.models, function(model){
-                    var levels='<td align="left">'+model.get("type")+'</td>';
-                    var override = '<td class="text-left"><span class="pull-left"><!--small><i>Override</i></small--> <input data-override type="checkbox" data-name='+model.get("type")+'></span></td>';
-                    levels +=  override + that.getLevelForComponent(model.get("type"),false);
-                    var html = '<tr class="overrideSpacer"></tr><tr class="componentRow borderShow" data-component="'+model.get("type")+'">'+levels+'</tr><tr></tr>';
-                    that.ui.filterContent.append(html);
-                });
+              var that = this;
+              var set = new Set();
+              _.each(that.componentsList.models, function(model){
+                that.createRow(model.get("type"), that);
+                set.add(model.get("type"));
+              });
+              
+              if (set.size > 0) {
+                that.ui.filterContent.append('<tr class="overrideSpacer"></tr><tr class="overrideSpacer"></tr><tr class="overrideSpacer"></tr>');
+              }
+              
+              var components = this.model.get("filter");
+              _.each(components,function(value,key){
+                if (!set.has(key)) {
+                  that.createRow(key, that);
+                }
+              });
+            },
+            createRow : function(type, that) {
+              var levels = '<td align="left">'+type+'</td>';
+              var override = '<td class="text-left"><span class="pull-left"><!--small><i>Override</i></small--> <input data-override type="checkbox" data-name='+type+'></span></td>';
+              levels +=  override + that.getLevelForComponent(type,false);
+              var html = '<tr class="overrideSpacer"></tr><tr class="componentRow borderShow" data-component="'+type+'">'+levels+'</tr><tr></tr>';
+              that.ui.filterContent.append(html);
             },
             populateValues : function(){
             	var that =this;
@@ -332,34 +348,35 @@ define(['require',
 
             },
             setValues : function(){
-            	var obj = {filter: {}},that= this;
-            	_.each(that.componentsList.models, function(model){
-            		var comp = model.get("type"),date = that.$("[data-date='"+comp+"']").data("daterangepicker");
-            		var host = (that.$("[data-host='"+comp+"']").length) ? that.$("[data-host='"+comp+"']").select2('val') : [];
-            		obj.filter[comp] = {
-            				label : comp,
-            				hosts: host,
-            				defaultLevels : that.getDefaultValues(comp),
-            				overrideLevels : that.getOverideValues(comp),
-            				expiryTime : (date && date.startDate) ? date.startDate.toJSON() : ""
-            		};
-            	});
-            	return (obj);
+              var obj = {filter: {}},that = this;
+              var components = this.model.get("filter");
+              _.each(components,function(value,key){
+                var date = that.$("[data-date='"+key+"']").data("daterangepicker");
+                var host = (that.$("[data-host='"+key+"']").length) ? that.$("[data-host='"+key+"']").select2('val') : [];
+                obj.filter[key] = {
+                    label : key,
+                    hosts: host,
+                    defaultLevels : that.getDefaultValues(key),
+                    overrideLevels : that.getOverideValues(key),
+                    expiryTime : (date && date.startDate) ? date.startDate.toJSON() : ""
+                };
+              });
+              return (obj);
             },
             getOverideValues : function(ofComponent){
-            	var $els = this.$("tr.overrideRow."+ofComponent).find("input:checked"),values=[];
-            	for(var i=0; i<$els.length; i++){
-            		values.push($($els[i]).data("id"));
-            	}
-            	return values;
+              var $els = this.$("tr.overrideRow."+ofComponent).find("input:checked"),values=[];
+              for(var i=0; i<$els.length; i++){
+                values.push($($els[i]).data("id"));
+              }
+              return values;
             },
             getDefaultValues : function(ofComponent){
-            	var $els = this.$("tr[data-component='"+ofComponent+"']").find("input:checked"),values=[];
-            	for(var i=0; i<$els.length; i++){
-            		if($($els[i]).data("id"))
-            			values.push($($els[i]).data("id"));
-            	}
-            	return values;
+              var $els = this.$("tr[data-component='"+ofComponent+"']").find("input:checked"),values=[];
+              for(var i=0; i<$els.length; i++){
+                if($($els[i]).data("id"))
+                  values.push($($els[i]).data("id"));
+              }
+              return values;
             }
         });
 


[15/58] [abbrv] ambari git commit: AMBARI-18310. Refactor logsearch portal code - part 3 (oleewere)

Posted by ol...@apache.org.
http://git-wip-us.apache.org/repos/asf/ambari/blob/6fa4abfe/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/templates/dashboard/MainLayoutView_tmpl.html
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/templates/dashboard/MainLayoutView_tmpl.html b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/templates/dashboard/MainLayoutView_tmpl.html
index c79ed1d..bc59f76 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/templates/dashboard/MainLayoutView_tmpl.html
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/templates/dashboard/MainLayoutView_tmpl.html
@@ -43,12 +43,6 @@
                                             <a class="collapse-link">
                                                 <i class="fa fa-chevron-up"></i>
                                             </a>
-                                            <!-- <a class="">
-                                                <i class="fa fa-gear"></i>
-                                            </a>
-                                            <a class="close-link">
-                                                <i class="fa fa-close"></i>
-                                            </a> -->
                                         </div>
                                         <div class="no-move"></div>
                                     </div>
@@ -62,71 +56,6 @@
                                     </div>
                                 </div>
                             </div>
-                            <!-- div class="col-md-3">
-                                <div class="box">
-                                    <div class="box-header">
-                                        <div class="box-name">
-                                            <span>Time Range</span>
-                                        </div>
-                                        <div class="box-icons">
-                                            <a class="collapse-link">
-                                                <i class="fa fa-chevron-up"></i>
-                                            </a>
-                                            <a class="">
-                                                <i class="fa fa-gear"></i>
-                                            </a>
-                                            <a class="close-link">
-                                                <i class="fa fa-close"></i>
-                                            </a>
-                                        </div>
-                                        <div class="no-move"></div>
-                                    </div>
-                                    <div class="box-content">
-                                        <div class="btn-group btn-group-sm">
-                                            <button class="btn btn-primary">15m</button>
-                                            <button class="btn btn-primary">1h</button>
-                                            <button class="btn btn-primary">24h</button>
-                                        </div>
-                                    </div>
-                                </div>
-                            </div>
-                            <div class="col-md-6">
-                                <div class="box">
-                                    <div class="box-header">
-                                        <div class="box-name">
-                                            <span>Filtering</span>
-                                        </div>
-                                        <div class="box-icons">
-                                            <a class="collapse-link">
-                                                <i class="fa fa-chevron-up"></i>
-                                            </a>
-                                            <a class="">
-                                                <i class="fa fa-gear"></i>
-                                            </a>
-                                            <a class="close-link">
-                                                <i class="fa fa-close"></i>
-                                            </a>
-                                        </div>
-                                        <div class="no-move"></div>
-                                    </div>
-                                    <div class="box-content">
-                                        <table class="table-bordered table-condensed">
-                                            <tr>
-                                                <th>Time</th>
-                                                <td colspan="5">must</td>
-                                            </tr>
-                                            <tr>
-                                                <th>field</th>
-                                                <td>logtime</td>
-                                                <th>from</th>
-                                                <td>2014-12-17T04:59:00.362Z</td>
-                                                <th>to</th>
-                                                <td>2015-06-15T04:59:00.363Z</td>
-                                            </tr>
-                                        </table>
-                                    </div>
-                                </div>
-                            </div-->
                         </div>
                         <div class="row">
                             <div class="col-md-3">
@@ -143,56 +72,6 @@
                             </div>
                             <div class="col-md-9">
                             <div id="r_BubbleTable"></div>
-                                <!-- <div class="box no-drop">
-                                    <div class="box-header">
-                                        <div class="box-name">
-                                            <span>Log Data</span>
-                                        </div>
-                                        <div class="box-icons">
-                                        	<span id="loaderGraph">
-                                             	<i class="fa fa-spinner fa-spin"></i>
-											</span>
-                                            <a class="">
-                                                <i class="fa fa-save"></i>
-                                            </a>
-                                            <a class="">
-                                                <i class="fa fa-info"></i>
-                                            </a>
-                                            <a class="">
-                                                <i class="fa fa-gear"></i>
-                                            </a>
-                                            <a class="collapse-link">
-                                                <i class="fa fa-chevron-up"></i>
-                                            </a>
-                                            <a class="close-link">
-                                                <i class="fa fa-close"></i>
-                                            </a>
-                                        </div>
-                                        <div class="no-move"></div>
-                                    </div>
-                                    <div class="box-content">
-                                    <div class="">
-	                                    <div class="radio-inline">
-											<label>
-												<input type="radio" name="viewType" value="G" checked=""> Graph
-												<i class="fa fa-circle-o small"></i>
-											</label>
-										</div>
-										<div class="radio-inline">
-											<label>
-												<input type="radio" name="viewType" value="T"> Table
-												<i class="fa fa-circle-o small"></i>
-											</label>
-										</div>
-									</div>
-									<div data-id="table" style="display:none;">
-										<div id=control></div>
-										<div id="rLogTable" ></div>
-									</div>
-									
-									<div id="graphAgg"></div>
-                                    </div>
-                                </div> -->
                             </div>
                         </div>
                     </div>

http://git-wip-us.apache.org/repos/asf/ambari/blob/6fa4abfe/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/templates/helpers/Helpers.js
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/templates/helpers/Helpers.js b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/templates/helpers/Helpers.js
index f4f1d32..151335d 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/templates/helpers/Helpers.js
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/templates/helpers/Helpers.js
@@ -22,7 +22,6 @@
 	var Handlebars 		= require('handlebars');
 	var Util	   		= require('utils/Utils');
     var localization 	= require('utils/LangSupport');
-    var SessionMgr   	= require('mgrs/SessionMgr');
 	require('moment');
 	/*
 	 * General guidelines while writing helpers:
@@ -274,18 +273,12 @@
             return 'styles/images/avatar' + parseInt(((Math.random()*10)%4) + 1,10) + '.png';
         });    
 	Handlebars.registerHelper('isSystemAdmin', function(context, options) {
-            if(SessionMgr.isSystemAdmin())
-            	return options.fn(this);
 			return options.inverse(this);
 	});
 	Handlebars.registerHelper('isSchoolAdmin', function(context, options) {
-            if(SessionMgr.isSchoolAdmin() || SessionMgr.isSystemAdmin())
-            	return options.fn(this);
 			return options.inverse(this);
 	});
 	Handlebars.registerHelper('isTeacher', function(context, options) {
-            if(SessionMgr.isTeacher())
-            	return options.fn(this);
 			return options.inverse(this);
 	});
 	Handlebars.registerHelper('getAvatar', function(options,size) {
@@ -510,41 +503,9 @@
 		}
 	    return new Handlebars.SafeString(html);
 	});
-	// Handlebars.registerHelper('getServices', function(services, serviceDef) {
-	// 	var XAEnums			= require('utils/XAEnums');
-	// 	var tr = '', serviceOperationDiv = '';
-	// 	var serviceType = serviceDef.get('name');
-	// 	if(!_.isUndefined(services[serviceType])){
-	// 		_.each(services[serviceType],function(serv){
-	// 			serviceName = serv.get('name');
-	// 			if(SessionMgr.isSystemAdmin()){
-	// 				serviceOperationDiv = '<div class="pull-right">\
-	// 				<a data-id="'+serv.id+'" class="btn btn-mini" href="#!/service/'+serviceDef.id+'/edit/'+serv.id+'" title="Edit"><i class="icon-edit"></i></a>\
-	// 				<a data-id="'+serv.id+'" class="deleteRepo btn btn-mini btn-danger" href="javascript:void(0);" title="Delete">\
-	// 				<i class="icon-trash"></i></a>\
-	// 				</div>'
-	// 			}
-	// 			tr += '<tr><td><div>\
-	// 					<a data-id="'+serv.id+'" href="#!/service/'+serv.id+'/policies">'+_.escape(serv.attributes.name)+'</a>'+serviceOperationDiv+'\
-	// 				  </div></td></tr>';
-	// 		});
-	// 	}
-	// 	return tr;
-	// });
 	Handlebars.registerHelper('capitaliseLetter', function(str) {
 		return str.toUpperCase();
 	});
-	// Handlebars.registerHelper('hasAccessToTab', function(tabName,options) {
-	// 	var vxPortalUser = SessionMgr.getUserProfile();
-	// 	var userModules = _.pluck(vxPortalUser.get('userPermList'), 'moduleName');
-	// 	var groupModules = _.pluck(vxPortalUser.get('groupPermissions'), 'moduleName');
-	// 	var moduleNames =  _.union(userModules,groupModules);
-	// 	var returnFlag = _.contains(moduleNames, tabName);
-	// 	if (returnFlag)
-	// 		return options.fn(this);
-	// 	else
-	// 		return options.inverse(this);
-	// });
 
 	/*logserach*/
 	Handlebars.registerHelper ("setChecked", function (value, currentValue) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/6fa4abfe/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/dao/AuditSolrDaoTest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/dao/AuditSolrDaoTest.java b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/dao/AuditSolrDaoTest.java
deleted file mode 100644
index 017d7a8..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/dao/AuditSolrDaoTest.java
+++ /dev/null
@@ -1,99 +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.dao;
-
-import java.util.ArrayList;
-
-import org.apache.ambari.logsearch.conf.SolrAuditLogConfig;
-import org.apache.ambari.logsearch.conf.SolrKerberosConfig;
-import org.apache.solr.client.solrj.SolrClient;
-import org.apache.solr.client.solrj.request.CollectionAdminRequest;
-import org.apache.solr.common.util.NamedList;
-import org.easymock.Capture;
-import org.easymock.CaptureType;
-import org.easymock.EasyMock;
-import org.easymock.EasyMockSupport;
-import org.easymock.Mock;
-import org.easymock.TestSubject;
-import org.junit.Before;
-import org.junit.Test;
-
-import junit.framework.Assert;
-
-public class AuditSolrDaoTest {
-
-  @TestSubject
-  private AuditSolrDao dao = new AuditSolrDao();
-
-  @Mock
-  private SolrAuditLogConfig configMock;
-
-  @Mock
-  private SolrKerberosConfig kerbConfigMock;
-
-  @Before
-  public void setUp() {
-    EasyMockSupport.injectMocks(this);
-  }
-
-  @Test
-  public void testAuditSolrDaoPostConstructor() throws Exception {
-    SolrClient mockSolrClient = EasyMock.strictMock(SolrClient.class);
-    
-    NamedList<Object> response = new NamedList<Object>();
-    NamedList<Object> header = new NamedList<Object>();
-    header.add("status", 0);
-    response.add("responseHeader", header);
-    response.add("collections", new ArrayList<String>());
-
-    EasyMock.expect(configMock.getSolrUrl()).andReturn(null);
-    EasyMock.expect(configMock.getZkConnectString()).andReturn("dummyHost1:2181,dummyHost2:2181");
-    EasyMock.expect(configMock.getConfigName()).andReturn("test_audit_logs_config_name");
-    EasyMock.expect(configMock.getCollection()).andReturn("test_audit_logs_collection");
-    EasyMock.expect(configMock.getSplitInterval()).andReturn("none");
-    EasyMock.expect(configMock.getNumberOfShards()).andReturn(123);
-    EasyMock.expect(configMock.getReplicationFactor()).andReturn(456);
-    EasyMock.expect(configMock.getAliasNameIn()).andReturn("alias");
-    EasyMock.expect(configMock.getRangerCollection()).andReturn("ranger_audit");
-    EasyMock.expect(kerbConfigMock.isEnabled()).andReturn(false);
-    EasyMock.expect(kerbConfigMock.getJaasFile()).andReturn("jaas_file");
-    
-    Capture<CollectionAdminRequest.Create> captureCreateRequest = EasyMock.newCapture(CaptureType.LAST);
-    
-    EasyMock.expect(mockSolrClient.request(EasyMock.anyObject(CollectionAdminRequest.List.class), EasyMock.anyString())).andReturn(response);
-    
-    mockSolrClient.request(EasyMock.capture(captureCreateRequest), EasyMock.anyString());
-    EasyMock.expectLastCall().andReturn(response);
-    
-    EasyMock.replay(mockSolrClient, configMock, kerbConfigMock);
-
-    dao.solrClient = mockSolrClient;
-    dao.isZkConnectString = true;
-    
-    dao.postConstructor();
-    EasyMock.verify(mockSolrClient);
-    
-    CollectionAdminRequest.Create createRequest = captureCreateRequest.getValue();
-    Assert.assertEquals(createRequest.getConfigName(), "test_audit_logs_config_name");
-    Assert.assertEquals(createRequest.getNumShards().intValue(), 123);
-    Assert.assertEquals(createRequest.getReplicationFactor().intValue(), 456);
-    Assert.assertEquals(createRequest.getCollectionName(), "test_audit_logs_collection");
-  }
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/6fa4abfe/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/dao/ServiceLogsSolrDaoTest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/dao/ServiceLogsSolrDaoTest.java b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/dao/ServiceLogsSolrDaoTest.java
deleted file mode 100644
index bdee8a8..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/dao/ServiceLogsSolrDaoTest.java
+++ /dev/null
@@ -1,95 +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.dao;
-
-import java.util.ArrayList;
-
-import org.apache.ambari.logsearch.conf.SolrKerberosConfig;
-import org.apache.ambari.logsearch.conf.SolrServiceLogConfig;
-import org.apache.solr.client.solrj.SolrClient;
-import org.apache.solr.client.solrj.request.CollectionAdminRequest;
-import org.apache.solr.common.util.NamedList;
-import org.easymock.Capture;
-import org.easymock.CaptureType;
-import org.easymock.EasyMock;
-import org.easymock.EasyMockSupport;
-import org.easymock.Mock;
-import org.easymock.TestSubject;
-import org.junit.Before;
-import org.junit.Test;
-
-import junit.framework.Assert;
-
-public class ServiceLogsSolrDaoTest {
-
-  @TestSubject
-  private ServiceLogsSolrDao dao = new ServiceLogsSolrDao();
-
-  @Mock
-  private SolrKerberosConfig kerbConfigMock;
-
-  @Mock
-  private SolrServiceLogConfig configMock;
-
-  @Before
-  public void setUp() {
-    EasyMockSupport.injectMocks(this);
-  }
-
-  @Test
-  public void testServiceLogsSolrDaoPostConstructor() throws Exception {
-    SolrClient mockSolrClient = EasyMock.strictMock(SolrClient.class);
-    
-    NamedList<Object> response = new NamedList<Object>();
-    NamedList<Object> header = new NamedList<Object>();
-    header.add("status", 0);
-    response.add("responseHeader", header);
-    response.add("collections", new ArrayList<String>());
-
-    EasyMock.expect(configMock.getSolrUrl()).andReturn(null);
-    EasyMock.expect(configMock.getZkConnectString()).andReturn("dummyHost1:2181,dummyHost2:2181");
-    EasyMock.expect(configMock.getConfigName()).andReturn("test_service_logs_config_name");
-    EasyMock.expect(configMock.getCollection()).andReturn("test_service_logs_collection");
-    EasyMock.expect(configMock.getSplitInterval()).andReturn("none");
-    EasyMock.expect(configMock.getNumberOfShards()).andReturn(789);
-    EasyMock.expect(configMock.getReplicationFactor()).andReturn(987);
-    EasyMock.expect(kerbConfigMock.isEnabled()).andReturn(false);
-    EasyMock.expect(kerbConfigMock.getJaasFile()).andReturn("jaas_file");
-    
-    Capture<CollectionAdminRequest.Create> captureCreateRequest = EasyMock.newCapture(CaptureType.LAST);
-    
-    EasyMock.expect(mockSolrClient.request(EasyMock.anyObject(CollectionAdminRequest.List.class), EasyMock.anyString())).andReturn(response);
-    mockSolrClient.request(EasyMock.capture(captureCreateRequest), EasyMock.anyString()); EasyMock.expectLastCall().andReturn(response);
-    
-    EasyMock.replay(mockSolrClient, configMock, kerbConfigMock);
-
-    dao.solrClient = mockSolrClient;
-    dao.isZkConnectString = true;
-    
-    dao.postConstructor();
-    EasyMock.verify(mockSolrClient, configMock, kerbConfigMock);
-    
-    CollectionAdminRequest.Create createRequest = captureCreateRequest.getValue();
-    Assert.assertEquals(createRequest.getConfigName(), "test_service_logs_config_name");
-    Assert.assertEquals(createRequest.getNumShards().intValue(), 789);
-    Assert.assertEquals(createRequest.getReplicationFactor().intValue(), 987);
-    Assert.assertEquals(createRequest.getCollectionName(), "test_service_logs_collection");
-  }
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/6fa4abfe/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/dao/SolrDaoBaseTest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/dao/SolrDaoBaseTest.java b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/dao/SolrDaoBaseTest.java
deleted file mode 100644
index 22b10c3..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/dao/SolrDaoBaseTest.java
+++ /dev/null
@@ -1,306 +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.dao;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-
-import javax.ws.rs.WebApplicationException;
-
-import org.apache.ambari.logsearch.conf.SolrKerberosConfig;
-import org.apache.ambari.logsearch.manager.ManagerBase.LogType;
-import org.apache.solr.client.solrj.SolrClient;
-import org.apache.solr.client.solrj.SolrQuery;
-import org.apache.solr.client.solrj.SolrRequest.METHOD;
-import org.apache.solr.client.solrj.impl.CloudSolrClient;
-import org.apache.solr.client.solrj.impl.HttpSolrClient;
-import org.apache.solr.client.solrj.request.CollectionAdminRequest;
-import org.apache.solr.client.solrj.response.QueryResponse;
-import org.apache.solr.client.solrj.response.UpdateResponse;
-import org.apache.solr.common.SolrInputDocument;
-import org.apache.solr.common.util.NamedList;
-import org.easymock.EasyMock;
-import org.easymock.EasyMockSupport;
-import org.easymock.Mock;
-import org.easymock.TestSubject;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-
-import junit.framework.Assert;
-
-public class SolrDaoBaseTest {
-
-  @TestSubject
-  private SolrDaoBase dao = new SolrDaoBase(LogType.SERVICE) {};
-
-  @Rule
-  public ExpectedException expectedException = ExpectedException.none();
-
-  @Mock
-  private SolrKerberosConfig kerbConfigMock;
-
-  @Before
-  public void setUp() {
-    EasyMockSupport.injectMocks(this);
-  }
-  
-  // ----------------------------------------------------------- connectToSolr -----------------------------------------------------------
-  
-  @Test
-  public void testConnectToSolrWithConnectString() throws Exception {
-    EasyMock.expect(kerbConfigMock.isEnabled()).andReturn(false);
-    EasyMock.expect(kerbConfigMock.getJaasFile()).andReturn("jaas_file");
-
-    EasyMock.replay(kerbConfigMock);
-
-    SolrClient solrClient = dao.connectToSolr(null, "zk_connect_string", "collection");
-    
-    Assert.assertEquals(solrClient.getClass(), CloudSolrClient.class);
-  }
-  
-  @Test
-  public void testConnectToSolrWithUrl() throws Exception {
-    EasyMock.expect(kerbConfigMock.isEnabled()).andReturn(false);
-    EasyMock.expect(kerbConfigMock.getJaasFile()).andReturn("jaas_file");
-
-    EasyMock.replay(kerbConfigMock);
-
-    SolrClient solrClient = dao.connectToSolr("url", null, "collection");
-    
-    Assert.assertEquals(solrClient.getClass(), HttpSolrClient.class);
-  }
-  
-  @Test
-  public void testConnectToSolrWithBoth() throws Exception {
-    EasyMock.expect(kerbConfigMock.isEnabled()).andReturn(false);
-    EasyMock.expect(kerbConfigMock.getJaasFile()).andReturn("jaas_file");
-
-    EasyMock.replay(kerbConfigMock);
-
-    SolrClient solrClient = dao.connectToSolr("url", "zk_connect_string", "collection");
-    
-    Assert.assertEquals(solrClient.getClass(), CloudSolrClient.class);
-  }
-  
-  @Test
-  public void testConnectToSolrWithNeither() throws Exception {
-    EasyMock.expect(kerbConfigMock.isEnabled()).andReturn(false);
-    EasyMock.expect(kerbConfigMock.getJaasFile()).andReturn("jaas_file");
-
-    EasyMock.replay(kerbConfigMock);
-
-    expectedException.expect(Exception.class);
-    expectedException.expectMessage("Both zkConnectString and URL are empty. zkConnectString=null, collection=collection, url=null");
-
-    dao.connectToSolr(null, null, "collection");
-  }
-  
-  @Test
-  public void testConnectToSolrWithoutCollection() throws Exception {
-    expectedException.expect(Exception.class);
-    expectedException.expectMessage("For solr, collection name is mandatory. zkConnectString=zk_connect_string, collection=null, url=url");
-
-    dao.connectToSolr("url", "zk_connect_string", null);
-  }
-  
-  // ---------------------------------------------------------- checkSolrStatus ----------------------------------------------------------
-  
-  @Test
-  public void testCheckSolrStatus() throws Exception {
-    SolrClient mockSolrClient = EasyMock.strictMock(SolrClient.class);
-    
-    NamedList<Object> response = new NamedList<Object>();
-    NamedList<Object> header = new NamedList<Object>();
-    header.add("status", 0);
-    response.add("responseHeader", header);
-    response.add("collections", new ArrayList<String>());
-    
-    EasyMock.expect(mockSolrClient.request(EasyMock.anyObject(CollectionAdminRequest.List.class), EasyMock.anyString())).andReturn(response);
-    EasyMock.replay(mockSolrClient);
-
-    dao.solrClient = mockSolrClient;
-    
-    boolean status = dao.checkSolrStatus(10000);
-    Assert.assertTrue(status);
-    
-    EasyMock.verify(mockSolrClient);
-  }
-  
-  @Test
-  public void testCheckSolrStatusNotSuccessful() throws Exception {
-    SolrClient mockSolrClient = EasyMock.strictMock(SolrClient.class);
-    EasyMock.replay(mockSolrClient);
-
-    dao.solrClient = mockSolrClient;
-    
-    boolean status = dao.checkSolrStatus(10000);
-    Assert.assertFalse(status);
-    
-    EasyMock.verify(mockSolrClient);
-  }
-  
-  // ------------------------------------------------------------- setupAlias ------------------------------------------------------------
-  
-  @Test
-  public void testSetupAlias() throws Exception {
-    SolrClient mockSolrClient = EasyMock.strictMock(SolrClient.class);
-    CloudSolrClient mockSolrClouldClient = EasyMock.strictMock(CloudSolrClient.class);
-    
-    NamedList<Object> response = new NamedList<Object>();
-    NamedList<Object> header = new NamedList<Object>();
-    header.add("status", 0);
-    response.add("responseHeader", header);
-    response.add("collections", Arrays.asList("collection1", "collection2"));
-    
-    EasyMock.expect(mockSolrClient.request(EasyMock.anyObject(CollectionAdminRequest.List.class), EasyMock.anyString())).andReturn(response);
-    EasyMock.expect(mockSolrClouldClient.request(EasyMock.anyObject(CollectionAdminRequest.CreateAlias.class), EasyMock.anyString())).andReturn(response);
-    mockSolrClouldClient.setDefaultCollection("alias_name"); EasyMock.expectLastCall();
-    
-    EasyMock.replay(mockSolrClient, mockSolrClouldClient);
-
-    dao.isZkConnectString = true;
-    dao.solrClient = mockSolrClient;
-    dao.solrClouldClient = mockSolrClouldClient;
-    dao.collectionName = "test_collection";
-    
-    dao.setupAlias("alias_name", Arrays.asList("collection1", "collection2"));
-    
-    Thread.sleep(1000);
-    
-    EasyMock.verify(mockSolrClient, mockSolrClouldClient);
-  }
-  
-  // ---------------------------------------------------------- setupCollections ---------------------------------------------------------
-  
-  @Test
-  public void testCreateCollectionsDontSplitPopulate() throws Exception {
-    SolrClient mockSolrClient = EasyMock.strictMock(SolrClient.class);
-    
-    NamedList<Object> response = new NamedList<Object>();
-    NamedList<Object> header = new NamedList<Object>();
-    header.add("status", 0);
-    response.add("responseHeader", header);
-    response.add("collections", new ArrayList<String>());
-    
-    EasyMock.expect(mockSolrClient.request(EasyMock.anyObject(CollectionAdminRequest.List.class), EasyMock.anyString())).andReturn(response);
-    EasyMock.expect(mockSolrClient.request(EasyMock.anyObject(CollectionAdminRequest.Create.class), EasyMock.anyString())).andReturn(response);
-    EasyMock.replay(mockSolrClient);
-
-    dao.isZkConnectString = true;
-    dao.solrClient = mockSolrClient;
-    dao.collectionName = "test_collection";
-    
-    dao.setupCollections("none", "configName", 1, 1, true);
-    
-    EasyMock.verify(mockSolrClient);
-  }
-  
-  @Test
-  public void testCreateCollectionsSplitDontPopulate() throws Exception {
-    SolrClient mockSolrClient = EasyMock.strictMock(SolrClient.class);
-    
-    NamedList<Object> response = new NamedList<Object>();
-    NamedList<Object> header = new NamedList<Object>();
-    header.add("status", 0);
-    response.add("responseHeader", header);
-    response.add("collections", new ArrayList<String>());
-    
-    EasyMock.expect(mockSolrClient.request(EasyMock.anyObject(CollectionAdminRequest.List.class), EasyMock.anyString())).andReturn(response);
-    EasyMock.expect(mockSolrClient.request(EasyMock.anyObject(CollectionAdminRequest.Create.class), EasyMock.anyString())).andReturn(response);
-    EasyMock.replay(mockSolrClient);
-
-    dao.isZkConnectString = true;
-    dao.solrClient = mockSolrClient;
-    
-    dao.setupCollections("1", "configName", 3, 1, false);
-    
-    EasyMock.verify(mockSolrClient);
-  }
-  
-  // -------------------------------------------------------------- process --------------------------------------------------------------
-  
-  @Test
-  public void testProcess() throws Exception {
-    SolrClient mockSolrClient = EasyMock.strictMock(SolrClient.class);
-    EasyMock.expect(mockSolrClient.query(EasyMock.anyObject(SolrQuery.class), EasyMock.eq(METHOD.POST))).andReturn(new QueryResponse());
-    EasyMock.replay(mockSolrClient);
-
-    dao.solrClient = mockSolrClient;
-    
-    dao.process(new SolrQuery());
-    
-    EasyMock.verify(mockSolrClient);
-  }
-  
-  @Test
-  public void testProcessNoConnection() throws Exception {
-    expectedException.expect(WebApplicationException.class);
-
-    dao.process(new SolrQuery());
-  }
-  
-  // ----------------------------------------------------------- add/removeDoc -----------------------------------------------------------
-  
-  @Test
-  public void testAddDoc() throws Exception {
-    SolrClient mockSolrClient = EasyMock.strictMock(SolrClient.class);
-    
-    UpdateResponse updateResponse = new UpdateResponse();
-    NamedList<Object> response = new NamedList<Object>();
-    NamedList<Object> header = new NamedList<Object>();
-    header.add("QTime", 1);
-    response.add("responseHeader", header);
-    updateResponse.setResponse(response);
-    
-    EasyMock.expect(mockSolrClient.add(EasyMock.anyObject(SolrInputDocument.class))).andReturn(updateResponse);
-    EasyMock.expect(mockSolrClient.commit()).andReturn(updateResponse);
-    EasyMock.replay(mockSolrClient);
-
-    dao.solrClient = mockSolrClient;
-    
-    dao.addDocs(new SolrInputDocument());
-    
-    EasyMock.verify(mockSolrClient);
-  }
-  
-  @Test
-  public void testRemoveDoc() throws Exception {
-    SolrClient mockSolrClient = EasyMock.strictMock(SolrClient.class);
-    
-    UpdateResponse updateResponse = new UpdateResponse();
-    NamedList<Object> response = new NamedList<Object>();
-    NamedList<Object> header = new NamedList<Object>();
-    header.add("QTime", 1);
-    response.add("responseHeader", header);
-    updateResponse.setResponse(response);
-    
-    EasyMock.expect(mockSolrClient.deleteByQuery(EasyMock.anyString())).andReturn(updateResponse);
-    EasyMock.expect(mockSolrClient.commit()).andReturn(updateResponse);
-    EasyMock.replay(mockSolrClient);
-
-    dao.solrClient = mockSolrClient;
-    
-    dao.removeDoc("query");
-    
-    EasyMock.verify(mockSolrClient);
-  }
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/6fa4abfe/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/dao/UserConfigSolrDaoTest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/dao/UserConfigSolrDaoTest.java b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/dao/UserConfigSolrDaoTest.java
deleted file mode 100644
index 3b01a19..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/dao/UserConfigSolrDaoTest.java
+++ /dev/null
@@ -1,164 +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.dao;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-
-import org.apache.ambari.logsearch.conf.SolrKerberosConfig;
-import org.apache.ambari.logsearch.conf.SolrUserConfig;
-import org.apache.solr.client.solrj.SolrClient;
-import org.apache.solr.client.solrj.SolrRequest.METHOD;
-import org.apache.solr.client.solrj.request.CollectionAdminRequest;
-import org.apache.solr.client.solrj.response.QueryResponse;
-import org.apache.solr.client.solrj.response.UpdateResponse;
-import org.apache.solr.common.SolrInputDocument;
-import org.apache.solr.common.params.SolrParams;
-import org.apache.solr.common.util.NamedList;
-import org.easymock.Capture;
-import org.easymock.CaptureType;
-import org.easymock.EasyMock;
-import org.easymock.EasyMockSupport;
-import org.easymock.Mock;
-import org.easymock.TestSubject;
-import org.junit.Before;
-import org.junit.Test;
-
-import junit.framework.Assert;
-
-public class UserConfigSolrDaoTest {
-
-  @TestSubject
-  private UserConfigSolrDao dao = new UserConfigSolrDao();
-
-  @Mock
-  private SolrUserConfig configMock;
-
-  @Mock
-  private SolrKerberosConfig kerbConfigMock;
-
-  @Before
-  public void setUp() {
-    EasyMockSupport.injectMocks(this);
-  }
-  
-  @Test
-  public void testUserConfigDaoPostConstructor() throws Exception {
-    SolrClient mockSolrClient = EasyMock.strictMock(SolrClient.class);
-    
-    NamedList<Object> requestResponse = new NamedList<Object>();
-    NamedList<Object> requestResponseHeader = new NamedList<Object>();
-    requestResponseHeader.add("status", 0);
-    requestResponse.add("responseHeader", requestResponseHeader);
-    requestResponse.add("collections", new ArrayList<String>());
-    
-    QueryResponse queryResponse = new QueryResponse();
-    
-    UpdateResponse updateResponse = new UpdateResponse();
-    NamedList<Object> updateResponseContent = new NamedList<Object>();
-    NamedList<Object> updateResponseHeader = new NamedList<Object>();
-    updateResponseHeader.add("QTime", 1);
-    updateResponseContent.add("responseHeader", updateResponseHeader);
-    updateResponse.setResponse(updateResponseContent);
-
-    EasyMock.expect(configMock.getSolrUrl()).andReturn(null).times(2);
-    EasyMock.expect(configMock.getZkConnectString()).andReturn("dummyHost1:2181,dummyHost2:2181").times(2);
-    EasyMock.expect(configMock.getConfigName()).andReturn("test_history_logs_config_name").times(2);
-    EasyMock.expect(configMock.getCollection()).andReturn("test_history_logs_collection").times(2);
-    EasyMock.expect(configMock.getSplitInterval()).andReturn("none").times(2);
-    EasyMock.expect(configMock.getNumberOfShards()).andReturn(123).times(2);
-    EasyMock.expect(configMock.getReplicationFactor()).andReturn(234).times(2);
-    EasyMock.expect(configMock.getLogLevels()).andReturn(Arrays.asList("TRACE")).times(2);
-    EasyMock.expect(kerbConfigMock.isEnabled()).andReturn(false).times(2);
-    EasyMock.expect(kerbConfigMock.getJaasFile()).andReturn("jaas_file").times(2);
-    
-    Capture<CollectionAdminRequest.Create> captureCreateRequest = EasyMock.newCapture(CaptureType.LAST);
-    Capture<SolrParams> captureSolrParams = EasyMock.newCapture(CaptureType.LAST);
-    Capture<METHOD> captureMethod = EasyMock.newCapture(CaptureType.LAST);
-    Capture<SolrInputDocument> captureSolrInputDocument = EasyMock.newCapture(CaptureType.LAST);
-    
-    EasyMock.expect(mockSolrClient.request(EasyMock.anyObject(CollectionAdminRequest.List.class), EasyMock.anyString())).andReturn(requestResponse);
-    mockSolrClient.request(EasyMock.capture(captureCreateRequest), EasyMock.anyString()); EasyMock.expectLastCall().andReturn(requestResponse);
-    mockSolrClient.query(EasyMock.capture(captureSolrParams), EasyMock.capture(captureMethod)); EasyMock.expectLastCall().andReturn(queryResponse);
-    mockSolrClient.add(EasyMock.capture(captureSolrInputDocument)); EasyMock.expectLastCall().andReturn(updateResponse);
-    EasyMock.expect(mockSolrClient.commit()).andReturn(updateResponse);
-    EasyMock.replay(mockSolrClient, configMock, kerbConfigMock);
-
-    dao.postConstructor();
-    dao.solrClient = mockSolrClient;
-    dao.isZkConnectString = true;
-    
-    dao.postConstructor();
-    EasyMock.verify(mockSolrClient);
-    
-    CollectionAdminRequest.Create createRequest = captureCreateRequest.getValue();
-    Assert.assertEquals(createRequest.getConfigName(), "test_history_logs_config_name");
-    Assert.assertEquals(createRequest.getReplicationFactor().intValue(), 234);
-    Assert.assertEquals(createRequest.getCollectionName(), "test_history_logs_collection");
-    
-    SolrParams solrParams = captureSolrParams.getValue();
-    Assert.assertEquals(solrParams.get("q"), "*:*");
-    Assert.assertEquals(solrParams.get("fq"), "rowtype:log_feeder_config");
-    
-    METHOD method = captureMethod.getValue();
-    Assert.assertEquals(method, METHOD.POST);
-    
-    SolrInputDocument solrInputDocument = captureSolrInputDocument.getValue();
-    Assert.assertNotNull(solrInputDocument.getFieldValue("id"));
-    Assert.assertEquals(solrInputDocument.getFieldValue("rowtype"), "log_feeder_config");
-    Assert.assertEquals(solrInputDocument.getFieldValue("jsons"), "{\"filter\":{\"test_component2\":{\"label\":\"test_component2\",\"hosts\":[],\"defaultLevels\":[\"TRACE\"],\"overrideLevels\":[]},\"test_component1\":{\"label\":\"test_component1\",\"hosts\":[],\"defaultLevels\":[\"TRACE\"],\"overrideLevels\":[]}},\"id\":\"" + solrInputDocument.getFieldValue("id") + "\"}");
-    Assert.assertEquals(solrInputDocument.getFieldValue("username"), "log_feeder_config");
-    Assert.assertEquals(solrInputDocument.getFieldValue("filtername"), "log_feeder_config");
-  }
-  
-  @Test
-  public void testDeleteUserConfig() throws Exception {
-    SolrClient mockSolrClient = EasyMock.strictMock(SolrClient.class);
-    
-    UpdateResponse updateResponse = new UpdateResponse();
-    NamedList<Object> response = new NamedList<Object>();
-    NamedList<Object> header = new NamedList<Object>();
-    header.add("QTime", 1);
-    response.add("responseHeader", header);
-    updateResponse.setResponse(response);
-
-    EasyMock.expect(configMock.getSolrUrl()).andReturn(null);
-    EasyMock.expect(configMock.getZkConnectString()).andReturn("dummyHost1:2181,dummyHost2:2181");
-    EasyMock.expect(configMock.getConfigName()).andReturn("test_history_logs_config_name");
-    EasyMock.expect(configMock.getCollection()).andReturn("test_history_logs_collection");
-    EasyMock.expect(configMock.getSplitInterval()).andReturn("none");
-    EasyMock.expect(configMock.getNumberOfShards()).andReturn(123);
-    EasyMock.expect(configMock.getReplicationFactor()).andReturn(234);
-    EasyMock.expect(kerbConfigMock.isEnabled()).andReturn(false);
-    EasyMock.expect(kerbConfigMock.getJaasFile()).andReturn("jaas_file");
-    
-    EasyMock.expect(mockSolrClient.deleteByQuery("id:test_id")).andReturn(updateResponse);
-    EasyMock.expect(mockSolrClient.commit()).andReturn(updateResponse);
-    EasyMock.replay(mockSolrClient, configMock, kerbConfigMock);
-
-    dao.postConstructor();
-    dao.solrClient = mockSolrClient;
-    dao.isZkConnectString = true;
-    
-    dao.deleteUserConfig("test_id");
-    
-    EasyMock.verify(mockSolrClient, configMock, kerbConfigMock);
-  }
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/6fa4abfe/ambari-logsearch/docker/test-config/logsearch/logsearch.properties
----------------------------------------------------------------------
diff --git a/ambari-logsearch/docker/test-config/logsearch/logsearch.properties b/ambari-logsearch/docker/test-config/logsearch/logsearch.properties
index 2c83581..71c1a1c 100644
--- a/ambari-logsearch/docker/test-config/logsearch/logsearch.properties
+++ b/ambari-logsearch/docker/test-config/logsearch/logsearch.properties
@@ -22,8 +22,6 @@ logsearch.service.logs.split.interval.mins=15
 logsearch.collection.service.logs.numshards=3
 logsearch.collection.service.logs.replication.factor=2
 
-logsearch.service.logs.fields=logtime,level,event_count,ip,type,seq_num,path,file,line_number,host,log_message,id
-
 # Audit logs
 logsearch.solr.audit.logs.zk_connect_string=localhost:9983
 logsearch.solr.collection.audit.logs=audit_logs


[43/58] [abbrv] ambari git commit: AMBARI-18310. Logsearch - Refactor solr query layer (oleewere)

Posted by ol...@apache.org.
AMBARI-18310. Logsearch - Refactor solr query layer (oleewere)

Change-Id: I0e99217fea1de03135b86e007fcb2a3ff6c2e257


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

Branch: refs/heads/branch-2.5
Commit: d7164202cce81c8dd7fd123158626dd0d8751c5c
Parents: 39ffb74
Author: oleewere <ol...@gmail.com>
Authored: Mon Sep 12 21:35:08 2016 +0200
Committer: oleewere <ol...@gmail.com>
Committed: Sat Nov 5 14:46:45 2016 +0100

----------------------------------------------------------------------
 .../ambari-logsearch-portal/pom.xml             |   10 +
 .../logsearch/common/ExternalServerClient.java  |    4 +-
 .../logsearch/common/LogSearchConstants.java    |   66 +-
 .../apache/ambari/logsearch/common/LogType.java |   34 +
 .../ambari/logsearch/common/MessageData.java    |  165 ++
 .../ambari/logsearch/common/MessageEnums.java   |   10 +-
 .../ambari/logsearch/common/VResponse.java      |  164 ++
 .../logsearch/conf/ApplicationConfig.java       |   13 +
 .../ambari/logsearch/conf/SolrConfig.java       |   11 +
 .../AbstractAuditLogRequestQueryConverter.java  |   59 +
 .../converter/AbstractConverterAware.java       |   47 +
 .../AbstractDateRangeFacetQueryConverter.java   |   55 +
 .../AbstractLogRequestFacetQueryConverter.java  |   85 +
 .../AbstractLogRequestQueryConverter.java       |   39 +
 .../AbstractOperationHolderConverter.java       |  160 ++
 .../AbstractSearchRequestQueryConverter.java    |   53 +
 ...AbstractServiceLogRequestQueryConverter.java |   44 +
 .../AuditBarGraphRequestQueryConverter.java     |   46 +
 .../AuditComponentsRequestQueryConverter.java   |   62 +
 .../AuditLogRequestQueryConverter.java          |   44 +
 .../AuditServiceLoadRequestQueryConverter.java  |   52 +
 .../BaseServiceLogRequestQueryConverter.java    |   86 +
 .../FieldAuditLogRequestQueryConverter.java     |   54 +
 ...ServiceLogAnyGraphRequestQueryConverter.java |   52 +
 ...eLogComponentLevelRequestQueryConverter.java |   66 +
 ...eLogComponentRequestFacetQueryConverter.java |   68 +
 ...rviceLogLevelCountRequestQueryConverter.java |   52 +
 ...eLogLevelDateRangeRequestQueryConverter.java |   61 +
 ...erviceLogTreeRequestFacetQueryConverter.java |   69 +
 ...erviceLogTruncatedRequestQueryConverter.java |   95 +
 .../StringFieldFacetQueryConverter.java         |   44 +
 .../UserConfigRequestQueryConverter.java        |   71 +
 .../UserExportRequestQueryConverter.java        |   55 +
 .../ambari/logsearch/dao/AuditSolrDao.java      |   23 +-
 .../logsearch/dao/ServiceLogsSolrDao.java       |   21 +-
 .../ambari/logsearch/dao/SolrAliasDao.java      |    8 +-
 .../ambari/logsearch/dao/SolrCollectionDao.java |    4 +-
 .../ambari/logsearch/dao/SolrDaoBase.java       |   99 +-
 .../logsearch/dao/SolrSchemaFieldDao.java       |   24 +-
 .../ambari/logsearch/dao/UserConfigSolrDao.java |   67 +-
 .../ambari/logsearch/doc/DocConstants.java      |   18 +-
 .../logsearch/graph/GraphDataGenerator.java     |  625 +++---
 .../logsearch/graph/GraphDataGeneratorBase.java |  169 --
 .../logsearch/manager/AuditLogsManager.java     |  481 +----
 .../ambari/logsearch/manager/ManagerBase.java   |  169 +-
 .../ambari/logsearch/manager/PublicManager.java |    4 +-
 .../logsearch/manager/ServiceLogsManager.java   | 1771 +++---------------
 .../logsearch/manager/SessionManager.java       |    5 +-
 .../logsearch/manager/UserConfigManager.java    |  199 +-
 .../model/common/LogFeederDataMap.java          |   50 +
 .../model/common/LogfeederFilterData.java       |   87 +
 .../model/request/FieldParamDefinition.java     |    2 +-
 .../model/request/LogParamDefinition.java       |    7 +
 .../request/LogTruncatedParamDefinition.java    |    4 +-
 .../model/request/QueryParamDefinition.java     |   32 -
 .../request/ServiceLogParamDefinition.java      |   13 -
 .../model/request/TopParamDefinition.java       |   31 +
 .../model/request/impl/AnyGraphRequest.java     |  109 --
 .../request/impl/AuditBarGraphRequest.java      |    2 +-
 .../request/impl/AuditComponentRequest.java     |   25 +
 .../model/request/impl/AuditLogRequest.java     |    2 +-
 .../request/impl/AuditServiceLoadRequest.java   |   25 +
 .../model/request/impl/BaseAuditLogRequest.java |   53 -
 .../model/request/impl/BaseLogRequest.java      |   47 +-
 .../request/impl/BaseServiceLogRequest.java     |   54 +-
 .../request/impl/FieldAuditLogRequest.java      |   18 +-
 .../model/request/impl/QueryRequest.java        |   40 -
 .../request/impl/ServiceAnyGraphRequest.java    |   28 +-
 .../impl/ServiceExtremeDatesRequest.java        |   41 -
 .../impl/ServiceLogAggregatedInfoRequest.java   |   25 +
 .../impl/ServiceLogComponentHostRequest.java    |   25 +
 .../impl/ServiceLogComponentLevelRequest.java   |   25 +
 .../impl/ServiceLogHostComponentRequest.java    |   39 +
 .../impl/ServiceLogLevelCountRequest.java       |   25 +
 .../impl/ServiceLogTruncatedRequest.java        |    6 +-
 .../model/request/impl/SimpleQueryRequest.java  |   42 -
 .../logsearch/model/response/TemplateData.java  |   36 +
 .../model/response/UserConfigData.java          |  108 ++
 .../response/UserConfigDataListResponse.java    |   55 +
 .../ambari/logsearch/query/QueryGeneration.java |  340 ----
 .../logsearch/query/QueryGenerationBase.java    |  282 ---
 .../query/SearchCriteriaConstants.java          |   70 -
 .../AbstractCommonAuditLogRequestConverter.java |   44 -
 .../AbstractCommonSearchRequestConverter.java   |   55 -
 ...bstractCommonServiceLogRequestConverter.java |   51 -
 .../query/converter/AbstractConverterAware.java |   47 -
 .../converter/AnyGraphRequestConverter.java     |   39 -
 .../AuditBarGraphRequestConverter.java          |   34 -
 .../converter/AuditLogRequestConverter.java     |   34 -
 .../converter/BaseAuditLogRequestConverter.java |   33 -
 .../BaseServiceLogRequestConverter.java         |   33 -
 .../FieldAuditLogRequestConverter.java          |   34 -
 .../FieldBarGraphRequestConverter.java          |   35 -
 .../ServiceAnyGraphRequestConverter.java        |   39 -
 .../ServiceExtremeDatesRequestConverter.java    |   34 -
 .../converter/ServiceGraphRequestConverter.java |   34 -
 .../ServiceLogExportRequestConverter.java       |   35 -
 .../converter/ServiceLogRequestConverter.java   |   39 -
 .../ServiceLogTruncatedRequestConverter.java    |   36 -
 .../converter/SimpleQueryRequestConverter.java  |   35 -
 .../converter/UserConfigRequestConverter.java   |   36 -
 .../converter/UserExportRequestConverter.java   |   36 -
 .../query/model/AnyGraphSearchCriteria.java     |   77 -
 .../model/AuditBarGraphSearchCriteria.java      |   33 -
 .../query/model/AuditLogSearchCriteria.java     |   33 -
 .../query/model/CommonSearchCriteria.java       |   95 -
 .../model/CommonServiceLogSearchCriteria.java   |   88 -
 .../model/FieldAuditBarGraphSearchCriteria.java |   32 -
 .../model/FieldAuditLogSearchCriteria.java      |   32 -
 .../logsearch/query/model/SearchCriteria.java   |  135 --
 .../model/ServiceAnyGraphSearchCriteria.java    |   60 -
 .../model/ServiceExtremeDatesCriteria.java      |   32 -
 .../query/model/ServiceGraphSearchCriteria.java |   32 -
 .../model/ServiceLogExportSearchCriteria.java   |   40 -
 .../query/model/ServiceLogSearchCriteria.java   |   65 -
 .../ServiceLogTruncatedSearchCriteria.java      |   48 -
 .../query/model/UserConfigSearchCriteria.java   |   48 -
 .../query/model/UserExportSearchCriteria.java   |   31 -
 .../logsearch/rest/AuditLogsResource.java       |   79 +-
 .../ambari/logsearch/rest/PublicResource.java   |    4 +-
 .../logsearch/rest/ServiceLogsResource.java     |   88 +-
 .../logsearch/rest/UserConfigResource.java      |   39 +-
 .../ambari/logsearch/solr/SolrConstants.java    |  113 ++
 .../logsearch/solr/model/SolrAuditLogData.java  |   51 +-
 .../logsearch/solr/model/SolrCommonLogData.java |   36 +-
 .../solr/model/SolrComponentTypeLogData.java    |    4 +-
 .../logsearch/solr/model/SolrHostLogData.java   |    4 +-
 .../solr/model/SolrServiceLogData.java          |   50 +-
 .../apache/ambari/logsearch/util/BizUtil.java   |  261 ---
 .../apache/ambari/logsearch/util/DateUtil.java  |    9 +
 .../ambari/logsearch/util/DownloadUtil.java     |  176 ++
 .../apache/ambari/logsearch/util/FileUtil.java  |   84 -
 .../ambari/logsearch/util/RESTErrorUtil.java    |    6 +-
 .../apache/ambari/logsearch/util/SolrUtil.java  |  305 +--
 .../org/apache/ambari/logsearch/view/VHost.java |   44 -
 .../org/apache/ambari/logsearch/view/VList.java |  243 ---
 .../ambari/logsearch/view/VLogfeederFilter.java |   91 -
 .../logsearch/view/VLogfeederFilterWrapper.java |   55 -
 .../apache/ambari/logsearch/view/VMessage.java  |  165 --
 .../apache/ambari/logsearch/view/VResponse.java |  164 --
 .../apache/ambari/logsearch/view/VSummary.java  |  103 -
 .../ambari/logsearch/view/VUserConfig.java      |  104 -
 .../ambari/logsearch/view/VUserConfigList.java  |   70 -
 .../LogsearchKRBAuthenticationFilter.java       |    1 -
 .../LogsearchAuthenticationProvider.java        |    4 +-
 ...rchExternalServerAuthenticationProvider.java |    9 +-
 .../LogsearchFileAuthenticationProvider.java    |    4 +-
 .../LogsearchLdapAuthenticationProvider.java    |    4 +-
 .../LogsearchSimpleAuthenticationProvider.java  |    4 +-
 .../src/main/resources/default.properties       |    1 -
 .../main/resources/templates/audit_log_txt.ftl  |   42 +
 .../resources/templates/service_log_txt.ftl     |   36 +
 .../scripts/collection_bases/VLogListBase.js    |    2 +-
 .../src/main/webapp/scripts/utils/ViewUtils.js  |    2 +-
 .../scripts/views/audit/AuditAggregatedView.js  |    6 +-
 .../scripts/views/audit/AuditTabLayoutView.js   |    4 +-
 .../views/dashboard/ComponentListView.js        |    2 +-
 .../scripts/views/dashboard/LogLevelBoxView.js  |    2 +-
 .../views/filter/CreateLogfeederFilterView.js   |    6 +-
 .../views/tabs/HierarchyTabLayoutView.js        |    5 +-
 .../webapp/scripts/views/tabs/LogFileView.js    |   94 +-
 .../troubleshoot/TroubleShootLayoutView.js      |    6 +-
 .../src/main/webapp/static/schema_fields.json   |    2 +-
 .../webapp/templates/tabs/LogFileView_tmpl.html |   50 +-
 .../converter/AbstractRequestConverterTest.java |   42 +
 .../AuditBarGraphRequestQueryConverterTest.java |   62 +
 ...AuditComponentRequestQueryConverterTest.java |   66 +
 .../converter/AuditLogRequestConverterTest.java |   64 +
 ...ditServiceLoadRequestQueryConverterTest.java |   61 +
 ...BaseServiceLogRequestQueryConverterTest.java |   70 +
 .../FieldAuditLogRequestQueryConverterTest.java |   61 +
 .../ServiceLogAnyGraphRequestConverterTest.java |   62 +
 ...ComponentLevelRequestQueryConverterTest.java |   65 +
 ...ComponentRequestFacetQueryConverterTest.java |   67 +
 ...eLogLevelCountRequestQueryConverterTest.java |   62 +
 ...LevelDateRangeRequestQueryConverterTest.java |   68 +
 ...ceLogTreeRequestFacetQueryConverterTest.java |   65 +
 ...ceLogTruncatedRequestQueryConverterTest.java |   64 +
 .../StringFieldFacetQueryConverterTest.java     |   48 +
 .../UserConfigRequestQueryConverterTest.java    |   54 +
 .../UserExportRequestQueryConverterTest.java    |   63 +
 .../logging/LoggingRequestHelperImpl.java       |    2 +-
 182 files changed, 5294 insertions(+), 7461 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/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 486a0ba..be58732 100755
--- a/ambari-logsearch/ambari-logsearch-portal/pom.xml
+++ b/ambari-logsearch/ambari-logsearch-portal/pom.xml
@@ -757,5 +757,15 @@
       <artifactId>spring-data-solr</artifactId>
       <version>${spring-data-solr.version}</version>
     </dependency>
+    <dependency>
+      <groupId>org.springframework</groupId>
+      <artifactId>spring-context-support</artifactId>
+      <version>${spring.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.freemarker</groupId>
+      <artifactId>freemarker</artifactId>
+      <version>2.3.20</version>
+    </dependency>
   </dependencies>
 </project>

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/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 9682a3d..c476b9d 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,6 +22,7 @@ import java.util.List;
 import java.util.Map;
 
 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;
@@ -33,12 +34,11 @@ import org.apache.log4j.Logger;
 import org.glassfish.jersey.client.JerseyClient;
 import org.glassfish.jersey.client.JerseyClientBuilder;
 import org.glassfish.jersey.client.authentication.HttpAuthenticationFeature;
-import org.springframework.stereotype.Component;
 
 /**
  * Layer to send REST request to External server using jersey client
  */
-@Component
+@Named
 public class ExternalServerClient {
 
   private static Logger LOG = Logger.getLogger(ExternalServerClient.class);

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/common/LogSearchConstants.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/common/LogSearchConstants.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/common/LogSearchConstants.java
index d9d3b86..b13768f 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/common/LogSearchConstants.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/common/LogSearchConstants.java
@@ -29,7 +29,7 @@ public class LogSearchConstants {
   public static final String FATAL = "FATAL";
   public static final String UNKNOWN = "UNKNOWN";
   
-  public static final String[] SUPPORTED_LOG_LEVEL ={FATAL,ERROR,WARN,INFO,DEBUG,TRACE,UNKNOWN};
+  public static final String[] SUPPORTED_LOG_LEVELS = {FATAL, ERROR, WARN, INFO, DEBUG, TRACE, UNKNOWN};
 
   // Application Constants
   public static final String HOST = "H";
@@ -37,49 +37,10 @@ public class LogSearchConstants {
   public static final String SCROLL_TYPE_AFTER = "after";
   public static final String SCROLL_TYPE_BEFORE = "before";
 
-  // UserConfig Constants
-  public static final String ID = "id";
-  public static final String USER_NAME = "username";
-  public static final String VALUES = "jsons";
-  public static final String FILTER_NAME = "filtername";
-  public static final String ROW_TYPE = "rowtype";
-  public static final String COMPOSITE_KEY = "composite_filtername-username";
-  public static final String SHARE_NAME_LIST = "share_username_list";
-
-  // SOLR Document Constants for ServiceLogs
-  public static final String BUNDLE_ID = "bundle_id";
-  public static final String LOGTIME = "logtime";
-  public static final String SEQUNCE_ID = "seq_num";
-  public static final String SOLR_COMPONENT = "type";
-  public static final String SOLR_LOG_MESSAGE = "log_message";
-  public static final String SOLR_KEY_LOG_MESSAGE = "key_log_message";
-  public static final String SOLR_HOST = "host";
-  public static final String SOLR_LEVEL = "level";
-  public static final String SOLR_THREAD_NAME = "thread_name";
-  public static final String SOLR_LOGGER_NAME = "logger_name";
-  public static final String SOLR_FILE = "file";
-  public static final String SOLR_LINE_NUMBER = "line_number";
-  public static final String SOLR_PATH = "path";
-
-  //SOLR Document Constant for audit log
-  public static final String AUDIT_COMPONENT = "repo";
-  public static final String AUDIT_EVTTIME = "evtTime";
-  public static final String AUDIT_REQUEST_USER = "reqUser";
-
-  // Operator's
-  public static final String MINUS_OPERATOR = "-";
-  public static final String NO_OPERATOR = "";
-
-  //operation
-  public static final String EXCLUDE_QUERY = "excludeQuery";
-  public static final String INCLUDE_QUERY = "includeQuery";
-
   // Seprator's
   public static final String I_E_SEPRATOR = "\\|i\\:\\:e\\|";
 
   //SUFFIX
-  public static final String UI_SUFFIX = "@UI@";
-  public static final String SOLR_SUFFIX = "@Solr@";
   public static final String NGRAM_SUFFIX = "ngram_";
 
   //Date Format for SOLR
@@ -90,41 +51,23 @@ public class LogSearchConstants {
   public static final String ASCENDING_ORDER = "asc";
   public static final String DESCENDING_ORDER = "desc";
 
-  //Solr Facet Sort By
-  public static final String FACET_INDEX = "index";
-  public static final String FACET_COUNT = "count";
-
   // logfeeder 
   public static final String LOGFEEDER_FILTER_NAME = "log_feeder_config";
-  public static final String LIST_SEPARATOR = ",";
-  
+
   public static final String SORT = "sort";
-  public static final String FL = "fl";
   
   //Facet Constant
   public static final String FACET_FIELD = "facet.field";
-  public static final String FACET_MINCOUNT = "facet.mincount";
-  public static final String FACET_JSON_FIELD = "json.facet";
   public static final String FACET_PIVOT = "facet.pivot";
   public static final String FACET_PIVOT_MINCOUNT = "facet.pivot.mincount";
-  public static final String FACET_DATE = "facet.date";
-  public static final String FACET_DATE_START = "facet.date.start";
-  public static final String FACET_DATE_END = "facet.date.end";
-  public static final String FACET_DATE_GAP = "facet.date.gap";
-  public static final String FACET_RANGE = "facet.range";
-  public static final String FACET_RANGE_START = "facet.range.start";
-  public static final String FACET_RANGE_END = "facet.range.end";
-  public static final String FACET_RANGE_GAP = "facet.range.gap";
-  public static final String FACET_GROUP = "group";
-  public static final String FACET_GROUP_MAIN = "group.main";
-  public static final String FACET_GROUP_FIELD = "group.field";
+  public static final String FACET_INDEX = "index";
 
   // Request params
-  public static final String REQUEST_PARAM_QUERY = "q";
   public static final String REQUEST_PARAM_XAXIS = "xAxis";
   public static final String REQUEST_PARAM_YAXIS = "yAxis";
   public static final String REQUEST_PARAM_STACK_BY = "stackBy";
   public static final String REQUEST_PARAM_UNIT = "unit";
+  public static final String REQUEST_PARAM_TOP = "top";
   public static final String REQUEST_PARAM_BUNDLE_ID = "bundle_id";
   public static final String REQUEST_PARAM_START_INDEX = "startIndex";
   public static final String REQUEST_PARAM_PAGE = "page";
@@ -151,7 +94,6 @@ public class LogSearchConstants {
   public static final String REQUEST_PARAM_HOST_NAME = "host_name";
   public static final String REQUEST_PARAM_COMPONENT_NAME = "component_name";
   public static final String REQUEST_PARAM_FILE_NAME = "file_name";
-  public static final String REQUEST_PARAM_DATE_RANGE_LABEL = "dateRangeLabel";
   public static final String REQUEST_PARAM_KEYWORD = "find";
   public static final String REQUEST_PARAM_SOURCE_LOG_ID = "sourceLogId";
   public static final String REQUEST_PARAM_KEYWORD_TYPE = "keywordType";

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/common/LogType.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/common/LogType.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/common/LogType.java
new file mode 100644
index 0000000..2e6cddb
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/common/LogType.java
@@ -0,0 +1,34 @@
+/*
+ * 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.common;
+
+public enum LogType {
+  SERVICE("Service"),
+  AUDIT("Audit");
+
+  private String label;
+
+  private LogType(String label) {
+    this.label = label;
+  }
+
+  public String getLabel() {
+    return label;
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/common/MessageData.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/common/MessageData.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/common/MessageData.java
new file mode 100644
index 0000000..34c83ee
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/common/MessageData.java
@@ -0,0 +1,165 @@
+/*
+* 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.common;
+
+import javax.xml.bind.annotation.XmlRootElement;
+
+@XmlRootElement
+public class MessageData implements java.io.Serializable {
+  private static final long serialVersionUID = 1L;
+
+  /**
+   * Message key
+   */
+  protected String name;
+  /**
+   * Resource bundle key
+   */
+  protected String rbKey;
+  /**
+   * Message description. Use rbKey for doing localized lookup
+   */
+  protected String message;
+  /**
+   * Id of the object to which this message is related to
+   */
+  protected Long objectId;
+  /**
+   * Name of the field or attribute to which this message is related to
+   */
+  protected String fieldName;
+
+  /**
+   * This method sets the value to the member attribute <b>name</b>. You
+   * cannot set null to the attribute.
+   * 
+   * @param name
+   *            Value to set member attribute <b>name</b>
+   */
+  public void setName(String name) {
+    this.name = name;
+  }
+
+  /**
+   * Returns the value for the member attribute <b>name</b>
+   * 
+   * @return String - value of member attribute <b>name</b>.
+   */
+  public String getName() {
+    return this.name;
+  }
+
+  /**
+   * This method sets the value to the member attribute <b>rbKey</b>. You
+   * cannot set null to the attribute.
+   * 
+   * @param rbKey
+   *            Value to set member attribute <b>rbKey</b>
+   */
+  public void setRbKey(String rbKey) {
+    this.rbKey = rbKey;
+  }
+
+  /**
+   * Returns the value for the member attribute <b>rbKey</b>
+   * 
+   * @return String - value of member attribute <b>rbKey</b>.
+   */
+  public String getRbKey() {
+    return this.rbKey;
+  }
+
+  /**
+   * This method sets the value to the member attribute <b>message</b>. You
+   * cannot set null to the attribute.
+   * 
+   * @param message
+   *            Value to set member attribute <b>message</b>
+   */
+  public void setMessage(String message) {
+    this.message = message;
+  }
+
+  /**
+   * Returns the value for the member attribute <b>message</b>
+   * 
+   * @return String - value of member attribute <b>message</b>.
+   */
+  public String getMessage() {
+    return this.message;
+  }
+
+  /**
+   * This method sets the value to the member attribute <b>objectId</b>. You
+   * cannot set null to the attribute.
+   * 
+   * @param objectId
+   *            Value to set member attribute <b>objectId</b>
+   */
+  public void setObjectId(Long objectId) {
+    this.objectId = objectId;
+  }
+
+  /**
+   * Returns the value for the member attribute <b>objectId</b>
+   * 
+   * @return Long - value of member attribute <b>objectId</b>.
+   */
+  public Long getObjectId() {
+    return this.objectId;
+  }
+
+  /**
+   * This method sets the value to the member attribute <b>fieldName</b>. You
+   * cannot set null to the attribute.
+   * 
+   * @param fieldName
+   *            Value to set member attribute <b>fieldName</b>
+   */
+  public void setFieldName(String fieldName) {
+    this.fieldName = fieldName;
+  }
+
+  /**
+   * Returns the value for the member attribute <b>fieldName</b>
+   * 
+   * @return String - value of member attribute <b>fieldName</b>.
+   */
+  public String getFieldName() {
+    return this.fieldName;
+  }
+
+  /**
+   * This return the bean content in string format
+   * 
+   * @return formatedStr
+   */
+  public String toString() {
+    String str = "MessageData={";
+    str += super.toString();
+    str += "name={" + name + "} ";
+    str += "rbKey={" + rbKey + "} ";
+    str += "message={" + message + "} ";
+    str += "objectId={" + objectId + "} ";
+    str += "fieldName={" + fieldName + "} ";
+    str += "}";
+    return str;
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/common/MessageEnums.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/common/MessageEnums.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/common/MessageEnums.java
index 786cf99..c0a7f32 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/common/MessageEnums.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/common/MessageEnums.java
@@ -18,8 +18,6 @@
  */
 package org.apache.ambari.logsearch.common;
 
-import org.apache.ambari.logsearch.view.VMessage;
-
 public enum MessageEnums {
 
   // Common Errors
@@ -51,16 +49,16 @@ public enum MessageEnums {
     this.messageDesc = messageDesc;
   }
 
-  public VMessage getMessage() {
-    VMessage msg = new VMessage();
+  public MessageData getMessage() {
+    MessageData msg = new MessageData();
     msg.setName(this.toString());
     msg.setRbKey(rbKey);
     msg.setMessage(messageDesc);
     return msg;
   }
 
-  public VMessage getMessage(Long objectId, String fieldName) {
-    VMessage msg = new VMessage();
+  public MessageData getMessage(Long objectId, String fieldName) {
+    MessageData msg = new MessageData();
     msg.setName(this.toString());
     msg.setRbKey(rbKey);
     msg.setMessage(messageDesc);

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/common/VResponse.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/common/VResponse.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/common/VResponse.java
new file mode 100644
index 0000000..0c052ab
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/common/VResponse.java
@@ -0,0 +1,164 @@
+/*
+ * 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.common;
+
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlRootElement;
+
+@XmlRootElement
+public class VResponse implements
+    java.io.Serializable {
+  private static final long serialVersionUID = 1L;
+
+  /**
+   * Enum values for ResponseStatus
+   */
+  /**
+   * STATUS_SUCCESS is an element of enum ResponseStatus. Its value is
+   * "STATUS_SUCCESS".
+   */
+  public static final int STATUS_SUCCESS = 0;
+  /**
+   * STATUS_ERROR is an element of enum ResponseStatus. Its value is
+   * "STATUS_ERROR".
+   */
+  public static final int STATUS_ERROR = 1;
+  /**
+   * STATUS_VALIDATION is an element of enum ResponseStatus. Its value is
+   * "STATUS_VALIDATION".
+   */
+  public static final int STATUS_VALIDATION = 2;
+  /**
+   * STATUS_WARN is an element of enum ResponseStatus. Its value is
+   * "STATUS_WARN".
+   */
+  public static final int STATUS_WARN = 3;
+  /**
+   * STATUS_INFO is an element of enum ResponseStatus. Its value is
+   * "STATUS_INFO".
+   */
+  public static final int STATUS_INFO = 4;
+  /**
+   * STATUS_PARTIAL_SUCCESS is an element of enum ResponseStatus. Its value is
+   * "STATUS_PARTIAL_SUCCESS".
+   */
+  public static final int STATUS_PARTIAL_SUCCESS = 5;
+
+  /**
+   * Max value for enum ResponseStatus_MAX
+   */
+  public static final int ResponseStatus_MAX = 5;
+
+  /**
+   * Status code This attribute is of type enum Response::ResponseStatus
+   */
+  protected int statusCode;
+  /**
+   * Message description
+   */
+  protected String msgDesc;
+  /**
+   * List of messages
+   */
+  protected List<MessageData> messageList;
+
+  /**
+   * Default constructor. This will set all the attributes to default value.
+   */
+  public VResponse() {
+    statusCode = 0;
+  }
+
+  /**
+   * This method sets the value to the member attribute <b>statusCode</b>. You
+   * cannot set null to the attribute.
+   * 
+   * @param statusCode
+   *            Value to set member attribute <b>statusCode</b>
+   */
+  public void setStatusCode(int statusCode) {
+    this.statusCode = statusCode;
+  }
+
+  /**
+   * Returns the value for the member attribute <b>statusCode</b>
+   * 
+   * @return int - value of member attribute <b>statusCode</b>.
+   */
+  public int getStatusCode() {
+    return this.statusCode;
+  }
+
+  /**
+   * This method sets the value to the member attribute <b>msgDesc</b>. You
+   * cannot set null to the attribute.
+   * 
+   * @param msgDesc
+   *            Value to set member attribute <b>msgDesc</b>
+   */
+  public void setMsgDesc(String msgDesc) {
+    this.msgDesc = msgDesc;
+  }
+
+  /**
+   * Returns the value for the member attribute <b>msgDesc</b>
+   * 
+   * @return String - value of member attribute <b>msgDesc</b>.
+   */
+  public String getMsgDesc() {
+    return this.msgDesc;
+  }
+
+  /**
+   * This method sets the value to the member attribute <b>messageList</b>.
+   * You cannot set null to the attribute.
+   * 
+   * @param messageList
+   *            Value to set member attribute <b>messageList</b>
+   */
+  public void setMessageList(List<MessageData> messageList) {
+    this.messageList = messageList;
+  }
+
+  /**
+   * Returns the value for the member attribute <b>messageList</b>
+   * 
+   * @return List<MessageData> - value of member attribute <b>messageList</b>.
+   */
+  public List<MessageData> getMessageList() {
+    return this.messageList;
+  }
+
+  /**
+   * This return the bean content in string format
+   * 
+   * @return formatedStr
+   */
+  public String toString() {
+    String str = "VResponse={";
+    str += super.toString();
+    str += "statusCode={" + statusCode + "} ";
+    str += "msgDesc={" + msgDesc + "} ";
+    str += "messageList={" + messageList + "} ";
+    str += "}";
+    return str;
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/ApplicationConfig.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/ApplicationConfig.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/ApplicationConfig.java
index b279a83..82a09b2 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/ApplicationConfig.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/ApplicationConfig.java
@@ -18,12 +18,16 @@
  */
 package org.apache.ambari.logsearch.conf;
 
+import freemarker.template.TemplateException;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.ComponentScan;
 import org.springframework.context.annotation.Configuration;
 import org.springframework.context.annotation.PropertySource;
 import org.springframework.context.support.ConversionServiceFactoryBean;
 import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
+import org.springframework.ui.freemarker.FreeMarkerConfigurationFactoryBean;
+
+import java.io.IOException;
 
 @Configuration
 @ComponentScan("org.apache.ambari.logsearch")
@@ -42,4 +46,13 @@ public class ApplicationConfig {
     return conversionServiceFactoryBean;
   }
 
+  @Bean
+  public freemarker.template.Configuration freemarkerConfiguration() throws IOException, TemplateException {
+    FreeMarkerConfigurationFactoryBean factoryBean = new FreeMarkerConfigurationFactoryBean();
+    factoryBean.setPreferFileSystemAccess(false);
+    factoryBean.setTemplateLoaderPath("classpath:/templates");
+    factoryBean.afterPropertiesSet();
+    return factoryBean.getObject();
+  }
+
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/SolrConfig.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/SolrConfig.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/SolrConfig.java
index 7508fb1..4868409 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/SolrConfig.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/SolrConfig.java
@@ -18,6 +18,7 @@
  */
 package org.apache.ambari.logsearch.conf;
 
+import org.apache.ambari.logsearch.dao.SolrSchemaFieldDao;
 import org.apache.ambari.logsearch.solr.AmbariSolrCloudClient;
 import org.apache.ambari.logsearch.solr.AmbariSolrCloudClientBuilder;
 import org.apache.commons.lang.StringUtils;
@@ -79,6 +80,16 @@ public class SolrConfig {
       solrUserConfigPropsConfig.getCollection()));
   }
 
+  @Bean(name = "serviceSolrFieldDao")
+  public SolrSchemaFieldDao serviceSolrFieldDao() {
+    return new SolrSchemaFieldDao();
+  }
+
+  @Bean(name = "auditSolrFieldDao")
+  public SolrSchemaFieldDao auditSolrFieldDao() {
+    return new SolrSchemaFieldDao();
+  }
+
   private CloudSolrClient createClient(String solrUrl, String zookeeperConnectString, String defaultCollection) {
     if (StringUtils.isNotEmpty(zookeeperConnectString)) {
       CloudSolrClient cloudSolrClient = new CloudSolrClient(zookeeperConnectString);

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/AbstractAuditLogRequestQueryConverter.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/AbstractAuditLogRequestQueryConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/AbstractAuditLogRequestQueryConverter.java
new file mode 100644
index 0000000..e4bce01
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/AbstractAuditLogRequestQueryConverter.java
@@ -0,0 +1,59 @@
+/*
+ * 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.LogSearchConstants;
+import org.apache.ambari.logsearch.model.request.impl.BaseLogRequest;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.data.domain.Sort;
+import org.springframework.data.solr.core.query.Query;
+
+import java.util.List;
+
+import static org.apache.ambari.logsearch.solr.SolrConstants.AuditLogConstants.AUDIT_COMPONENT;
+import static org.apache.ambari.logsearch.solr.SolrConstants.AuditLogConstants.AUDIT_EVTTIME;
+import static org.apache.ambari.logsearch.solr.SolrConstants.CommonLogConstants.SEQUENCE_ID;
+
+public abstract class AbstractAuditLogRequestQueryConverter<SOURCE extends BaseLogRequest, RESULT extends Query>
+  extends AbstractLogRequestQueryConverter<SOURCE, RESULT>{
+
+  @Override
+  public Sort sort(SOURCE request) {
+    String sortBy = request.getSortBy();
+    String sortType = request.getSortType();
+    Sort.Order defaultSortOrder;
+    if (StringUtils.isNotBlank(sortBy)) {
+      Sort.Direction direction = StringUtils.equals(sortType , LogSearchConstants.ASCENDING_ORDER) ? Sort.Direction.ASC : Sort.Direction.DESC;
+      defaultSortOrder = new Sort.Order(direction, sortBy);
+    } else {
+      defaultSortOrder = new Sort.Order(Sort.Direction.DESC, AUDIT_EVTTIME);
+    }
+    Sort.Order secuqnceIdOrder = new Sort.Order(Sort.Direction.DESC, SEQUENCE_ID);
+    return new Sort(defaultSortOrder, secuqnceIdOrder);
+  }
+
+  @Override
+  public void addComponentFilters(SOURCE request, RESULT query) {
+    List<String> includeTypes = splitValueAsList(request.getMustBe(), ",");
+    List<String> excludeTypes = splitValueAsList(request.getMustNot(), ",");
+    addInFilterQuery(query, AUDIT_COMPONENT, includeTypes);
+    addInFilterQuery(query, AUDIT_COMPONENT, excludeTypes, true);
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/AbstractConverterAware.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/AbstractConverterAware.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/AbstractConverterAware.java
new file mode 100644
index 0000000..a4db91f
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/AbstractConverterAware.java
@@ -0,0 +1,47 @@
+/*
+ * 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.springframework.core.convert.ConversionService;
+import org.springframework.core.convert.converter.Converter;
+import org.springframework.core.convert.converter.ConverterRegistry;
+
+import javax.annotation.PostConstruct;
+import javax.inject.Inject;
+import javax.inject.Named;
+
+public abstract class AbstractConverterAware<SOURCE, RESULT> implements Converter<SOURCE, RESULT> {
+
+  @Inject
+  @Named("conversionService")
+  private ConversionService conversionService;
+
+  public ConversionService getConversionService() {
+    return conversionService;
+  }
+
+  @PostConstruct
+  private void register() {
+    if (conversionService instanceof ConverterRegistry) {
+      ((ConverterRegistry) conversionService).addConverter(this);
+    } else {
+      throw new IllegalStateException("Can't register Converter to ConverterRegistry");
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/AbstractDateRangeFacetQueryConverter.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/AbstractDateRangeFacetQueryConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/AbstractDateRangeFacetQueryConverter.java
new file mode 100644
index 0000000..2143f56
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/AbstractDateRangeFacetQueryConverter.java
@@ -0,0 +1,55 @@
+/*
+ * 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.LogSearchConstants;
+import org.apache.ambari.logsearch.model.request.DateRangeParamDefinition;
+import org.apache.ambari.logsearch.model.request.UnitParamDefinition;
+import org.apache.commons.lang.StringUtils;
+import org.apache.solr.client.solrj.SolrQuery;
+
+import java.util.Locale;
+
+public abstract class AbstractDateRangeFacetQueryConverter<SOURCE extends DateRangeParamDefinition & UnitParamDefinition>
+  extends AbstractOperationHolderConverter<SOURCE , SolrQuery> {
+
+  @Override
+  public SolrQuery convert(SOURCE request) {
+    SolrQuery solrQuery = new SolrQuery();
+    String unit = StringUtils.defaultIfEmpty(request.getUnit(), "+1HOUR");
+    solrQuery.setQuery("*:*");
+    solrQuery.setFacet(true);
+    solrQuery.addFacetPivotField("{!range=r1}" + getTypeFieldName());
+    solrQuery.setFacetMinCount(1);
+    solrQuery.setFacetLimit(-1);
+    solrQuery.setFacetSort(LogSearchConstants.FACET_INDEX);
+    solrQuery.add("facet.range", "{!tag=r1}" + getDateFieldName());
+    solrQuery.add(String.format(Locale.ROOT, "f.%s.%s", new Object[]{getDateFieldName(), "facet.range.start"}), request.getFrom());
+    solrQuery.add(String.format(Locale.ROOT, "f.%s.%s", new Object[]{getDateFieldName(), "facet.range.end"}), request.getTo());
+    solrQuery.add(String.format(Locale.ROOT, "f.%s.%s", new Object[]{getDateFieldName(), "facet.range.gap"}), unit);
+    solrQuery.remove("sort");
+    solrQuery.setRows(0);
+    solrQuery.setStart(0);
+    return solrQuery;
+  }
+
+  public abstract String getDateFieldName();
+
+  public abstract String getTypeFieldName();
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/AbstractLogRequestFacetQueryConverter.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/AbstractLogRequestFacetQueryConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/AbstractLogRequestFacetQueryConverter.java
new file mode 100644
index 0000000..9dbab24
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/AbstractLogRequestFacetQueryConverter.java
@@ -0,0 +1,85 @@
+/*
+ * 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.BaseLogRequest;
+import org.apache.commons.lang.StringEscapeUtils;
+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 org.springframework.data.solr.core.query.SimpleStringCriteria;
+
+import java.util.List;
+
+import static org.apache.ambari.logsearch.solr.SolrConstants.ServiceLogConstants.COMPONENT;
+import static org.apache.ambari.logsearch.solr.SolrConstants.AuditLogConstants.AUDIT_COMPONENT;
+
+public abstract class AbstractLogRequestFacetQueryConverter<SOURCE extends BaseLogRequest> extends AbstractOperationHolderConverter<SOURCE, SimpleFacetQuery>{
+
+  @Override
+  public SimpleFacetQuery convert(SOURCE request) {
+    String fromValue = StringUtils.isNotEmpty(request.getFrom()) ? request.getFrom() : "*";
+    String toValue = StringUtils.isNotEmpty(request.getTo()) ? request.getTo() : "*";
+    Criteria criteria = new SimpleStringCriteria("*:*");
+    SimpleFacetQuery facetQuery = new SimpleFacetQuery();
+    facetQuery.addCriteria(criteria);
+    SimpleFilterQuery simpleFilterQuery = new SimpleFilterQuery();
+    simpleFilterQuery.addCriteria(new SimpleStringCriteria(getDateTimeField() + ":[" + fromValue +" TO "+ toValue+ "]" ));
+    facetQuery.addFilterQuery(simpleFilterQuery);
+    FacetOptions facetOptions = new FacetOptions();
+    facetOptions.setFacetMinCount(1);
+    facetOptions.setFacetSort(getFacetSort());
+    appendFacetOptions(facetOptions, request);
+    addIncludeFieldValues(facetQuery, StringEscapeUtils.unescapeXml(request.getIncludeQuery()));
+    addExcludeFieldValues(facetQuery, StringEscapeUtils.unescapeXml(request.getExcludeQuery()));
+    facetQuery.setFacetOptions(facetOptions);
+    facetQuery.setRows(0);
+    addComponentFilters(facetQuery, request);
+    appendFacetQuery(facetQuery, request);
+    return facetQuery;
+  }
+
+  public abstract FacetOptions.FacetSort getFacetSort();
+
+  public abstract String getDateTimeField();
+
+  public abstract LogType getLogType();
+
+  public void appendFacetQuery(SimpleFacetQuery facetQuery, SOURCE request) {
+  }
+
+  public void appendFacetOptions(FacetOptions facetOptions, SOURCE request) {
+    facetOptions.setFacetLimit(-1);
+  }
+
+  private void addComponentFilters(SimpleFacetQuery query, SOURCE request) {
+    List<String> includeTypes = splitValueAsList(request.getMustBe(), ",");
+    List<String> excludeTypes = splitValueAsList(request.getMustNot(), ",");
+    if (LogType.AUDIT.equals(getLogType())) {
+      addInFilterQuery(query, AUDIT_COMPONENT, includeTypes);
+      addInFilterQuery(query, AUDIT_COMPONENT, excludeTypes, true);
+    } else if (LogType.SERVICE.equals(getLogType())) {
+      addInFilterQuery(query, COMPONENT, includeTypes);
+      addInFilterQuery(query, COMPONENT, excludeTypes, true);
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/AbstractLogRequestQueryConverter.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/AbstractLogRequestQueryConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/AbstractLogRequestQueryConverter.java
new file mode 100644
index 0000000..9b7c9d2
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/AbstractLogRequestQueryConverter.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.converter;
+
+import org.apache.ambari.logsearch.model.request.impl.BaseLogRequest;
+import org.apache.commons.lang.StringEscapeUtils;
+import org.springframework.data.solr.core.query.Query;
+
+public abstract class AbstractLogRequestQueryConverter<REQUEST_TYPE extends BaseLogRequest, QUERY_TYPE extends Query>
+  extends AbstractSearchRequestQueryConverter<REQUEST_TYPE, QUERY_TYPE> {
+
+  @Override
+  public QUERY_TYPE extendSolrQuery(REQUEST_TYPE request, QUERY_TYPE query) {
+    addComponentFilters(request, query);
+    addIncludeFieldValues(query, StringEscapeUtils.unescapeXml(request.getIncludeQuery()));
+    addExcludeFieldValues(query, StringEscapeUtils.unescapeXml(request.getExcludeQuery()));
+    return extendLogQuery(request, query);
+  }
+
+  public abstract QUERY_TYPE extendLogQuery(REQUEST_TYPE request, QUERY_TYPE query);
+
+  public abstract void addComponentFilters(REQUEST_TYPE request, QUERY_TYPE query);
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/AbstractOperationHolderConverter.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/AbstractOperationHolderConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/AbstractOperationHolderConverter.java
new file mode 100644
index 0000000..5945d72
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/AbstractOperationHolderConverter.java
@@ -0,0 +1,160 @@
+/*
+ * 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 com.google.common.base.Splitter;
+import com.google.gson.Gson;
+import com.google.gson.reflect.TypeToken;
+import org.apache.ambari.logsearch.common.LogType;
+import org.apache.ambari.logsearch.dao.SolrSchemaFieldDao;
+import org.apache.ambari.logsearch.util.SolrUtil;
+import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.lang.StringUtils;
+import org.springframework.data.solr.core.query.Criteria;
+import org.springframework.data.solr.core.query.Query;
+import org.springframework.data.solr.core.query.SimpleFilterQuery;
+import org.springframework.data.solr.core.query.SimpleStringCriteria;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import static org.apache.ambari.logsearch.solr.SolrConstants.ServiceLogConstants.LOG_MESSAGE;
+
+public abstract class AbstractOperationHolderConverter <REQUEST_TYPE, QUERY_TYPE>
+  extends AbstractConverterAware<REQUEST_TYPE, QUERY_TYPE> {
+
+  @Inject
+  @Named("serviceSolrFieldDao")
+  private SolrSchemaFieldDao serviceSolrSchemaFieldDao;
+
+  @Inject
+  @Named("auditSolrFieldDao")
+  private SolrSchemaFieldDao auditSolrSchemaFieldDao;
+
+  public List<String> splitValueAsList(String value, String separator) {
+    return StringUtils.isNotEmpty(value) ? Splitter.on(separator).omitEmptyStrings().splitToList(value) : null;
+  }
+
+  public Query addEqualsFilterQuery(Query query, String field, String value) {
+    return this.addEqualsFilterQuery(query, field, value, false);
+  }
+
+  public Query addEqualsFilterQuery(Query query, String field, String value, boolean negate) {
+    if (StringUtils.isNotEmpty(value)) {
+      addFilterQuery(query, new Criteria(field).is(value), negate);
+    }
+    return query;
+  }
+
+  public Query addContainsFilterQuery(Query query, String field, String value) {
+    return this.addContainsFilterQuery(query, field, value, false);
+  }
+
+  public Query addContainsFilterQuery(Query query, String field, String value, boolean negate) {
+    if (StringUtils.isNotEmpty(value)) {
+      addFilterQuery(query, new Criteria(field).contains(value), negate);
+    }
+    return query;
+  }
+
+  public Query addInFilterQuery(Query query, String field, List<String> values) {
+    return this.addInFilterQuery(query, field, values, false);
+  }
+
+  public Query addInFilterQuery(Query query, String field, List<String> values, boolean negate) {
+    if (CollectionUtils.isNotEmpty(values)) {
+      addFilterQuery(query, new Criteria(field).is(values), negate);
+    }
+    return query;
+  }
+
+  public Query addRangeFilter(Query query, String field, String from, String to) {
+    return this.addRangeFilter(query, field, from, to, false);
+  }
+
+  public Query addRangeFilter(Query query, String field, String from, String to, boolean negate) { // TODO use criteria.between without escaping
+    String fromValue = StringUtils.defaultIfEmpty(from, "*");
+    String toValue = StringUtils.defaultIfEmpty(to, "*");
+    addFilterQuery(query, new SimpleStringCriteria(field + ":[" + fromValue +" TO "+ toValue + "]" ), negate);
+    return query;
+  }
+
+  public void addFilterQuery(Query query, Criteria criteria, boolean negate) {
+    if (negate) {
+      criteria.not();
+    }
+    query.addFilterQuery(new SimpleFilterQuery(criteria));
+  }
+
+  public Query addIncludeFieldValues(Query query, String fieldValuesMapStr) {
+    if (StringUtils.isNotEmpty(fieldValuesMapStr)) {
+      List<Map<String, String>> criterias = new Gson().fromJson(fieldValuesMapStr,
+        new TypeToken<List<HashMap<String, String>>>(){}.getType());
+      for (Map<String, String> criteriaMap : criterias) {
+        for (Map.Entry<String, String> fieldEntry : criteriaMap.entrySet()) {
+          escapeFieldValueByType(fieldEntry);
+          if (fieldEntry.getKey().equalsIgnoreCase(LOG_MESSAGE)) {
+            addFilterQuery(query, new Criteria(fieldEntry.getKey()).contains(escapeFieldValueByType(fieldEntry)), false);
+          } else {
+            addFilterQuery(query, new Criteria(fieldEntry.getKey()).is(escapeFieldValueByType(fieldEntry)), false);
+          }
+        }
+      }
+    }
+    return query;
+  }
+
+  public Query addExcludeFieldValues(Query query, String fieldValuesMapStr) {
+    if (StringUtils.isNotEmpty(fieldValuesMapStr)) {
+      List<Map<String, String>> criterias = new Gson().fromJson(fieldValuesMapStr,
+        new TypeToken<List<HashMap<String, String>>>(){}.getType());
+      for (Map<String, String> criteriaMap : criterias) {
+        for (Map.Entry<String, String> fieldEntry : criteriaMap.entrySet()) {
+          escapeFieldValueByType(fieldEntry);
+          if (fieldEntry.getKey().equalsIgnoreCase(LOG_MESSAGE)) {
+            addFilterQuery(query, new Criteria(fieldEntry.getKey()).contains(escapeFieldValueByType(fieldEntry)), true);
+          } else {
+            addFilterQuery(query, new Criteria(fieldEntry.getKey()).is(escapeFieldValueByType(fieldEntry)), true);
+          }
+        }
+      }
+    }
+    return query;
+  }
+
+  public abstract LogType getLogType();
+
+  private String escapeFieldValueByType(Map.Entry<String, String> fieldEntry) {
+    String escapedFieldValue;
+    if (fieldEntry.getKey().equalsIgnoreCase(LOG_MESSAGE)) {
+      escapedFieldValue = SolrUtil.escapeForLogMessage(fieldEntry.getValue());
+    } else {
+      escapedFieldValue = SolrUtil.putWildCardByType(fieldEntry.getValue(), fieldEntry.getKey(), getSchemaFieldsTypeMapByLogType(getLogType()));
+    }
+    return escapedFieldValue;
+  }
+
+  private Map<String, String> getSchemaFieldsTypeMapByLogType(LogType logType) {
+    return LogType.AUDIT.equals(logType) ? auditSolrSchemaFieldDao.getSchemaFieldTypeMap() : serviceSolrSchemaFieldDao.getSchemaFieldTypeMap();
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/AbstractSearchRequestQueryConverter.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/AbstractSearchRequestQueryConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/AbstractSearchRequestQueryConverter.java
new file mode 100644
index 0000000..2604f13
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/AbstractSearchRequestQueryConverter.java
@@ -0,0 +1,53 @@
+/*
+ * 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.dao.SolrSchemaFieldDao;
+import org.apache.ambari.logsearch.model.request.impl.CommonSearchRequest;
+import org.apache.commons.lang.StringUtils;
+import org.springframework.data.domain.PageRequest;
+import org.springframework.data.domain.Sort;
+import org.springframework.data.solr.core.query.Criteria;
+import org.springframework.data.solr.core.query.Query;
+import org.springframework.data.solr.core.query.SimpleStringCriteria;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+
+public abstract class AbstractSearchRequestQueryConverter<REQUEST_TYPE extends CommonSearchRequest, QUERY_TYPE extends Query>
+  extends AbstractOperationHolderConverter<REQUEST_TYPE, QUERY_TYPE> {
+
+  @Override
+  public QUERY_TYPE convert(REQUEST_TYPE request) {
+    QUERY_TYPE query = createQuery();
+    int page = StringUtils.isNumeric(request.getPage()) ? new Integer(request.getPage()) : 0;
+    int pageSize = StringUtils.isNumeric(request.getPageSize()) ? new Integer(request.getPageSize()) : 99999;
+    PageRequest pageRequest = new PageRequest(page, pageSize, sort(request));
+    query.setPageRequest(pageRequest);
+    Criteria criteria = new SimpleStringCriteria("*:*");
+    query.addCriteria(criteria);
+    return extendSolrQuery(request, query);
+  }
+
+  public abstract QUERY_TYPE extendSolrQuery(REQUEST_TYPE request, QUERY_TYPE query);
+
+  public abstract Sort sort(REQUEST_TYPE request);
+
+  public abstract QUERY_TYPE createQuery();
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/AbstractServiceLogRequestQueryConverter.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/AbstractServiceLogRequestQueryConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/AbstractServiceLogRequestQueryConverter.java
new file mode 100644
index 0000000..e1cd077
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/AbstractServiceLogRequestQueryConverter.java
@@ -0,0 +1,44 @@
+/*
+ * 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.BaseLogRequest;
+import org.springframework.data.solr.core.query.Query;
+
+import java.util.List;
+
+import static org.apache.ambari.logsearch.solr.SolrConstants.ServiceLogConstants.COMPONENT;
+
+public abstract class AbstractServiceLogRequestQueryConverter<REQUEST_TYPE extends BaseLogRequest, QUERY_TYPE extends Query>
+  extends AbstractLogRequestQueryConverter<REQUEST_TYPE, QUERY_TYPE>  {
+
+  @Override
+  public LogType getLogType() {
+    return LogType.SERVICE;
+  }
+
+  @Override
+  public void addComponentFilters(REQUEST_TYPE request, QUERY_TYPE query) {
+    List<String> includeTypes = splitValueAsList(request.getMustBe(), ",");
+    List<String> excludeTypes = splitValueAsList(request.getMustNot(), ",");
+    addInFilterQuery(query, COMPONENT, includeTypes);
+    addInFilterQuery(query, COMPONENT, excludeTypes, true);
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/AuditBarGraphRequestQueryConverter.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/AuditBarGraphRequestQueryConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/AuditBarGraphRequestQueryConverter.java
new file mode 100644
index 0000000..897bb64
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/AuditBarGraphRequestQueryConverter.java
@@ -0,0 +1,46 @@
+/*
+ * 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.AuditBarGraphRequest;
+
+import javax.inject.Named;
+
+import static org.apache.ambari.logsearch.solr.SolrConstants.AuditLogConstants.AUDIT_COMPONENT;
+import static org.apache.ambari.logsearch.solr.SolrConstants.AuditLogConstants.AUDIT_EVTTIME;
+
+@Named
+public class AuditBarGraphRequestQueryConverter extends AbstractDateRangeFacetQueryConverter<AuditBarGraphRequest> {
+
+  @Override
+  public String getDateFieldName() {
+    return AUDIT_EVTTIME;
+  }
+
+  @Override
+  public String getTypeFieldName() {
+    return AUDIT_COMPONENT;
+  }
+
+  @Override
+  public LogType getLogType() {
+    return LogType.AUDIT;
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/AuditComponentsRequestQueryConverter.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/AuditComponentsRequestQueryConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/AuditComponentsRequestQueryConverter.java
new file mode 100644
index 0000000..d81bdbf
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/AuditComponentsRequestQueryConverter.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.common.LogSearchConstants;
+import org.apache.ambari.logsearch.common.LogType;
+import org.apache.ambari.logsearch.model.request.impl.AuditComponentRequest;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.data.domain.Sort;
+import org.springframework.data.solr.core.query.FacetOptions;
+import org.springframework.data.solr.core.query.SimpleFacetQuery;
+
+import javax.inject.Named;
+
+import static org.apache.ambari.logsearch.solr.SolrConstants.AuditLogConstants.AUDIT_COMPONENT;
+
+@Named
+public class AuditComponentsRequestQueryConverter extends AbstractSearchRequestQueryConverter<AuditComponentRequest, SimpleFacetQuery> {
+
+  @Override
+  public SimpleFacetQuery extendSolrQuery(AuditComponentRequest request, SimpleFacetQuery query) {
+    FacetOptions facetOptions = new FacetOptions(); // TODO: check that date filtering is needed or not
+    facetOptions.addFacetOnField(AUDIT_COMPONENT);
+    facetOptions.setFacetSort(FacetOptions.FacetSort.INDEX);
+    facetOptions.setFacetLimit(-1);
+    query.setFacetOptions(facetOptions);
+    return query;
+  }
+
+  @Override
+  public Sort sort(AuditComponentRequest request) {
+    Sort.Direction direction = StringUtils.equals(request.getSortType(), LogSearchConstants.DESCENDING_ORDER)
+      ? Sort.Direction.DESC : Sort.Direction.ASC;
+    return new Sort(new Sort.Order(direction, AUDIT_COMPONENT));
+  }
+
+  @Override
+  public SimpleFacetQuery createQuery() {
+    return new SimpleFacetQuery();
+  }
+
+  @Override
+  public LogType getLogType() {
+    return LogType.AUDIT;
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/AuditLogRequestQueryConverter.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/AuditLogRequestQueryConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/AuditLogRequestQueryConverter.java
new file mode 100644
index 0000000..a2c1d81
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/AuditLogRequestQueryConverter.java
@@ -0,0 +1,44 @@
+/*
+ * 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.AuditLogRequest;
+import org.springframework.data.solr.core.query.SimpleQuery;
+
+import javax.inject.Named;
+
+@Named
+public class AuditLogRequestQueryConverter extends AbstractAuditLogRequestQueryConverter<AuditLogRequest, SimpleQuery> {
+
+  @Override
+  public SimpleQuery extendLogQuery(AuditLogRequest request, SimpleQuery query) {
+    return query;
+  }
+
+  @Override
+  public SimpleQuery createQuery() {
+    return new SimpleQuery();
+  }
+
+  @Override
+  public LogType getLogType() {
+    return LogType.AUDIT;
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/AuditServiceLoadRequestQueryConverter.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/AuditServiceLoadRequestQueryConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/AuditServiceLoadRequestQueryConverter.java
new file mode 100644
index 0000000..fb1c763
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/AuditServiceLoadRequestQueryConverter.java
@@ -0,0 +1,52 @@
+/*
+ * 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.AuditServiceLoadRequest;
+import org.springframework.data.solr.core.query.FacetOptions;
+
+import javax.inject.Named;
+
+import static org.apache.ambari.logsearch.solr.SolrConstants.AuditLogConstants.AUDIT_EVTTIME;
+import static org.apache.ambari.logsearch.solr.SolrConstants.AuditLogConstants.AUDIT_COMPONENT;
+
+@Named
+public class AuditServiceLoadRequestQueryConverter extends AbstractLogRequestFacetQueryConverter<AuditServiceLoadRequest> {
+
+  @Override
+  public FacetOptions.FacetSort getFacetSort() {
+    return FacetOptions.FacetSort.COUNT;
+  }
+
+  @Override
+  public String getDateTimeField() {
+    return AUDIT_EVTTIME;
+  }
+
+  @Override
+  public LogType getLogType() {
+    return LogType.AUDIT;
+  }
+
+  @Override
+  public void appendFacetOptions(FacetOptions facetOptions, AuditServiceLoadRequest request) {
+    facetOptions.addFacetOnField(AUDIT_COMPONENT);
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/BaseServiceLogRequestQueryConverter.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/BaseServiceLogRequestQueryConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/BaseServiceLogRequestQueryConverter.java
new file mode 100644
index 0000000..4894bfb
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/BaseServiceLogRequestQueryConverter.java
@@ -0,0 +1,86 @@
+/*
+ * 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.LogSearchConstants;
+import org.apache.ambari.logsearch.common.LogType;
+import org.apache.ambari.logsearch.model.request.impl.BaseServiceLogRequest;
+import org.apache.ambari.logsearch.util.SolrUtil;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.data.domain.Sort;
+import org.springframework.data.solr.core.query.SimpleQuery;
+import javax.inject.Named;
+import java.util.List;
+
+import static org.apache.ambari.logsearch.solr.SolrConstants.ServiceLogConstants.LOGTIME;
+import static org.apache.ambari.logsearch.solr.SolrConstants.ServiceLogConstants.LEVEL;
+import static org.apache.ambari.logsearch.solr.SolrConstants.ServiceLogConstants.KEY_LOG_MESSAGE;
+import static org.apache.ambari.logsearch.solr.SolrConstants.ServiceLogConstants.HOST;
+import static org.apache.ambari.logsearch.solr.SolrConstants.ServiceLogConstants.PATH;
+import static org.apache.ambari.logsearch.solr.SolrConstants.ServiceLogConstants.COMPONENT;
+import static org.apache.ambari.logsearch.solr.SolrConstants.ServiceLogConstants.BUNDLE_ID;
+import static org.apache.ambari.logsearch.solr.SolrConstants.CommonLogConstants.SEQUENCE_ID;
+
+@Named
+public class BaseServiceLogRequestQueryConverter extends AbstractServiceLogRequestQueryConverter<BaseServiceLogRequest, SimpleQuery> {
+
+  @Override
+  public SimpleQuery extendLogQuery(BaseServiceLogRequest request, SimpleQuery query) {
+    List<String> levels = splitValueAsList(request.getLevel(), ",");
+    addContainsFilterQuery(query, KEY_LOG_MESSAGE, SolrUtil.escapeForStandardTokenizer(request.getiMessage()));
+    addContainsFilterQuery(query, KEY_LOG_MESSAGE, SolrUtil.escapeForStandardTokenizer(request.geteMessage()), true);
+    addEqualsFilterQuery(query, HOST, SolrUtil.escapeQueryChars(request.getHostName()));
+    addEqualsFilterQuery(query, PATH, SolrUtil.escapeQueryChars(request.getFileName()));
+    addEqualsFilterQuery(query, COMPONENT, SolrUtil.escapeQueryChars(request.getComponentName()));
+    addEqualsFilterQuery(query, BUNDLE_ID, request.getBundleId());
+    addInFilterQuery(query, LEVEL, levels);
+    addRangeFilter(query, LOGTIME, request.getFrom(), request.getTo());
+    return query;
+  }
+
+  @Override
+  public Sort sort(BaseServiceLogRequest request) {
+    String sortBy = request.getSortBy();
+    String sortType = request.getSortType();
+    Sort.Order defaultSortOrder;
+    if (StringUtils.isNotBlank(sortBy)) {
+      Sort.Direction direction = StringUtils.equals(sortType, LogSearchConstants.ASCENDING_ORDER) ? Sort.Direction.ASC : Sort.Direction.DESC;
+      defaultSortOrder = new Sort.Order(direction, sortBy);
+    } else {
+      defaultSortOrder = new Sort.Order(Sort.Direction.DESC, LOGTIME);
+    }
+    Sort.Order secuqnceIdOrder = new Sort.Order(Sort.Direction.DESC, SEQUENCE_ID);
+    return new Sort(defaultSortOrder, secuqnceIdOrder);
+  }
+
+  @Override
+  public SimpleQuery createQuery() {
+    return new SimpleQuery();
+  }
+
+  @Override
+  public LogType getLogType() {
+    return LogType.SERVICE;
+  }
+
+  @Override
+  public void addComponentFilters(BaseServiceLogRequest request, SimpleQuery query) {
+
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/FieldAuditLogRequestQueryConverter.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/FieldAuditLogRequestQueryConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/FieldAuditLogRequestQueryConverter.java
new file mode 100644
index 0000000..a4e613b
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/FieldAuditLogRequestQueryConverter.java
@@ -0,0 +1,54 @@
+/*
+ * 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.FieldAuditLogRequest;
+import org.springframework.data.solr.core.query.FacetOptions;
+
+import javax.inject.Named;
+
+import static org.apache.ambari.logsearch.solr.SolrConstants.AuditLogConstants.AUDIT_EVTTIME;
+import static org.apache.ambari.logsearch.solr.SolrConstants.AuditLogConstants.AUDIT_COMPONENT;
+
+@Named
+public class FieldAuditLogRequestQueryConverter extends AbstractLogRequestFacetQueryConverter<FieldAuditLogRequest> {
+
+  @Override
+  public void appendFacetOptions(FacetOptions facetOptions, FieldAuditLogRequest request) {
+    facetOptions.addFacetOnPivot(request.getField(), AUDIT_COMPONENT);
+    facetOptions.setFacetLimit(request.getTop());
+  }
+
+  @Override
+  public FacetOptions.FacetSort getFacetSort() {
+    return FacetOptions.FacetSort.COUNT;
+  }
+
+  @Override
+  public String getDateTimeField() {
+    return AUDIT_EVTTIME;
+  }
+
+  @Override
+  public LogType getLogType() {
+    return LogType.AUDIT;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/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
new file mode 100644
index 0000000..1d2a657
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/ServiceLogAnyGraphRequestQueryConverter.java
@@ -0,0 +1,52 @@
+/*
+ * 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.ServiceAnyGraphRequest;
+import org.springframework.data.solr.core.query.FacetOptions;
+
+import static org.apache.ambari.logsearch.solr.SolrConstants.ServiceLogConstants.LOGTIME;
+import static org.apache.ambari.logsearch.solr.SolrConstants.ServiceLogConstants.LEVEL;
+
+import javax.inject.Named;
+
+@Named
+public class ServiceLogAnyGraphRequestQueryConverter extends AbstractLogRequestFacetQueryConverter<ServiceAnyGraphRequest>{
+
+  @Override
+  public void appendFacetOptions(FacetOptions facetOptions, ServiceAnyGraphRequest request) {
+    facetOptions.addFacetOnField(LEVEL);
+  }
+
+  @Override
+  public FacetOptions.FacetSort getFacetSort() {
+    return FacetOptions.FacetSort.COUNT;
+  }
+
+  @Override
+  public String getDateTimeField() {
+    return LOGTIME;
+  }
+
+  @Override
+  public LogType getLogType() {
+    return LogType.SERVICE;
+  }
+}


[03/58] [abbrv] ambari git commit: AMBARI-18310. Refactor logsearch portal side code (oleewere)

Posted by ol...@apache.org.
http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/ServiceLogsREST.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/ServiceLogsREST.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/ServiceLogsREST.java
deleted file mode 100644
index 7a27e1c..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/ServiceLogsREST.java
+++ /dev/null
@@ -1,574 +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.rest;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.Context;
-import javax.ws.rs.core.Response;
-
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiImplicitParam;
-import io.swagger.annotations.ApiImplicitParams;
-import io.swagger.annotations.ApiOperation;
-import org.apache.ambari.logsearch.common.LogSearchConstants;
-import org.apache.ambari.logsearch.common.SearchCriteria;
-import org.apache.ambari.logsearch.manager.LogsMgr;
-import org.apache.ambari.logsearch.view.VCountList;
-import org.apache.ambari.logsearch.view.VNameValueList;
-import org.apache.ambari.logsearch.view.VNodeList;
-import org.apache.commons.lang.StringEscapeUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Scope;
-import org.springframework.stereotype.Component;
-
-import static org.apache.ambari.logsearch.doc.DocConstants.CommonDescriptions.*;
-import static org.apache.ambari.logsearch.doc.DocConstants.ServiceDescriptions.*;
-import static org.apache.ambari.logsearch.doc.DocConstants.ServiceOperationDescriptions.*;
-
-@Api(value = "service/logs", description = "Service log operations")
-@Path("service/logs")
-@Component
-@Scope("request")
-public class ServiceLogsREST {
-
-  @Autowired
-  LogsMgr logMgr;
-
-  @GET
-  @Produces({"application/json"})
-  @ApiOperation(SEARCH_LOGS_OD)
-  @ApiImplicitParams(value = {
-    @ApiImplicitParam(value = HOST_D, name = "host", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = COMPONENT_D, name = "component", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = FIND_D, name = "find", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = SOURCE_LOG_ID_D, name = "sourceLogId", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = KEYWORD_TYPE_D, name = "keywordType", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = TOKEN_D, name = "token", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = IS_LAST_PAGE_D, name = "isLastPage", dataType = "boolean", paramType = "query"),
-    @ApiImplicitParam(value = ADVANCED_SEARCH_D, name = "advancedSearch", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = QUERY_D,name = "q", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = LEVEL_D, name = "level", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = TREE_PARAMS_D, name = "treeParams", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = COLUMN_QUERY_D, name = "columnQuery", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = I_MESSAGE_D, name = "iMessage", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = G_E_MESSAGE_D, name = "gEMessage", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = E_MESSAGE_D, name = "eMessage", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = G_MUST_NOT_D, name = "gMustNot", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = MUST_BE_D, name = "mustBe", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = MUST_NOT_D, name = "mustNot", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = HOST_NAME_D, name = "host_name", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = COMPONENT_NAME_D, name = "component_name", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = FILE_NAME_D, name = "file_name", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = EXCLUDE_QUERY_D, name = "excludeQuery", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = INCLUDE_QUERY_D, name = "includeQuery", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = START_TIME_D, name = "start_time", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = END_TIME_D, name = "end_time", dataType = "string", paramType = "query")
-  })
-  public String searchSolrData(@Context HttpServletRequest request) {
-    SearchCriteria searchCriteria = new SearchCriteria(request);
-    searchCriteria.addRequiredServiceLogsParams(request);
-    searchCriteria.addParam("hostLogFile", request.getParameter("host"));
-    searchCriteria.addParam("compLogFile",
-      request.getParameter("component"));
-    searchCriteria.addParam("keyword", StringEscapeUtils.unescapeXml(request.getParameter("find")));
-    searchCriteria.addParam("sourceLogId", request.getParameter("sourceLogId"));
-    searchCriteria.addParam("keywordType",
-      request.getParameter("keywordType"));
-    searchCriteria.addParam("token",
-      request.getParameter("token"));
-    searchCriteria.addParam("isLastPage",request.getParameter("isLastPage"));
-    return logMgr.searchLogs(searchCriteria);
-  }
-
-  @GET
-  @Path("/hosts")
-  @Produces({"application/json"})
-  @ApiOperation(GET_HOSTS_OD)
-  @ApiImplicitParams(value = {
-    @ApiImplicitParam(value = QUERY_D, name = "q", dataType = "string", paramType = "query")
-  })
-  public String getHosts(@Context HttpServletRequest request) {
-    SearchCriteria searchCriteria = new SearchCriteria(request);
-    searchCriteria.addParam("q", request.getParameter("q"));
-    return logMgr.getHosts();
-  }
-
-  @GET
-  @Path("/components")
-  @Produces({"application/json"})
-  @ApiOperation(GET_COMPONENTS_OD)
-  @ApiImplicitParams(value = {
-    @ApiImplicitParam(value = QUERY_D, name = "q", dataType = "string", paramType = "query")
-  })
-  public String getComponents(@Context HttpServletRequest request) {
-    SearchCriteria searchCriteria = new SearchCriteria(request);
-    searchCriteria.addParam("q", request.getParameter("q"));
-    return logMgr.getComponents();
-  }
-
-  @GET
-  @Path("/aggregated")
-  @Produces({"application/json"})
-  @ApiOperation(GET_AGGREGATED_INFO_OD)
-  @ApiImplicitParams(value = {
-    @ApiImplicitParam(value = ADVANCED_SEARCH_D, name = "advancedSearch", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = QUERY_D,name = "q", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = LEVEL_D, name = "level", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = TREE_PARAMS_D, name = "treeParams", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = COLUMN_QUERY_D, name = "columnQuery", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = I_MESSAGE_D, name = "iMessage", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = G_E_MESSAGE_D, name = "gEMessage", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = E_MESSAGE_D, name = "eMessage", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = G_MUST_NOT_D, name = "gMustNot", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = MUST_BE_D, name = "mustBe", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = MUST_NOT_D, name = "mustNot", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = HOST_NAME_D, name = "host_name", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = COMPONENT_NAME_D, name = "component_name", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = FILE_NAME_D, name = "file_name", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = EXCLUDE_QUERY_D, name = "excludeQuery", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = INCLUDE_QUERY_D, name = "includeQuery", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = START_TIME_D, name = "start_time", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = END_TIME_D, name = "end_time", dataType = "string", paramType = "query")
-  })
-  public String getAggregatedInfo(@Context HttpServletRequest request) {
-    SearchCriteria searchCriteria = new SearchCriteria();
-    searchCriteria.addRequiredServiceLogsParams(request);
-    return logMgr.getAggregatedInfo(searchCriteria);
-  }
-
-  @GET
-  @Path("/levels/count")
-  @Produces({"application/json"})
-  @ApiOperation(GET_LOG_LEVELS_COUNT_OD)
-  @ApiImplicitParams(value = {
-    @ApiImplicitParam(value = QUERY_D, name = "q", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = START_TIME_D, name = "start_time", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = END_TIME_D, name = "end_time", dataType = "string", paramType = "query")
-  })
-  public VCountList getLogLevelsCount(@Context HttpServletRequest request) {
-    SearchCriteria searchCriteria = new SearchCriteria();
-    searchCriteria.addParam("q", request.getParameter("q"));
-    searchCriteria
-      .addParam("startDate", request.getParameter("start_time"));
-    searchCriteria.addParam("endDate", request.getParameter("end_time"));
-    return logMgr.getLogLevelCount();
-  }
-
-  @GET
-  @Path("/components/count")
-  @Produces({"application/json"})
-  @ApiOperation(GET_COMPONENTS_COUNT_OD)
-  @ApiImplicitParams(value = {
-    @ApiImplicitParam(value = QUERY_D, name = "q", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = START_TIME_D, name = "start_time", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = END_TIME_D, name = "end_time", dataType = "string", paramType = "query")
-  })
-  public VCountList getComponentsCount(@Context HttpServletRequest request) {
-    SearchCriteria searchCriteria = new SearchCriteria();
-    searchCriteria.addParam("q", request.getParameter("q"));
-    searchCriteria
-      .addParam("startDate", request.getParameter("start_time"));
-    searchCriteria.addParam("endDate", request.getParameter("end_time"));
-    return logMgr.getComponentsCount();
-  }
-
-  @GET
-  @Path("/hosts/count")
-  @Produces({"application/json"})
-  @ApiOperation(GET_HOSTS_COUNT_OD)
-  @ApiImplicitParams(value = {
-    @ApiImplicitParam(value = QUERY_D, name = "q", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = START_TIME_D, name = "start_time", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = END_TIME_D, name = "end_time", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = EXCLUDE_QUERY_D, name = "excludeQuery", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = INCLUDE_QUERY_D, name = "includeQuery", dataType = "string", paramType = "query")
-  })
-  public VCountList getHostsCount(@Context HttpServletRequest request) {
-    SearchCriteria searchCriteria = new SearchCriteria();
-    searchCriteria.addParam("q", request.getParameter("q"));
-    searchCriteria
-      .addParam("startDate", request.getParameter("start_time"));
-    searchCriteria.addParam("endDate", request.getParameter("end_time"));
-    searchCriteria.addParam("excludeQuery", StringEscapeUtils
-      .unescapeXml(request.getParameter("excludeQuery")));
-    searchCriteria.addParam("includeQuery", StringEscapeUtils
-      .unescapeXml(request.getParameter("includeQuery")));
-    return logMgr.getHostsCount();
-  }
-
-  @GET
-  @Path("/tree")
-  @Produces({"application/json"})
-  @ApiOperation(GET_TREE_EXTENSION_OD)
-  @ApiImplicitParams(value = {
-    @ApiImplicitParam(value = HOST_D, name = "host", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = COMPONENT_D, name = "component", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = ADVANCED_SEARCH_D, name = "advancedSearch", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = QUERY_D,name = "q", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = LEVEL_D, name = "level", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = TREE_PARAMS_D, name = "treeParams", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = COLUMN_QUERY_D, name = "columnQuery", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = I_MESSAGE_D, name = "iMessage", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = G_E_MESSAGE_D, name = "gEMessage", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = E_MESSAGE_D, name = "eMessage", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = G_MUST_NOT_D, name = "gMustNot", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = MUST_BE_D, name = "mustBe", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = MUST_NOT_D, name = "mustNot", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = HOST_NAME_D, name = "host_name", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = COMPONENT_NAME_D, name = "component_name", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = FILE_NAME_D, name = "file_name", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = EXCLUDE_QUERY_D, name = "excludeQuery", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = INCLUDE_QUERY_D, name = "includeQuery", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = START_TIME_D, name = "start_time", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = END_TIME_D, name = "end_time", dataType = "string", paramType = "query")
-  })
-  public VNodeList getTreeExtension(@Context HttpServletRequest request) {
-    SearchCriteria searchCriteria = new SearchCriteria(request);
-    searchCriteria.addRequiredServiceLogsParams(request);
-    searchCriteria.addParam("hostLogFile", request.getParameter("host"));
-    searchCriteria.addParam("compLogFile",
-      request.getParameter("component"));
-    searchCriteria.addParam("hostName", request.getParameter("hostName"));
-    return logMgr.getTreeExtension(searchCriteria);
-  }
-
-  @GET
-  @Path("/levels/counts/namevalues")
-  @Produces({"application/json"})
-  @ApiOperation(GET_LOG_LEVELS_COUNT_OD)
-  @ApiImplicitParams(value = {
-    @ApiImplicitParam(value = HOST_D, name = "host", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = COMPONENT_D, name = "component", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = ADVANCED_SEARCH_D, name = "advancedSearch", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = QUERY_D,name = "q", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = LEVEL_D, name = "level", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = TREE_PARAMS_D, name = "treeParams", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = COLUMN_QUERY_D, name = "columnQuery", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = I_MESSAGE_D, name = "iMessage", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = G_E_MESSAGE_D, name = "gEMessage", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = E_MESSAGE_D, name = "eMessage", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = G_MUST_NOT_D, name = "gMustNot", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = MUST_BE_D, name = "mustBe", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = MUST_NOT_D, name = "mustNot", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = HOST_NAME_D, name = "host_name", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = COMPONENT_NAME_D, name = "component_name", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = FILE_NAME_D, name = "file_name", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = EXCLUDE_QUERY_D, name = "excludeQuery", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = INCLUDE_QUERY_D, name = "includeQuery", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = START_TIME_D, name = "start_time", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = END_TIME_D, name = "end_time", dataType = "string", paramType = "query")
-  })
-  public VNameValueList getLogsLevelCount(@Context HttpServletRequest request) {
-    SearchCriteria searchCriteria = new SearchCriteria(request);
-    searchCriteria.addRequiredServiceLogsParams(request);
-    searchCriteria.addParam("hostLogFile", request.getParameter("host"));
-    searchCriteria.addParam("compLogFile",
-      request.getParameter("component"));
-    return logMgr.getLogsLevelCount(searchCriteria);
-  }
-
-  @GET
-  @Path("/histogram")
-  @Produces({"application/json"})
-  @ApiOperation(GET_HISTOGRAM_DATA_OD)
-  @ApiImplicitParams(value = {
-    @ApiImplicitParam(value = HOST_D, name = "host", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = COMPONENT_D, name = "component", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = UNIT_D, name = "unit", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = ADVANCED_SEARCH_D, name = "advancedSearch", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = QUERY_D,name = "q", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = LEVEL_D, name = "level", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = TREE_PARAMS_D, name = "treeParams", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = COLUMN_QUERY_D, name = "columnQuery", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = I_MESSAGE_D, name = "iMessage", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = G_E_MESSAGE_D, name = "gEMessage", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = E_MESSAGE_D, name = "eMessage", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = G_MUST_NOT_D, name = "gMustNot", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = MUST_BE_D, name = "mustBe", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = MUST_NOT_D, name = "mustNot", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = HOST_NAME_D, name = "host_name", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = COMPONENT_NAME_D, name = "component_name", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = FILE_NAME_D, name = "file_name", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = EXCLUDE_QUERY_D, name = "excludeQuery", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = INCLUDE_QUERY_D, name = "includeQuery", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = START_TIME_D, name = "start_time", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = END_TIME_D, name = "end_time", dataType = "string", paramType = "query")
-  })
-  public String getHistogramData(@Context HttpServletRequest request) {
-    SearchCriteria searchCriteria = new SearchCriteria(request);
-    searchCriteria.addRequiredServiceLogsParams(request);
-    searchCriteria.addParam("hostLogFile", request.getParameter("host"));
-    searchCriteria.addParam("compLogFile",
-      request.getParameter("component"));
-    searchCriteria.addParam("unit", request.getParameter("unit"));
-    return logMgr.getHistogramData(searchCriteria);
-  }
-
-  @GET
-  @Path("/request/cancel")
-  @Produces({"application/json"})
-  @ApiOperation(CANCEL_FIND_REQUEST_OD)
-  @ApiImplicitParams(value = {
-    @ApiImplicitParam(value = TOKEN_D, name = "token", dataType = "string", paramType = "query"),
-  })
-  public String cancelFindRequest(@Context HttpServletRequest request) {
-    String uniqueId = request.getParameter("token");
-    return logMgr.cancelFindRequestByDate(uniqueId);
-  }
-
-  @GET
-  @Path("/export")
-  @Produces({"application/json"})
-  @ApiOperation(EXPORT_TO_TEXT_FILE_OD)
-  @ApiImplicitParams(value = {
-    @ApiImplicitParam(value = HOST_D, name = "host", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = COMPONENT_D, name = "component", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = FORMAT_D, name = "format", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = UTC_OFFSET_D, name = "utcOffset", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = ADVANCED_SEARCH_D, name = "advancedSearch", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = QUERY_D,name = "q", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = LEVEL_D, name = "level", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = TREE_PARAMS_D, name = "treeParams", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = COLUMN_QUERY_D, name = "columnQuery", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = I_MESSAGE_D, name = "iMessage", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = G_E_MESSAGE_D, name = "gEMessage", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = E_MESSAGE_D, name = "eMessage", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = G_MUST_NOT_D, name = "gMustNot", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = MUST_BE_D, name = "mustBe", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = MUST_NOT_D, name = "mustNot", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = HOST_NAME_D, name = "host_name", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = COMPONENT_NAME_D, name = "component_name", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = FILE_NAME_D, name = "file_name", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = EXCLUDE_QUERY_D, name = "excludeQuery", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = INCLUDE_QUERY_D, name = "includeQuery", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = START_TIME_D, name = "start_time", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = END_TIME_D, name = "end_time", dataType = "string", paramType = "query")
-  })
-  public Response exportToTextFile(@Context HttpServletRequest request) {
-
-    SearchCriteria searchCriteria = new SearchCriteria(request);
-    searchCriteria.addRequiredServiceLogsParams(request);
-    searchCriteria.addParam("hostLogFile", request.getParameter("host"));
-    searchCriteria.addParam("compLogFile",
-      request.getParameter("component"));
-    searchCriteria.addParam("format", request.getParameter("format"));
-    searchCriteria.addParam("utcOffset", request.getParameter("utcOffset"));
-    return logMgr.exportToTextFile(searchCriteria);
-
-  }
-
-  @GET
-  @Path("/hosts/components")
-  @Produces({"application/json"})
-  @ApiOperation(GET_HOST_LIST_BY_COMPONENT_OD)
-  @ApiImplicitParams(value = {
-    @ApiImplicitParam(value = HOST_D, name = "host", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = COMPONENT_D, name = "component", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = ADVANCED_SEARCH_D, name = "advancedSearch", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = QUERY_D,name = "q", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = LEVEL_D, name = "level", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = TREE_PARAMS_D, name = "treeParams", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = COLUMN_QUERY_D, name = "columnQuery", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = I_MESSAGE_D, name = "iMessage", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = G_E_MESSAGE_D, name = "gEMessage", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = E_MESSAGE_D, name = "eMessage", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = G_MUST_NOT_D, name = "gMustNot", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = MUST_BE_D, name = "mustBe", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = MUST_NOT_D, name = "mustNot", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = HOST_NAME_D, name = "host_name", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = COMPONENT_NAME_D, name = "component_name", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = FILE_NAME_D, name = "file_name", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = EXCLUDE_QUERY_D, name = "excludeQuery", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = INCLUDE_QUERY_D, name = "includeQuery", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = START_TIME_D, name = "start_time", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = END_TIME_D, name = "end_time", dataType = "string", paramType = "query")
-  })
-  public String getHostListByComponent(@Context HttpServletRequest request) {
-    SearchCriteria searchCriteria = new SearchCriteria(request);
-    searchCriteria.addRequiredServiceLogsParams(request);
-    searchCriteria.addParam("hostLogFile", request.getParameter("host"));
-    searchCriteria.addParam("compLogFile",
-      request.getParameter("component"));
-    searchCriteria.addParam("componentName",
-      request.getParameter("componentName"));
-    return logMgr.getHostListByComponent(searchCriteria);
-  }
-
-  @GET
-  @Path("/components/level/counts")
-  @Produces({"application/json"})
-  @ApiOperation(GET_COMPONENT_LIST_WITH_LEVEL_COUNT_OD)
-  @ApiImplicitParams(value = {
-    @ApiImplicitParam(value = HOST_D, name = "host", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = COMPONENT_D, name = "component", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = ADVANCED_SEARCH_D, name = "advancedSearch", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = QUERY_D,name = "q", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = LEVEL_D, name = "level", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = TREE_PARAMS_D, name = "treeParams", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = COLUMN_QUERY_D, name = "columnQuery", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = I_MESSAGE_D, name = "iMessage", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = G_E_MESSAGE_D, name = "gEMessage", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = E_MESSAGE_D, name = "eMessage", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = G_MUST_NOT_D, name = "gMustNot", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = MUST_BE_D, name = "mustBe", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = MUST_NOT_D, name = "mustNot", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = HOST_NAME_D, name = "host_name", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = COMPONENT_NAME_D, name = "component_name", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = FILE_NAME_D, name = "file_name", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = EXCLUDE_QUERY_D, name = "excludeQuery", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = INCLUDE_QUERY_D, name = "includeQuery", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = START_TIME_D, name = "start_time", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = END_TIME_D, name = "end_time", dataType = "string", paramType = "query")
-  })
-  public String getComponentListWithLevelCounts(
-    @Context HttpServletRequest request) {
-    SearchCriteria searchCriteria = new SearchCriteria(request);
-    searchCriteria.addRequiredServiceLogsParams(request);
-    searchCriteria.addParam("hostLogFile", request.getParameter("host"));
-    searchCriteria.addParam("compLogFile",
-      request.getParameter("component"));
-    return logMgr.getComponentListWithLevelCounts(searchCriteria);
-  }
-
-  @GET
-  @Path("/solr/boundarydates")
-  @Produces({"application/json"})
-  @ApiOperation(GET_EXTREME_DATES_FOR_BUNDLE_ID_OD)
-  public String getExtremeDatesForBundelId(@Context HttpServletRequest request) {
-
-    SearchCriteria searchCriteria = new SearchCriteria(request);
-    searchCriteria.addParam(LogSearchConstants.BUNDLE_ID,
-      request.getParameter("bundle_id"));
-
-    return logMgr.getExtremeDatesForBundelId(searchCriteria);
-
-  }
-
-  @GET
-  @Path("/fields")
-  @Produces({"application/json"})
-  @ApiOperation(GET_SERVICE_LOGS_FIELD_NAME_OD)
-  public String getServiceLogsFieldsName() {
-    return logMgr.getServiceLogsFieldsName();
-  }
-
-  @GET
-  @Path("/schema/fields")
-  @Produces({"application/json"})
-  @ApiOperation(GET_SERVICE_LOGS_SCHEMA_FIELD_NAME_OD)
-  public String getServiceLogsSchemaFieldsName() {
-    return logMgr.getServiceLogsSchemaFieldsName();
-  }
-
-  @GET
-  @Path("/anygraph")
-  @Produces({"application/json"})
-  @ApiOperation(GET_ANY_GRAPH_DATA_OD)
-  @ApiImplicitParams(value = {
-    @ApiImplicitParam(value = X_AXIS_D, name = "xAxis", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = Y_AXIS_D, name = "yAxis", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = STACK_BY_D, name = "stackBy", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = FROM_D, name = "from", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = TO_D, name = "to", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = UNIT_D, name = "unit", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = ADVANCED_SEARCH_D, name = "advancedSearch", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = QUERY_D,name = "q", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = LEVEL_D, name = "level", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = TREE_PARAMS_D, name = "treeParams", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = COLUMN_QUERY_D, name = "columnQuery", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = I_MESSAGE_D, name = "iMessage", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = G_E_MESSAGE_D, name = "gEMessage", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = E_MESSAGE_D, name = "eMessage", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = G_MUST_NOT_D, name = "gMustNot", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = MUST_BE_D, name = "mustBe", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = MUST_NOT_D, name = "mustNot", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = HOST_NAME_D, name = "host_name", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = COMPONENT_NAME_D, name = "component_name", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = FILE_NAME_D, name = "file_name", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = EXCLUDE_QUERY_D, name = "excludeQuery", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = INCLUDE_QUERY_D, name = "includeQuery", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = START_TIME_D, name = "start_time", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = END_TIME_D, name = "end_time", dataType = "string", paramType = "query")
-  })
-  public String getAnyGraphData(@Context HttpServletRequest request) {
-    SearchCriteria searchCriteria = new SearchCriteria(request);
-    searchCriteria.addRequiredServiceLogsParams(request);
-    searchCriteria.addParam("xAxis", request.getParameter("xAxis"));
-    searchCriteria.addParam("yAxis", request.getParameter("yAxis"));
-    searchCriteria.addParam("stackBy", request.getParameter("stackBy"));
-    searchCriteria.addParam("from", request.getParameter("from"));
-    searchCriteria.addParam("to", request.getParameter("to"));
-    searchCriteria.addParam("unit", request.getParameter("unit"));
-    return logMgr.getAnyGraphData(searchCriteria);
-  }
-
-  @GET
-  @Path("/truncated")
-  @Produces({"application/json"})
-  @ApiOperation(GET_AFTER_BEFORE_LOGS_OD)
-  @ApiImplicitParams(value = {
-    @ApiImplicitParam(value = HOST_D, name = "host", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = COMPONENT_D,name = "component", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = ID_D, name = "id", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = SCROLL_TYPE_D, name = "scrollType", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = NUMBER_ROWS_D, name = "numberRows", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = ADVANCED_SEARCH_D, name = "advancedSearch", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = QUERY_D,name = "q", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = LEVEL_D, name = "level", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = TREE_PARAMS_D, name = "treeParams", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = COLUMN_QUERY_D, name = "columnQuery", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = I_MESSAGE_D, name = "iMessage", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = G_E_MESSAGE_D, name = "gEMessage", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = E_MESSAGE_D, name = "eMessage", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = G_MUST_NOT_D, name = "gMustNot", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = MUST_BE_D, name = "mustBe", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = MUST_NOT_D, name = "mustNot", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = HOST_NAME_D, name = "host_name", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = COMPONENT_NAME_D, name = "component_name", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = FILE_NAME_D, name = "file_name", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = EXCLUDE_QUERY_D, name = "excludeQuery", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = INCLUDE_QUERY_D, name = "includeQuery", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = START_TIME_D, name = "start_time", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = END_TIME_D, name = "end_time", dataType = "string", paramType = "query")
-  })
-  public String getAfterBeforeLogs(@Context HttpServletRequest request) {
-    SearchCriteria searchCriteria = new SearchCriteria(request);
-    searchCriteria.addRequiredServiceLogsParams(request);
-    searchCriteria.addParam("hostLogFile", request.getParameter("host"));
-    searchCriteria.addParam("compLogFile",
-      request.getParameter("component"));
-    searchCriteria.addParam("id", request.getParameter("id"));
-    searchCriteria.addParam("scrollType",
-      request.getParameter("scrollType"));
-    searchCriteria.addParam("numberRows",
-      request.getParameter("numberRows"));
-    return logMgr.getAfterBeforeLogs(searchCriteria);
-  }
-
-  @GET
-  @Path("/serviceconfig")
-  @Produces({"application/json"})
-  @ApiOperation(GET_HADOOP_SERVICE_CONFIG_JSON_OD)
-  public String getHadoopServiceConfigJSON() {
-    return logMgr.getHadoopServiceConfigJSON();
-  }
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/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
new file mode 100644
index 0000000..5400825
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/ServiceLogsResource.java
@@ -0,0 +1,238 @@
+/*
+ * 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.rest;
+
+import javax.inject.Inject;
+import javax.ws.rs.BeanParam;
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.QueryParam;
+import javax.ws.rs.core.Response;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import org.apache.ambari.logsearch.model.request.impl.BaseServiceLogRequest;
+import org.apache.ambari.logsearch.model.request.impl.ServiceAnyGraphRequest;
+import org.apache.ambari.logsearch.model.request.impl.ServiceExtremeDatesRequest;
+import org.apache.ambari.logsearch.model.request.impl.ServiceGraphRequest;
+import org.apache.ambari.logsearch.model.request.impl.ServiceLogExportRequest;
+import org.apache.ambari.logsearch.model.request.impl.ServiceLogFileRequest;
+import org.apache.ambari.logsearch.model.request.impl.ServiceLogRequest;
+import org.apache.ambari.logsearch.model.request.impl.ServiceLogTruncatedRequest;
+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.NameValueDataListResponse;
+import org.apache.ambari.logsearch.model.response.NodeListResponse;
+import org.apache.ambari.logsearch.model.response.ServiceLogResponse;
+import org.apache.ambari.logsearch.query.model.CommonSearchCriteria;
+import org.apache.ambari.logsearch.query.model.SearchCriteria;
+import org.apache.ambari.logsearch.manager.ServiceLogsManager;
+import org.apache.ambari.logsearch.query.model.ServiceAnyGraphSearchCriteria;
+import org.apache.ambari.logsearch.query.model.ServiceExtremeDatesCriteria;
+import org.apache.ambari.logsearch.query.model.ServiceGraphSearchCriteria;
+import org.apache.ambari.logsearch.query.model.ServiceLogExportSearchCriteria;
+import org.apache.ambari.logsearch.query.model.ServiceLogFileSearchCriteria;
+import org.apache.ambari.logsearch.query.model.ServiceLogSearchCriteria;
+import org.apache.ambari.logsearch.query.model.ServiceLogTruncatedSearchCriteria;
+import org.springframework.context.annotation.Scope;
+import org.springframework.core.convert.ConversionService;
+import org.springframework.stereotype.Component;
+
+import static org.apache.ambari.logsearch.doc.DocConstants.ServiceOperationDescriptions.*;
+
+@Api(value = "service/logs", description = "Service log operations")
+@Path("service/logs")
+@Component
+@Scope("request")
+public class ServiceLogsResource {
+
+  @Inject
+  private ServiceLogsManager serviceLogsManager;
+
+  @Inject
+  private ConversionService conversionService;
+
+  @GET
+  @Produces({"application/json"})
+  @ApiOperation(SEARCH_LOGS_OD)
+  public ServiceLogResponse searchSolrData(@BeanParam ServiceLogRequest request) {
+    return serviceLogsManager.searchLogs(conversionService.convert(request, ServiceLogSearchCriteria.class));
+  }
+
+  @GET
+  @Path("/hosts")
+  @Produces({"application/json"})
+  @ApiOperation(GET_HOSTS_OD)
+  public GroupListResponse getHosts() {
+    return serviceLogsManager.getHosts();
+  }
+
+  @GET
+  @Path("/components")
+  @Produces({"application/json"})
+  @ApiOperation(GET_COMPONENTS_OD)
+  public GroupListResponse getComponents() {
+    return serviceLogsManager.getComponents();
+  }
+
+  @GET
+  @Path("/aggregated")
+  @Produces({"application/json"})
+  @ApiOperation(GET_AGGREGATED_INFO_OD)
+  public GraphDataListResponse getAggregatedInfo(@BeanParam BaseServiceLogRequest request) {
+    return serviceLogsManager.getAggregatedInfo(conversionService.convert(request, CommonSearchCriteria.class));
+  }
+
+  @GET
+  @Path("/levels/count")
+  @Produces({"application/json"})
+  @ApiOperation(GET_LOG_LEVELS_COUNT_OD)
+  public CountDataListResponse getLogLevelsCount() {
+    return serviceLogsManager.getLogLevelCount();
+  }
+
+  @GET
+  @Path("/components/count")
+  @Produces({"application/json"})
+  @ApiOperation(GET_COMPONENTS_COUNT_OD)
+  public CountDataListResponse getComponentsCount() {
+    return serviceLogsManager.getComponentsCount();
+  }
+
+  @GET
+  @Path("/hosts/count")
+  @Produces({"application/json"})
+  @ApiOperation(GET_HOSTS_COUNT_OD)
+  public CountDataListResponse getHostsCount() {
+    return serviceLogsManager.getHostsCount();
+  }
+
+  @GET
+  @Path("/tree")
+  @Produces({"application/json"})
+  @ApiOperation(GET_TREE_EXTENSION_OD)
+  public NodeListResponse getTreeExtension(@QueryParam("hostName") @ApiParam String hostName, @BeanParam ServiceLogFileRequest request) {
+    SearchCriteria searchCriteria = conversionService.convert(request, ServiceLogFileSearchCriteria.class);
+    searchCriteria.addParam("hostName", hostName); // TODO: use host_name instead - needs UI change
+    return serviceLogsManager.getTreeExtension(searchCriteria);
+  }
+
+  @GET
+  @Path("/levels/counts/namevalues")
+  @Produces({"application/json"})
+  @ApiOperation(GET_LOG_LEVELS_COUNT_OD)
+  public NameValueDataListResponse getLogsLevelCount(@BeanParam ServiceLogFileRequest request) {
+    return serviceLogsManager.getLogsLevelCount(conversionService.convert(request, ServiceLogFileSearchCriteria.class));
+  }
+
+  @GET
+  @Path("/histogram")
+  @Produces({"application/json"})
+  @ApiOperation(GET_HISTOGRAM_DATA_OD)
+  public BarGraphDataListResponse getHistogramData(@BeanParam ServiceGraphRequest request) {
+    return serviceLogsManager.getHistogramData(conversionService.convert(request, ServiceGraphSearchCriteria.class));
+  }
+
+  @GET
+  @Path("/request/cancel")
+  @Produces({"application/json"})
+  @ApiOperation(CANCEL_FIND_REQUEST_OD)
+  public String cancelFindRequest(@QueryParam("token") @ApiParam String token) {
+    return serviceLogsManager.cancelFindRequestByDate(token);
+  }
+
+  @GET
+  @Path("/export")
+  @Produces({"application/json"})
+  @ApiOperation(EXPORT_TO_TEXT_FILE_OD)
+  public Response exportToTextFile(@BeanParam ServiceLogExportRequest request) {
+    return serviceLogsManager.exportToTextFile(conversionService.convert(request, ServiceLogExportSearchCriteria.class));
+
+  }
+
+  @GET
+  @Path("/hosts/components")
+  @Produces({"application/json"})
+  @ApiOperation(GET_HOST_LIST_BY_COMPONENT_OD)
+  public NodeListResponse getHostListByComponent(@BeanParam ServiceLogFileRequest request, @QueryParam("componentName") @ApiParam String componentName) {
+    SearchCriteria searchCriteria = conversionService.convert(request, ServiceLogFileSearchCriteria.class);
+    searchCriteria.addParam("componentName", componentName); // TODO: use component_name instead - needs UI change
+    return serviceLogsManager.getHostListByComponent(searchCriteria);
+  }
+
+  @GET
+  @Path("/components/levels/counts")
+  @Produces({"application/json"})
+  @ApiOperation(GET_COMPONENT_LIST_WITH_LEVEL_COUNT_OD)
+  public NodeListResponse getComponentListWithLevelCounts(@BeanParam ServiceLogFileRequest request) {
+    return serviceLogsManager.getComponentListWithLevelCounts(conversionService.convert(request, ServiceLogFileSearchCriteria.class));
+  }
+
+  @GET
+  @Path("/solr/boundarydates")
+  @Produces({"application/json"})
+  @ApiOperation(GET_EXTREME_DATES_FOR_BUNDLE_ID_OD)
+  public NameValueDataListResponse getExtremeDatesForBundelId(@BeanParam ServiceExtremeDatesRequest request) {
+    return serviceLogsManager.getExtremeDatesForBundelId(conversionService.convert(request, ServiceExtremeDatesCriteria.class));
+  }
+
+  @GET
+  @Path("/fields")
+  @Produces({"application/json"})
+  @ApiOperation(GET_SERVICE_LOGS_FIELD_NAME_OD)
+  public String getServiceLogsFieldsName() {
+    return serviceLogsManager.getServiceLogsFieldsName();
+  }
+
+  @GET
+  @Path("/schema/fields")
+  @Produces({"application/json"})
+  @ApiOperation(GET_SERVICE_LOGS_SCHEMA_FIELD_NAME_OD)
+  public String getServiceLogsSchemaFieldsName() {
+    return serviceLogsManager.getServiceLogsSchemaFieldsName();
+  }
+
+  @GET
+  @Path("/anygraph")
+  @Produces({"application/json"})
+  @ApiOperation(GET_ANY_GRAPH_DATA_OD)
+  public BarGraphDataListResponse getAnyGraphData(@BeanParam ServiceAnyGraphRequest request) {
+    return serviceLogsManager.getAnyGraphData(conversionService.convert(request, ServiceAnyGraphSearchCriteria.class));
+  }
+
+  @GET
+  @Path("/truncated")
+  @Produces({"application/json"})
+  @ApiOperation(GET_AFTER_BEFORE_LOGS_OD)
+  public ServiceLogResponse getAfterBeforeLogs(@BeanParam ServiceLogTruncatedRequest request) {
+    return serviceLogsManager.getAfterBeforeLogs(conversionService.convert(request, ServiceLogTruncatedSearchCriteria.class));
+  }
+
+  @GET
+  @Path("/serviceconfig")
+  @Produces({"application/json"})
+  @ApiOperation(GET_HADOOP_SERVICE_CONFIG_JSON_OD)
+  public String getHadoopServiceConfigJSON() {
+    return serviceLogsManager.getHadoopServiceConfigJSON();
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/UserConfigREST.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/UserConfigREST.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/UserConfigREST.java
deleted file mode 100644
index 699dc17..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/UserConfigREST.java
+++ /dev/null
@@ -1,128 +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.rest;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.ws.rs.DELETE;
-import javax.ws.rs.GET;
-import javax.ws.rs.POST;
-import javax.ws.rs.PUT;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.Context;
-
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiImplicitParam;
-import io.swagger.annotations.ApiImplicitParams;
-import io.swagger.annotations.ApiOperation;
-import org.apache.ambari.logsearch.common.LogSearchConstants;
-import org.apache.ambari.logsearch.common.SearchCriteria;
-import org.apache.ambari.logsearch.manager.UserConfigMgr;
-import org.apache.ambari.logsearch.view.VUserConfig;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Scope;
-import org.springframework.stereotype.Component;
-
-import static org.apache.ambari.logsearch.doc.DocConstants.UserConfigDescriptions.*;
-import static org.apache.ambari.logsearch.doc.DocConstants.UserConfigOperationDescriptions.*;
-
-@Api(value = "userconfig", description = "User config operations")
-@Path("userconfig")
-@Component
-@Scope("request")
-public class UserConfigREST {
-
-  @Autowired
-  UserConfigMgr userConfigMgr;
-
-  @POST
-  @Produces({"application/json"})
-  @ApiOperation(SAVE_USER_CONFIG_OD)
-  public String saveUserConfig(VUserConfig vhist) {
-    return userConfigMgr.saveUserConfig(vhist);
-  }
-
-  @PUT
-  @Produces({"application/json"})
-  @ApiOperation(UPDATE_USER_CONFIG_OD)
-  public String updateUserConfig(VUserConfig vhist) {
-    return userConfigMgr.updateUserConfig(vhist);
-  }
-
-  @DELETE
-  @Path("/{id}")
-  @ApiOperation(DELETE_USER_CONFIG_OD)
-  public void deleteUserConfig(@PathParam("id") String id) {
-    userConfigMgr.deleteUserConfig(id);
-  }
-
-  @GET
-  @Produces({"application/json"})
-  @ApiOperation(GET_USER_CONFIG_OD)
-  @ApiImplicitParams(value = {
-    @ApiImplicitParam(value = USER_ID_D, name = "userId", paramType = "query", dataType = "string"),
-    @ApiImplicitParam(value = FILTER_NAME_D, name = "filterName", paramType = "query", dataType = "string"),
-    @ApiImplicitParam(value = ROW_TYPE_D, name = "rowType", paramType = "query", dataType = "string")
-  })
-  public String getUserConfig(@Context HttpServletRequest request) {
-    SearchCriteria searchCriteria = new SearchCriteria(request);
-    searchCriteria.addParam(LogSearchConstants.USER_NAME,
-      request.getParameter("userId"));
-    searchCriteria.addParam(LogSearchConstants.FILTER_NAME,
-      request.getParameter("filterName"));
-    searchCriteria.addParam(LogSearchConstants.ROW_TYPE,
-      request.getParameter("rowType"));
-    return userConfigMgr.getUserConfig(searchCriteria);
-  }
-
-  @GET
-  @Path("/users/filter")
-  @Produces({"application/json"})
-  @ApiOperation(GET_USER_FILTER_OD)
-  public String getUserFilter(@Context HttpServletRequest request) {
-    return userConfigMgr.getUserFilter();
-  }
-
-  @POST
-  @Path("/users/filter")
-  @Produces({"application/json"})
-  @ApiOperation(UPDATE_USER_FILTER_OD)
-  public String createUserFilter(String json) {
-    return userConfigMgr.saveUserFiter(json);
-  }
-
-  @PUT
-  @Path("/users/filter/{id}")
-  @Produces({"application/json"})
-  @ApiOperation(GET_USER_FILTER_BY_ID_OD)
-  public String updateUserFilter(String json) {
-    return userConfigMgr.saveUserFiter(json);
-  }
-
-  @GET
-  @Path("/users/names")
-  @Produces({"application/json"})
-  @ApiOperation(GET_ALL_USER_NAMES_OD)
-  public String getAllUserName() {
-    return userConfigMgr.getAllUserName();
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/UserConfigResource.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/UserConfigResource.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/UserConfigResource.java
new file mode 100644
index 0000000..fd36978
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/UserConfigResource.java
@@ -0,0 +1,116 @@
+/*
+ * 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.rest;
+
+import javax.inject.Inject;
+import javax.ws.rs.BeanParam;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.apache.ambari.logsearch.manager.UserConfigManager;
+import org.apache.ambari.logsearch.model.request.impl.UserConfigRequest;
+import org.apache.ambari.logsearch.query.model.UserConfigSearchCriteria;
+import org.apache.ambari.logsearch.view.VUserConfig;
+import org.springframework.context.annotation.Scope;
+import org.springframework.core.convert.ConversionService;
+import org.springframework.stereotype.Component;
+
+import static org.apache.ambari.logsearch.doc.DocConstants.UserConfigOperationDescriptions.*;
+
+@Api(value = "userconfig", description = "User config operations")
+@Path("userconfig")
+@Component
+@Scope("request")
+public class UserConfigResource {
+
+  @Inject
+  private UserConfigManager userConfigManager;
+
+  @Inject
+  private ConversionService conversionService;
+
+  @POST
+  @Produces({"application/json"})
+  @ApiOperation(SAVE_USER_CONFIG_OD)
+  public String saveUserConfig(VUserConfig vhist) {
+    return userConfigManager.saveUserConfig(vhist);
+  }
+
+  @PUT
+  @Produces({"application/json"})
+  @ApiOperation(UPDATE_USER_CONFIG_OD)
+  public String updateUserConfig(VUserConfig vhist) {
+    return userConfigManager.updateUserConfig(vhist);
+  }
+
+  @DELETE
+  @Path("/{id}")
+  @ApiOperation(DELETE_USER_CONFIG_OD)
+  public void deleteUserConfig(@PathParam("id") String id) {
+    userConfigManager.deleteUserConfig(id);
+  }
+
+  @GET
+  @Produces({"application/json"})
+  @ApiOperation(GET_USER_CONFIG_OD)
+  public String getUserConfig(@BeanParam UserConfigRequest request) {
+    return userConfigManager.getUserConfig(conversionService.convert(request, UserConfigSearchCriteria.class));
+  }
+
+  @GET
+  @Path("/filters")
+  @Produces({"application/json"})
+  @ApiOperation(GET_USER_FILTER_OD)
+  public String getUserFilter() {
+    return userConfigManager.getUserFilter();
+  }
+
+  @POST
+  @Path("/filters")
+  @Produces({"application/json"})
+  @ApiOperation(UPDATE_USER_FILTER_OD)
+  public String createUserFilter(String json) {
+    return userConfigManager.saveUserFiter(json);
+  }
+
+  @PUT
+  @Path("/filters/{id}")
+  @Produces({"application/json"})
+  @ApiOperation(GET_USER_FILTER_BY_ID_OD)
+  public String updateUserFilter(String json) {
+    return userConfigManager.saveUserFiter(json);
+  }
+
+  @GET
+  @Path("/names")
+  @Produces({"application/json"})
+  @ApiOperation(GET_ALL_USER_NAMES_OD)
+  public String getAllUserName() {
+    return userConfigManager.getAllUserName();
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/service/UserService.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/service/UserService.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/service/UserService.java
index 4b2b918..ba4431d 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/service/UserService.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/service/UserService.java
@@ -18,7 +18,6 @@
  */
 package org.apache.ambari.logsearch.service;
 
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.core.userdetails.UserDetailsService;
 import org.springframework.security.core.userdetails.UsernameNotFoundException;
 import org.springframework.stereotype.Service;
@@ -26,12 +25,14 @@ import org.apache.ambari.logsearch.dao.UserDao;
 import org.apache.ambari.logsearch.web.model.User;
 import org.apache.log4j.Logger;
 
+import javax.inject.Inject;
+
 
 @Service
 public class UserService implements UserDetailsService {
   private static final Logger logger = Logger.getLogger(UserService.class);
 
-  @Autowired
+  @Inject
   private UserDao userDao;
 
   @Override

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/model/SolrAuditLogData.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/model/SolrAuditLogData.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/model/SolrAuditLogData.java
new file mode 100644
index 0000000..a3f59f7
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/model/SolrAuditLogData.java
@@ -0,0 +1,339 @@
+/*
+ * 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.model;
+
+import org.apache.ambari.logsearch.model.response.AuditLogData;
+import org.apache.solr.client.solrj.beans.Field;
+
+import java.util.Date;
+import java.util.List;
+
+public class SolrAuditLogData extends SolrCommonLogData implements AuditLogData {
+
+  @Field("logType")
+  private String logType;
+
+  @Field("policy")
+  private String policy;
+
+  @Field("access")
+  private String access;
+
+  @Field("action")
+  private String action;
+
+  @Field("agent")
+  private String agent;
+
+  @Field("agentHost")
+  private String agentHost;
+
+  @Field("cliIP")
+  private String clientIp;
+
+  @Field("cliType")
+  private String clientType;
+
+  @Field("reqContext")
+  private String requestContext;
+
+  @Field("enforcer")
+  private String enforcer;
+
+  @Field("evtTime")
+  private Date eventTime;
+
+  @Field("reason")
+  private String reason;
+
+  @Field("proxyUsers")
+  private List<String> proxyUsers;
+
+  @Field("repo")
+  private String repo;
+
+  @Field("repoType")
+  private String repoType;
+
+  @Field("reqData")
+  private String requestData;
+
+  @Field("reqUser")
+  private String requestUser;
+
+  @Field("resType")
+  private String responseType;
+
+  @Field("resource")
+  private String resource;
+
+  @Field("result")
+  private Integer result;
+
+  @Field("sess")
+  private String session;
+
+  @Field("tags")
+  private List<String> tags;
+
+  @Field("tags_str")
+  private String tagsStr;
+
+  @Field("text")
+  private String text;
+
+  @Override
+  public String getText() {
+    return text;
+  }
+
+  @Override
+  public void setText(String text) {
+    this.text = text;
+  }
+
+  @Override
+  public String getTagsStr() {
+    return tagsStr;
+  }
+
+  @Override
+  public void setTagsStr(String tagsStr) {
+    this.tagsStr = tagsStr;
+  }
+
+  @Override
+  public List<String> getTags() {
+    return tags;
+  }
+
+  @Override
+  public void setTags(List<String> tags) {
+    this.tags = tags;
+  }
+
+  @Override
+  public String getSession() {
+    return session;
+  }
+
+  @Override
+  public void setSession(String session) {
+    this.session = session;
+  }
+
+  @Override
+  public Integer getResult() {
+    return result;
+  }
+
+  @Override
+  public void setResult(Integer result) {
+    this.result = result;
+  }
+
+  @Override
+  public String getResource() {
+    return resource;
+  }
+
+  @Override
+  public void setResource(String resource) {
+    this.resource = resource;
+  }
+
+  @Override
+  public String getResponseType() {
+    return responseType;
+  }
+
+  public void setResponseType(String responseType) {
+    this.responseType = responseType;
+  }
+
+  @Override
+  public String getRequestUser() {
+    return requestUser;
+  }
+
+  @Override
+  public void setRequestUser(String requestUser) {
+    this.requestUser = requestUser;
+  }
+
+  @Override
+  public String getRequestData() {
+    return requestData;
+  }
+
+  @Override
+  public void setRequestData(String requestData) {
+    this.requestData = requestData;
+  }
+
+  @Override
+  public String getRepoType() {
+    return repoType;
+  }
+
+  @Override
+  public void setRepoType(String repoType) {
+    this.repoType = repoType;
+  }
+
+  @Override
+  public String getRepo() {
+    return repo;
+  }
+
+  @Override
+  public void setRepo(String repo) {
+    this.repo = repo;
+  }
+
+  @Override
+  public List<String> getProxyUsers() {
+    return proxyUsers;
+  }
+
+  @Override
+  public void setProxyUsers(List<String> proxyUsers) {
+    this.proxyUsers = proxyUsers;
+  }
+
+  @Override
+  public String getReason() {
+    return reason;
+  }
+
+  @Override
+  public void setReason(String reason) {
+    this.reason = reason;
+  }
+
+  @Override
+  public Date getEventTime() {
+    return eventTime;
+  }
+
+  @Override
+  public void setEventTime(Date eventTime) {
+    this.eventTime = eventTime;
+  }
+
+  @Override
+  public String getEnforcer() {
+    return enforcer;
+  }
+
+  @Override
+  public void setEnforcer(String enforcer) {
+    this.enforcer = enforcer;
+  }
+
+  @Override
+  public String getRequestContext() {
+    return requestContext;
+  }
+
+  @Override
+  public void setRequestContext(String requestContext) {
+    this.requestContext = requestContext;
+  }
+
+  @Override
+  public String getClientType() {
+    return clientType;
+  }
+
+  @Override
+  public void setClientType(String clientType) {
+    this.clientType = clientType;
+  }
+
+  @Override
+  public String getClientIp() {
+    return clientIp;
+  }
+
+  @Override
+  public void setClientIp(String clientIp) {
+    this.clientIp = clientIp;
+  }
+
+  @Override
+  public String getAgent() {
+    return agent;
+  }
+
+  @Override
+  public void setAgent(String agent) {
+    this.agent = agent;
+  }
+
+  @Override
+  public String getAgentHost() {
+    return agentHost;
+  }
+
+  @Override
+  public void setAgentHost(String agentHost) {
+    this.agentHost = agentHost;
+  }
+
+  @Override
+  public String getAction() {
+    return action;
+  }
+
+  @Override
+  public void setAction(String action) {
+    this.action = action;
+  }
+
+  @Override
+  public String getAccess() {
+    return access;
+  }
+
+  @Override
+  public void setAccess(String access) {
+    this.access = access;
+  }
+
+  @Override
+  public String getPolicy() {
+    return policy;
+  }
+
+  @Override
+  public void setPolicy(String policy) {
+    this.policy = policy;
+  }
+
+  @Override
+  public String getLogType() {
+    return logType;
+  }
+
+  @Override
+  public void setLogType(String logType) {
+    this.logType = logType;
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/model/SolrCommonLogData.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/model/SolrCommonLogData.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/model/SolrCommonLogData.java
new file mode 100644
index 0000000..d68279d
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/model/SolrCommonLogData.java
@@ -0,0 +1,248 @@
+/*
+ * 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.model;
+
+import org.apache.ambari.logsearch.model.response.CommonLogData;
+import org.apache.solr.client.solrj.beans.Field;
+
+import java.util.Date;
+
+public class SolrCommonLogData implements CommonLogData {
+
+  @Field("id")
+  private String id;
+
+  @Field("bundle_id")
+  private String bundleId;
+
+  @Field("case_id")
+  private String caseId;
+
+  @Field("cluster")
+  private String cluster;
+
+  @Field("seq_num")
+  private Long seqNum;
+
+  @Field("log_message")
+  private String logMessage;
+
+  @Field("logfile_line_number")
+  private Integer logFileLineNumber;
+
+  @Field("event_dur_m5")
+  private Long eventDurationMs;
+
+  @Field("file")
+  private String file;
+
+  @Field("type")
+  private String type;
+
+  @Field("event_count")
+  private Long eventCount;
+
+  @Field("event_md5")
+  private String eventMd5;
+
+  @Field("message_md5")
+  private String messageMd5;
+
+  @Field("_ttl_")
+  private String ttl;
+
+  @Field("_expire_at_")
+  private Date expire;
+
+  @Field("_version_")
+  private Long version;
+
+  @Field("_router_field_")
+  private Integer routerField;
+
+  @Override
+  public String getId() {
+    return this.id;
+  }
+
+  @Override
+  public void setId(String id) {
+    this.id = id;
+  }
+
+  @Override
+  public String getCaseId() {
+    return this.caseId;
+  }
+
+  @Override
+  public void setCaseId(String caseId) {
+    this.caseId = caseId;
+  }
+
+  @Override
+  public String getLogMessage() {
+    return this.logMessage;
+  }
+
+  @Override
+  public String getBundleId() {
+    return bundleId;
+  }
+
+  @Override
+  public void setBundleId(String bundleId) {
+    this.bundleId = bundleId;
+  }
+
+  @Override
+  public Integer getLogFileLineNumber() {
+    return logFileLineNumber;
+  }
+
+  @Override
+  public void setLogFileLineNumber(Integer logFileLineNumber) {
+    this.logFileLineNumber = logFileLineNumber;
+  }
+
+  @Override
+  public void setLogMessage(String logMessage) {
+    this.logMessage = logMessage;
+  }
+
+  @Override
+  public Long getEventDurationMs() {
+    return eventDurationMs;
+  }
+
+  @Override
+  public void setEventDurationMs(Long eventDurationMs) {
+    this.eventDurationMs = eventDurationMs;
+  }
+
+  @Override
+  public String getFile() {
+    return file;
+  }
+
+  @Override
+  public void setFile(String file) {
+    this.file = file;
+  }
+
+  @Override
+  public Long getSeqNum() {
+    return seqNum;
+  }
+
+  @Override
+  public void setSeqNum(Long seqNum) {
+    this.seqNum = seqNum;
+  }
+
+  @Override
+  public String getMessageMd5() {
+    return messageMd5;
+  }
+
+  @Override
+  public void setMessageMd5(String messageMd5) {
+    this.messageMd5 = messageMd5;
+  }
+
+  @Override
+  public String getEventMd5() {
+    return eventMd5;
+  }
+
+  @Override
+  public void setEventMd5(String eventMd5) {
+    this.eventMd5 = eventMd5;
+  }
+
+  @Override
+  public String getCluster() {
+    return cluster;
+  }
+
+  @Override
+  public void setCluster(String cluster) {
+    this.cluster = cluster;
+  }
+
+  @Override
+  public Long getEventCount() {
+    return eventCount;
+  }
+
+  @Override
+  public void setEventCount(Long eventCount) {
+    this.eventCount = eventCount;
+  }
+
+  @Override
+  public String getTtl() {
+    return this.ttl;
+  }
+
+  @Override
+  public void setTtl(String ttl) {
+    this.ttl = ttl;
+  }
+
+  @Override
+  public Date getExpire() {
+    return expire;
+  }
+
+  @Override
+  public void setExpire(Date expire) {
+    this.expire = expire;
+  }
+
+  @Override
+  public Long getVersion() {
+    return version;
+  }
+
+  @Override
+  public void setVersion(Long version) {
+    this.version = version;
+  }
+
+  @Override
+  public Integer getRouterField() {
+    return this.routerField;
+  }
+
+  @Override
+  public void setRouterField(Integer routerField) {
+    this.routerField = routerField;
+  }
+
+  @Override
+  public String getType() {
+    return type;
+  }
+
+  @Override
+  public void setType(String type) {
+    this.type = type;
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/model/SolrComponentTypeLogData.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/model/SolrComponentTypeLogData.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/model/SolrComponentTypeLogData.java
new file mode 100644
index 0000000..988c878
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/model/SolrComponentTypeLogData.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.solr.model;
+
+import org.apache.ambari.logsearch.model.response.ComponentTypeLogData;
+import org.apache.solr.client.solrj.beans.Field;
+
+public class SolrComponentTypeLogData implements ComponentTypeLogData {
+
+  @Field("type")
+  private String type;
+
+  @Override
+  public String getType() {
+    return this.type;
+  }
+
+  @Override
+  public void setType(String type) {
+    this.type = type;
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/model/SolrHostLogData.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/model/SolrHostLogData.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/model/SolrHostLogData.java
new file mode 100644
index 0000000..215b22c
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/model/SolrHostLogData.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.solr.model;
+
+import org.apache.ambari.logsearch.model.response.HostLogData;
+import org.apache.solr.client.solrj.beans.Field;
+
+public class SolrHostLogData implements HostLogData {
+
+  @Field("host")
+  private String host;
+
+  @Override
+  public String getHost() {
+    return host;
+  }
+
+  @Override
+  public void setHost(String host) {
+    this.host = host;
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/model/SolrServiceLogData.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/model/SolrServiceLogData.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/model/SolrServiceLogData.java
new file mode 100644
index 0000000..890dc7d
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/model/SolrServiceLogData.java
@@ -0,0 +1,118 @@
+/*
+ * 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.model;
+
+import org.apache.ambari.logsearch.model.response.ServiceLogData;
+import org.apache.solr.client.solrj.beans.Field;
+
+import java.util.Date;
+
+public class SolrServiceLogData extends SolrCommonLogData implements ServiceLogData {
+
+  @Field("level")
+  private String level;
+
+  @Field("line_number")
+  private Integer lineNumber;
+
+  @Field("logtime")
+  private Date logTime;
+
+  @Field("type")
+  private String type;
+
+  @Field("ip")
+  private String ip;
+
+  @Field("path")
+  private String path;
+
+  @Field("host")
+  private String host;
+
+  @Override
+  public String getPath() {
+    return path;
+  }
+
+  @Override
+  public void setPath(String path) {
+    this.path = path;
+  }
+
+  @Override
+  public String getIp() {
+    return ip;
+  }
+
+  @Override
+  public void setIp(String ip) {
+    this.ip = ip;
+  }
+
+  @Override
+  public String getType() {
+    return type;
+  }
+
+  @Override
+  public void setType(String type) {
+    this.type = type;
+  }
+
+  @Override
+  public String getHost() {
+    return host;
+  }
+
+  @Override
+  public void setHost(String host) {
+    this.host = host;
+  }
+
+  @Override
+  public Date getLogTime() {
+    return logTime;
+  }
+
+  @Override
+  public void setLogTime(Date logTime) {
+    this.logTime = logTime;
+  }
+
+  @Override
+  public Integer getLineNumber() {
+    return lineNumber;
+  }
+
+  @Override
+  public void setLineNumber(Integer lineNumber) {
+    this.lineNumber = lineNumber;
+  }
+
+  @Override
+  public String getLevel() {
+    return level;
+  }
+
+  @Override
+  public void setLevel(String level) {
+    this.level = level;
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/util/BizUtil.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/util/BizUtil.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/util/BizUtil.java
index bd6cfbb..637a4d7 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/util/BizUtil.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/util/BizUtil.java
@@ -32,10 +32,10 @@ import java.util.Map.Entry;
 import java.util.Set;
 
 import org.apache.ambari.logsearch.common.LogSearchConstants;
-import org.apache.ambari.logsearch.view.VBarDataList;
-import org.apache.ambari.logsearch.view.VBarGraphData;
+import org.apache.ambari.logsearch.model.response.BarGraphData;
+import org.apache.ambari.logsearch.model.response.BarGraphDataListResponse;
+import org.apache.ambari.logsearch.model.response.NameValueData;
 import org.apache.ambari.logsearch.view.VHost;
-import org.apache.ambari.logsearch.view.VNameValue;
 import org.apache.ambari.logsearch.view.VSummary;
 import org.apache.commons.collections.CollectionUtils;
 import org.apache.commons.lang.StringUtils;
@@ -173,41 +173,41 @@ public class BizUtil {
   }
 
   @SuppressWarnings({"unchecked", "rawtypes"})
-  public static VBarDataList buildSummaryForTopCounts(SimpleOrderedMap<Object> jsonFacetResponse,String innerJsonKey,String outerJsonKey) {
+  public static BarGraphDataListResponse buildSummaryForTopCounts(SimpleOrderedMap<Object> jsonFacetResponse, String innerJsonKey, String outerJsonKey) {
 
-    VBarDataList vBarDataList = new VBarDataList();
+    BarGraphDataListResponse barGraphDataListResponse = new BarGraphDataListResponse();
 
-    Collection<VBarGraphData> dataList = new ArrayList<VBarGraphData>();
+    Collection<BarGraphData> dataList = new ArrayList<>();
     if (jsonFacetResponse == null) {
       logger.info("Solr document list in null");
-      return vBarDataList;
+      return barGraphDataListResponse;
     }
     List<Object> userList = jsonFacetResponse.getAll(outerJsonKey);
     if (userList.isEmpty()) {
-      return vBarDataList;
+      return barGraphDataListResponse;
     }
     SimpleOrderedMap<Map<String, Object>> userMap = (SimpleOrderedMap<Map<String, Object>>) userList.get(0);
     if (userMap == null) {
       logger.info("No top user details found");
-      return vBarDataList;
+      return barGraphDataListResponse;
     }
     List<SimpleOrderedMap> userUsageList = (List<SimpleOrderedMap>) userMap.get("buckets");
     if(userUsageList == null){
-      return vBarDataList;
+      return barGraphDataListResponse;
     }
     for (SimpleOrderedMap usageMap : userUsageList) {
       if (usageMap != null) {
-        VBarGraphData vBarGraphData = new VBarGraphData();
+        BarGraphData barGraphData = new BarGraphData();
         String userName = (String) usageMap.get("val");
         if (!StringUtils.isBlank(userName)) {
-          vBarGraphData.setName(userName);
+          barGraphData.setName(userName);
         }
         SimpleOrderedMap repoMap = (SimpleOrderedMap) usageMap.get(innerJsonKey);
-        List<VNameValue> componetCountList = new ArrayList<VNameValue>();
-        List<SimpleOrderedMap> repoUsageList = (List<SimpleOrderedMap>) repoMap.get("buckets");
+        List<NameValueData> componetCountList = new ArrayList<NameValueData>();
         if (repoMap != null) {
+          List<SimpleOrderedMap> repoUsageList = (List<SimpleOrderedMap>) repoMap.get("buckets");
           for (SimpleOrderedMap repoUsageMap : repoUsageList) {
-            VNameValue componetCount = new VNameValue();
+            NameValueData componetCount = new NameValueData();
             if (repoUsageMap.get("val") != null) {
               componetCount.setName(repoUsageMap.get("val").toString());
             }
@@ -221,19 +221,19 @@ public class BizUtil {
             componetCount.setValue(eventCount);
             componetCountList.add(componetCount);
           }
-          vBarGraphData.setDataCounts(componetCountList);
-          dataList.add(vBarGraphData);
+          barGraphData.setDataCount(componetCountList);
+          dataList.add(barGraphData);
         }
       }}
-    vBarDataList.setGraphData(dataList);
+    barGraphDataListResponse.setGraphData(dataList);
     logger.info("getting graph data");
 
-    return vBarDataList;
+    return barGraphDataListResponse;
   }
   
   public static HashMap<String, String> sortHashMapByValues(HashMap<String, String> passedMap) {
     if (passedMap == null ) {
-      return passedMap;
+      return null;
     }
     HashMap<String, String> sortedMap = new LinkedHashMap<String, String>();
     List<String> mapValues = new ArrayList<String>(passedMap.values());

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VBarDataList.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VBarDataList.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VBarDataList.java
deleted file mode 100644
index b13946c..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VBarDataList.java
+++ /dev/null
@@ -1,46 +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.view;
-
-import java.util.ArrayList;
-import java.util.Collection;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlRootElement;
-
-@XmlRootElement
-@XmlAccessorType(XmlAccessType.FIELD)
-public class VBarDataList {
-  protected  Collection<VBarGraphData> graphData;
-
-  public VBarDataList() {
-    graphData = new ArrayList<VBarGraphData>();
-  }
-
-  public Collection<VBarGraphData> getGraphData() {
-    return graphData;
-  }
-
-  public void setGraphData(Collection<VBarGraphData> histogramData) {
-    this.graphData = histogramData;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VBarGraphData.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VBarGraphData.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VBarGraphData.java
deleted file mode 100644
index 50fe47e..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VBarGraphData.java
+++ /dev/null
@@ -1,50 +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.view;
-
-import java.util.Collection;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlRootElement;
-
-@XmlRootElement
-@XmlAccessorType(XmlAccessType.FIELD)
-public class VBarGraphData {
-  protected Collection<VNameValue> dataCount = null;
-  protected String name;
-
-  public String getName() {
-    return name;
-  }
-
-  public void setName(String level) {
-    this.name = level;
-  }
-
-  public Collection<VNameValue> getDataCount() {
-    return dataCount;
-  }
-
-  public void setDataCounts(Collection<VNameValue> dateValueCounts) {
-    this.dataCount = dateValueCounts;
-  }
-
-}


[46/58] [abbrv] ambari git commit: AMBARI-18372. Audit logs should not be filtered by Log Feeder (Miklos Gergely via oleewere)

Posted by ol...@apache.org.
AMBARI-18372. Audit logs should not be filtered by Log Feeder (Miklos Gergely via oleewere)

Change-Id: I636b5619e365e9a9f1271a0da4df545d459900cf


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

Branch: refs/heads/branch-2.5
Commit: 0fac45170b9d9e4d3d6e6c1edf7b8fa52fba2c77
Parents: a941d1e
Author: Miklos Gergely <mg...@hortonworks.com>
Authored: Mon Oct 3 16:13:42 2016 +0200
Committer: oleewere <ol...@gmail.com>
Committed: Sat Nov 5 14:46:46 2016 +0100

----------------------------------------------------------------------
 .../logfeeder/logconfig/FilterLogData.java      | 10 ++--
 .../ambari/logfeeder/output/OutputManager.java  |  4 +-
 .../logconfig/LogConfigHandlerTest.java         | 51 ++++++++++++++++----
 .../logfeeder/output/OutputManagerTest.java     |  2 +
 4 files changed, 53 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/0fac4517/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/logconfig/FilterLogData.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/logconfig/FilterLogData.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/logconfig/FilterLogData.java
index 801a289..a05a916 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/logconfig/FilterLogData.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/logconfig/FilterLogData.java
@@ -23,6 +23,7 @@ import java.util.List;
 import java.util.Map;
 
 import org.apache.ambari.logfeeder.common.LogFeederConstants;
+import org.apache.ambari.logfeeder.input.InputMarker;
 import org.apache.ambari.logfeeder.util.LogFeederUtil;
 import org.apache.commons.collections.CollectionUtils;
 import org.apache.commons.collections.MapUtils;
@@ -39,15 +40,18 @@ public enum FilterLogData {
   
   private static final boolean DEFAULT_VALUE = true;
 
-  public boolean isAllowed(String jsonBlock) {
+  public boolean isAllowed(String jsonBlock, InputMarker inputMarker) {
     if (StringUtils.isEmpty(jsonBlock)) {
       return DEFAULT_VALUE;
     }
     Map<String, Object> jsonObj = LogFeederUtil.toJSONObject(jsonBlock);
-    return isAllowed(jsonObj);
+    return isAllowed(jsonObj, inputMarker);
   }
 
-  public boolean isAllowed(Map<String, Object> jsonObj) {
+  public boolean isAllowed(Map<String, Object> jsonObj, InputMarker inputMarker) {
+    if ("audit".equals(inputMarker.input.getConfigs().get(LogFeederConstants.ROW_TYPE)))
+      return true;
+    
     boolean isAllowed = applyFilter(jsonObj);
     if (!isAllowed) {
       LOG.trace("Filter block the content :" + LogFeederUtil.getGson().toJson(jsonObj));

http://git-wip-us.apache.org/repos/asf/ambari/blob/0fac4517/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/OutputManager.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/OutputManager.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/OutputManager.java
index 2c81c19..86b5c57 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/OutputManager.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/OutputManager.java
@@ -139,7 +139,7 @@ public class OutputManager {
       }
     }
     
-    if (FilterLogData.INSTANCE.isAllowed(jsonObj)) {
+    if (FilterLogData.INSTANCE.isAllowed(jsonObj, inputMarker)) {
       for (Output output : input.getOutputList()) {
         try {
           output.write(jsonObj, inputMarker);
@@ -171,7 +171,7 @@ public class OutputManager {
   }
 
   public void write(String jsonBlock, InputMarker inputMarker) {
-    if (FilterLogData.INSTANCE.isAllowed(jsonBlock)) {
+    if (FilterLogData.INSTANCE.isAllowed(jsonBlock, inputMarker)) {
       for (Output output : inputMarker.input.getOutputList()) {
         try {
           output.write(jsonBlock, inputMarker);

http://git-wip-us.apache.org/repos/asf/ambari/blob/0fac4517/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/logconfig/LogConfigHandlerTest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/logconfig/LogConfigHandlerTest.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/logconfig/LogConfigHandlerTest.java
index 02ffd47..266108f 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/logconfig/LogConfigHandlerTest.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/logconfig/LogConfigHandlerTest.java
@@ -26,6 +26,9 @@ import java.util.Map;
 import static org.easymock.EasyMock.*;
 import static org.junit.Assert.*;
 
+import org.apache.ambari.logfeeder.common.LogFeederConstants;
+import org.apache.ambari.logfeeder.input.Input;
+import org.apache.ambari.logfeeder.input.InputMarker;
 import org.apache.ambari.logfeeder.util.LogFeederUtil;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
@@ -35,6 +38,24 @@ public class LogConfigHandlerTest {
   
   private static LogConfigFetcher mockFetcher;
   
+  private static InputMarker inputMarkerAudit;
+  private static InputMarker inputMarkerService;
+  static {
+    Map<String, Object> auditMap = new HashMap<String, Object>();
+    auditMap.put(LogFeederConstants.ROW_TYPE, "audit");
+    Input auditInput = strictMock(Input.class);
+    expect(auditInput.getConfigs()).andReturn(auditMap).anyTimes();
+    inputMarkerAudit = new InputMarker(auditInput, null, 0);
+    
+    Map<String, Object> serviceMap = new HashMap<String, Object>();
+    serviceMap.put(LogFeederConstants.ROW_TYPE, "service");
+    Input serviceInput = strictMock(Input.class);
+    expect(serviceInput.getConfigs()).andReturn(serviceMap).anyTimes();
+    inputMarkerService = new InputMarker(serviceInput, null, 0);
+    
+    replay(auditInput, serviceInput);
+  }
+  
   private static final Map<String, Object> CONFIG_MAP = new HashMap<>();
   static {
     CONFIG_MAP.put("jsons",
@@ -74,40 +95,52 @@ public class LogConfigHandlerTest {
   }
   
   @Test
+  public void testLogConfigHandler_auditAllowed() throws Exception {
+    assertTrue(FilterLogData.INSTANCE.isAllowed("{'host':'host1', 'type':'configured_log_file', 'level':'DEBUG'}",
+        inputMarkerAudit));
+  }
+  
+  @Test
   public void testLogConfigHandler_emptyDataAllowed() throws Exception {
-    assertTrue(FilterLogData.INSTANCE.isAllowed((String)null));
-    assertTrue(FilterLogData.INSTANCE.isAllowed(""));
-    assertTrue(FilterLogData.INSTANCE.isAllowed(Collections.<String, Object> emptyMap()));
+    assertTrue(FilterLogData.INSTANCE.isAllowed((String)null, inputMarkerService));
+    assertTrue(FilterLogData.INSTANCE.isAllowed("", inputMarkerService));
+    assertTrue(FilterLogData.INSTANCE.isAllowed(Collections.<String, Object> emptyMap(), inputMarkerService));
   }
   
   @Test
   public void testLogConfigHandler_notConfiguredLogAllowed() throws Exception {
-    assertTrue(FilterLogData.INSTANCE.isAllowed("{'host':'host1', 'type':'not_configured_log_file', 'level':'INFO'}"));
+    assertTrue(FilterLogData.INSTANCE.isAllowed("{'host':'host1', 'type':'not_configured_log_file', 'level':'INFO'}",
+        inputMarkerService));
   }
   
   @Test
   public void testLogConfigHandler_configuredDataAllow() throws Exception {
-    assertTrue(FilterLogData.INSTANCE.isAllowed("{'host':'host1', 'type':'configured_log_file', 'level':'INFO'}"));
+    assertTrue(FilterLogData.INSTANCE.isAllowed("{'host':'host1', 'type':'configured_log_file', 'level':'INFO'}",
+        inputMarkerService));
   }
   
   @Test
   public void testLogConfigHandler_configuredDataDontAllow() throws Exception {
-    assertFalse(FilterLogData.INSTANCE.isAllowed("{'host':'host1', 'type':'configured_log_file', 'level':'DEBUG'}"));
+    assertFalse(FilterLogData.INSTANCE.isAllowed("{'host':'host1', 'type':'configured_log_file', 'level':'DEBUG'}",
+        inputMarkerService));
   }
   
   @Test
   public void testLogConfigHandler_overridenConfiguredData() throws Exception {
-    assertTrue(FilterLogData.INSTANCE.isAllowed("{'host':'host1', 'type':'configured_log_file2', 'level':'DEBUG'}"));
+    assertTrue(FilterLogData.INSTANCE.isAllowed("{'host':'host1', 'type':'configured_log_file2', 'level':'DEBUG'}",
+        inputMarkerService));
   }
   
   @Test
   public void testLogConfigHandler_overridenConfiguredDataDifferentHost() throws Exception {
-    assertFalse(FilterLogData.INSTANCE.isAllowed("{'host':'host2', 'type':'configured_log_file2', 'level':'DEBUG'}"));
+    assertFalse(FilterLogData.INSTANCE.isAllowed("{'host':'host2', 'type':'configured_log_file2', 'level':'DEBUG'}",
+        inputMarkerService));
   }
   
   @Test
   public void testLogConfigHandler_overridenConfiguredDataExpired() throws Exception {
-    assertFalse(FilterLogData.INSTANCE.isAllowed("{'host':'host1', 'type':'configured_log_file3', 'level':'DEBUG'}"));
+    assertFalse(FilterLogData.INSTANCE.isAllowed("{'host':'host1', 'type':'configured_log_file3', 'level':'DEBUG'}",
+        inputMarkerService));
   }
   
   @AfterClass

http://git-wip-us.apache.org/repos/asf/ambari/blob/0fac4517/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/output/OutputManagerTest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/output/OutputManagerTest.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/output/OutputManagerTest.java
index e103346..a080fa8 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/output/OutputManagerTest.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/output/OutputManagerTest.java
@@ -102,6 +102,7 @@ public class OutputManagerTest {
     expect(mockInput.getContextFields()).andReturn(Collections.<String, String> emptyMap());
     expect(mockInput.isUseEventMD5()).andReturn(false);
     expect(mockInput.isGenEventMD5()).andReturn(false);
+    expect(mockInput.getConfigs()).andReturn(Collections.<String, Object> emptyMap());
     expect(mockInput.getOutputList()).andReturn(Arrays.asList(output1, output2, output3));
     
     output1.write(jsonObj, inputMarker); expectLastCall();
@@ -131,6 +132,7 @@ public class OutputManagerTest {
     Output output2 = strictMock(Output.class);
     Output output3 = strictMock(Output.class);
     
+    expect(mockInput.getConfigs()).andReturn(Collections.<String, Object> emptyMap());
     expect(mockInput.getOutputList()).andReturn(Arrays.asList(output1, output2, output3));
     
     output1.write(jsonString, inputMarker); expectLastCall();


[26/58] [abbrv] ambari git commit: AMBARI-18246. Clean up Log Feeder (Miklos Gergely via oleewere)

Posted by ol...@apache.org.
http://git-wip-us.apache.org/repos/asf/ambari/blob/1b07a6dd/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/input/Input.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/input/Input.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/input/Input.java
index 5feb9c4..e13d9bd 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/input/Input.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/input/Input.java
@@ -21,7 +21,6 @@ package org.apache.ambari.logfeeder.input;
 
 import java.io.File;
 import java.util.ArrayList;
-import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -29,88 +28,138 @@ import java.util.Map;
 import org.apache.ambari.logfeeder.common.ConfigBlock;
 import org.apache.ambari.logfeeder.common.LogfeederException;
 import org.apache.ambari.logfeeder.filter.Filter;
-import org.apache.ambari.logfeeder.metrics.MetricCount;
+import org.apache.ambari.logfeeder.metrics.MetricData;
 import org.apache.ambari.logfeeder.output.Output;
-import org.apache.ambari.logfeeder.output.OutputMgr;
+import org.apache.ambari.logfeeder.output.OutputManager;
 import org.apache.log4j.Logger;
 
 public abstract class Input extends ConfigBlock implements Runnable {
-  static private Logger logger = Logger.getLogger(Input.class);
-
-  protected OutputMgr outputMgr;
-  protected InputMgr inputMgr;
+  private static final Logger LOG = Logger.getLogger(Input.class);
 
+  private static final boolean DEFAULT_TAIL = true;
+  private static final boolean DEFAULT_USE_EVENT_MD5 = false;
+  private static final boolean DEFAULT_GEN_EVENT_MD5 = true;
+  
+  protected InputManager inputManager;
+  protected OutputManager outputManager;
   private List<Output> outputList = new ArrayList<Output>();
 
-  private Filter firstFilter = null;
   private Thread thread;
-  private boolean isClosed = false;
-  protected String filePath = null;
-  private String type = null;
+  private String type;
+  protected String filePath;
+  private Filter firstFilter;
+  private boolean isClosed;
 
-  protected boolean tail = true;
-  private boolean useEventMD5 = false;
-  private boolean genEventMD5 = true;
+  protected boolean tail;
+  private boolean useEventMD5;
+  private boolean genEventMD5;
 
-  protected MetricCount readBytesMetric = new MetricCount();
+  protected MetricData readBytesMetric = new MetricData(getReadBytesMetricName(), false);
+  protected String getReadBytesMetricName() {
+    return null;
+  }
+  
+  @Override
+  public void loadConfig(Map<String, Object> map) {
+    super.loadConfig(map);
+    String typeValue = getStringValue("type");
+    if (typeValue != null) {
+      // Explicitly add type and value to field list
+      contextFields.put("type", typeValue);
+      @SuppressWarnings("unchecked")
+      Map<String, Object> addFields = (Map<String, Object>) map.get("add_fields");
+      if (addFields == null) {
+        addFields = new HashMap<String, Object>();
+        map.put("add_fields", addFields);
+      }
+      addFields.put("type", typeValue);
+    }
+  }
 
-  /**
-   * This method will be called from the thread spawned for the output. This
-   * method should only exit after all data are read from the source or the
-   * process is exiting
-   */
-  abstract void start() throws Exception;
+  public void setType(String type) {
+    this.type = type;
+  }
+
+  public void setInputManager(InputManager inputManager) {
+    this.inputManager = inputManager;
+  }
+
+  public void setOutputManager(OutputManager outputManager) {
+    this.outputManager = outputManager;
+  }
+
+  public void addFilter(Filter filter) {
+    if (firstFilter == null) {
+      firstFilter = filter;
+    } else {
+      Filter f = firstFilter;
+      while (f.getNextFilter() != null) {
+        f = f.getNextFilter();
+      }
+      f.setNextFilter(filter);
+    }
+  }
+
+  public void addOutput(Output output) {
+    outputList.add(output);
+  }
 
   @Override
   public void init() throws Exception {
     super.init();
-    tail = getBooleanValue("tail", tail);
-    useEventMD5 = getBooleanValue("use_event_md5_as_id", useEventMD5);
-    genEventMD5 = getBooleanValue("gen_event_md5", genEventMD5);
+    tail = getBooleanValue("tail", DEFAULT_TAIL);
+    useEventMD5 = getBooleanValue("use_event_md5_as_id", DEFAULT_USE_EVENT_MD5);
+    genEventMD5 = getBooleanValue("gen_event_md5", DEFAULT_GEN_EVENT_MD5);
 
     if (firstFilter != null) {
       firstFilter.init();
     }
   }
 
-  @Override
-  public String getNameForThread() {
-    if (filePath != null) {
-      try {
-        return (type + "=" + (new File(filePath)).getName());
-      } catch (Throwable ex) {
-        logger.warn("Couldn't get basename for filePath=" + filePath,
-          ex);
-      }
+  boolean monitor() {
+    if (isReady()) {
+      LOG.info("Starting thread. " + getShortDescription());
+      thread = new Thread(this, getNameForThread());
+      thread.start();
+      return true;
+    } else {
+      return false;
     }
-    return super.getNameForThread() + ":" + type;
   }
 
+  public abstract boolean isReady();
+
   @Override
   public void run() {
     try {
-      logger.info("Started to monitor. " + getShortDescription());
+      LOG.info("Started to monitor. " + getShortDescription());
       start();
     } catch (Exception e) {
-      logger.error("Error writing to output.", e);
+      LOG.error("Error writing to output.", e);
     }
-    logger.info("Exiting thread. " + getShortDescription());
+    LOG.info("Exiting thread. " + getShortDescription());
   }
 
+  /**
+   * This method will be called from the thread spawned for the output. This
+   * method should only exit after all data are read from the source or the
+   * process is exiting
+   */
+  abstract void start() throws Exception;
+
   protected void outputLine(String line, InputMarker marker) {
-    statMetric.count++;
-    readBytesMetric.count += (line.length());
+    statMetric.value++;
+    readBytesMetric.value += (line.length());
 
     if (firstFilter != null) {
       try {
         firstFilter.apply(line, marker);
       } catch (LogfeederException e) {
-        logger.error(e.getLocalizedMessage(),e);
+        LOG.error(e.getLocalizedMessage(), e);
       }
     } else {
-      // TODO: For now, let's make filter mandatory, so that no one
-      // accidently forgets to write filter
-      // outputMgr.write(line, this);
+      // TODO: For now, let's make filter mandatory, so that no one accidently forgets to write filter
+      // outputManager.write(line, this);
     }
   }
 
@@ -120,60 +169,10 @@ public abstract class Input extends ConfigBlock implements Runnable {
     }
   }
 
-  public boolean monitor() {
-    if (isReady()) {
-      logger.info("Starting thread. " + getShortDescription());
-      thread = new Thread(this, getNameForThread());
-      thread.start();
-      return true;
-    } else {
-      return false;
-    }
-  }
-
-  public void checkIn(InputMarker inputMarker) {
-    // Default implementation is to ignore.
-  }
-
-  /**
-   * This is generally used by final checkin
-   */
-  public void checkIn() {
-  }
-
-  public boolean isReady() {
-    return true;
-  }
-
-  public boolean isTail() {
-    return tail;
-  }
-
-  public void setTail(boolean tail) {
-    this.tail = tail;
-  }
-
-  public boolean isUseEventMD5() {
-    return useEventMD5;
-  }
-
-  public void setUseEventMD5(boolean useEventMD5) {
-    this.useEventMD5 = useEventMD5;
-  }
-
-  public boolean isGenEventMD5() {
-    return genEventMD5;
-  }
-
-  public void setGenEventMD5(boolean genEventMD5) {
-    this.genEventMD5 = genEventMD5;
-  }
-
   @Override
   public void setDrain(boolean drain) {
-    logger.info("Request to drain. " + getShortDescription());
+    LOG.info("Request to drain. " + getShortDescription());
     super.setDrain(drain);
-    ;
     try {
       thread.interrupt();
     } catch (Throwable t) {
@@ -181,38 +180,36 @@ public abstract class Input extends ConfigBlock implements Runnable {
     }
   }
 
-  public Filter getFirstFilter() {
-    return firstFilter;
-  }
-
-  public void setFirstFilter(Filter filter) {
-    firstFilter = filter;
+  public void addMetricsContainers(List<MetricData> metricsList) {
+    super.addMetricsContainers(metricsList);
+    if (firstFilter != null) {
+      firstFilter.addMetricsContainers(metricsList);
+    }
+    metricsList.add(readBytesMetric);
   }
 
-  public void setInputMgr(InputMgr inputMgr) {
-    this.inputMgr = inputMgr;
-  }
+  @Override
+  public void logStat() {
+    super.logStat();
+    logStatForMetric(readBytesMetric, "Stat: Bytes Read");
 
-  public void setOutputMgr(OutputMgr outputMgr) {
-    this.outputMgr = outputMgr;
+    if (firstFilter != null) {
+      firstFilter.logStat();
+    }
   }
 
-  public String getFilePath() {
-    return filePath;
-  }
+  public abstract void checkIn(InputMarker inputMarker);
 
-  public void setFilePath(String filePath) {
-    this.filePath = filePath;
-  }
+  public abstract void lastCheckIn();
 
   public void close() {
-    logger.info("Close called. " + getShortDescription());
+    LOG.info("Close called. " + getShortDescription());
 
     try {
       if (firstFilter != null) {
         firstFilter.close();
       } else {
-        outputMgr.close();
+        outputManager.close();
       }
     } catch (Throwable t) {
       // Ignore
@@ -220,86 +217,60 @@ public abstract class Input extends ConfigBlock implements Runnable {
     isClosed = true;
   }
 
-  public void setClosed(boolean isClosed) {
-    this.isClosed = isClosed;
-  }
-
-  public boolean isClosed() {
-    return isClosed;
-  }
-
-  @Override
-  public void loadConfig(Map<String, Object> map) {
-    super.loadConfig(map);
-    String typeValue = getStringValue("type");
-    if (typeValue != null) {
-      // Explicitly add type and value to field list
-      contextFields.put("type", typeValue);
-      @SuppressWarnings("unchecked")
-      Map<String, Object> addFields = (Map<String, Object>) map
-        .get("add_fields");
-      if (addFields == null) {
-        addFields = new HashMap<String, Object>();
-        map.put("add_fields", addFields);
-      }
-      addFields.put("type", typeValue);
-    }
+  public boolean isTail() {
+    return tail;
   }
 
-  @Override
-  public String getShortDescription() {
-    return null;
+  public boolean isUseEventMD5() {
+    return useEventMD5;
   }
 
-  @Override
-  public void logStat() {
-    super.logStat();
-    logStatForMetric(readBytesMetric, "Stat: Bytes Read");
-
-    if (firstFilter != null) {
-      firstFilter.logStat();
-    }
+  public boolean isGenEventMD5() {
+    return genEventMD5;
   }
 
-  @Override
-  public String toString() {
-    return getShortDescription();
+  public Filter getFirstFilter() {
+    return firstFilter;
   }
 
-  public void rollOver() {
-    // Only some inputs support it. E.g. InputFile
+  public String getFilePath() {
+    return filePath;
   }
 
-  public String getType() {
-    return type;
+  public void setFilePath(String filePath) {
+    this.filePath = filePath;
   }
 
-  public void setType(String type) {
-    this.type = type;
+  public void setClosed(boolean isClosed) {
+    this.isClosed = isClosed;
   }
 
-  public Date getEventTime() {
-    return null;
+  public boolean isClosed() {
+    return isClosed;
   }
 
   public List<Output> getOutputList() {
     return outputList;
   }
-
-  public void addOutput(Output output) {
-    outputList.add(output);
-  }
-
-  public void addMetricsContainers(List<MetricCount> metricsList) {
-    super.addMetricsContainers(metricsList);
-    if (firstFilter != null) {
-      firstFilter.addMetricsContainers(metricsList);
-    }
-    metricsList.add(readBytesMetric);
-  }
   
   public Thread getThread(){
     return thread;
   }
 
+  @Override
+  public String getNameForThread() {
+    if (filePath != null) {
+      try {
+        return (type + "=" + (new File(filePath)).getName());
+      } catch (Throwable ex) {
+        LOG.warn("Couldn't get basename for filePath=" + filePath, ex);
+      }
+    }
+    return super.getNameForThread() + ":" + type;
+  }
+
+  @Override
+  public String toString() {
+    return getShortDescription();
+  }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/1b07a6dd/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/input/InputFile.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/input/InputFile.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/input/InputFile.java
index c9f5ded..3737839 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/input/InputFile.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/input/InputFile.java
@@ -19,528 +19,99 @@
 package org.apache.ambari.logfeeder.input;
 
 import java.io.BufferedReader;
-import java.io.EOFException;
 import java.io.File;
 import java.io.FileFilter;
 import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.RandomAccessFile;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import java.nio.file.attribute.BasicFileAttributes;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Map;
 
 import org.apache.ambari.logfeeder.input.reader.LogsearchReaderFactory;
-import org.apache.ambari.logfeeder.util.LogFeederUtil;
+import org.apache.ambari.logfeeder.util.FileUtil;
 import org.apache.commons.io.filefilter.WildcardFileFilter;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.log4j.Level;
-import org.apache.log4j.Logger;
+import org.apache.commons.lang3.ArrayUtils;
 import org.apache.solr.common.util.Base64;
 
-public class InputFile extends Input {
-  private static final Logger logger = Logger.getLogger(InputFile.class);
-
-  private String logPath = null;
-  private boolean isStartFromBegining = true;
-
-  private boolean isReady = false;
-  private File[] logPathFiles = null;
-  private Object fileKey = null;
-  private String base64FileKey = null;
-
-  private boolean isRolledOver = false;
-  private boolean addWildCard = false;
-
-  private long lastCheckPointTimeMS = 0;
-  private int checkPointIntervalMS = 5 * 1000; // 5 seconds
-  private RandomAccessFile checkPointWriter = null;
-  private Map<String, Object> jsonCheckPoint = null;
-
-  private File checkPointFile = null;
-
-  private InputMarker lastCheckPointInputMarker = null;
-
-  private String checkPointExtension = ".cp";
-
-  @Override
-  public void init() throws Exception {
-    logger.info("init() called");
-    statMetric.metricsName = "input.files.read_lines";
-    readBytesMetric.metricsName = "input.files.read_bytes";
-    checkPointExtension = LogFeederUtil.getStringProperty(
-      "logfeeder.checkpoint.extension", checkPointExtension);
-
-    // Let's close the file and set it to true after we start monitoring it
-    setClosed(true);
-    logPath = getStringValue("path");
-    tail = getBooleanValue("tail", tail);
-    addWildCard = getBooleanValue("add_wild_card", addWildCard);
-    checkPointIntervalMS = getIntValue("checkpoint.interval.ms",
-      checkPointIntervalMS);
-
-    if (logPath == null || logPath.isEmpty()) {
-      logger.error("path is empty for file input. "
-        + getShortDescription());
-      return;
-    }
-
-    String startPosition = getStringValue("start_position");
-    if (StringUtils.isEmpty(startPosition)
-      || startPosition.equalsIgnoreCase("beginning")
-      || startPosition.equalsIgnoreCase("begining")) {
-      isStartFromBegining = true;
-    }
-
-    if (!tail) {
-      // start position end doesn't apply if we are not tailing
-      isStartFromBegining = true;
-    }
-
-    setFilePath(logPath);
-    boolean isFileReady = isReady();
-
-    logger.info("File to monitor " + logPath + ", tail=" + tail
-      + ", addWildCard=" + addWildCard + ", isReady=" + isFileReady);
-
-    super.init();
-  }
+public class InputFile extends AbstractInputFile {
 
   @Override
   public boolean isReady() {
     if (!isReady) {
       // Let's try to check whether the file is available
-      logPathFiles = getActualFiles(logPath);
-      if (logPathFiles != null && logPathFiles.length > 0
-        && logPathFiles[0].isFile()) {
-
-        if (isTail() && logPathFiles.length > 1) {
-          logger.warn("Found multiple files (" + logPathFiles.length
-            + ") for the file filter " + filePath
-            + ". Will use only the first one. Using "
-            + logPathFiles[0].getAbsolutePath());
+      logFiles = getActualFiles(logPath);
+      if (!ArrayUtils.isEmpty(logFiles) && logFiles[0].isFile()) {
+        if (tail && logFiles.length > 1) {
+          LOG.warn("Found multiple files (" + logFiles.length + ") for the file filter " + filePath +
+              ". Will use only the first one. Using " + logFiles[0].getAbsolutePath());
         }
-        logger.info("File filter " + filePath + " expanded to "
-          + logPathFiles[0].getAbsolutePath());
+        LOG.info("File filter " + filePath + " expanded to " + logFiles[0].getAbsolutePath());
         isReady = true;
       } else {
-        logger.debug(logPath + " file doesn't exist. Ignoring for now");
+        LOG.debug(logPath + " file doesn't exist. Ignoring for now");
       }
     }
     return isReady;
   }
 
   private File[] getActualFiles(String searchPath) {
-    if (addWildCard) {
-      if (!searchPath.endsWith("*")) {
-        searchPath = searchPath + "*";
-      }
-    }
-    File checkFile = new File(searchPath);
-    if (checkFile.isFile()) {
-      return new File[]{checkFile};
+    File searchFile = new File(searchPath);
+    if (searchFile.isFile()) {
+      return new File[]{searchFile};
+    } else {
+      FileFilter fileFilter = new WildcardFileFilter(searchFile.getName());
+      return searchFile.getParentFile().listFiles(fileFilter);
     }
-    // Let's do wild card search
-    // First check current folder
-    File checkFiles[] = findFileForWildCard(searchPath, new File("."));
-    if (checkFiles == null || checkFiles.length == 0) {
-      // Let's check from the parent folder
-      File parentDir = (new File(searchPath)).getParentFile();
-      if (parentDir != null) {
-        String wildCard = (new File(searchPath)).getName();
-        checkFiles = findFileForWildCard(wildCard, parentDir);
-      }
-    }
-    return checkFiles;
-  }
-
-  private File[] findFileForWildCard(String searchPath, File dir) {
-    logger.debug("findFileForWildCard(). filePath=" + searchPath + ", dir="
-      + dir + ", dir.fullpath=" + dir.getAbsolutePath());
-    FileFilter fileFilter = new WildcardFileFilter(searchPath);
-    return dir.listFiles(fileFilter);
-  }
-
-  @Override
-  synchronized public void checkIn(InputMarker inputMarker) {
-    super.checkIn(inputMarker);
-    if (checkPointWriter != null) {
-      try {
-        int lineNumber = LogFeederUtil.objectToInt(
-          jsonCheckPoint.get("line_number"), 0, "line_number");
-        if (lineNumber > inputMarker.lineNumber) {
-          // Already wrote higher line number for this input
-          return;
-        }
-        // If interval is greater than last checkPoint time, then write
-        long currMS = System.currentTimeMillis();
-        if (!isClosed()
-          && (currMS - lastCheckPointTimeMS) < checkPointIntervalMS) {
-          // Let's save this one so we can update the check point file
-          // on flush
-          lastCheckPointInputMarker = inputMarker;
-          return;
-        }
-        lastCheckPointTimeMS = currMS;
-
-        jsonCheckPoint.put("line_number", ""
-          + new Integer(inputMarker.lineNumber));
-        jsonCheckPoint.put("last_write_time_ms", "" + new Long(currMS));
-        jsonCheckPoint.put("last_write_time_date", new Date());
-
-        String jsonStr = LogFeederUtil.getGson().toJson(jsonCheckPoint);
-
-        // Let's rewind
-        checkPointWriter.seek(0);
-        checkPointWriter.writeInt(jsonStr.length());
-        checkPointWriter.write(jsonStr.getBytes());
-
-        if (isClosed()) {
-          final String LOG_MESSAGE_KEY = this.getClass()
-            .getSimpleName() + "_FINAL_CHECKIN";
-          LogFeederUtil.logErrorMessageByInterval(
-            LOG_MESSAGE_KEY,
-            "Wrote final checkPoint, input="
-              + getShortDescription()
-              + ", checkPointFile="
-              + checkPointFile.getAbsolutePath()
-              + ", checkPoint=" + jsonStr, null, logger,
-            Level.INFO);
-        }
-      } catch (Throwable t) {
-        final String LOG_MESSAGE_KEY = this.getClass().getSimpleName()
-          + "_CHECKIN_EXCEPTION";
-        LogFeederUtil
-          .logErrorMessageByInterval(LOG_MESSAGE_KEY,
-            "Caught exception checkIn. , input="
-              + getShortDescription(), t, logger,
-            Level.ERROR);
-      }
-    }
-
-  }
-
-  @Override
-  public void checkIn() {
-    super.checkIn();
-    if (lastCheckPointInputMarker != null) {
-      checkIn(lastCheckPointInputMarker);
-    }
-  }
-
-  @Override
-  public void rollOver() {
-    logger.info("Marking this input file for rollover. "
-      + getShortDescription());
-    isRolledOver = true;
   }
 
   @Override
   void start() throws Exception {
-
-    if (logPathFiles == null || logPathFiles.length == 0) {
-      return;
-    }
     boolean isProcessFile = getBooleanValue("process_file", true);
     if (isProcessFile) {
-      if (isTail()) {
-        processFile(logPathFiles[0]);
+      if (tail) {
+        processFile(logFiles[0]);
       } else {
-        for (File file : logPathFiles) {
+        for (File file : logFiles) {
           try {
             processFile(file);
             if (isClosed() || isDrain()) {
-              logger.info("isClosed or isDrain. Now breaking loop.");
+              LOG.info("isClosed or isDrain. Now breaking loop.");
               break;
             }
           } catch (Throwable t) {
-            logger.error("Error processing file=" + file.getAbsolutePath(), t);
+            LOG.error("Error processing file=" + file.getAbsolutePath(), t);
           }
         }
       }
       close();
-    }else{
-      copyFiles(logPathFiles);
+    } else {
+      copyFiles(logFiles);
     }
-    
   }
 
   @Override
-  public void close() {
-    super.close();
-    logger.info("close() calling checkPoint checkIn(). "
-      + getShortDescription());
-    checkIn();
-  }
-
-  private void processFile(File logPathFile) throws FileNotFoundException,
-    IOException {
-    logger.info("Monitoring logPath=" + logPath + ", logPathFile="
-      + logPathFile);
-    BufferedReader br = null;
-    checkPointFile = null;
-    checkPointWriter = null;
-    jsonCheckPoint = null;
-    int resumeFromLineNumber = 0;
-
-    int lineCount = 0;
-    try {
-      setFilePath(logPathFile.getAbsolutePath());
-      br = new BufferedReader(LogsearchReaderFactory.INSTANCE.getReader(logPathFile));
-
-      // Whether to send to output from the beginning.
-      boolean resume = isStartFromBegining;
-
-      // Seems FileWatch is not reliable, so let's only use file key comparison
-      fileKey = getFileKey(logPathFile);
-      base64FileKey = Base64.byteArrayToBase64(fileKey.toString()
-        .getBytes());
-      logger.info("fileKey=" + fileKey + ", base64=" + base64FileKey
-        + ". " + getShortDescription());
-
-      if (isTail()) {
-        try {
-          logger.info("Checking existing checkpoint file. "
-            + getShortDescription());
-
-          String fileBase64 = Base64.byteArrayToBase64(fileKey
-            .toString().getBytes());
-          String checkPointFileName = fileBase64
-            + checkPointExtension;
-          File checkPointFolder = inputMgr.getCheckPointFolderFile();
-          checkPointFile = new File(checkPointFolder,
-            checkPointFileName);
-          checkPointWriter = new RandomAccessFile(checkPointFile,
-            "rw");
-
-          try {
-            int contentSize = checkPointWriter.readInt();
-            byte b[] = new byte[contentSize];
-            int readSize = checkPointWriter.read(b, 0, contentSize);
-            if (readSize != contentSize) {
-              logger.error("Couldn't read expected number of bytes from checkpoint file. expected="
-                + contentSize
-                + ", read="
-                + readSize
-                + ", checkPointFile="
-                + checkPointFile
-                + ", input=" + getShortDescription());
-            } else {
-              String jsonCheckPointStr = new String(b, 0, readSize);
-              jsonCheckPoint = LogFeederUtil
-                .toJSONObject(jsonCheckPointStr);
-
-              resumeFromLineNumber = LogFeederUtil.objectToInt(
-                jsonCheckPoint.get("line_number"), 0,
-                "line_number");
-
-              if (resumeFromLineNumber > 0) {
-                // Let's read from last line read
-                resume = false;
-              }
-              logger.info("CheckPoint. checkPointFile="
-                + checkPointFile + ", json="
-                + jsonCheckPointStr
-                + ", resumeFromLineNumber="
-                + resumeFromLineNumber + ", resume="
-                + resume);
-            }
-          } catch (EOFException eofEx) {
-            logger.info("EOFException. Will reset checkpoint file "
-              + checkPointFile.getAbsolutePath() + " for "
-              + getShortDescription());
-          }
-          if (jsonCheckPoint == null) {
-            // This seems to be first time, so creating the initial
-            // checkPoint object
-            jsonCheckPoint = new HashMap<String, Object>();
-            jsonCheckPoint.put("file_path", filePath);
-            jsonCheckPoint.put("file_key", fileBase64);
-          }
-
-        } catch (Throwable t) {
-          logger.error(
-            "Error while configuring checkpoint file. Will reset file. checkPointFile="
-              + checkPointFile, t);
-        }
-      }
-
-      setClosed(false);
-      int sleepStep = 2;
-      int sleepIteration = 0;
-      while (true) {
-        try {
-          if (isDrain()) {
-            break;
-          }
-
-          String line = br.readLine();
-          if (line == null) {
-            if (!resume) {
-              resume = true;
-            }
-            sleepIteration++;
-            try {
-              // Since FileWatch service is not reliable, we will check
-              // file inode every n seconds after no write
-              if (sleepIteration > 4) {
-                Object newFileKey = getFileKey(logPathFile);
-                if (newFileKey != null) {
-                  if (fileKey == null
-                    || !newFileKey.equals(fileKey)) {
-                    logger.info("File key is different. Calling rollover. oldKey="
-                      + fileKey
-                      + ", newKey="
-                      + newFileKey
-                      + ". "
-                      + getShortDescription());
-                    // File has rotated.
-                    rollOver();
-                  }
-                }
-              }
-              // Flush on the second iteration
-              if (!tail && sleepIteration >= 2) {
-                logger.info("End of file. Done with filePath="
-                  + logPathFile.getAbsolutePath()
-                  + ", lineCount=" + lineCount);
-                flush();
-                break;
-              } else if (sleepIteration == 2) {
-                flush();
-              } else if (sleepIteration >= 2) {
-                if (isRolledOver) {
-                  isRolledOver = false;
-                  // Close existing file
-                  try {
-                    logger.info("File is rolled over. Closing current open file."
-                      + getShortDescription()
-                      + ", lineCount=" + lineCount);
-                    br.close();
-                  } catch (Exception ex) {
-                    logger.error("Error closing file"
-                      + getShortDescription());
-                    break;
-                  }
-                  try {
-                    logger.info("Opening new rolled over file."
-                      + getShortDescription());
-                    br = new BufferedReader(LogsearchReaderFactory.
-                      INSTANCE.getReader(logPathFile));
-                    lineCount = 0;
-                    fileKey = getFileKey(logPathFile);
-                    base64FileKey = Base64
-                      .byteArrayToBase64(fileKey
-                        .toString().getBytes());
-                    logger.info("fileKey=" + fileKey
-                      + ", base64=" + base64FileKey
-                      + ", " + getShortDescription());
-                  } catch (Exception ex) {
-                    logger.error("Error opening rolled over file. "
-                      + getShortDescription());
-                    // Let's add this to monitoring and exit this thread
-                    logger.info("Added input to not ready list."
-                      + getShortDescription());
-                    isReady = false;
-                    inputMgr.addToNotReady(this);
-                    break;
-                  }
-                  logger.info("File is successfully rolled over. "
-                    + getShortDescription());
-                  continue;
-                }
-              }
-              Thread.sleep(sleepStep * 1000);
-              sleepStep = (sleepStep * 2);
-              sleepStep = sleepStep > 10 ? 10 : sleepStep;
-            } catch (InterruptedException e) {
-              logger.info("Thread interrupted."
-                + getShortDescription());
-            }
-          } else {
-            lineCount++;
-            sleepStep = 1;
-            sleepIteration = 0;
-
-            if (!resume && lineCount > resumeFromLineNumber) {
-              logger.info("Resuming to read from last line. lineCount="
-                + lineCount
-                + ", input="
-                + getShortDescription());
-              resume = true;
-            }
-            if (resume) {
-              InputMarker marker = new InputMarker();
-              marker.base64FileKey = base64FileKey;
-              marker.input = this;
-              marker.lineNumber = lineCount;
-              outputLine(line, marker);
-            }
-          }
-        } catch (Throwable t) {
-          final String LOG_MESSAGE_KEY = this.getClass()
-            .getSimpleName() + "_READ_LOOP_EXCEPTION";
-          LogFeederUtil.logErrorMessageByInterval(LOG_MESSAGE_KEY,
-            "Caught exception in read loop. lineNumber="
-              + lineCount + ", input="
-              + getShortDescription(), t, logger,
-            Level.ERROR);
-
-        }
-      }
-    } finally {
-      if (br != null) {
-        logger.info("Closing reader." + getShortDescription()
-          + ", lineCount=" + lineCount);
-        try {
-          br.close();
-        } catch (Throwable t) {
-          // ignore
-        }
-      }
-    }
-  }
-
-  static public Object getFileKey(File file) {
-    try {
-      Path fileFullPath = Paths.get(file.getAbsolutePath());
-      if (fileFullPath != null) {
-        BasicFileAttributes basicAttr = Files.readAttributes(
-          fileFullPath, BasicFileAttributes.class);
-        return basicAttr.fileKey();
-      }
-    } catch (Throwable ex) {
-      logger.error("Error getting file attributes for file=" + file, ex);
-    }
-    return file.toString();
+  protected BufferedReader openLogFile(File logFile) throws FileNotFoundException {
+    BufferedReader br = new BufferedReader(LogsearchReaderFactory.INSTANCE.getReader(logFile));
+    fileKey = getFileKey(logFile);
+    base64FileKey = Base64.byteArrayToBase64(fileKey.toString().getBytes());
+    LOG.info("fileKey=" + fileKey + ", base64=" + base64FileKey + ". " + getShortDescription());
+    return br;
   }
 
   @Override
-  public String getShortDescription() {
-    return "input:source="
-      + getStringValue("source")
-      + ", path="
-      + (logPathFiles != null && logPathFiles.length > 0 ? logPathFiles[0]
-      .getAbsolutePath() : getStringValue("path"));
+  protected Object getFileKey(File logFile) {
+    return FileUtil.getFileKey(logFile);
   }
-  
-  public void copyFiles(File[] files) {
+
+  private void copyFiles(File[] files) {
     boolean isCopyFile = getBooleanValue("copy_file", false);
     if (isCopyFile && files != null) {
       for (File file : files) {
         try {
-          InputMarker marker = new InputMarker();
-          marker.input = this;
-          outputMgr.copyFile(file, marker);
+          InputMarker marker = new InputMarker(this, null, 0);
+          outputManager.copyFile(file, marker);
           if (isClosed() || isDrain()) {
-            logger.info("isClosed or isDrain. Now breaking loop.");
+            LOG.info("isClosed or isDrain. Now breaking loop.");
             break;
           }
         } catch (Throwable t) {
-          logger.error("Error processing file=" + file.getAbsolutePath(), t);
+          LOG.error("Error processing file=" + file.getAbsolutePath(), t);
         }
       }
     }

http://git-wip-us.apache.org/repos/asf/ambari/blob/1b07a6dd/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/input/InputManager.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/input/InputManager.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/input/InputManager.java
new file mode 100644
index 0000000..8e70850
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/input/InputManager.java
@@ -0,0 +1,379 @@
+/*
+ * 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.logfeeder.input;
+
+import java.io.EOFException;
+import java.io.File;
+import java.io.FileFilter;
+import java.io.IOException;
+import java.io.RandomAccessFile;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.UUID;
+
+import org.apache.ambari.logfeeder.metrics.MetricData;
+import org.apache.ambari.logfeeder.util.FileUtil;
+import org.apache.ambari.logfeeder.util.LogFeederUtil;
+import org.apache.commons.io.filefilter.WildcardFileFilter;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.log4j.Logger;
+import org.apache.solr.common.util.Base64;
+
+public class InputManager {
+  private static final Logger LOG = Logger.getLogger(InputManager.class);
+
+  private static final String CHECKPOINT_SUBFOLDER_NAME = "logfeeder_checkpoints";
+  public static final String DEFAULT_CHECKPOINT_EXTENSION = ".cp";
+  
+  private List<Input> inputList = new ArrayList<Input>();
+  private Set<Input> notReadyList = new HashSet<Input>();
+
+  private boolean isDrain = false;
+  private boolean isAnyInputTail = false;
+
+  private File checkPointFolderFile = null;
+
+  private MetricData filesCountMetric = new MetricData("input.files.count", true);
+
+  private String checkPointExtension;
+  
+  private Thread inputIsReadyMonitor = null;
+
+  public List<Input> getInputList() {
+    return inputList;
+  }
+
+  public void add(Input input) {
+    inputList.add(input);
+  }
+
+  public void removeInput(Input input) {
+    LOG.info("Trying to remove from inputList. " + input.getShortDescription());
+    Iterator<Input> iter = inputList.iterator();
+    while (iter.hasNext()) {
+      Input iterInput = iter.next();
+      if (iterInput.equals(input)) {
+        LOG.info("Removing Input from inputList. " + input.getShortDescription());
+        iter.remove();
+      }
+    }
+  }
+
+  private int getActiveFilesCount() {
+    int count = 0;
+    for (Input input : inputList) {
+      if (input.isReady()) {
+        count++;
+      }
+    }
+    return count;
+  }
+
+  public void init() {
+    checkPointExtension = LogFeederUtil.getStringProperty("logfeeder.checkpoint.extension", DEFAULT_CHECKPOINT_EXTENSION);
+    for (Input input : inputList) {
+      try {
+        input.init();
+        if (input.isTail()) {
+          isAnyInputTail = true;
+        }
+      } catch (Exception e) {
+        LOG.error("Error initializing input. " + input.getShortDescription(), e);
+      }
+    }
+
+    if (isAnyInputTail) {
+      LOG.info("Determining valid checkpoint folder");
+      boolean isCheckPointFolderValid = false;
+      // We need to keep track of the files we are reading.
+      String checkPointFolder = LogFeederUtil.getStringProperty("logfeeder.checkpoint.folder");
+      if (!StringUtils.isEmpty(checkPointFolder)) {
+        checkPointFolderFile = new File(checkPointFolder);
+        isCheckPointFolderValid = verifyCheckPointFolder(checkPointFolderFile);
+      }
+      if (!isCheckPointFolderValid) {
+        // Let's try home folder
+        String userHome = LogFeederUtil.getStringProperty("user.home");
+        if (userHome != null) {
+          checkPointFolderFile = new File(userHome, CHECKPOINT_SUBFOLDER_NAME);
+          LOG.info("Checking if home folder can be used for checkpoints. Folder=" + checkPointFolderFile);
+          isCheckPointFolderValid = verifyCheckPointFolder(checkPointFolderFile);
+        }
+      }
+      if (!isCheckPointFolderValid) {
+        // Let's use tmp folder
+        String tmpFolder = LogFeederUtil.getStringProperty("java.io.tmpdir");
+        if (tmpFolder == null) {
+          tmpFolder = "/tmp";
+        }
+        checkPointFolderFile = new File(tmpFolder, CHECKPOINT_SUBFOLDER_NAME);
+        LOG.info("Checking if tmps folder can be used for checkpoints. Folder=" + checkPointFolderFile);
+        isCheckPointFolderValid = verifyCheckPointFolder(checkPointFolderFile);
+        if (isCheckPointFolderValid) {
+          LOG.warn("Using tmp folder " + checkPointFolderFile + " to store check points. This is not recommended." +
+              "Please set logfeeder.checkpoint.folder property");
+        }
+      }
+
+      if (isCheckPointFolderValid) {
+        LOG.info("Using folder " + checkPointFolderFile + " for storing checkpoints");
+      }
+    }
+
+  }
+
+  private boolean verifyCheckPointFolder(File folderPathFile) {
+    if (!folderPathFile.exists()) {
+      try {
+        if (!folderPathFile.mkdir()) {
+          LOG.warn("Error creating folder for check point. folder=" + folderPathFile);
+        }
+      } catch (Throwable t) {
+        LOG.warn("Error creating folder for check point. folder=" + folderPathFile, t);
+      }
+    }
+
+    if (folderPathFile.exists() && folderPathFile.isDirectory()) {
+      // Let's check whether we can create a file
+      File testFile = new File(folderPathFile, UUID.randomUUID().toString());
+      try {
+        testFile.createNewFile();
+        return testFile.delete();
+      } catch (IOException e) {
+        LOG.warn("Couldn't create test file in " + folderPathFile.getAbsolutePath() + " for checkPoint", e);
+      }
+    }
+    return false;
+  }
+
+  public File getCheckPointFolderFile() {
+    return checkPointFolderFile;
+  }
+
+  public void monitor() {
+    for (Input input : inputList) {
+      if (input.isReady()) {
+        input.monitor();
+      } else {
+        if (input.isTail()) {
+          LOG.info("Adding input to not ready list. Note, it is possible this component is not run on this host. " +
+              "So it might not be an issue. " + input.getShortDescription());
+          notReadyList.add(input);
+        } else {
+          LOG.info("Input is not ready, so going to ignore it " + input.getShortDescription());
+        }
+      }
+    }
+    // Start the monitoring thread if any file is in tail mode
+    if (isAnyInputTail) {
+       inputIsReadyMonitor = new Thread("InputIsReadyMonitor") {
+        @Override
+        public void run() {
+          LOG.info("Going to monitor for these missing files: " + notReadyList.toString());
+          while (true) {
+            if (isDrain) {
+              LOG.info("Exiting missing file monitor.");
+              break;
+            }
+            try {
+              Iterator<Input> iter = notReadyList.iterator();
+              while (iter.hasNext()) {
+                Input input = iter.next();
+                try {
+                  if (input.isReady()) {
+                    input.monitor();
+                    iter.remove();
+                  }
+                } catch (Throwable t) {
+                  LOG.error("Error while enabling monitoring for input. " + input.getShortDescription());
+                }
+              }
+              Thread.sleep(30 * 1000);
+            } catch (Throwable t) {
+              // Ignore
+            }
+          }
+        }
+      };
+      inputIsReadyMonitor.start();
+    }
+  }
+
+  void addToNotReady(Input notReadyInput) {
+    notReadyList.add(notReadyInput);
+  }
+
+  public void addMetricsContainers(List<MetricData> metricsList) {
+    for (Input input : inputList) {
+      input.addMetricsContainers(metricsList);
+    }
+    filesCountMetric.value = getActiveFilesCount();
+    metricsList.add(filesCountMetric);
+  }
+
+  public void logStats() {
+    for (Input input : inputList) {
+      input.logStat();
+    }
+
+    filesCountMetric.value = getActiveFilesCount();
+    LogFeederUtil.logStatForMetric(filesCountMetric, "Stat: Files Monitored Count", "");
+  }
+
+
+  public void cleanCheckPointFiles() {
+
+    if (checkPointFolderFile == null) {
+      LOG.info("Will not clean checkPoint files. checkPointFolderFile=" + checkPointFolderFile);
+      return;
+    }
+    LOG.info("Cleaning checkPoint files. checkPointFolderFile=" + checkPointFolderFile.getAbsolutePath());
+    try {
+      // Loop over the check point files and if filePath is not present, then move to closed
+      String searchPath = "*" + checkPointExtension;
+      FileFilter fileFilter = new WildcardFileFilter(searchPath);
+      File[] checkPointFiles = checkPointFolderFile.listFiles(fileFilter);
+      int totalCheckFilesDeleted = 0;
+      for (File checkPointFile : checkPointFiles) {
+        try (RandomAccessFile checkPointReader = new RandomAccessFile(checkPointFile, "r")) {
+          int contentSize = checkPointReader.readInt();
+          byte b[] = new byte[contentSize];
+          int readSize = checkPointReader.read(b, 0, contentSize);
+          if (readSize != contentSize) {
+            LOG.error("Couldn't read expected number of bytes from checkpoint file. expected=" + contentSize + ", read="
+              + readSize + ", checkPointFile=" + checkPointFile);
+          } else {
+            String jsonCheckPointStr = new String(b, 0, readSize);
+            Map<String, Object> jsonCheckPoint = LogFeederUtil.toJSONObject(jsonCheckPointStr);
+
+            String logFilePath = (String) jsonCheckPoint.get("file_path");
+            String logFileKey = (String) jsonCheckPoint.get("file_key");
+            if (logFilePath != null && logFileKey != null) {
+              boolean deleteCheckPointFile = false;
+              File logFile = new File(logFilePath);
+              if (logFile.exists()) {
+                Object fileKeyObj = FileUtil.getFileKey(logFile);
+                String fileBase64 = Base64.byteArrayToBase64(fileKeyObj.toString().getBytes());
+                if (!logFileKey.equals(fileBase64)) {
+                  deleteCheckPointFile = true;
+                  LOG.info("CheckPoint clean: File key has changed. old=" + logFileKey + ", new=" + fileBase64 + ", filePath=" +
+                      logFilePath + ", checkPointFile=" + checkPointFile.getAbsolutePath());
+                }
+              } else {
+                LOG.info("CheckPoint clean: Log file doesn't exist. filePath=" + logFilePath + ", checkPointFile=" +
+                    checkPointFile.getAbsolutePath());
+                deleteCheckPointFile = true;
+              }
+              if (deleteCheckPointFile) {
+                LOG.info("Deleting CheckPoint file=" + checkPointFile.getAbsolutePath() + ", logFile=" + logFilePath);
+                checkPointFile.delete();
+                totalCheckFilesDeleted++;
+              }
+            }
+          }
+        } catch (EOFException eof) {
+          LOG.warn("Caught EOFException. Ignoring reading existing checkPoint file. " + checkPointFile);
+        } catch (Throwable t) {
+          LOG.error("Error while checking checkPoint file. " + checkPointFile, t);
+        }
+      }
+      LOG.info("Deleted " + totalCheckFilesDeleted + " checkPoint file(s). checkPointFolderFile=" +
+          checkPointFolderFile.getAbsolutePath());
+
+    } catch (Throwable t) {
+      LOG.error("Error while cleaning checkPointFiles", t);
+    }
+  }
+
+  public void waitOnAllInputs() {
+    //wait on inputs
+    for (Input input : inputList) {
+      if (input != null) {
+        Thread inputThread = input.getThread();
+        if (inputThread != null) {
+          try {
+            inputThread.join();
+          } catch (InterruptedException e) {
+            // ignore
+          }
+        }
+      }
+    }
+    // wait on monitor
+    if (inputIsReadyMonitor != null) {
+      try {
+        this.close();
+        inputIsReadyMonitor.join();
+      } catch (InterruptedException e) {
+        // ignore
+      }
+    }
+  }
+
+  public void checkInAll() {
+    for (Input input : inputList) {
+      input.lastCheckIn();
+    }
+  }
+
+  public void close() {
+    for (Input input : inputList) {
+      try {
+        input.setDrain(true);
+      } catch (Throwable t) {
+        LOG.error("Error while draining. input=" + input.getShortDescription(), t);
+      }
+    }
+    isDrain = true;
+
+    // Need to get this value from property
+    int iterations = 30;
+    int waitTimeMS = 1000;
+    for (int i = 0; i < iterations; i++) {
+      boolean allClosed = true;
+      for (Input input : inputList) {
+        if (!input.isClosed()) {
+          try {
+            allClosed = false;
+            LOG.warn("Waiting for input to close. " + input.getShortDescription() + ", " + (iterations - i) + " more seconds");
+            Thread.sleep(waitTimeMS);
+          } catch (Throwable t) {
+            // Ignore
+          }
+        }
+      }
+      if (allClosed) {
+        LOG.info("All inputs are closed. Iterations=" + i);
+        return;
+      }
+    }
+    
+    LOG.warn("Some inputs were not closed after " + iterations + " iterations");
+    for (Input input : inputList) {
+      if (!input.isClosed()) {
+        LOG.warn("Input not closed. Will ignore it." + input.getShortDescription());
+      }
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/1b07a6dd/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/input/InputMarker.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/input/InputMarker.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/input/InputMarker.java
index 48a7f1d..6767687 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/input/InputMarker.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/input/InputMarker.java
@@ -23,13 +23,18 @@ package org.apache.ambari.logfeeder.input;
  * This file contains the file inode, line number of the log currently been read
  */
 public class InputMarker {
-  public int lineNumber = 0;
-  public Input input;
-  public String base64FileKey = null;
-
+  public final Input input;
+  public final String base64FileKey;
+  public final int lineNumber;
+  
+  public InputMarker(Input input, String base64FileKey, int lineNumber) {
+    this.input = input;
+    this.base64FileKey = base64FileKey;
+    this.lineNumber = lineNumber;
+  }
+  
   @Override
   public String toString() {
-    return "InputMarker [lineNumber=" + lineNumber + ", input="
-      + input.getShortDescription() + "]";
+    return "InputMarker [lineNumber=" + lineNumber + ", input=" + input.getShortDescription() + "]";
   }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/1b07a6dd/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/input/InputMgr.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/input/InputMgr.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/input/InputMgr.java
deleted file mode 100644
index b18c9b0..0000000
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/input/InputMgr.java
+++ /dev/null
@@ -1,451 +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.logfeeder.input;
-
-import java.io.EOFException;
-import java.io.File;
-import java.io.FileFilter;
-import java.io.IOException;
-import java.io.RandomAccessFile;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.UUID;
-
-import org.apache.ambari.logfeeder.metrics.MetricCount;
-import org.apache.ambari.logfeeder.util.LogFeederUtil;
-import org.apache.commons.io.filefilter.WildcardFileFilter;
-import org.apache.log4j.Logger;
-import org.apache.solr.common.util.Base64;
-
-public class InputMgr {
-  private static final Logger logger = Logger.getLogger(InputMgr.class);
-
-  private List<Input> inputList = new ArrayList<Input>();
-  private Set<Input> notReadyList = new HashSet<Input>();
-
-  private boolean isDrain = false;
-  private boolean isAnyInputTail = false;
-
-  private String checkPointSubFolderName = "logfeeder_checkpoints";
-  private File checkPointFolderFile = null;
-
-  private MetricCount filesCountMetric = new MetricCount();
-
-  private String checkPointExtension = ".cp";
-  
-  private Thread inputIsReadyMonitor = null;
-
-  public List<Input> getInputList() {
-    return inputList;
-  }
-
-  public void add(Input input) {
-    inputList.add(input);
-  }
-
-  public void removeInput(Input input) {
-    logger.info("Trying to remove from inputList. "
-      + input.getShortDescription());
-    Iterator<Input> iter = inputList.iterator();
-    while (iter.hasNext()) {
-      Input iterInput = iter.next();
-      if (iterInput.equals(input)) {
-        logger.info("Removing Input from inputList. "
-          + input.getShortDescription());
-        iter.remove();
-      }
-    }
-  }
-
-  public int getActiveFilesCount() {
-    int count = 0;
-    for (Input input : inputList) {
-      if (input.isReady()) {
-        count++;
-      }
-    }
-    return count;
-  }
-
-  public void init() {
-    filesCountMetric.metricsName = "input.files.count";
-    filesCountMetric.isPointInTime = true;
-
-    checkPointExtension = LogFeederUtil.getStringProperty(
-      "logfeeder.checkpoint.extension", checkPointExtension);
-    for (Input input : inputList) {
-      try {
-        input.init();
-        if (input.isTail()) {
-          isAnyInputTail = true;
-        }
-      } catch (Exception e) {
-        logger.error(
-          "Error initializing input. "
-            + input.getShortDescription(), e);
-      }
-    }
-
-    if (isAnyInputTail) {
-      logger.info("Determining valid checkpoint folder");
-      boolean isCheckPointFolderValid = false;
-      // We need to keep track of the files we are reading.
-      String checkPointFolder = LogFeederUtil
-        .getStringProperty("logfeeder.checkpoint.folder");
-      if (checkPointFolder != null && !checkPointFolder.isEmpty()) {
-        checkPointFolderFile = new File(checkPointFolder);
-        isCheckPointFolderValid = verifyCheckPointFolder(checkPointFolderFile);
-      }
-      if (!isCheckPointFolderValid) {
-        // Let's try home folder
-        String userHome = LogFeederUtil.getStringProperty("user.home");
-        if (userHome != null) {
-          checkPointFolderFile = new File(userHome,
-            checkPointSubFolderName);
-          logger.info("Checking if home folder can be used for checkpoints. Folder="
-            + checkPointFolderFile);
-          isCheckPointFolderValid = verifyCheckPointFolder(checkPointFolderFile);
-        }
-      }
-      if (!isCheckPointFolderValid) {
-        // Let's use tmp folder
-        String tmpFolder = LogFeederUtil
-          .getStringProperty("java.io.tmpdir");
-        if (tmpFolder == null) {
-          tmpFolder = "/tmp";
-        }
-        checkPointFolderFile = new File(tmpFolder,
-          checkPointSubFolderName);
-        logger.info("Checking if tmps folder can be used for checkpoints. Folder="
-          + checkPointFolderFile);
-        isCheckPointFolderValid = verifyCheckPointFolder(checkPointFolderFile);
-        if (isCheckPointFolderValid) {
-          logger.warn("Using tmp folder "
-            + checkPointFolderFile
-            + " to store check points. This is not recommended."
-            + "Please set logfeeder.checkpoint.folder property");
-        }
-      }
-
-      if (isCheckPointFolderValid) {
-        logger.info("Using folder " + checkPointFolderFile
-          + " for storing checkpoints");
-      }
-    }
-
-  }
-
-  public File getCheckPointFolderFile() {
-    return checkPointFolderFile;
-  }
-
-  private boolean verifyCheckPointFolder(File folderPathFile) {
-    if (!folderPathFile.exists()) {
-      // Create the folder
-      try {
-        if (!folderPathFile.mkdir()) {
-          logger.warn("Error creating folder for check point. folder="
-            + folderPathFile);
-        }
-      } catch (Throwable t) {
-        logger.warn("Error creating folder for check point. folder="
-          + folderPathFile, t);
-      }
-    }
-
-    if (folderPathFile.exists() && folderPathFile.isDirectory()) {
-      // Let's check whether we can create a file
-      File testFile = new File(folderPathFile, UUID.randomUUID()
-        .toString());
-      try {
-        testFile.createNewFile();
-        return testFile.delete();
-      } catch (IOException e) {
-        logger.warn(
-          "Couldn't create test file in "
-            + folderPathFile.getAbsolutePath()
-            + " for checkPoint", e);
-      }
-    }
-    return false;
-  }
-
-  public void monitor() {
-    for (Input input : inputList) {
-      if (input.isReady()) {
-        input.monitor();
-      } else {
-        if (input.isTail()) {
-          logger.info("Adding input to not ready list. Note, it is possible this component is not run on this host. So it might not be an issue. "
-            + input.getShortDescription());
-          notReadyList.add(input);
-        } else {
-          logger.info("Input is not ready, so going to ignore it "
-            + input.getShortDescription());
-        }
-      }
-    }
-    // Start the monitoring thread if any file is in tail mode
-    if (isAnyInputTail) {
-       inputIsReadyMonitor = new Thread("InputIsReadyMonitor") {
-        @Override
-        public void run() {
-          logger.info("Going to monitor for these missing files: "
-            + notReadyList.toString());
-          while (true) {
-            if (isDrain) {
-              logger.info("Exiting missing file monitor.");
-              break;
-            }
-            try {
-              Iterator<Input> iter = notReadyList.iterator();
-              while (iter.hasNext()) {
-                Input input = iter.next();
-                try {
-                  if (input.isReady()) {
-                    input.monitor();
-                    iter.remove();
-                  }
-                } catch (Throwable t) {
-                  logger.error("Error while enabling monitoring for input. "
-                    + input.getShortDescription());
-                }
-              }
-              Thread.sleep(30 * 1000);
-            } catch (Throwable t) {
-              // Ignore
-            }
-          }
-        }
-      };
-      inputIsReadyMonitor.start();
-    }
-  }
-
-  public void addToNotReady(Input notReadyInput) {
-    notReadyList.add(notReadyInput);
-  }
-
-  public void addMetricsContainers(List<MetricCount> metricsList) {
-    for (Input input : inputList) {
-      input.addMetricsContainers(metricsList);
-    }
-    filesCountMetric.count = getActiveFilesCount();
-    metricsList.add(filesCountMetric);
-  }
-
-  public void logStats() {
-    for (Input input : inputList) {
-      input.logStat();
-    }
-
-    filesCountMetric.count = getActiveFilesCount();
-    LogFeederUtil.logStatForMetric(filesCountMetric,
-      "Stat: Files Monitored Count", null);
-  }
-
-  public void close() {
-    for (Input input : inputList) {
-      try {
-        input.setDrain(true);
-      } catch (Throwable t) {
-        logger.error(
-          "Error while draining. input="
-            + input.getShortDescription(), t);
-      }
-    }
-    isDrain = true;
-
-    // Need to get this value from property
-    int iterations = 30;
-    int waitTimeMS = 1000;
-    int i = 0;
-    boolean allClosed = true;
-    for (i = 0; i < iterations; i++) {
-      allClosed = true;
-      for (Input input : inputList) {
-        if (!input.isClosed()) {
-          try {
-            allClosed = false;
-            logger.warn("Waiting for input to close. "
-              + input.getShortDescription() + ", "
-              + (iterations - i) + " more seconds");
-            Thread.sleep(waitTimeMS);
-          } catch (Throwable t) {
-            // Ignore
-          }
-        }
-      }
-      if (allClosed) {
-        break;
-      }
-    }
-    if (!allClosed) {
-      logger.warn("Some inputs were not closed. Iterations=" + i);
-      for (Input input : inputList) {
-        if (!input.isClosed()) {
-          logger.warn("Input not closed. Will ignore it."
-            + input.getShortDescription());
-        }
-      }
-    } else {
-      logger.info("All inputs are closed. Iterations=" + i);
-    }
-
-  }
-
-  public void checkInAll() {
-    for (Input input : inputList) {
-      input.checkIn();
-    }
-  }
-
-  public void cleanCheckPointFiles() {
-
-    if (checkPointFolderFile == null) {
-      logger.info("Will not clean checkPoint files. checkPointFolderFile="
-        + checkPointFolderFile);
-      return;
-    }
-    logger.info("Cleaning checkPoint files. checkPointFolderFile="
-      + checkPointFolderFile.getAbsolutePath());
-    try {
-      // Loop over the check point files and if filePath is not present, then move to closed
-      String searchPath = "*" + checkPointExtension;
-      FileFilter fileFilter = new WildcardFileFilter(searchPath);
-      File[] checkPointFiles = checkPointFolderFile.listFiles(fileFilter);
-      int totalCheckFilesDeleted = 0;
-      for (File checkPointFile : checkPointFiles) {
-        RandomAccessFile checkPointReader = null;
-        try {
-          checkPointReader = new RandomAccessFile(checkPointFile, "r");
-
-          int contentSize = checkPointReader.readInt();
-          byte b[] = new byte[contentSize];
-          int readSize = checkPointReader.read(b, 0, contentSize);
-          if (readSize != contentSize) {
-            logger.error("Couldn't read expected number of bytes from checkpoint file. expected="
-              + contentSize
-              + ", read="
-              + readSize
-              + ", checkPointFile=" + checkPointFile);
-          } else {
-            // Create JSON string
-            String jsonCheckPointStr = new String(b, 0, readSize);
-            Map<String, Object> jsonCheckPoint = LogFeederUtil
-              .toJSONObject(jsonCheckPointStr);
-
-            String logFilePath = (String) jsonCheckPoint
-              .get("file_path");
-            String logFileKey = (String) jsonCheckPoint
-              .get("file_key");
-            if (logFilePath != null && logFileKey != null) {
-              boolean deleteCheckPointFile = false;
-              File logFile = new File(logFilePath);
-              if (logFile.exists()) {
-                Object fileKeyObj = InputFile
-                  .getFileKey(logFile);
-                String fileBase64 = Base64
-                  .byteArrayToBase64(fileKeyObj
-                    .toString().getBytes());
-                if (!logFileKey.equals(fileBase64)) {
-                  deleteCheckPointFile = true;
-                  logger.info("CheckPoint clean: File key has changed. old="
-                    + logFileKey
-                    + ", new="
-                    + fileBase64
-                    + ", filePath="
-                    + logFilePath
-                    + ", checkPointFile="
-                    + checkPointFile.getAbsolutePath());
-                }
-              } else {
-                logger.info("CheckPoint clean: Log file doesn't exist. filePath="
-                  + logFilePath
-                  + ", checkPointFile="
-                  + checkPointFile.getAbsolutePath());
-                deleteCheckPointFile = true;
-              }
-              if (deleteCheckPointFile) {
-                logger.info("Deleting CheckPoint file="
-                  + checkPointFile.getAbsolutePath()
-                  + ", logFile=" + logFilePath);
-                checkPointFile.delete();
-                totalCheckFilesDeleted++;
-              }
-            }
-          }
-        } catch (EOFException eof) {
-          logger.warn("Caught EOFException. Ignoring reading existing checkPoint file. "
-            + checkPointFile);
-        } catch (Throwable t) {
-          logger.error("Error while checking checkPoint file. "
-            + checkPointFile, t);
-        } finally {
-          if (checkPointReader != null) {
-            try {
-              checkPointReader.close();
-            } catch (Throwable t) {
-              logger.error("Error closing checkPoint file. "
-                + checkPointFile, t);
-            }
-          }
-        }
-      }
-      logger.info("Deleted " + totalCheckFilesDeleted
-        + " checkPoint file(s). checkPointFolderFile="
-        + checkPointFolderFile.getAbsolutePath());
-
-    } catch (Throwable t) {
-      logger.error("Error while cleaning checkPointFiles", t);
-    }
-  }
-
-  public void waitOnAllInputs() {
-    //wait on inputs
-    if (inputList != null) {
-      for (Input input : inputList) {
-        if (input != null) {
-          Thread inputThread = input.getThread();
-          if (inputThread != null) {
-            try {
-              inputThread.join();
-            } catch (InterruptedException e) {
-              // ignore
-            }
-          }
-        }
-      }
-    }
-    // wait on monitor
-    if (inputIsReadyMonitor != null) {
-      try {
-        this.close();
-        inputIsReadyMonitor.join();
-      } catch (InterruptedException e) {
-        // ignore
-      }
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/1b07a6dd/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/input/InputS3File.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/input/InputS3File.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/input/InputS3File.java
index c9d28bd..f560379 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/input/InputS3File.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/input/InputS3File.java
@@ -19,201 +19,57 @@
 package org.apache.ambari.logfeeder.input;
 
 import java.io.BufferedReader;
-import java.io.EOFException;
 import java.io.File;
-import java.io.FileNotFoundException;
 import java.io.IOException;
-import java.io.RandomAccessFile;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Map;
 
-import org.apache.ambari.logfeeder.util.LogFeederUtil;
 import org.apache.ambari.logfeeder.util.S3Util;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.log4j.Level;
-import org.apache.log4j.Logger;
+import org.apache.commons.lang.ArrayUtils;
 import org.apache.solr.common.util.Base64;
 
-public class InputS3File extends Input {
-  private static final Logger logger = Logger.getLogger(InputS3File.class);
-
-  private String logPath = null;
-  private boolean isStartFromBegining = true;
-
-  private boolean isReady = false;
-  private String[] s3LogPathFiles = null;
-  private Object fileKey = null;
-  private String base64FileKey = null;
-
-  private boolean isRolledOver = false;
-  private boolean addWildCard = false;
-
-  private long lastCheckPointTimeMS = 0;
-  private int checkPointIntervalMS = 5 * 1000; // 5 seconds
-  private RandomAccessFile checkPointWriter = null;
-  private Map<String, Object> jsonCheckPoint = null;
-
-  private File checkPointFile = null;
-
-  private InputMarker lastCheckPointInputMarker = null;
-
-  private String checkPointExtension = ".cp";
-
-
-  @Override
-  public void init() throws Exception {
-    logger.info("init() called");
-    statMetric.metricsName = "input.files.read_lines";
-    readBytesMetric.metricsName = "input.files.read_bytes";
-    checkPointExtension = LogFeederUtil.getStringProperty(
-        "logfeeder.checkpoint.extension", checkPointExtension);
-
-    // Let's close the file and set it to true after we start monitoring it
-    setClosed(true);
-    logPath = getStringValue("path");
-    tail = getBooleanValue("tail", tail);
-    addWildCard = getBooleanValue("add_wild_card", addWildCard);
-    checkPointIntervalMS = getIntValue("checkpoint.interval.ms",
-        checkPointIntervalMS);
-    if (logPath == null || logPath.isEmpty()) {
-      logger.error("path is empty for file input. " + getShortDescription());
-      return;
-    }
-
-    String startPosition = getStringValue("start_position");
-    if (StringUtils.isEmpty(startPosition)
-        || startPosition.equalsIgnoreCase("beginning")
-        || startPosition.equalsIgnoreCase("begining")) {
-      isStartFromBegining = true;
-    }
-
-    if (!tail) {
-      // start position end doesn't apply if we are not tailing
-      isStartFromBegining = true;
-    }
-
-    setFilePath(logPath);
-    boolean isFileReady = isReady();
-
-    logger.info("File to monitor " + logPath + ", tail=" + tail
-        + ", addWildCard=" + addWildCard + ", isReady=" + isFileReady);
-
-    super.init();
-  }
+public class InputS3File extends AbstractInputFile {
 
   @Override
   public boolean isReady() {
     if (!isReady) {
       // Let's try to check whether the file is available
-      s3LogPathFiles = getActualFiles(logPath);
-      if (s3LogPathFiles != null && s3LogPathFiles.length > 0) {
-        if (isTail() && s3LogPathFiles.length > 1) {
-          logger.warn("Found multiple files (" + s3LogPathFiles.length
-              + ") for the file filter " + filePath
-              + ". Will use only the first one. Using " + s3LogPathFiles[0]);
+      logFiles = getActualFiles(logPath);
+      if (!ArrayUtils.isEmpty(logFiles)) {
+        if (tail && logFiles.length > 1) {
+          LOG.warn("Found multiple files (" + logFiles.length + ") for the file filter " + filePath +
+              ". Will use only the first one. Using " + logFiles[0].getAbsolutePath());
         }
-        logger.info("File filter " + filePath + " expanded to "
-            + s3LogPathFiles[0]);
+        LOG.info("File filter " + filePath + " expanded to " + logFiles[0].getAbsolutePath());
         isReady = true;
       } else {
-        logger.debug(logPath + " file doesn't exist. Ignoring for now");
+        LOG.debug(logPath + " file doesn't exist. Ignoring for now");
       }
     }
     return isReady;
   }
 
-  private String[] getActualFiles(String searchPath) {
+  private File[] getActualFiles(String searchPath) {
     // TODO search file on s3
-    return new String[] { searchPath };
-  }
-
-  @Override
-  synchronized public void checkIn(InputMarker inputMarker) {
-    super.checkIn(inputMarker);
-    if (checkPointWriter != null) {
-      try {
-        int lineNumber = LogFeederUtil.objectToInt(
-            jsonCheckPoint.get("line_number"), 0, "line_number");
-        if (lineNumber > inputMarker.lineNumber) {
-          // Already wrote higher line number for this input
-          return;
-        }
-        // If interval is greater than last checkPoint time, then write
-        long currMS = System.currentTimeMillis();
-        if (!isClosed()
-            && (currMS - lastCheckPointTimeMS) < checkPointIntervalMS) {
-          // Let's save this one so we can update the check point file
-          // on flush
-          lastCheckPointInputMarker = inputMarker;
-          return;
-        }
-        lastCheckPointTimeMS = currMS;
-
-        jsonCheckPoint.put("line_number", ""
-            + new Integer(inputMarker.lineNumber));
-        jsonCheckPoint.put("last_write_time_ms", "" + new Long(currMS));
-        jsonCheckPoint.put("last_write_time_date", new Date());
-
-        String jsonStr = LogFeederUtil.getGson().toJson(jsonCheckPoint);
-
-        // Let's rewind
-        checkPointWriter.seek(0);
-        checkPointWriter.writeInt(jsonStr.length());
-        checkPointWriter.write(jsonStr.getBytes());
-
-        if (isClosed()) {
-          final String LOG_MESSAGE_KEY = this.getClass().getSimpleName()
-              + "_FINAL_CHECKIN";
-          LogFeederUtil.logErrorMessageByInterval(LOG_MESSAGE_KEY,
-              "Wrote final checkPoint, input=" + getShortDescription()
-                  + ", checkPointFile=" + checkPointFile.getAbsolutePath()
-                  + ", checkPoint=" + jsonStr, null, logger, Level.INFO);
-        }
-      } catch (Throwable t) {
-        final String LOG_MESSAGE_KEY = this.getClass().getSimpleName()
-            + "_CHECKIN_EXCEPTION";
-        LogFeederUtil.logErrorMessageByInterval(LOG_MESSAGE_KEY,
-            "Caught exception checkIn. , input=" + getShortDescription(), t,
-            logger, Level.ERROR);
-      }
-    }
-
-  }
-
-  @Override
-  public void checkIn() {
-    super.checkIn();
-    if (lastCheckPointInputMarker != null) {
-      checkIn(lastCheckPointInputMarker);
-    }
-  }
-
-  @Override
-  public void rollOver() {
-    logger.info("Marking this input file for rollover. "
-        + getShortDescription());
-    isRolledOver = true;
+    return new File[] { new File(searchPath) };
   }
 
   @Override
   void start() throws Exception {
-    if (s3LogPathFiles == null || s3LogPathFiles.length == 0) {
+    if (ArrayUtils.isEmpty(logFiles)) {
       return;
     }
 
-    if (isTail()) {
-      processFile(s3LogPathFiles[0]);
+    if (tail) {
+      processFile(logFiles[0]);
     } else {
-      for (String s3FilePath : s3LogPathFiles) {
+      for (File s3FilePath : logFiles) {
         try {
           processFile(s3FilePath);
           if (isClosed() || isDrain()) {
-            logger.info("isClosed or isDrain. Now breaking loop.");
+            LOG.info("isClosed or isDrain. Now breaking loop.");
             break;
           }
         } catch (Throwable t) {
-          logger.error("Error processing file=" + s3FilePath, t);
+          LOG.error("Error processing file=" + s3FilePath, t);
         }
       }
     }
@@ -221,244 +77,18 @@ public class InputS3File extends Input {
   }
 
   @Override
-  public void close() {
-    super.close();
-    logger.info("close() calling checkPoint checkIn(). "
-        + getShortDescription());
-    checkIn();
-  }
-
-  private void processFile(String logPathFile) throws FileNotFoundException,
-      IOException {
-    logger.info("Monitoring logPath=" + logPath + ", logPathFile="
-        + logPathFile);
-    BufferedReader br = null;
-    checkPointFile = null;
-    checkPointWriter = null;
-    jsonCheckPoint = null;
-    int resumeFromLineNumber = 0;
-
-    int lineCount = 0;
-    try {
-      setFilePath(logPathFile);
-      String s3AccessKey = getStringValue("s3_access_key");
-      String s3SecretKey = getStringValue("s3_secret_key");
-      br = S3Util.INSTANCE.getReader(logPathFile,s3AccessKey,s3SecretKey);
-      if(br==null){
-        //log err
-        return;
-      }
-      
-      // Whether to send to output from the beginning.
-      boolean resume = isStartFromBegining;
-
-      // Seems FileWatch is not reliable, so let's only use file key comparison
-      fileKey = getFileKey(logPathFile);
-      base64FileKey = Base64.byteArrayToBase64(fileKey.toString().getBytes());
-      logger.info("fileKey=" + fileKey + ", base64=" + base64FileKey + ". "
-          + getShortDescription());
-
-      if (isTail()) {
-        try {
-          // Let's see if there is a checkpoint for this file
-          logger.info("Checking existing checkpoint file. "
-              + getShortDescription());
-
-          String fileBase64 = Base64.byteArrayToBase64(fileKey.toString()
-              .getBytes());
-          String checkPointFileName = fileBase64 + checkPointExtension;
-          File checkPointFolder = inputMgr.getCheckPointFolderFile();
-          checkPointFile = new File(checkPointFolder, checkPointFileName);
-          checkPointWriter = new RandomAccessFile(checkPointFile, "rw");
-
-          try {
-            int contentSize = checkPointWriter.readInt();
-            byte b[] = new byte[contentSize];
-            int readSize = checkPointWriter.read(b, 0, contentSize);
-            if (readSize != contentSize) {
-              logger
-                  .error("Couldn't read expected number of bytes from checkpoint file. expected="
-                      + contentSize
-                      + ", read="
-                      + readSize
-                      + ", checkPointFile="
-                      + checkPointFile
-                      + ", input="
-                      + getShortDescription());
-            } else {
-              String jsonCheckPointStr = new String(b, 0, readSize);
-              jsonCheckPoint = LogFeederUtil.toJSONObject(jsonCheckPointStr);
-
-              resumeFromLineNumber = LogFeederUtil.objectToInt(
-                  jsonCheckPoint.get("line_number"), 0, "line_number");
-
-              if (resumeFromLineNumber > 0) {
-                // Let's read from last line read
-                resume = false;
-              }
-              logger.info("CheckPoint. checkPointFile=" + checkPointFile
-                  + ", json=" + jsonCheckPointStr + ", resumeFromLineNumber="
-                  + resumeFromLineNumber + ", resume=" + resume);
-            }
-          } catch (EOFException eofEx) {
-            logger.info("EOFException. Will reset checkpoint file "
-                + checkPointFile.getAbsolutePath() + " for "
-                + getShortDescription());
-          }
-          if (jsonCheckPoint == null) {
-            // This seems to be first time, so creating the initial
-            // checkPoint object
-            jsonCheckPoint = new HashMap<String, Object>();
-            jsonCheckPoint.put("file_path", filePath);
-            jsonCheckPoint.put("file_key", fileBase64);
-          }
-
-        } catch (Throwable t) {
-          logger.error(
-              "Error while configuring checkpoint file. Will reset file. checkPointFile="
-                  + checkPointFile, t);
-        }
-      }
-
-      setClosed(false);
-      int sleepStep = 2;
-      int sleepIteration = 0;
-      while (true) {
-        try {
-          if (isDrain()) {
-            break;
-          }
-
-          String line = br.readLine();
-          if (line == null) {
-            if (!resume) {
-              resume = true;
-            }
-            sleepIteration++;
-            try {
-              // Since FileWatch service is not reliable, we will check
-              // file inode every n seconds after no write
-              if (sleepIteration > 4) {
-                Object newFileKey = getFileKey(logPathFile);
-                if (newFileKey != null) {
-                  if (fileKey == null || !newFileKey.equals(fileKey)) {
-                    logger
-                        .info("File key is different. Calling rollover. oldKey="
-                            + fileKey
-                            + ", newKey="
-                            + newFileKey
-                            + ". "
-                            + getShortDescription());
-                    // File has rotated.
-                    rollOver();
-                  }
-                }
-              }
-              // Flush on the second iteration
-              if (!tail && sleepIteration >= 2) {
-                logger.info("End of file. Done with filePath=" + logPathFile
-                    + ", lineCount=" + lineCount);
-                flush();
-                break;
-              } else if (sleepIteration == 2) {
-                flush();
-              } else if (sleepIteration >= 2) {
-                if (isRolledOver) {
-                  isRolledOver = false;
-                  // Close existing file
-                  try {
-                    logger
-                        .info("File is rolled over. Closing current open file."
-                            + getShortDescription() + ", lineCount="
-                            + lineCount);
-                    br.close();
-                  } catch (Exception ex) {
-                    logger.error("Error closing file" + getShortDescription());
-                    break;
-                  }
-                  try {
-                    // Open new file
-                    logger.info("Opening new rolled over file."
-                        + getShortDescription());
-                    br = S3Util.INSTANCE.getReader(logPathFile,s3AccessKey,s3SecretKey);
-                    lineCount = 0;
-                    fileKey = getFileKey(logPathFile);
-                    base64FileKey = Base64.byteArrayToBase64(fileKey.toString()
-                        .getBytes());
-                    logger.info("fileKey=" + fileKey + ", base64="
-                        + base64FileKey + ", " + getShortDescription());
-                  } catch (Exception ex) {
-                    logger.error("Error opening rolled over file. "
-                        + getShortDescription());
-                    // Let's add this to monitoring and exit this thread
-                    logger.info("Added input to not ready list."
-                        + getShortDescription());
-                    isReady = false;
-                    inputMgr.addToNotReady(this);
-                    break;
-                  }
-                  logger.info("File is successfully rolled over. "
-                      + getShortDescription());
-                  continue;
-                }
-              }
-              Thread.sleep(sleepStep * 1000);
-              sleepStep = (sleepStep * 2);
-              sleepStep = sleepStep > 10 ? 10 : sleepStep;
-            } catch (InterruptedException e) {
-              logger.info("Thread interrupted." + getShortDescription());
-            }
-          } else {
-            lineCount++;
-            sleepStep = 1;
-            sleepIteration = 0;
-
-            if (!resume && lineCount > resumeFromLineNumber) {
-              logger.info("Resuming to read from last line. lineCount="
-                  + lineCount + ", input=" + getShortDescription());
-              resume = true;
-            }
-            if (resume) {
-              InputMarker marker = new InputMarker();
-              marker.base64FileKey = base64FileKey;
-              marker.input = this;
-              marker.lineNumber = lineCount;
-              outputLine(line, marker);
-            }
-          }
-        } catch (Throwable t) {
-          final String LOG_MESSAGE_KEY = this.getClass().getSimpleName()
-              + "_READ_LOOP_EXCEPTION";
-          LogFeederUtil.logErrorMessageByInterval(LOG_MESSAGE_KEY,
-              "Caught exception in read loop. lineNumber=" + lineCount
-                  + ", input=" + getShortDescription(), t, logger, Level.ERROR);
-
-        }
-      }
-    } finally {
-      if (br != null) {
-        logger.info("Closing reader." + getShortDescription() + ", lineCount="
-            + lineCount);
-        try {
-          br.close();
-        } catch (Throwable t) {
-          // ignore
-        }
-      }
-    }
-  }
-
-  static public Object getFileKey(String s3FilePath) {
-    return s3FilePath.toString();
+  protected BufferedReader openLogFile(File logPathFile) throws IOException {
+    String s3AccessKey = getStringValue("s3_access_key");
+    String s3SecretKey = getStringValue("s3_secret_key");
+    BufferedReader br = S3Util.getReader(logPathFile.getPath(), s3AccessKey, s3SecretKey);
+    fileKey = getFileKey(logPathFile);
+    base64FileKey = Base64.byteArrayToBase64(fileKey.toString().getBytes());
+    LOG.info("fileKey=" + fileKey + ", base64=" + base64FileKey + ". " + getShortDescription());
+    return br;
   }
 
   @Override
-  public String getShortDescription() {
-    return "input:source="
-        + getStringValue("source")
-        + ", path="
-        + (s3LogPathFiles != null && s3LogPathFiles.length > 0 ? s3LogPathFiles[0]
-            : getStringValue("path"));
+  protected Object getFileKey(File logFile) {
+    return logFile.getPath();
   }
-
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/1b07a6dd/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/input/InputSimulate.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/input/InputSimulate.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/input/InputSimulate.java
index 5ba56a5..743be69 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/input/InputSimulate.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/input/InputSimulate.java
@@ -18,7 +18,7 @@
  */
 package org.apache.ambari.logfeeder.input;
 
-import java.net.Inet4Address;
+import java.net.InetAddress;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Date;
@@ -66,7 +66,7 @@ public class InputSimulate extends Input {
     
     Filter filter = new FilterJSON();
     filter.setInput(this);
-    setFirstFilter(filter);
+    addFilter(filter);
   }
   
   private List<String> getSimulatedLogTypes() {
@@ -88,23 +88,18 @@ public class InputSimulate extends Input {
     
     return LOG_TEXT_PATTERN.replaceAll("<LOG_MESSAGE_PATTERN>", logMessagePattern);
   }
-  
-  @Override
-  public String getNameForThread() {
-    return "Simulated input";
-  }
 
   @Override
-  public String getShortDescription() {
-    return "Simulated input";
+  public boolean isReady() {
+    return true;
   }
-  
+
   @Override
   void start() throws Exception {
     if (types.isEmpty())
       return;
     
-    getFirstFilter().setOutputMgr(outputMgr);
+    getFirstFilter().setOutputManager(outputManager);
     while (true) {
       String type = imitateRandomLogFile();
       
@@ -129,10 +124,7 @@ public class InputSimulate extends Input {
   }
 
   private InputMarker getInputMarker(String type) throws Exception {
-    InputMarker marker = new InputMarker();
-    marker.input = this;
-    marker.lineNumber = getLineNumber(type);
-    marker.base64FileKey = getBase64FileKey();
+    InputMarker marker = new InputMarker(this, getBase64FileKey(), getLineNumber(type));
     return marker;
   }
 
@@ -147,7 +139,7 @@ public class InputSimulate extends Input {
   }
 
   private String getBase64FileKey() throws Exception {
-    String fileKey = Inet4Address.getLocalHost().getHostAddress() + "|" + filePath;
+    String fileKey = InetAddress.getLocalHost().getHostAddress() + "|" + filePath;
     return Base64.byteArrayToBase64(fileKey.getBytes());
   }
 
@@ -155,4 +147,20 @@ public class InputSimulate extends Input {
     Date d = new Date();
     return String.format(logText, d.getTime(), level, marker.lineNumber);
   }
+
+  @Override
+  public void checkIn(InputMarker inputMarker) {}
+
+  @Override
+  public void lastCheckIn() {}
+  
+  @Override
+  public String getNameForThread() {
+    return "Simulated input";
+  }
+
+  @Override
+  public String getShortDescription() {
+    return "Simulated input";
+  }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/1b07a6dd/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/input/reader/GZIPReader.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/input/reader/GZIPReader.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/input/reader/GZIPReader.java
index a2a9db2..9ccc4f2 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/input/reader/GZIPReader.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/input/reader/GZIPReader.java
@@ -18,7 +18,6 @@
  */
 package org.apache.ambari.logfeeder.input.reader;
 
-import java.io.File;
 import java.io.FileInputStream;
 import java.io.FileNotFoundException;
 import java.io.IOException;
@@ -30,15 +29,11 @@ import org.apache.log4j.Logger;
 
 class GZIPReader extends InputStreamReader {
 
-  private static Logger logger = Logger.getLogger(GZIPReader.class);
+  private static final Logger LOG = Logger.getLogger(GZIPReader.class);
 
   GZIPReader(String fileName) throws FileNotFoundException {
     super(getStream(fileName));
-    logger.info("Created GZIPReader for file : " + fileName);
-  }
-
-  GZIPReader(File file) throws FileNotFoundException {
-    super(getStream(file.getName()));
+    LOG.info("Created GZIPReader for file : " + fileName);
   }
 
   private static InputStream getStream(String fileName) {
@@ -48,7 +43,7 @@ class GZIPReader extends InputStreamReader {
       fileStream = new FileInputStream(fileName);
       gzipStream = new GZIPInputStream(fileStream);
     } catch (Exception e) {
-      logger.error(e, e.getCause());
+      LOG.error(e, e.getCause());
     }
     return gzipStream;
   }
@@ -58,21 +53,13 @@ class GZIPReader extends InputStreamReader {
    */
   static boolean isValidFile(String fileName) {
     // TODO make it generic and put in factory itself
-    InputStream is = null;
-    try {
-      is = new FileInputStream(fileName);
+    
+    try (InputStream is = new FileInputStream(fileName)) {
       byte[] signature = new byte[2];
       int nread = is.read(signature); // read the gzip signature
       return nread == 2 && signature[0] == (byte) 0x1f && signature[1] == (byte) 0x8b;
     } catch (IOException e) {
       return false;
-    } finally {
-      if (is != null) {
-        try {
-          is.close();
-        } catch (IOException e) {
-        }
-      }
     }
   }
 }


[18/58] [abbrv] ambari git commit: AMBARI-18310. Refactor logsearch portal code - part 3 (oleewere)

Posted by ol...@apache.org.
http://git-wip-us.apache.org/repos/asf/ambari/blob/6fa4abfe/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 02309fc..1d4f91f 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
@@ -21,18 +21,14 @@ package org.apache.ambari.logsearch.manager;
 import java.io.IOException;
 import java.text.ParseException;
 import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.Calendar;
 import java.util.Collection;
 import java.util.Date;
 import java.util.GregorianCalendar;
 import java.util.HashMap;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Locale;
 import java.util.Map;
-import java.util.Map.Entry;
 import java.util.TimeZone;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.CopyOnWriteArrayList;
@@ -40,10 +36,9 @@ import java.util.concurrent.CopyOnWriteArrayList;
 import javax.inject.Inject;
 import javax.ws.rs.core.Response;
 
-import org.apache.ambari.logsearch.common.ConfigHelper;
 import org.apache.ambari.logsearch.common.LogSearchConstants;
 import org.apache.ambari.logsearch.common.MessageEnums;
-import org.apache.ambari.logsearch.conf.SolrServiceLogConfig;
+import org.apache.ambari.logsearch.conf.SolrServiceLogPropsConfig;
 import org.apache.ambari.logsearch.dao.ServiceLogsSolrDao;
 import org.apache.ambari.logsearch.graph.GraphDataGenerator;
 import org.apache.ambari.logsearch.model.response.BarGraphData;
@@ -67,7 +62,6 @@ import org.apache.ambari.logsearch.query.model.CommonServiceLogSearchCriteria;
 import org.apache.ambari.logsearch.query.model.ServiceAnyGraphSearchCriteria;
 import org.apache.ambari.logsearch.query.model.ServiceGraphSearchCriteria;
 import org.apache.ambari.logsearch.query.model.ServiceLogExportSearchCriteria;
-import org.apache.ambari.logsearch.query.model.ServiceLogFileSearchCriteria;
 import org.apache.ambari.logsearch.query.model.ServiceLogSearchCriteria;
 import org.apache.ambari.logsearch.query.model.ServiceLogTruncatedSearchCriteria;
 import org.apache.ambari.logsearch.solr.model.SolrComponentTypeLogData;
@@ -117,7 +111,7 @@ public class ServiceLogsManager extends ManagerBase<SolrServiceLogData, ServiceL
   @Inject
   private GraphDataGenerator graphDataGenerator;
   @Inject
-  private SolrServiceLogConfig solrServiceLogConfig;
+  private SolrServiceLogPropsConfig solrServiceLogPropsConfig;
 
   public ServiceLogResponse searchLogs(ServiceLogSearchCriteria searchCriteria) {
     String keyword = searchCriteria.getKeyword();
@@ -406,7 +400,7 @@ public class ServiceLogsManager extends ManagerBase<SolrServiceLogData, ServiceL
     return extensionTree;
   }
 
-  public NodeListResponse getTreeExtension(ServiceLogFileSearchCriteria searchCriteria) {
+  public NodeListResponse getTreeExtension(ServiceLogSearchCriteria searchCriteria) {
     SolrQuery solrQuery = queryGenerator.commonServiceFilterQuery(searchCriteria);
     solrQuery.setParam("event", "/getTreeExtension");
 
@@ -469,7 +463,7 @@ public class ServiceLogsManager extends ManagerBase<SolrServiceLogData, ServiceL
     return list;
   }
 
-  public NodeListResponse getHostListByComponent(ServiceLogFileSearchCriteria searchCriteria) {
+  public NodeListResponse getHostListByComponent(ServiceLogSearchCriteria searchCriteria) {
     SolrQuery solrQuery = queryGenerator.commonServiceFilterQuery(searchCriteria);
     solrQuery.setParam("event", "/service/hosts/components");
 
@@ -529,7 +523,7 @@ public class ServiceLogsManager extends ManagerBase<SolrServiceLogData, ServiceL
     }
   }
 
-  public NameValueDataListResponse getLogsLevelCount(ServiceLogFileSearchCriteria sc) {
+  public NameValueDataListResponse getLogsLevelCount(ServiceLogSearchCriteria sc) {
     NameValueDataListResponse nameValueList = new NameValueDataListResponse();
     SolrQuery query = queryGenerator.commonServiceFilterQuery(sc);
     query.setParam("event", "/service/logs/levels/counts/namevalues");
@@ -1169,7 +1163,7 @@ public class ServiceLogsManager extends ManagerBase<SolrServiceLogData, ServiceL
         return dataList;
       }
 
-      extractValuesFromBuckets(jsonFacetResponse, "x", "y", histogramData);
+      serviceLogsSolrDao.extractValuesFromBuckets(jsonFacetResponse, "x", "y", histogramData);
 
       Collection<NameValueData> vNameValues = new ArrayList<NameValueData>();
       List<BarGraphData> graphDatas = new ArrayList<BarGraphData>();
@@ -1337,19 +1331,6 @@ public class ServiceLogsManager extends ManagerBase<SolrServiceLogData, ServiceL
         isNormalExcluded = true;
       }
 
-      String globalExcludeString = (String) searchCriteria
-          .getParamValue("gEMessage");
-      if (StringUtils.isBlank(globalExcludeString)) {
-        globalExcludeString = "";
-      }
-
-      String globalExclude[] = globalExcludeString
-          .split(LogSearchConstants.I_E_SEPRATOR);
-
-      for (String exc : globalExclude) {
-        excludeString = excludeString + ",\"" + exc + "\"";
-      }
-
       if (!StringUtils.isBlank(excludeString)) {
         if (!isNormalExcluded) {
           excludeString = excludeString.replaceFirst(",", "");
@@ -1387,7 +1368,7 @@ public class ServiceLogsManager extends ManagerBase<SolrServiceLogData, ServiceL
     }
   }
 
-  public NodeListResponse getComponentListWithLevelCounts(ServiceLogFileSearchCriteria searchCriteria) {
+  public NodeListResponse getComponentListWithLevelCounts(ServiceLogSearchCriteria searchCriteria) {
     SolrQuery solrQuery = queryGenerator.commonServiceFilterQuery(searchCriteria);
     solrQuery.setParam("event", "/service/logs/components/levels/counts");
 
@@ -1517,95 +1498,8 @@ public class ServiceLogsManager extends ManagerBase<SolrServiceLogData, ServiceL
     return nameValueList;
   }
 
-  public String getServiceLogsFieldsName() {
-    List<String> fieldsNames = solrServiceLogConfig.getFields();
-    if (fieldsNames.size() > 0) {
-
-      List<String> uiFieldNames = new ArrayList<String>();
-      String temp = null;
-      for (String field : fieldsNames) {
-        temp = solrServiceLogConfig.getSolrAndUiColumns().get(field + LogSearchConstants.SOLR_SUFFIX);
-        if (temp == null){
-          uiFieldNames.add(field);
-        }else{
-          uiFieldNames.add(temp);
-        }
-      }
-      return convertObjToString(uiFieldNames);
-
-    }
-    throw RESTErrorUtil.createRESTException(
-      "No field name found in property file",
-      MessageEnums.DATA_NOT_FOUND);
-
-  }
-
   public String getServiceLogsSchemaFieldsName() {
-
-    List<String> fieldNames = new ArrayList<String>();
-    String excludeArray[] = Arrays.copyOf(solrServiceLogConfig.getExcludeColumnList().toArray(),
-      solrServiceLogConfig.getExcludeColumnList().size(), String[].class);
-
-    HashMap<String, String> uiFieldColumnMapping = new LinkedHashMap<String, String>();
-    ConfigHelper.getSchemaFieldsName(excludeArray, fieldNames,serviceLogsSolrDao);
-
-    for (String fieldName : fieldNames) {
-      String uiField = solrServiceLogConfig.getSolrAndUiColumns().get(fieldName + LogSearchConstants.SOLR_SUFFIX);
-      if (uiField != null) {
-        uiFieldColumnMapping.put(fieldName, uiField);
-      } else {
-        uiFieldColumnMapping.put(fieldName, fieldName);
-      }
-    }
-
-    HashMap<String, String> uiFieldColumnMappingSorted = new LinkedHashMap<String, String>();
-    uiFieldColumnMappingSorted.put(LogSearchConstants.SOLR_LOG_MESSAGE, LogSearchConstants.SOLR_LOG_MESSAGE);
-
-    Iterator<Entry<String, String>> it = BizUtil
-        .sortHashMapByValues(uiFieldColumnMapping).entrySet().iterator();
-    while (it.hasNext()) {
-      @SuppressWarnings("rawtypes")
-      Map.Entry pair = (Map.Entry) it.next();
-      uiFieldColumnMappingSorted.put("" + pair.getKey(), "" + pair.getValue());
-    }
-
-    return convertObjToString(uiFieldColumnMappingSorted);
-
-  }
-
-  @SuppressWarnings("unchecked")
-  public void extractValuesFromBuckets(
-    SimpleOrderedMap<Object> jsonFacetResponse, String outerField,
-    String innerField, List<BarGraphData> histogramData) {
-    NamedList<Object> stack = (NamedList<Object>) jsonFacetResponse
-      .get(outerField);
-    ArrayList<Object> stackBuckets = (ArrayList<Object>) stack
-      .get("buckets");
-    for (Object temp : stackBuckets) {
-      BarGraphData vBarGraphData = new BarGraphData();
-
-      SimpleOrderedMap<Object> level = (SimpleOrderedMap<Object>) temp;
-      String name = ((String) level.getVal(0)).toUpperCase();
-      vBarGraphData.setName(name);
-
-      Collection<NameValueData> vNameValues = new ArrayList<NameValueData>();
-      vBarGraphData.setDataCount(vNameValues);
-      ArrayList<Object> levelBuckets = (ArrayList<Object>) ((NamedList<Object>) level
-        .get(innerField)).get("buckets");
-      for (Object temp1 : levelBuckets) {
-        SimpleOrderedMap<Object> countValue = (SimpleOrderedMap<Object>) temp1;
-        String value = DateUtil
-          .convertDateWithMillisecondsToSolrDate((Date) countValue
-            .getVal(0));
-
-        String count = "" + countValue.getVal(1);
-        NameValueData vNameValue = new NameValueData();
-        vNameValue.setName(value);
-        vNameValue.setValue(count);
-        vNameValues.add(vNameValue);
-      }
-      histogramData.add(vBarGraphData);
-    }
+    return convertObjToString(serviceLogsSolrDao.schemaFieldNameMap);
   }
 
   public BarGraphDataListResponse getAnyGraphData(ServiceAnyGraphSearchCriteria searchCriteria) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/6fa4abfe/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/manager/UserConfigManager.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/manager/UserConfigManager.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/manager/UserConfigManager.java
index 7430770..6772138 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/manager/UserConfigManager.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/manager/UserConfigManager.java
@@ -53,7 +53,6 @@ import javax.inject.Inject;
 public class UserConfigManager extends JsonManagerBase {
 
   private static final Logger logger = Logger.getLogger(UserConfigManager.class);
-
   @Inject
   private UserConfigSolrDao userConfigSolrDao;
   @Inject

http://git-wip-us.apache.org/repos/asf/ambari/blob/6fa4abfe/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/LogFileParamDefinition.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/LogFileParamDefinition.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/LogFileParamDefinition.java
deleted file mode 100644
index c355989..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/LogFileParamDefinition.java
+++ /dev/null
@@ -1,45 +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.model.request;
-
-import io.swagger.annotations.ApiParam;
-import org.apache.ambari.logsearch.common.LogSearchConstants;
-
-import static org.apache.ambari.logsearch.doc.DocConstants.LogFileDescriptions.COMPONENT_D;
-import static org.apache.ambari.logsearch.doc.DocConstants.LogFileDescriptions.HOST_D;
-import static org.apache.ambari.logsearch.doc.DocConstants.LogFileDescriptions.LOG_TYPE_D;
-
-
-public interface LogFileParamDefinition {
-
-  String getComponent();
-
-  @ApiParam(value = COMPONENT_D, name = LogSearchConstants.REQUEST_PARAM_COMPONENT)
-  void setComponent(String component);
-
-  String getHost();
-
-  @ApiParam(value = HOST_D, name = LogSearchConstants.REQUEST_PARAM_HOST)
-  void setHost(String host);
-
-  String getLogType();
-
-  @ApiParam(value = LOG_TYPE_D, name = LogSearchConstants.REQUEST_PARAM_LOG_TYPE)
-  void setLogType(String logType);
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/6fa4abfe/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/LogFileTailParamDefinition.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/LogFileTailParamDefinition.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/LogFileTailParamDefinition.java
deleted file mode 100644
index a527c48..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/LogFileTailParamDefinition.java
+++ /dev/null
@@ -1,32 +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.model.request;
-
-import io.swagger.annotations.ApiParam;
-import org.apache.ambari.logsearch.common.LogSearchConstants;
-
-import static org.apache.ambari.logsearch.doc.DocConstants.LogFileDescriptions.TAIL_SIZE_D;
-
-public interface LogFileTailParamDefinition {
-
-  String getTailSize();
-
-  @ApiParam(value = TAIL_SIZE_D, name = LogSearchConstants.REQUEST_PARAM_TAIL_SIZE)
-  void setTailSize(String tailSize);
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/6fa4abfe/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/LogParamDefinition.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/LogParamDefinition.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/LogParamDefinition.java
index e503ff5..e44de35 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/LogParamDefinition.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/LogParamDefinition.java
@@ -20,10 +20,7 @@ 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.CommonDescriptions.COLUMN_QUERY_D;
 import static org.apache.ambari.logsearch.doc.DocConstants.CommonDescriptions.I_MESSAGE_D;
-import static org.apache.ambari.logsearch.doc.DocConstants.CommonDescriptions.G_E_MESSAGE_D;
 import static org.apache.ambari.logsearch.doc.DocConstants.CommonDescriptions.MUST_BE_D;
 import static org.apache.ambari.logsearch.doc.DocConstants.CommonDescriptions.MUST_NOT_D;
 import static org.apache.ambari.logsearch.doc.DocConstants.CommonDescriptions.INCLUDE_QUERY_D;
@@ -31,21 +28,11 @@ import static org.apache.ambari.logsearch.doc.DocConstants.CommonDescriptions.EX
 
 public interface LogParamDefinition {
 
-  String getColumnQuery();
-
-  @ApiParam(value = COLUMN_QUERY_D, name = LogSearchConstants.REQUEST_PARAM_COLUMN_QUERY)
-  void setColumnQuery(String columnQuery);
-
   String getiMessage();
 
   @ApiParam(value = I_MESSAGE_D, name = LogSearchConstants.REQUEST_PARAM_I_MESSAGE)
   void setiMessage(String iMessage);
 
-  String getgEMessage();
-
-  @ApiParam(value = G_E_MESSAGE_D, name = LogSearchConstants.REQUEST_PARAM_G_E_MESSAGE)
-  void setgEMessage(String gEMessage);
-
   String getMustBe();
 
   @ApiParam(value = MUST_BE_D, name = LogSearchConstants.REQUEST_PARAM_MUST_BE)

http://git-wip-us.apache.org/repos/asf/ambari/blob/6fa4abfe/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/ServiceLogFileParamDefinition.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/ServiceLogFileParamDefinition.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/ServiceLogFileParamDefinition.java
deleted file mode 100644
index a266b3e..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/ServiceLogFileParamDefinition.java
+++ /dev/null
@@ -1,38 +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.model.request;
-
-import io.swagger.annotations.ApiParam;
-import org.apache.ambari.logsearch.common.LogSearchConstants;
-
-import static org.apache.ambari.logsearch.doc.DocConstants.ServiceDescriptions.HOST_D;
-import static org.apache.ambari.logsearch.doc.DocConstants.ServiceDescriptions.COMPONENT_D;
-
-public interface ServiceLogFileParamDefinition {
-
-  String getHostLogFile();
-
-  @ApiParam(value = HOST_D, name = LogSearchConstants.REQUEST_PARAM_HOST_LOG_FILE)
-  void setHostLogFile(String hostLogFile);
-
-  String getComponentLogFile();
-
-  @ApiParam(value = COMPONENT_D, name = LogSearchConstants.REQUEST_PARAM_COMPONENT_LOG_FILE)
-  void setComponentLogFile(String componentLogFile);
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/6fa4abfe/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 f280ac2..abc1f08 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
@@ -22,8 +22,6 @@ import io.swagger.annotations.ApiParam;
 import org.apache.ambari.logsearch.common.LogSearchConstants;
 
 import static org.apache.ambari.logsearch.doc.DocConstants.ServiceDescriptions.LEVEL_D;
-import static org.apache.ambari.logsearch.doc.DocConstants.ServiceDescriptions.ADVANCED_SEARCH_D;
-import static org.apache.ambari.logsearch.doc.DocConstants.ServiceDescriptions.TREE_PARAMS_D;
 import static org.apache.ambari.logsearch.doc.DocConstants.CommonDescriptions.E_MESSAGE_D;
 import static org.apache.ambari.logsearch.doc.DocConstants.ServiceDescriptions.G_MUST_NOT_D;
 import static org.apache.ambari.logsearch.doc.DocConstants.ServiceDescriptions.HOST_NAME_D;
@@ -38,26 +36,11 @@ public interface ServiceLogParamDefinition {
   @ApiParam(value = LEVEL_D, name = LogSearchConstants.REQUEST_PARAM_LEVEL)
   void setLevel(String level);
 
-  String getAdvancedSearch();
-
-  @ApiParam(value = ADVANCED_SEARCH_D, name = LogSearchConstants.REQUEST_PARAM_ADVANCED_SEARCH)
-  void setAdvancedSearch(String advancedSearch);
-
-  String getTreeParams();
-
-  @ApiParam(value = TREE_PARAMS_D, name = LogSearchConstants.REQUEST_PARAM_TREE_PARAMS)
-  void setTreeParams(String treeParams);
-
   String geteMessage();
 
   @ApiParam(value = E_MESSAGE_D, name = LogSearchConstants.REQUEST_PARAM_E_MESSAGE)
   void seteMessage(String eMessage);
 
-  String getgMustNot();
-
-  @ApiParam(value = G_MUST_NOT_D, name = LogSearchConstants.REQUEST_PARAM_G_MUST_NOT)
-  void setgMustNot(String gMustNot);
-
   String getHostName();
 
   @ApiParam(value = HOST_NAME_D, name = LogSearchConstants.REQUEST_PARAM_HOST_NAME)

http://git-wip-us.apache.org/repos/asf/ambari/blob/6fa4abfe/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/BaseLogRequest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/BaseLogRequest.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/BaseLogRequest.java
index 5a96991..1371350 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/BaseLogRequest.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/BaseLogRequest.java
@@ -25,15 +25,10 @@ import org.apache.ambari.logsearch.model.request.LogParamDefinition;
 import javax.ws.rs.QueryParam;
 
 public class BaseLogRequest extends QueryRequest implements LogParamDefinition {
-  @QueryParam(LogSearchConstants.REQUEST_PARAM_COLUMN_QUERY)
-  private String columnQuery;
 
   @QueryParam(LogSearchConstants.REQUEST_PARAM_I_MESSAGE)
   private String iMessage;
 
-  @QueryParam(LogSearchConstants.REQUEST_PARAM_G_E_MESSAGE)
-  private String gEMessage;
-
   @QueryParam(LogSearchConstants.REQUEST_PARAM_MUST_BE)
   private String mustBe;
 
@@ -47,16 +42,6 @@ public class BaseLogRequest extends QueryRequest implements LogParamDefinition {
   private String includeQuery;
 
   @Override
-  public String getColumnQuery() {
-    return columnQuery;
-  }
-
-  @Override
-  public void setColumnQuery(String columnQuery) {
-    this.columnQuery = columnQuery;
-  }
-
-  @Override
   public String getiMessage() {
     return iMessage;
   }
@@ -67,16 +52,6 @@ public class BaseLogRequest extends QueryRequest implements LogParamDefinition {
   }
 
   @Override
-  public String getgEMessage() {
-    return gEMessage;
-  }
-
-  @Override
-  public void setgEMessage(String gEMessage) {
-    this.gEMessage = gEMessage;
-  }
-
-  @Override
   public String getMustBe() {
     return mustBe;
   }

http://git-wip-us.apache.org/repos/asf/ambari/blob/6fa4abfe/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 ba4f4a8..5770ba6 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
@@ -31,18 +31,9 @@ public class BaseServiceLogRequest extends BaseLogRequest
   @QueryParam(LogSearchConstants.REQUEST_PARAM_LEVEL)
   private String level;
 
-  @QueryParam(LogSearchConstants.REQUEST_PARAM_ADVANCED_SEARCH)
-  private String advancedSearch;
-
-  @QueryParam(LogSearchConstants.REQUEST_PARAM_TREE_PARAMS)
-  private String treeParams;
-
   @QueryParam(LogSearchConstants.REQUEST_PARAM_E_MESSAGE)
   private String eMessage;
 
-  @QueryParam(LogSearchConstants.REQUEST_PARAM_G_MUST_NOT)
-  private String gMustNot;
-
   @QueryParam(LogSearchConstants.REQUEST_PARAM_HOST_NAME)
   private String hostName;
 
@@ -75,26 +66,6 @@ public class BaseServiceLogRequest extends BaseLogRequest
   }
 
   @Override
-  public String getAdvancedSearch() {
-    return advancedSearch;
-  }
-
-  @Override
-  public void setAdvancedSearch(String advancedSearch) {
-    this.advancedSearch = advancedSearch;
-  }
-
-  @Override
-  public String getTreeParams() {
-    return treeParams;
-  }
-
-  @Override
-  public void setTreeParams(String treeParams) {
-    this.treeParams = treeParams;
-  }
-
-  @Override
   public String geteMessage() {
     return eMessage;
   }
@@ -105,16 +76,6 @@ public class BaseServiceLogRequest extends BaseLogRequest
   }
 
   @Override
-  public String getgMustNot() {
-    return gMustNot;
-  }
-
-  @Override
-  public void setgMustNot(String gMustNot) {
-    this.gMustNot = gMustNot;
-  }
-
-  @Override
   public String getHostName() {
     return hostName;
   }

http://git-wip-us.apache.org/repos/asf/ambari/blob/6fa4abfe/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/LogFileRequest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/LogFileRequest.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/LogFileRequest.java
deleted file mode 100644
index 78c5b33..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/LogFileRequest.java
+++ /dev/null
@@ -1,67 +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.model.request.impl;
-
-import org.apache.ambari.logsearch.common.LogSearchConstants;
-import org.apache.ambari.logsearch.model.request.LogFileParamDefinition;
-import org.apache.ambari.logsearch.model.request.SearchRequest;
-
-import javax.ws.rs.QueryParam;
-
-public class LogFileRequest implements SearchRequest, LogFileParamDefinition {
-
-  @QueryParam(LogSearchConstants.REQUEST_PARAM_COMPONENT)
-  private String component;
-
-  @QueryParam(LogSearchConstants.REQUEST_PARAM_HOST)
-  private String host;
-
-  @QueryParam(LogSearchConstants.REQUEST_PARAM_LOG_TYPE)
-  private String logType;
-
-  @Override
-  public String getComponent() {
-    return component;
-  }
-
-  @Override
-  public void setComponent(String component) {
-    this.component = component;
-  }
-
-  @Override
-  public String getHost() {
-    return host;
-  }
-
-  @Override
-  public void setHost(String host) {
-    this.host = host;
-  }
-
-  @Override
-  public String getLogType() {
-    return logType;
-  }
-
-  @Override
-  public void setLogType(String logType) {
-    this.logType = logType;
-  }
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/6fa4abfe/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/LogFileTailRequest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/LogFileTailRequest.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/LogFileTailRequest.java
deleted file mode 100644
index d5b91ab..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/LogFileTailRequest.java
+++ /dev/null
@@ -1,40 +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.model.request.impl;
-
-import org.apache.ambari.logsearch.common.LogSearchConstants;
-import org.apache.ambari.logsearch.model.request.LogFileTailParamDefinition;
-
-import javax.ws.rs.QueryParam;
-
-public class LogFileTailRequest extends LogFileRequest implements LogFileTailParamDefinition {
-
-  @QueryParam(LogSearchConstants.REQUEST_PARAM_TAIL_SIZE)
-  private String tailSize;
-
-  @Override
-  public String getTailSize() {
-    return tailSize;
-  }
-
-  @Override
-  public void setTailSize(String tailSize) {
-    this.tailSize = tailSize;
-  }
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/6fa4abfe/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/ServiceGraphRequest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/ServiceGraphRequest.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/ServiceGraphRequest.java
index 1618aa1..57884b7 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/ServiceGraphRequest.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/ServiceGraphRequest.java
@@ -23,7 +23,7 @@ import org.apache.ambari.logsearch.model.request.UnitParamDefinition;
 
 import javax.ws.rs.QueryParam;
 
-public class ServiceGraphRequest extends ServiceLogFileRequest implements UnitParamDefinition {
+public class ServiceGraphRequest extends ServiceLogRequest implements UnitParamDefinition {
 
   @QueryParam(LogSearchConstants.REQUEST_PARAM_UNIT)
   private String unit;

http://git-wip-us.apache.org/repos/asf/ambari/blob/6fa4abfe/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/ServiceLogExportRequest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/ServiceLogExportRequest.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/ServiceLogExportRequest.java
index 6ae0dc9..16300ce 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/ServiceLogExportRequest.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/ServiceLogExportRequest.java
@@ -24,7 +24,7 @@ import org.apache.ambari.logsearch.model.request.UtcOffsetParamDefinition;
 
 import javax.ws.rs.QueryParam;
 
-public class ServiceLogExportRequest extends ServiceLogFileRequest implements FormatParamDefinition, UtcOffsetParamDefinition {
+public class ServiceLogExportRequest extends ServiceLogRequest implements FormatParamDefinition, UtcOffsetParamDefinition {
 
   @QueryParam(LogSearchConstants.REQUEST_PARAM_FORMAT)
   private String format;

http://git-wip-us.apache.org/repos/asf/ambari/blob/6fa4abfe/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/ServiceLogFileRequest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/ServiceLogFileRequest.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/ServiceLogFileRequest.java
deleted file mode 100644
index 6c7078a..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/ServiceLogFileRequest.java
+++ /dev/null
@@ -1,54 +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.model.request.impl;
-
-import io.swagger.annotations.ApiParam;
-import org.apache.ambari.logsearch.common.LogSearchConstants;
-import org.apache.ambari.logsearch.model.request.ServiceLogFileParamDefinition;
-
-import javax.ws.rs.QueryParam;
-
-public class ServiceLogFileRequest extends BaseServiceLogRequest implements ServiceLogFileParamDefinition {
-
-  @QueryParam(LogSearchConstants.REQUEST_PARAM_HOST_LOG_FILE)
-  private String hostLogFile;
-
-  @QueryParam(LogSearchConstants.REQUEST_PARAM_COMPONENT_LOG_FILE)
-  private String componentLogFile;
-
-  @Override
-  public String getHostLogFile() {
-    return hostLogFile;
-  }
-
-  @Override
-  public void setHostLogFile(String hostLogFile) {
-    this.hostLogFile = hostLogFile;
-  }
-
-  @Override
-  public String getComponentLogFile() {
-    return componentLogFile;
-  }
-
-  @Override
-  public void setComponentLogFile(String componentLogFile) {
-    this.componentLogFile = componentLogFile;
-  }
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/6fa4abfe/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/ServiceLogRequest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/ServiceLogRequest.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/ServiceLogRequest.java
index 9a46de3..fe36ad8 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/ServiceLogRequest.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/ServiceLogRequest.java
@@ -24,7 +24,7 @@ import org.apache.ambari.logsearch.model.request.ServiceLogSearchParamDefinition
 
 import javax.ws.rs.QueryParam;
 
-public class ServiceLogRequest extends ServiceLogFileRequest implements ServiceLogSearchParamDefinition, LastPageParamDefinition {
+public class ServiceLogRequest extends BaseServiceLogRequest implements ServiceLogSearchParamDefinition, LastPageParamDefinition {
 
   @QueryParam(LogSearchConstants.REQUEST_PARAM_KEYWORD)
   private String keyWord;

http://git-wip-us.apache.org/repos/asf/ambari/blob/6fa4abfe/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/ServiceLogTruncatedRequest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/ServiceLogTruncatedRequest.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/ServiceLogTruncatedRequest.java
index 516c328..8067896 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/ServiceLogTruncatedRequest.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/ServiceLogTruncatedRequest.java
@@ -23,7 +23,7 @@ import org.apache.ambari.logsearch.model.request.LogTruncatedParamDefinition;
 
 import javax.ws.rs.QueryParam;
 
-public class ServiceLogTruncatedRequest extends ServiceLogFileRequest implements LogTruncatedParamDefinition {
+public class ServiceLogTruncatedRequest extends ServiceLogRequest implements LogTruncatedParamDefinition {
 
   @QueryParam(LogSearchConstants.REQUEST_PARAM_ID)
   private String id;

http://git-wip-us.apache.org/repos/asf/ambari/blob/6fa4abfe/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/QueryGeneration.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/QueryGeneration.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/QueryGeneration.java
index 9ea29c2..8095faf 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/QueryGeneration.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/QueryGeneration.java
@@ -23,14 +23,11 @@ import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Locale;
-import java.util.regex.Pattern;
 
-import org.apache.ambari.logsearch.common.ConfigHelper;
 import org.apache.ambari.logsearch.common.LogSearchConstants;
 import org.apache.ambari.logsearch.common.PropertiesHelper;
-import org.apache.ambari.logsearch.conf.SolrAuditLogConfig;
-import org.apache.ambari.logsearch.conf.SolrServiceLogConfig;
-import org.apache.ambari.logsearch.query.model.AuditLogSearchCriteria;
+import org.apache.ambari.logsearch.conf.SolrAuditLogPropsConfig;
+import org.apache.ambari.logsearch.conf.SolrServiceLogPropsConfig;
 import org.apache.ambari.logsearch.query.model.CommonSearchCriteria;
 import org.apache.ambari.logsearch.query.model.CommonServiceLogSearchCriteria;
 import org.apache.ambari.logsearch.query.model.SearchCriteria;
@@ -57,20 +54,18 @@ public class QueryGeneration extends QueryGenerationBase {
   private static Logger logger = Logger.getLogger(QueryGeneration.class);
 
   @Inject
-  private SolrServiceLogConfig solrServiceLogConfig;
+  private SolrServiceLogPropsConfig solrServiceLogPropsConfig;
 
   @Inject
-  private SolrAuditLogConfig solrAuditLogConfig;
+  private SolrAuditLogPropsConfig solrAuditLogPropsConfig;
 
   public SolrQuery commonServiceFilterQuery(CommonServiceLogSearchCriteria searchCriteria) {
     LogType logType = LogType.SERVICE;
     SolrQuery solrQuery = new SolrQuery();
-    String advQuery = (String) searchCriteria.getParamValue("advanceSearch"); // TODO: check these are used from the UI or not
-    String gEmessage = (String) searchCriteria.getParamValue("gEMessage");
+    // TODO: check these are used from the UI or not
     String globalExcludeComp = (String) searchCriteria.getParamValue("gMustNot");
     String unselectedComp = (String) searchCriteria.getParamValue("unselectComp");
 
-    String treeParams = searchCriteria.getTreeParams();
     String givenQuery = (String) searchCriteria.getParamValue("q");
     String level = searchCriteria.getLevel();
     String startTime = searchCriteria.getFrom();
@@ -82,37 +77,15 @@ public class QueryGeneration extends QueryGenerationBase {
     String urlHostName = searchCriteria.getHostName();
     String urlComponentName = searchCriteria.getComponentName();
     String file_name = searchCriteria.getFileName();
-    // build advance query
-    if (!StringUtils.isBlank(advQuery)) {
-      String advQueryParameters[] = advQuery.split(Pattern.quote("}{"));
-      SolrQuery advSolrQuery = new SolrQuery();
-      for (String queryParam : advQueryParameters) {
-        String params[] = queryParam.split(Pattern.quote("="));
-        if (params.length > 1)
-          advSolrQuery.setParam(params[0], params[1]);
-      }
-      setFilterClauseWithFieldName(advSolrQuery, level, LogSearchConstants.SOLR_LEVEL, "", Condition.OR);
-      setSingleRangeFilter(advSolrQuery, LogSearchConstants.LOGTIME, startTime, endTime);
-      setFilterClauseWithFieldName(advSolrQuery, unselectedComp, LogSearchConstants.SOLR_COMPONENT, LogSearchConstants.MINUS_OPERATOR,
-          Condition.AND);
-      setFilterClauseWithFieldName(advSolrQuery, selectedComp, LogSearchConstants.SOLR_COMPONENT, LogSearchConstants.NO_OPERATOR,
-          Condition.OR);
-
-      setPagination(advSolrQuery, searchCriteria);
-
-      return advSolrQuery;
-    }
 
     SolrUtil.setMainQuery(solrQuery, givenQuery);
 
     setSingleRangeFilter(solrQuery, LogSearchConstants.LOGTIME, startTime, endTime);
     addFilter(solrQuery, selectedComp, LogSearchConstants.SOLR_COMPONENT, Condition.OR);
-    addFilterQueryFromArray(solrQuery, treeParams, LogSearchConstants.SOLR_HOST, Condition.OR);
 
     setFilterClauseWithFieldName(solrQuery, level, LogSearchConstants.SOLR_LEVEL, LogSearchConstants.NO_OPERATOR, Condition.OR);
 
     setFilterClauseForSolrSearchableString(solrQuery, iMessage, Condition.OR, LogSearchConstants.NO_OPERATOR, LogSearchConstants.SOLR_KEY_LOG_MESSAGE);
-    setFilterClauseForSolrSearchableString(solrQuery, gEmessage, Condition.AND, LogSearchConstants.MINUS_OPERATOR, LogSearchConstants.SOLR_KEY_LOG_MESSAGE);
     setFilterClauseForSolrSearchableString(solrQuery, eMessage, Condition.AND, LogSearchConstants.MINUS_OPERATOR, LogSearchConstants.SOLR_KEY_LOG_MESSAGE);
 
     applyLogFileFilter(solrQuery, searchCriteria);
@@ -156,35 +129,24 @@ public class QueryGeneration extends QueryGenerationBase {
   private void setUserSpecificFilter(SearchCriteria searchCriteria, SolrQuery solrQuery, String paramName, String operation,
       LogType logType) {
     String queryString = (String) searchCriteria.getParamValue(paramName);
-    String columnQuery = (String) searchCriteria.getParamValue(LogSearchConstants.COLUMN_QUERY);
     if (StringUtils.isBlank(queryString)) {
       queryString = null;
     }
-    if (!StringUtils.isBlank(columnQuery) && StringUtils.isBlank(queryString) && !paramName.equals(LogSearchConstants.EXCLUDE_QUERY)) {
-      queryString = columnQuery;
-    }
     List<String> conditionQuries = new ArrayList<String>();
     List<String> referalConditionQuries = new ArrayList<String>();
     List<String> elments = new ArrayList<String>();
     List<HashMap<String, Object>> queryList = JSONUtil.jsonToMapObjectList(queryString);
     if (queryList != null && queryList.size() > 0) {
-      if (!StringUtils.isBlank(columnQuery) && !columnQuery.equals(queryString) && !paramName.equals(LogSearchConstants.EXCLUDE_QUERY)) {
-        List<HashMap<String, Object>> columnQueryList = JSONUtil.jsonToMapObjectList(columnQuery);
-        if (columnQueryList != null && columnQueryList.size() > 0) {
-          queryList.addAll(columnQueryList);
-        }
-      }
       for (HashMap<String, Object> columnListMap : queryList) {
         String orQuery = "";
         StringBuilder field = new StringBuilder();
         if (columnListMap != null) {
           for (String key : columnListMap.keySet()) {
-            if (!StringUtils.isBlank(key)) {
-              String originalKey = getOriginalKey(key, logType);
-              String value = getOriginalValue(originalKey, "" + columnListMap.get(key));
-              orQuery = putWildCardByType(value, originalKey, logType);
+            if (!StringUtils.isBlank(key)) {;
+              String value = getOriginalValue(key, "" + columnListMap.get(key));
+              orQuery = putWildCardByType(value, key, logType);
               if (StringUtils.isBlank(orQuery)) {
-                logger.debug("Removing invalid filter for key :"+originalKey +" and value :" +value );
+                logger.debug("Removing invalid filter for key :"+key +" and value :" +value );
                 continue;
               }
               boolean isSame = false;
@@ -193,17 +155,17 @@ public class QueryGeneration extends QueryGenerationBase {
               }
               if (isSame && !operation.equals(LogSearchConstants.EXCLUDE_QUERY)) {
                 for (String tempCondition : conditionQuries) {
-                  if (tempCondition.contains(originalKey)) {
+                  if (tempCondition.contains(key)) {
                     String newCondtion = tempCondition + " " + Condition.OR.name() + " " + orQuery;
                     referalConditionQuries.remove(tempCondition);
                     referalConditionQuries.add(newCondtion);
                   }
                 }
-                conditionQuries.removeAll(conditionQuries);
+                conditionQuries.clear();
                 conditionQuries.addAll(referalConditionQuries);
               } else {
-                conditionQuries.add(orQuery.toString());
-                referalConditionQuries.add(orQuery.toString());
+                conditionQuries.add(orQuery);
+                referalConditionQuries.add(orQuery);
               }
               field.append(key);
               elments.add(field.toString());
@@ -213,7 +175,7 @@ public class QueryGeneration extends QueryGenerationBase {
       }
     }
     if (!referalConditionQuries.isEmpty() && !StringUtils.isBlank(operation)) {
-      if (operation.equals(LogSearchConstants.INCLUDE_QUERY) || operation.equals(LogSearchConstants.COLUMN_QUERY)) {
+      if (operation.equals(LogSearchConstants.INCLUDE_QUERY)) {
         for (String filter : referalConditionQuries) {
           if (!StringUtils.isBlank(filter)) {
             solrQuery.addFilterQuery(filter);
@@ -235,17 +197,12 @@ public class QueryGeneration extends QueryGenerationBase {
     SolrQuery solrQuery = new SolrQuery();
     solrQuery.setQuery("*:*");
 
-    String globalExcludeComp = (String) searchCriteria.getParamValue("gMustNot"); // TODO: check this are used from UI or not
-    String unselectedComp = (String) searchCriteria.getParamValue("unselectComp");
-
     String startTime = searchCriteria.getStartTime();
     String endTime = searchCriteria.getEndTime();
     String selectedComp = searchCriteria.getMustBe();
     setFilterClauseWithFieldName(solrQuery, selectedComp, LogSearchConstants.AUDIT_COMPONENT, LogSearchConstants.NO_OPERATOR, Condition.OR);
     setUserSpecificFilter(searchCriteria, solrQuery, LogSearchConstants.INCLUDE_QUERY, LogSearchConstants.INCLUDE_QUERY, logType);
     setUserSpecificFilter(searchCriteria, solrQuery, LogSearchConstants.EXCLUDE_QUERY, LogSearchConstants.EXCLUDE_QUERY, logType);
-    setFilterClauseWithFieldName(solrQuery, globalExcludeComp, LogSearchConstants.AUDIT_COMPONENT, LogSearchConstants.MINUS_OPERATOR, Condition.AND);
-    setFilterClauseWithFieldName(solrQuery, unselectedComp, LogSearchConstants.AUDIT_COMPONENT, LogSearchConstants.MINUS_OPERATOR, Condition.AND);
     setSingleRangeFilter(solrQuery, LogSearchConstants.AUDIT_EVTTIME, startTime, endTime);
     setPagination(solrQuery, searchCriteria);
     try {
@@ -266,11 +223,11 @@ public class QueryGeneration extends QueryGenerationBase {
     SolrDaoBase solrDaoBase = null;
     switch (logType) {
     case AUDIT:
-      fieldType = auditSolrDao.schemaFieldsNameMap.get(key);
+      fieldType = auditSolrDao.schemaFieldNameMap.get(key);
       solrDaoBase = auditSolrDao;
       break;
     case SERVICE:
-      fieldType = serviceLogsSolrDao.schemaFieldsNameMap.get(key);
+      fieldType = serviceLogsSolrDao.schemaFieldNameMap.get(key);
       solrDaoBase = serviceLogsSolrDao;
       if (key.equalsIgnoreCase(LogSearchConstants.SOLR_LOG_MESSAGE)) {
         return SolrUtil.escapeForLogMessage(key, str);
@@ -338,7 +295,7 @@ public class QueryGeneration extends QueryGenerationBase {
     }
     try {
       String propertyFieldMappings[] = solrValue.split(LogSearchConstants.LIST_SEPARATOR);
-      if (propertyFieldMappings != null && propertyFieldMappings.length > 0) {
+      if (propertyFieldMappings.length > 0) {
         HashMap<String, String> propertyFieldValue = new HashMap<String, String>();
         for (String temp : propertyFieldMappings) {
           if (!StringUtils.isBlank(temp)) {
@@ -361,24 +318,7 @@ public class QueryGeneration extends QueryGenerationBase {
     return value;
   }
 
-  private String getOriginalKey(String key, LogType logType) {
-    String originalKey;
-    switch (logType) {
-    case AUDIT:
-      originalKey = solrAuditLogConfig.getSolrAndUiColumns().get(key + LogSearchConstants.UI_SUFFIX);
-      break;
-    case SERVICE:
-      originalKey = solrServiceLogConfig.getSolrAndUiColumns().get(key + LogSearchConstants.UI_SUFFIX);
-      break;
-    default:
-      originalKey = null;
-    }
-    if (StringUtils.isBlank(originalKey)) {
-      return key;
-    }
-    return originalKey;
-  }
-  
+
   private boolean checkTokenizer(String fieldType, Class tokenizerFactoryClass, SolrDaoBase solrDaoBase) {
     HashMap<String, Object> fieldTypeMap = SolrUtil.getFieldTypeInfoMap(fieldType,solrDaoBase);
     HashMap<String, Object> analyzer = (HashMap<String, Object>) fieldTypeMap.get("analyzer");

http://git-wip-us.apache.org/repos/asf/ambari/blob/6fa4abfe/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/QueryGenerationBase.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/QueryGenerationBase.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/QueryGenerationBase.java
index d7d30d7..536f41c 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/QueryGenerationBase.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/QueryGenerationBase.java
@@ -271,34 +271,6 @@ public abstract class QueryGenerationBase {
     return "";
   }
 
-  protected void addFilterQueryFromArray(SolrQuery solrQuery, String jsonArrStr, String solrFieldName, Condition condition) {
-    if (!StringUtils.isBlank(jsonArrStr) && condition != null && solrQuery != null) {
-      Gson gson = new Gson();
-      String[] arr = null;
-      try {
-        arr = gson.fromJson(jsonArrStr, String[].class);
-      } catch (Exception exception) {
-        logger.error("Invaild json array:" + jsonArrStr);
-        return;
-      }
-      String query;;
-      switch (condition) {
-      case OR:
-        query = SolrUtil.orList(solrFieldName, arr,"");
-        break;
-      case AND:
-        query = SolrUtil.andList(solrFieldName, arr, "");
-        break;
-      default:
-        query=null;
-        logger.error("Invalid condition :" + condition.name());
-      }
-      if (!StringUtils.isBlank(query)) {
-        solrQuery.addFilterQuery(query);
-      }
-    }
-  }
-
   protected void addFilter(SolrQuery solrQuery, String paramValue, String solrFieldName, Condition condition) {
     String filterQuery = buildListQuery(paramValue, solrFieldName, condition);
     if (!StringUtils.isBlank(filterQuery)) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/6fa4abfe/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/SearchCriteriaConstants.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/SearchCriteriaConstants.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/SearchCriteriaConstants.java
index c67d3cd..3c4df76 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/SearchCriteriaConstants.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/SearchCriteriaConstants.java
@@ -45,21 +45,13 @@ public class SearchCriteriaConstants {
   public static final String PARAM_FROM = "from";
   public static final String PARAM_TO = "to";
 
-  public static final String PARAM_LOG_FILE_COMPONENT = "component";
-  public static final String PARAM_LOG_FILE_HOST = "host";
-  public static final String PARAM_LOG_FILE_TYPE = "logType";
-  public static final String PARAM_LOG_TAIL_SIZE = "tailSize";
-
   public static final String PARAM_COMPONENT_NAME = "component_name";
   public static final String PARAM_HOST_NAME = "host_name";
   public static final String PARAM_FILE_NAME = "file_name";
   public static final String PARAM_BUNDLE_ID = "bundle_id";
   public static final String PARAM_SELECT_COMP = "selectComp";
   public static final String PARAM_LEVEL = "level";
-  public static final String PARAM_TREE_PARAMS = "treeParams";
 
-  public static final String PARAM_HOST_LOG_FILE = "hostLogFile";
-  public static final String PARAM_COMPONENT_LOG_FILE = "compLogFile";
   public static final String PARAM_ID = "id";
   public static final String PARAM_SCROLL_TYPE = "scrollType";
   public static final String PARAM_NUMBER_ROWS = "numberRows";

http://git-wip-us.apache.org/repos/asf/ambari/blob/6fa4abfe/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AbstractCommonAuditLogRequestConverter.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AbstractCommonAuditLogRequestConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AbstractCommonAuditLogRequestConverter.java
index e25eb51..d40c5a1 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AbstractCommonAuditLogRequestConverter.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AbstractCommonAuditLogRequestConverter.java
@@ -31,10 +31,6 @@ public abstract class AbstractCommonAuditLogRequestConverter<SOURCE extends Base
   public RESULT convertToSearchCriteria(SOURCE request) {
     RESULT criteria = createCriteria(request);
     criteria.addParam("q", request.getQuery());
-    criteria.addParam("columnQuery", StringEscapeUtils.unescapeXml(request.getColumnQuery()));
-    criteria.addParam("gEMessage", StringEscapeUtils.unescapeXml(request.getgEMessage()));
-    criteria.setIncludeMessage(StringEscapeUtils.unescapeXml(request.getiMessage()));
-    criteria.setExcludeMessage(StringEscapeUtils.unescapeXml(request.getgEMessage()));
     criteria.setMustBe(request.getMustBe());
     criteria.setMustNot(request.getMustNot());
     criteria.setExcludeQuery(StringEscapeUtils.unescapeXml(request.getExcludeQuery()));

http://git-wip-us.apache.org/repos/asf/ambari/blob/6fa4abfe/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AbstractCommonServiceLogRequestConverter.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AbstractCommonServiceLogRequestConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AbstractCommonServiceLogRequestConverter.java
index 2282c11..8e91584 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AbstractCommonServiceLogRequestConverter.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AbstractCommonServiceLogRequestConverter.java
@@ -29,13 +29,9 @@ public abstract class AbstractCommonServiceLogRequestConverter<SOURCE extends Ba
   public RESULT convertToSearchCriteria(SOURCE request) {
     RESULT criteria = createCriteria(request);
     // TODO: check are these used from the UI or not?
-    criteria.addParam("advanceSearch", StringEscapeUtils.unescapeXml(request.getAdvancedSearch()));
     criteria.addParam("q", request.getQuery());
-    criteria.addParam("gMustNot", request.getgMustNot());
-    criteria.addParam("gEMessage", StringEscapeUtils.unescapeXml(request.getgEMessage()));
     criteria.addParam("unselectComp", request.getMustNot());
 
-    criteria.setTreeParams(StringEscapeUtils.unescapeHtml(request.getTreeParams()));
     criteria.setLevel(request.getLevel());
     criteria.setFrom(request.getFrom());
     criteria.setTo(request.getTo());
@@ -44,8 +40,6 @@ public abstract class AbstractCommonServiceLogRequestConverter<SOURCE extends Ba
     criteria.setHostName(request.getHostName());
     criteria.setComponentName(request.getComponentName());
     criteria.setFileName(request.getFileName());
-    criteria.setIncludeMessage(StringEscapeUtils.unescapeXml(request.getiMessage()));
-    criteria.setExcludeMessage(StringEscapeUtils.unescapeXml(request.getgEMessage()));
     criteria.setStartTime(request.getStartTime());
     criteria.setEndTime(request.getEndTime());
     criteria.setExcludeQuery(StringEscapeUtils.unescapeXml(request.getExcludeQuery()));

http://git-wip-us.apache.org/repos/asf/ambari/blob/6fa4abfe/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/LogFileRequestConverter.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/LogFileRequestConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/LogFileRequestConverter.java
deleted file mode 100644
index 62c2fbe..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/LogFileRequestConverter.java
+++ /dev/null
@@ -1,37 +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.query.converter;
-
-import org.apache.ambari.logsearch.model.request.impl.LogFileRequest;
-import org.apache.ambari.logsearch.query.model.LogFileSearchCriteria;
-import org.springframework.core.convert.converter.Converter;
-import org.springframework.stereotype.Component;
-
-@Component
-public class LogFileRequestConverter implements Converter<LogFileRequest, LogFileSearchCriteria> {
-
-  @Override
-  public LogFileSearchCriteria convert(LogFileRequest request) {
-    LogFileSearchCriteria criteria = new LogFileSearchCriteria();
-    criteria.setLogFileComponent(request.getComponent());
-    criteria.setLogFileHost(request.getHost());
-    criteria.setLogType(request.getLogType());
-    return criteria;
-  }
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/6fa4abfe/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/LogFileTailRequestConverter.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/LogFileTailRequestConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/LogFileTailRequestConverter.java
deleted file mode 100644
index 08c6ecc..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/LogFileTailRequestConverter.java
+++ /dev/null
@@ -1,38 +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.query.converter;
-
-import org.apache.ambari.logsearch.model.request.impl.LogFileTailRequest;
-import org.apache.ambari.logsearch.query.model.LogFileTailSearchCriteria;
-import org.springframework.core.convert.converter.Converter;
-import org.springframework.stereotype.Component;
-
-@Component
-public class LogFileTailRequestConverter implements Converter<LogFileTailRequest, LogFileTailSearchCriteria> {
-
-  @Override
-  public LogFileTailSearchCriteria convert(LogFileTailRequest request) {
-    LogFileTailSearchCriteria criteria = new LogFileTailSearchCriteria();
-    criteria.setLogFileComponent(request.getComponent());
-    criteria.setLogFileHost(request.getHost());
-    criteria.setLogType(request.getLogType());
-    criteria.setLogTailSize(request.getTailSize());
-    return criteria;
-  }
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/6fa4abfe/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceGraphRequestConverter.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceGraphRequestConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceGraphRequestConverter.java
index 6c501ae..37ec7dc 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceGraphRequestConverter.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceGraphRequestConverter.java
@@ -28,8 +28,6 @@ public class ServiceGraphRequestConverter extends AbstractCommonServiceLogReques
   @Override
   public ServiceGraphSearchCriteria createCriteria(ServiceGraphRequest request) {
     ServiceGraphSearchCriteria criteria = new ServiceGraphSearchCriteria();
-    criteria.setLogFileHostName(request.getHostLogFile());
-    criteria.setLogFileComponentName(request.getComponentLogFile());
     criteria.setUnit(request.getUnit());
     return criteria;
   }

http://git-wip-us.apache.org/repos/asf/ambari/blob/6fa4abfe/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceLogExportRequestConverter.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceLogExportRequestConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceLogExportRequestConverter.java
index bd06546..783b0e0 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceLogExportRequestConverter.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceLogExportRequestConverter.java
@@ -28,8 +28,6 @@ public class ServiceLogExportRequestConverter extends AbstractCommonServiceLogRe
   @Override
   public ServiceLogExportSearchCriteria createCriteria(ServiceLogExportRequest request) {
     ServiceLogExportSearchCriteria criteria = new ServiceLogExportSearchCriteria();
-    criteria.setLogFileHostName(request.getHostLogFile());
-    criteria.setLogFileComponentName(request.getComponentLogFile());
     criteria.setFormat(request.getFormat());
     criteria.setUtcOffset(request.getUtcOffset());
     return criteria;

http://git-wip-us.apache.org/repos/asf/ambari/blob/6fa4abfe/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceLogFileRequestConverter.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceLogFileRequestConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceLogFileRequestConverter.java
deleted file mode 100644
index 392c9d3..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceLogFileRequestConverter.java
+++ /dev/null
@@ -1,36 +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.query.converter;
-
-import org.apache.ambari.logsearch.model.request.impl.ServiceLogFileRequest;
-import org.apache.ambari.logsearch.query.model.ServiceLogFileSearchCriteria;
-import org.springframework.stereotype.Component;
-
-@Component
-public class ServiceLogFileRequestConverter
-  extends AbstractCommonServiceLogRequestConverter<ServiceLogFileRequest, ServiceLogFileSearchCriteria> {
-
-  @Override
-  public ServiceLogFileSearchCriteria createCriteria(ServiceLogFileRequest request) {
-    ServiceLogFileSearchCriteria criteria = new ServiceLogFileSearchCriteria();
-    criteria.setLogFileHostName(request.getHostLogFile());
-    criteria.setLogFileComponentName(request.getComponentLogFile());
-    return criteria;
-  }
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/6fa4abfe/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceLogRequestConverter.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceLogRequestConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceLogRequestConverter.java
index aa93c6a..86d055d 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceLogRequestConverter.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceLogRequestConverter.java
@@ -29,8 +29,6 @@ public class ServiceLogRequestConverter extends AbstractCommonServiceLogRequestC
   @Override
   public ServiceLogSearchCriteria createCriteria(ServiceLogRequest request) {
     ServiceLogSearchCriteria criteria = new ServiceLogSearchCriteria();
-    criteria.setLogFileComponentName(request.getHostLogFile());
-    criteria.setLogFileComponentName(request.getComponentLogFile());
     criteria.setKeyword(StringEscapeUtils.unescapeXml(request.getKeyWord()));
     criteria.setKeywordType(request.getKeywordType());
     criteria.setSourceLogId(request.getSourceLogId());

http://git-wip-us.apache.org/repos/asf/ambari/blob/6fa4abfe/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceLogTruncatedRequestConverter.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceLogTruncatedRequestConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceLogTruncatedRequestConverter.java
index 1e58b79..2154357 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceLogTruncatedRequestConverter.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceLogTruncatedRequestConverter.java
@@ -28,8 +28,6 @@ public class ServiceLogTruncatedRequestConverter extends AbstractCommonServiceLo
   @Override
   public ServiceLogTruncatedSearchCriteria createCriteria(ServiceLogTruncatedRequest request) {
     ServiceLogTruncatedSearchCriteria criteria = new ServiceLogTruncatedSearchCriteria();
-    criteria.setLogFileHostName(request.getHostLogFile());
-    criteria.setLogFileComponentName(request.getComponentLogFile());
     criteria.setId(request.getId());
     criteria.setScrollType(request.getScrollType());
     criteria.setNumberRows(request.getNumberRows());

http://git-wip-us.apache.org/repos/asf/ambari/blob/6fa4abfe/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/CommonServiceLogSearchCriteria.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/CommonServiceLogSearchCriteria.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/CommonServiceLogSearchCriteria.java
index 4c79c69..b02c234 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/CommonServiceLogSearchCriteria.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/CommonServiceLogSearchCriteria.java
@@ -22,14 +22,6 @@ import org.apache.ambari.logsearch.query.SearchCriteriaConstants;
 
 public class CommonServiceLogSearchCriteria extends CommonSearchCriteria {
 
-  public String getTreeParams() {
-    return getParam(SearchCriteriaConstants.PARAM_TREE_PARAMS, String.class);
-  }
-
-  public void setTreeParams(String treeParams) {
-    addParam(SearchCriteriaConstants.PARAM_TREE_PARAMS, treeParams);
-  }
-
   public String getLevel() {
     return getParam(SearchCriteriaConstants.PARAM_LEVEL, String.class);
   }

http://git-wip-us.apache.org/repos/asf/ambari/blob/6fa4abfe/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/LogFileSearchCriteria.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/LogFileSearchCriteria.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/LogFileSearchCriteria.java
deleted file mode 100644
index e33e5eb..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/LogFileSearchCriteria.java
+++ /dev/null
@@ -1,52 +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.query.model;
-
-import org.apache.ambari.logsearch.common.Marker;
-
-import static org.apache.ambari.logsearch.query.SearchCriteriaConstants.PARAM_LOG_FILE_COMPONENT;
-import static org.apache.ambari.logsearch.query.SearchCriteriaConstants.PARAM_LOG_FILE_HOST;
-import static org.apache.ambari.logsearch.query.SearchCriteriaConstants.PARAM_LOG_FILE_TYPE;
-
-public class LogFileSearchCriteria extends SearchCriteria {
-
-  public String getLogFileComponent() {
-    return getParam(PARAM_LOG_FILE_COMPONENT, String.class);
-  }
-
-  public void setLogFileComponent(String logFileComponent) {
-    addParam(PARAM_LOG_FILE_COMPONENT, logFileComponent);
-  }
-
-  public String getLogFileHost() {
-    return getParam(PARAM_LOG_FILE_HOST, String.class);
-  }
-
-  public void setLogFileHost(String logFileHost) {
-    addParam(PARAM_LOG_FILE_HOST, logFileHost);
-  }
-
-  public String getLogType() {
-    return getParam(PARAM_LOG_FILE_TYPE, String.class);
-  }
-
-  public void setLogType(String logType) {
-    addParam(PARAM_LOG_FILE_TYPE, logType);
-  }
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/6fa4abfe/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/LogFileTailSearchCriteria.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/LogFileTailSearchCriteria.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/LogFileTailSearchCriteria.java
deleted file mode 100644
index ccea4ab..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/LogFileTailSearchCriteria.java
+++ /dev/null
@@ -1,32 +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.query.model;
-
-import static org.apache.ambari.logsearch.query.SearchCriteriaConstants.PARAM_LOG_TAIL_SIZE;
-
-public class LogFileTailSearchCriteria extends LogFileSearchCriteria {
-
-  public String getLogTailSize() {
-    return getParam(PARAM_LOG_TAIL_SIZE, String.class);
-  }
-
-  public void setLogTailSize(String logTailSize) {
-    addParam(PARAM_LOG_TAIL_SIZE, logTailSize);
-  }
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/6fa4abfe/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/SearchCriteria.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/SearchCriteria.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/SearchCriteria.java
index 661337f..8e397ac 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/SearchCriteria.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/SearchCriteria.java
@@ -123,4 +123,13 @@ public class SearchCriteria {
     this.globalEndTime = globalEndTime;
   }
 
+  @Override
+  public String toString() {
+    StringBuilder sb = new StringBuilder();
+    for (Map.Entry<String, Object> entry : paramList.entrySet()) {
+      sb.append(entry.getKey() + " : " + entry.getValue() + ";");
+    }
+    return sb.toString();
+  }
+
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/6fa4abfe/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceAnyGraphSearchCriteria.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceAnyGraphSearchCriteria.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceAnyGraphSearchCriteria.java
index cd852b5..0f4bb5a 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceAnyGraphSearchCriteria.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceAnyGraphSearchCriteria.java
@@ -25,7 +25,7 @@ import static org.apache.ambari.logsearch.query.SearchCriteriaConstants.PARAM_UN
 import static org.apache.ambari.logsearch.query.SearchCriteriaConstants.PARAM_X_AXIS;
 import static org.apache.ambari.logsearch.query.SearchCriteriaConstants.PARAM_Y_AXIS;
 
-public class ServiceAnyGraphSearchCriteria extends ServiceLogFileSearchCriteria {
+public class ServiceAnyGraphSearchCriteria extends ServiceLogSearchCriteria {
   public String getxAxis() {
     return getParam(PARAM_X_AXIS, String.class);
   }

http://git-wip-us.apache.org/repos/asf/ambari/blob/6fa4abfe/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceGraphSearchCriteria.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceGraphSearchCriteria.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceGraphSearchCriteria.java
index 8988af1..4173bac 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceGraphSearchCriteria.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceGraphSearchCriteria.java
@@ -20,7 +20,7 @@ package org.apache.ambari.logsearch.query.model;
 
 import org.apache.ambari.logsearch.query.SearchCriteriaConstants;
 
-public class ServiceGraphSearchCriteria extends ServiceLogFileSearchCriteria {
+public class ServiceGraphSearchCriteria extends ServiceLogSearchCriteria {
 
   public String getUnit() {
     return getParam(SearchCriteriaConstants.PARAM_UNIT, String.class);

http://git-wip-us.apache.org/repos/asf/ambari/blob/6fa4abfe/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceLogExportSearchCriteria.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceLogExportSearchCriteria.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceLogExportSearchCriteria.java
index c7b7a39..6c757af 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceLogExportSearchCriteria.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceLogExportSearchCriteria.java
@@ -20,7 +20,7 @@ package org.apache.ambari.logsearch.query.model;
 
 import org.apache.ambari.logsearch.query.SearchCriteriaConstants;
 
-public class ServiceLogExportSearchCriteria extends ServiceLogFileSearchCriteria {
+public class ServiceLogExportSearchCriteria extends ServiceLogSearchCriteria {
 
   public void setFormat(String format) {
     addParam(SearchCriteriaConstants.PARAM_FORMAT, format);

http://git-wip-us.apache.org/repos/asf/ambari/blob/6fa4abfe/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceLogFileSearchCriteria.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceLogFileSearchCriteria.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceLogFileSearchCriteria.java
deleted file mode 100644
index a80a3ce..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceLogFileSearchCriteria.java
+++ /dev/null
@@ -1,40 +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.query.model;
-
-import org.apache.ambari.logsearch.query.SearchCriteriaConstants;
-
-public class ServiceLogFileSearchCriteria extends CommonServiceLogSearchCriteria {
-
-  public void setLogFileHostName(String logFileHostName) {
-    addParam(SearchCriteriaConstants.PARAM_HOST_LOG_FILE, logFileHostName);
-  }
-
-  public String getLogFileHostName() {
-    return getParam(SearchCriteriaConstants.PARAM_HOST_LOG_FILE, String.class);
-  }
-
-  public void setLogFileComponentName(String logFileComponentName) {
-    addParam(SearchCriteriaConstants.PARAM_COMPONENT_LOG_FILE, logFileComponentName);
-  }
-
-  public String getLogFileComponentName() {
-    return getParam(SearchCriteriaConstants.PARAM_COMPONENT_LOG_FILE, String.class);
-  }
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/6fa4abfe/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceLogSearchCriteria.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceLogSearchCriteria.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceLogSearchCriteria.java
index b3a6bf7..e469367 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceLogSearchCriteria.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceLogSearchCriteria.java
@@ -20,7 +20,7 @@ package org.apache.ambari.logsearch.query.model;
 
 import org.apache.ambari.logsearch.query.SearchCriteriaConstants;
 
-public class ServiceLogSearchCriteria extends ServiceLogFileSearchCriteria {
+public class ServiceLogSearchCriteria extends CommonServiceLogSearchCriteria {
 
   public void setKeyword(String keyword) {
     addParam(SearchCriteriaConstants.PARAM_KEYWORD, keyword);

http://git-wip-us.apache.org/repos/asf/ambari/blob/6fa4abfe/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceLogTruncatedSearchCriteria.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceLogTruncatedSearchCriteria.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceLogTruncatedSearchCriteria.java
index bcdac5b..277aeb9 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceLogTruncatedSearchCriteria.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceLogTruncatedSearchCriteria.java
@@ -20,7 +20,7 @@ package org.apache.ambari.logsearch.query.model;
 
 import org.apache.ambari.logsearch.query.SearchCriteriaConstants;
 
-public class ServiceLogTruncatedSearchCriteria extends ServiceLogFileSearchCriteria {
+public class ServiceLogTruncatedSearchCriteria extends ServiceLogSearchCriteria {
 
   public String getId() {
     return getParam(SearchCriteriaConstants.PARAM_ID, String.class);


[44/58] [abbrv] ambari git commit: AMBARI-18348. Ranger audit log collection is not used in Log Search (Miklos Gergely via oleewere)

Posted by ol...@apache.org.
AMBARI-18348. Ranger audit log collection is not used in Log Search (Miklos Gergely via oleewere)

Change-Id: I50b4c2c375d1657d620cfd1cab30943688ef079a


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

Branch: refs/heads/branch-2.5
Commit: a941d1ec83b3de9899e04fd72e79f4001d36e311
Parents: 0c73672
Author: Miklos Gergely <mg...@hortonworks.com>
Authored: Mon Oct 3 16:13:08 2016 +0200
Committer: oleewere <ol...@gmail.com>
Committed: Sat Nov 5 14:46:45 2016 +0100

----------------------------------------------------------------------
 .../ambari/logfeeder/filter/FilterKeyValue.java |  41 +++-
 .../logfeeder/filter/FilterKeyValueTest.java    |  29 ++-
 .../configuration/logsearch-properties.xml      |  19 +-
 .../LOGSEARCH/0.5.0/package/scripts/params.py   |   5 +
 .../0.5.0/package/scripts/setup_logsearch.py    |  19 +-
 .../templates/input.config-ambari.json.j2       | 235 ++++++++++++++++++-
 .../test/python/stacks/2.4/configs/default.json |   2 +
 ambari-web/app/data/HDP2/site_properties.js     |  22 +-
 8 files changed, 339 insertions(+), 33 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/a941d1ec/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/filter/FilterKeyValue.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/filter/FilterKeyValue.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/filter/FilterKeyValue.java
index c9c3f2c..5bb15ff 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/filter/FilterKeyValue.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/filter/FilterKeyValue.java
@@ -21,7 +21,7 @@ package org.apache.ambari.logfeeder.filter;
 
 import java.util.List;
 import java.util.Map;
-import java.util.StringTokenizer;
+import java.util.regex.Pattern;
 
 import org.apache.ambari.logfeeder.common.LogfeederException;
 import org.apache.ambari.logfeeder.input.InputMarker;
@@ -37,7 +37,8 @@ public class FilterKeyValue extends Filter {
   private String sourceField = null;
   private String valueSplit = "=";
   private String fieldSplit = "\t";
-
+  private String valueBorders = null;
+  
   private MetricData errorMetric = new MetricData("filter.error.keyvalue", false);
 
   @Override
@@ -47,6 +48,7 @@ public class FilterKeyValue extends Filter {
     sourceField = getStringValue("source_field");
     valueSplit = getStringValue("value_split", valueSplit);
     fieldSplit = getStringValue("field_split", fieldSplit);
+    valueBorders = getStringValue("value_borders");
 
     LOG.info("init() done. source_field=" + sourceField + ", value_split=" + valueSplit + ", " + ", field_split=" +
         fieldSplit + ", " + getShortDescription());
@@ -68,18 +70,16 @@ public class FilterKeyValue extends Filter {
     }
     Object valueObj = jsonObj.get(sourceField);
     if (valueObj != null) {
-      StringTokenizer fieldTokenizer = new StringTokenizer(valueObj.toString(), fieldSplit);
-      while (fieldTokenizer.hasMoreTokens()) {
-        String nv = fieldTokenizer.nextToken();
-        StringTokenizer nvTokenizer = new StringTokenizer(nv, valueSplit);
-        while (nvTokenizer.hasMoreTokens()) {
-          String name = nvTokenizer.nextToken();
-          if (nvTokenizer.hasMoreTokens()) {
-            String value = nvTokenizer.nextToken();
+      String splitPattern = Pattern.quote(fieldSplit);
+      String[] tokens = valueObj.toString().split(splitPattern);
+      for (String nv : tokens) {
+        String[] nameValue = getNameValue(nv);
+        String name = nameValue != null && nameValue.length == 2 ? nameValue[0] : null;
+        String value = nameValue != null && nameValue.length == 2 ? nameValue[1] : null;
+        if (name != null && value != null) {
             jsonObj.put(name, value);
-          } else {
-            logParseError("name=" + name + ", pair=" + nv + ", field=" + sourceField + ", field_value=" + valueObj);
-          }
+         } else {
+           logParseError("name=" + name + ", pair=" + nv + ", field=" + sourceField + ", field_value=" + valueObj);
         }
       }
     }
@@ -87,6 +87,21 @@ public class FilterKeyValue extends Filter {
     statMetric.value++;
   }
 
+  private String[] getNameValue(String nv) {
+    if (valueBorders != null) {
+      if (nv.charAt(nv.length() - 1) == valueBorders.charAt(1)) {
+        String splitPattern = Pattern.quote("" + valueBorders.charAt(0));
+        return nv.substring(0, nv.length() - 1).split(splitPattern);
+      } else {
+        return null;
+      }
+    }
+    else {
+      String splitPattern = Pattern.quote(valueSplit);
+      return nv.split(splitPattern);
+    }
+  }
+
   private void logParseError(String inputStr) {
     errorMetric.value++;
     String logMessageKey = this.getClass().getSimpleName() + "_PARSEERROR";

http://git-wip-us.apache.org/repos/asf/ambari/blob/a941d1ec/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/filter/FilterKeyValueTest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/filter/FilterKeyValueTest.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/filter/FilterKeyValueTest.java
index 30cee42..05647e6 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/filter/FilterKeyValueTest.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/filter/FilterKeyValueTest.java
@@ -1,4 +1,4 @@
-/*
+/**
  * 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
@@ -21,8 +21,8 @@ package org.apache.ambari.logfeeder.filter;
 import java.util.HashMap;
 import java.util.Map;
 
-import org.apache.ambari.logfeeder.input.InputMarker;
 import org.apache.ambari.logfeeder.output.OutputManager;
+import org.apache.ambari.logfeeder.input.InputMarker;
 import org.apache.log4j.Logger;
 import org.easymock.Capture;
 import org.easymock.CaptureType;
@@ -77,6 +77,31 @@ public class FilterKeyValueTest {
   }
 
   @Test
+  public void testFilterKeyValue_extractionWithBorders() throws Exception {
+    LOG.info("testFilterKeyValue_extractionWithBorders()");
+
+    Map<String, Object> config = new HashMap<String, Object>();
+    config.put("source_field", "keyValueField");
+    config.put("field_split", "&");
+    config.put("value_borders", "()");
+    init(config);
+
+    mockOutputManager.write(EasyMock.capture(capture), EasyMock.anyObject(InputMarker.class));
+    EasyMock.expectLastCall();
+    EasyMock.replay(mockOutputManager);
+
+    filterKeyValue.apply("{ keyValueField: 'name1(value1)&name2(value2)' }", new InputMarker(null, null, 0));
+
+    EasyMock.verify(mockOutputManager);
+    Map<String, Object> jsonParams = capture.getValue();
+
+    assertEquals("Original missing!", "name1(value1)&name2(value2)", jsonParams.remove("keyValueField"));
+    assertEquals("Incorrect extraction: name1", "value1", jsonParams.remove("name1"));
+    assertEquals("Incorrect extraction: name2", "value2", jsonParams.remove("name2"));
+    assertTrue("jsonParams are not empty!", jsonParams.isEmpty());
+  }
+
+  @Test
   public void testFilterKeyValue_missingSourceField() throws Exception {
     LOG.info("testFilterKeyValue_missingSourceField()");
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/a941d1ec/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/configuration/logsearch-properties.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/configuration/logsearch-properties.xml b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/configuration/logsearch-properties.xml
index e521c8e..febeffd 100644
--- a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/configuration/logsearch-properties.xml
+++ b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/configuration/logsearch-properties.xml
@@ -113,6 +113,23 @@
     <on-ambari-upgrade add="true"/>
   </property>
   <property>
+    <name>logsearch.solr.audit.logs.use.ranger</name>
+    <value>false</value>
+    <display-name>Ranger Audit Logs Enabled</display-name>
+    <description>Use Ranger Audit collection. This is supported only if Ranger Solr is installed in SolrCloud mode</description>
+    <value-attributes>
+      <type>boolean</type>
+    </value-attributes>
+    <on-ambari-upgrade add="true"/>
+  </property>
+  <property>
+    <name>logsearch.ranger.audit.logs.collection.name</name>
+    <value>ranger_audits</value>
+    <display-name>Log Search Solr Ranger Audit Logs Collection</display-name>
+    <description>Name for the ranger audit logs collection</description>
+    <on-ambari-upgrade add="true"/>
+  </property>
+  <property>
     <name>logsearch.logfeeder.include.default.level</name>
     <value>FATAL,ERROR,WARN</value>
     <description>Include default Log Feeder Log Levels for Log Search. Used for bootstrapping the configuration only. (levels: FATAL,ERROR,WARN,INFO,DEBUG,TRACE)</description>
@@ -133,7 +150,7 @@
     <on-ambari-upgrade add="true"/>
   </property>
   <property>
-    <name>logsearch.auth.external_auth.enable</name>
+    <name>logsearch.auth.external_auth.enabled</name>
     <value>true</value>
     <display-name>External authentication</display-name>
     <description>Enable external authentication</description>

http://git-wip-us.apache.org/repos/asf/ambari/blob/a941d1ec/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/params.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/params.py b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/params.py
index 8b0ce75..7200d7b 100644
--- a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/params.py
+++ b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/params.py
@@ -205,6 +205,11 @@ logsearch_properties['logsearch.solr.collection.history'] = 'history'
 logsearch_properties['logsearch.solr.history.config.name'] = 'history'
 logsearch_properties['logsearch.collection.history.replication.factor'] = '1'
 
+if logsearch_properties['logsearch.solr.audit.logs.use.ranger'] == 'false':
+  del logsearch_properties['logsearch.ranger.audit.logs.collection.name']
+
+del logsearch_properties['logsearch.solr.audit.logs.use.ranger']
+
 logsearch_properties['logsearch.solr.metrics.collector.hosts'] = format(logsearch_properties['logsearch.solr.metrics.collector.hosts'])
 
 logsearch_properties['logsearch.solr.jmx.port'] = infra_solr_jmx_port

http://git-wip-us.apache.org/repos/asf/ambari/blob/a941d1ec/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/setup_logsearch.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/setup_logsearch.py b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/setup_logsearch.py
index 8d84093..6c1a936 100644
--- a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/setup_logsearch.py
+++ b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/setup_logsearch.py
@@ -38,13 +38,14 @@ def setup_logsearch():
             )
 
   Directory([params.logsearch_dir, params.logsearch_server_conf, params.logsearch_config_set_dir],
-          mode=0755,
-          cd_access='a',
-          owner=params.logsearch_user,
-          group=params.user_group,
-          create_parents=True,
-          recursive_ownership=True
-          )
+            mode=0755,
+            cd_access='a',
+            owner=params.logsearch_user,
+            group=params.user_group,
+            create_parents=True,
+            recursive_ownership=True
+            )
+
   File(params.logsearch_log,
        mode=0644,
        owner=params.logsearch_user,
@@ -53,8 +54,8 @@ def setup_logsearch():
        )
 
   PropertiesFile(format("{logsearch_server_conf}/logsearch.properties"),
-       properties=params.logsearch_properties
-       )
+                 properties=params.logsearch_properties
+                 )
 
   File(format("{logsearch_server_conf}/HadoopServiceConfig.json"),
        content=Template("HadoopServiceConfig.json.j2"),

http://git-wip-us.apache.org/repos/asf/ambari/blob/a941d1ec/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/templates/input.config-ambari.json.j2
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/templates/input.config-ambari.json.j2 b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/templates/input.config-ambari.json.j2
index 34f4b30..e2646ff 100644
--- a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/templates/input.config-ambari.json.j2
+++ b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/templates/input.config-ambari.json.j2
@@ -52,8 +52,12 @@
     },
     {
       "type":"ambari_audit",
-      "rowtype":"service",
+      "rowtype":"audit",
       "add_fields":{
+        "logType":"AmbariAudit",
+        "enforcer":"ambari-acl",
+        "repoType":"1",
+        "repo":"ambari",
         "level":"INFO"
       },
       "path":"{{ambari_server_log_dir}}/ambari-audit.log"
@@ -237,10 +241,10 @@
 
       },
       "log4j_format":"%d{ISO8601} %-5p %c{2} (%F:%M(%L)) - %m%n",
-      "multiline_pattern":"^(%{TIMESTAMP_ISO8601:logtime})",
-      "message_pattern":"(?m)^%{TIMESTAMP_ISO8601:logtime},%{SPACE}%{GREEDYDATA:log_message}",
+      "multiline_pattern":"^(%{TIMESTAMP_ISO8601:evtTime})",
+      "message_pattern":"(?m)^%{TIMESTAMP_ISO8601:evtTime},%{SPACE}%{GREEDYDATA:log_message}",
       "post_map_values":{
-        "logtime":{
+        "evtTime":{
           "map_date":{
             "target_date_pattern":"yyyy-MM-dd'T'HH:mm:ss.SSSXX"
           }
@@ -249,6 +253,229 @@
 
       }
 
+    },
+    {
+      "filter":"keyvalue",
+      "sort_order":1,
+      "conditions":{
+        "fields":{
+          "type":[
+            "ambari_audit"
+          ]
+
+        }
+
+      },
+      "source_field":"log_message",
+      "field_split":", ",
+      "value_borders":"()",
+      "post_map_values":{
+        "User":{
+          "map_fieldname":{
+            "new_fieldname":"reqUser"
+          }
+        },
+        "Hostname":{
+          "map_fieldname":{
+            "new_fieldname":"host"
+          }
+        },
+        "RemoteIp":{
+          "map_fieldname":{
+            "new_fieldname":"cliIP"
+          }
+        },
+        "RequestType":{
+          "map_fieldname":{
+            "new_fieldname":"cliType"
+          }
+        },
+        "RequestId":{
+          "map_fieldname":{
+            "new_fieldname":"request_id"
+          }
+        },
+        "TaskId":{
+          "map_fieldname":{
+            "new_fieldname":"task_id"
+          }
+        },
+        "Operation":{
+          "map_fieldname":{
+            "new_fieldname":"action"
+          }
+        },
+        "url":{
+          "map_fieldname":{
+            "new_fieldname":"resource"
+          }
+        },
+        "ResourcePath":{
+          "map_fieldname":{
+            "new_fieldname":"resource"
+          }
+        },
+        "Status":[
+          {
+            "map_fieldvalue":{
+              "pre_value":"Success",
+              "post_value":"1"
+            }
+          },
+          {
+            "map_fieldvalue":{
+              "pre_value":"Successfully queued",
+              "post_value":"1"
+            }
+          },
+          {
+            "map_fieldvalue":{
+              "pre_value":"QUEUED",
+              "post_value":"1"
+            }
+          },
+          {
+            "map_fieldvalue":{
+              "pre_value":"PENDING",
+              "post_value":"1"
+            }
+          },
+          {
+            "map_fieldvalue":{
+              "pre_value":"COMPLETED",
+              "post_value":"1"
+            }
+          },
+          {
+            "map_fieldvalue":{
+              "pre_value":"IN_PROGRESS",
+              "post_value":"1"
+            }
+          },
+          {
+            "map_fieldvalue":{
+              "pre_value":"Failed",
+              "post_value":"0"
+            }
+          },
+          {
+            "map_fieldvalue":{
+              "pre_value":"Failed to queue",
+              "post_value":"0"
+            }
+          },
+          {
+            "map_fieldvalue":{
+              "pre_value":"HOLDING",
+              "post_value":"0"
+            }
+          },
+          {
+            "map_fieldvalue":{
+              "pre_value":"HOLDING_FAILED",
+              "post_value":"0"
+            }
+          },
+          {
+            "map_fieldvalue":{
+              "pre_value":"HOLDING_TIMEDOUT",
+              "post_value":"0"
+            }
+          },
+          {
+            "map_fieldvalue":{
+              "pre_value":"FAILED",
+              "post_value":"0"
+            }
+          },
+          {
+            "map_fieldvalue":{
+              "pre_value":"TIMEDOUT",
+              "post_value":"0"
+            }
+          },
+          {
+            "map_fieldvalue":{
+              "pre_value":"ABORTED",
+              "post_value":"0"
+            }
+          },
+          {
+            "map_fieldvalue":{
+              "pre_value":"SKIPPED_FAILED",
+              "post_value":"0"
+            }
+          },
+          {
+            "map_fieldname":{
+              "new_fieldname":"result"
+            }
+          }
+        ],
+        "ResultStatus":[
+          {
+            "map_fieldvalue":{
+              "pre_value":"200 OK",
+              "post_value":"1"
+            }
+          },
+          {
+            "map_fieldvalue":{
+              "pre_value":"201 Created",
+              "post_value":"1"
+            }
+          },
+          {
+            "map_fieldvalue":{
+              "pre_value":"202 Accepted",
+              "post_value":"1"
+            }
+          },
+          {
+            "map_fieldvalue":{
+              "pre_value":"400 Bad Request",
+              "post_value":"0"
+            }
+          },
+          {
+            "map_fieldvalue":{
+              "pre_value":"401 Unauthorized",
+              "post_value":"0"
+            }
+          },
+          {
+            "map_fieldvalue":{
+              "pre_value":"403 Forbidden",
+              "post_value":"0"
+            }
+          },
+          {
+            "map_fieldvalue":{
+              "pre_value":"404 Not Found",
+              "post_value":"0"
+            }
+          },
+          {
+            "map_fieldvalue":{
+              "pre_value":"409 Resource Conflict",
+              "post_value":"0"
+            }
+          },
+          {
+            "map_fieldvalue":{
+              "pre_value":"500 Internal Server Error",
+              "post_value":"0"
+            }
+          },
+          {
+            "map_fieldname":{
+              "new_fieldname":"result"
+            }
+          }
+        ]
+
+      }
+
     }
 
   ]

http://git-wip-us.apache.org/repos/asf/ambari/blob/a941d1ec/ambari-server/src/test/python/stacks/2.4/configs/default.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.4/configs/default.json b/ambari-server/src/test/python/stacks/2.4/configs/default.json
index 8ac6fa7..1ebbda9 100644
--- a/ambari-server/src/test/python/stacks/2.4/configs/default.json
+++ b/ambari-server/src/test/python/stacks/2.4/configs/default.json
@@ -289,6 +289,8 @@
         "logsearch.collection.service.logs.replication.factor": "1",
         "logsearch.collection.audit.logs.numshards": "10",
         "logsearch.collection.audit.logs.replication.factor": "1",
+        "logsearch.solr.audit.logs.use.ranger": "false",
+        "logsearch.ranger.audit.logs.collection.name": "ranger_audits",
         "logsearch.solr.metrics.collector.hosts" : "{metrics_collector_hosts}",
         "logsearch.auth.external_auth.enabled" : "false",
         "logsearch.auth.external_auth.host_url" : "{ambari_server_auth_host_url}",

http://git-wip-us.apache.org/repos/asf/ambari/blob/a941d1ec/ambari-web/app/data/HDP2/site_properties.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/data/HDP2/site_properties.js b/ambari-web/app/data/HDP2/site_properties.js
index 9311e75..fac40c4 100644
--- a/ambari-web/app/data/HDP2/site_properties.js
+++ b/ambari-web/app/data/HDP2/site_properties.js
@@ -2208,33 +2208,47 @@ var hdp2properties = [
     "index": 5
   },
   {
-    "name": "logsearch.solr.metrics.collector.hosts",
+    "name": "logsearch.solr.audit.logs.use.ranger",
     "serviceName": "LOGSEARCH",
     "filename": "logsearch-properties.xml",
     "category": "Advanced logsearch-properties",
     "index": 6
   },
   {
-    "name": "logsearch.auth.external_auth.enable",
+    "name": "logsearch.ranger.audit.logs.collection.name",
     "serviceName": "LOGSEARCH",
     "filename": "logsearch-properties.xml",
     "category": "Advanced logsearch-properties",
     "index": 7
   },
   {
-    "name": "logsearch.auth.external_auth.host_url",
+    "name": "logsearch.solr.metrics.collector.hosts",
     "serviceName": "LOGSEARCH",
     "filename": "logsearch-properties.xml",
     "category": "Advanced logsearch-properties",
     "index": 8
   },
   {
-    "name": "logsearch.auth.external_auth.login_url",
+    "name": "logsearch.auth.external_auth.enable",
     "serviceName": "LOGSEARCH",
     "filename": "logsearch-properties.xml",
     "category": "Advanced logsearch-properties",
     "index": 9
   },
+  {
+    "name": "logsearch.auth.external_auth.host_url",
+    "serviceName": "LOGSEARCH",
+    "filename": "logsearch-properties.xml",
+    "category": "Advanced logsearch-properties",
+    "index": 10
+  },
+  {
+    "name": "logsearch.auth.external_auth.login_url",
+    "serviceName": "LOGSEARCH",
+    "filename": "logsearch-properties.xml",
+    "category": "Advanced logsearch-properties",
+    "index": 11
+  },
   /*infra-solr-client-log4j*/
   {
     "name": "infra_solr_client_log_dir",


[32/58] [abbrv] ambari git commit: AMBARI-18246. Logfeeder cleanup - appendum for branch-2.5 (oleewere)

Posted by ol...@apache.org.
AMBARI-18246. Logfeeder cleanup - appendum for branch-2.5 (oleewere)

Change-Id: Ie7b8a669ecd418ca566b5d060d5f0a40ee84824f


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

Branch: refs/heads/branch-2.5
Commit: 149cb7de87927137e1295e3b444df0f46aa26a9c
Parents: 6fa4abf
Author: oleewere <ol...@gmail.com>
Authored: Wed Sep 28 11:38:30 2016 +0200
Committer: oleewere <ol...@gmail.com>
Committed: Sat Nov 5 14:46:45 2016 +0100

----------------------------------------------------------------------
 .../apache/ambari/logfeeder/metrics/MetricsManager.java | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/149cb7de/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/metrics/MetricsManager.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/metrics/MetricsManager.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/metrics/MetricsManager.java
index a679a33..fca2b20 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/metrics/MetricsManager.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/metrics/MetricsManager.java
@@ -49,14 +49,14 @@ public class MetricsManager {
     LOG.info("Initializing MetricsManager()");
     amsClient = new LogFeederAMSClient();
 
-    if (amsClient.getCollectorUri(null) != null) {
+    if (amsClient.getCollectorUri() != null) {
       findNodeHostName();
       if (nodeHostName == null) {
         isMetricsEnabled = false;
         LOG.error("Failed getting hostname for node. Disabling publishing LogFeeder metrics");
       } else {
         isMetricsEnabled = true;
-        LOG.info("LogFeeder Metrics is enabled. Metrics host=" + amsClient.getCollectorUri(null));
+        LOG.info("LogFeeder Metrics is enabled. Metrics host=" + amsClient.getCollectorUri());
       }
     } else {
       LOG.info("LogFeeder Metrics publish is disabled");
@@ -80,14 +80,14 @@ public class MetricsManager {
       }
       if (nodeHostName == null) {
         isMetricsEnabled = false;
-        logger.error("Failed getting hostname for node. Disabling publishing LogFeeder metrics");
+        LOG.error("Failed getting hostname for node. Disabling publishing LogFeeder metrics");
       } else {
         isMetricsEnabled = true;
-        logger.info("LogFeeder Metrics is enabled. Metrics host="
-          + amsClient.getCollectorUri(null));
+        LOG.info("LogFeeder Metrics is enabled. Metrics host="
+          + amsClient.getCollectorUri());
       }
     } else {
-      logger.info("LogFeeder Metrics publish is disabled");
+      LOG.info("LogFeeder Metrics publish is disabled");
     }
   }
 


[48/58] [abbrv] ambari git commit: AMBARI-18510. Use logsearch truststore to look for credential in case of external authentication (Miklos Gergely via oleewere)

Posted by ol...@apache.org.
http://git-wip-us.apache.org/repos/asf/ambari/blob/3f48c53b/ambari-logsearch/docker/test-config/logsearch/logsearch-env.sh
----------------------------------------------------------------------
diff --git a/ambari-logsearch/docker/test-config/logsearch/logsearch-env.sh b/ambari-logsearch/docker/test-config/logsearch/logsearch-env.sh
index 2ad7055..2c2d056 100644
--- a/ambari-logsearch/docker/test-config/logsearch/logsearch-env.sh
+++ b/ambari-logsearch/docker/test-config/logsearch/logsearch-env.sh
@@ -21,7 +21,7 @@ export LOGSEARCH_PORT=61888
 # path containing LogSearch.jar file
 export LOGSEARCH_PATH=/root/ambari/ambari-logsearch/ambari-logsearch-portal/target/package
 
-export LOGSEARCH_CONF_DIR=/root/test-config/logsearch
+export LOGSEARCH_CONF_DIR=/root/config/logsearch
 
 export LOGFILE=/var/log/ambari-logsearch-portal/logsearch.log
 
@@ -33,4 +33,12 @@ LOGSEARCH_JAVA_MEM=${LOGSEARCH_JAVA_MEM:-"-Xmx1024m"}
 
 export LOGSEARCH_DEBUG=true
 
-export LOGSEARCH_DEBUG_PORT=5005
\ No newline at end of file
+export LOGSEARCH_DEBUG_PORT=5005
+
+export LOGSEARCH_SSL="true"
+export LOGSEARCH_KEYSTORE_LOCATION=/root/config/ssl/logsearch.keyStore.jks
+export LOGSEARCH_KEYSTORE_PASSWORD=bigdata
+export LOGSEARCH_KEYSTORE_TYPE=jks
+export LOGSEARCH_TRUSTSTORE_LOCATION=/root/config/ssl/logsearch.trustStore.jks
+export LOGSEARCH_TRUSTSTORE_PASSWORD=bigdata
+export LOGSEARCH_TRUSTSTORE_TYPE=jks

http://git-wip-us.apache.org/repos/asf/ambari/blob/3f48c53b/ambari-logsearch/docker/test-config/logsearch/logsearch-https.properties
----------------------------------------------------------------------
diff --git a/ambari-logsearch/docker/test-config/logsearch/logsearch-https.properties b/ambari-logsearch/docker/test-config/logsearch/logsearch-https.properties
new file mode 100644
index 0000000..1bd8c70
--- /dev/null
+++ b/ambari-logsearch/docker/test-config/logsearch/logsearch-https.properties
@@ -0,0 +1,55 @@
+# 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.
+
+logsearch.solr.zk_connect_string=localhost:9983
+
+# Service Logs
+logsearch.solr.collection.service.logs=hadoop_logs
+
+logsearch.service.logs.split.interval.mins=15
+logsearch.collection.service.logs.numshards=3
+logsearch.collection.service.logs.replication.factor=2
+
+# Audit logs
+logsearch.solr.audit.logs.zk_connect_string=localhost:9983
+logsearch.solr.collection.audit.logs=audit_logs
+logsearch.solr.audit.logs.url=
+
+logsearch.audit.logs.split.interval.mins=15
+logsearch.collection.audit.logs.numshards=3
+logsearch.collection.audit.logs.replication.factor=2
+
+# History logs
+logsearch.solr.collection.history=history
+logsearch.solr.history.config.name=history
+logsearch.collection.history.replication.factor=1
+
+# Metrics
+logsearch.solr.metrics.collector.hosts=
+logsearch.solr.jmx.port=18886
+
+# Logfeeder Settings
+
+logsearch.logfeeder.include.default.level=FATAL,ERROR,WARN,INFO,DEBUG,TRACE,UNKNOWN
+
+# logsearch-admin.json
+logsearch.auth.file.enable=true
+logsearch.login.credentials.file=user_pass.json
+
+logsearch.auth.ldap.enable=false
+logsearch.auth.simple.enable=false
+logsearch.auth.external_auth.enable=false
+
+logsearch.protocol=https

http://git-wip-us.apache.org/repos/asf/ambari/blob/3f48c53b/ambari-logsearch/docker/test-config/solr/solr-env-ssl.sh
----------------------------------------------------------------------
diff --git a/ambari-logsearch/docker/test-config/solr/solr-env-ssl.sh b/ambari-logsearch/docker/test-config/solr/solr-env-ssl.sh
new file mode 100644
index 0000000..faaa6ff
--- /dev/null
+++ b/ambari-logsearch/docker/test-config/solr/solr-env-ssl.sh
@@ -0,0 +1,101 @@
+#!/bin/bash
+# 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.
+
+# By default the script will use JAVA_HOME to determine which java
+# to use, but you can set a specific path for Solr to use without
+# affecting other Java applications on your server/workstation.
+SOLR_JAVA_HOME=/usr/java/default
+
+# Increase Java Min/Max Heap as needed to support your indexing / query needs
+SOLR_JAVA_MEM="-Xms1024m -Xmx2048m"
+
+# Enable verbose GC logging
+GC_LOG_OPTS="-verbose:gc -XX:+PrintHeapAtGC -XX:+PrintGCDetails \
+-XX:+PrintGCDateStamps -XX:+PrintGCTimeStamps -XX:+PrintTenuringDistribution -XX:+PrintGCApplicationStoppedTime"
+
+# These GC settings have shown to work well for a number of common Solr workloads
+GC_TUNE="-XX:NewRatio=3 \
+-XX:SurvivorRatio=4 \
+-XX:TargetSurvivorRatio=90 \
+-XX:MaxTenuringThreshold=8 \
+-XX:+UseConcMarkSweepGC \
+-XX:+UseParNewGC \
+-XX:ConcGCThreads=4 -XX:ParallelGCThreads=4 \
+-XX:+CMSScavengeBeforeRemark \
+-XX:PretenureSizeThreshold=64m \
+-XX:+UseCMSInitiatingOccupancyOnly \
+-XX:CMSInitiatingOccupancyFraction=50 \
+-XX:CMSMaxAbortablePrecleanTime=6000 \
+-XX:+CMSParallelRemarkEnabled \
+-XX:+ParallelRefProcEnabled"
+
+# Set the ZooKeeper connection string if using an external ZooKeeper ensemble
+# e.g. host1:2181,host2:2181/chroot
+# Leave empty if not using SolrCloud
+#ZK_HOST="localhost:9983/ambari-solr"
+
+# Set the ZooKeeper client timeout (for SolrCloud mode)
+ZK_CLIENT_TIMEOUT="60000"
+
+# By default the start script uses "localhost"; override the hostname here
+# for production SolrCloud environments to control the hostname exposed to cluster state
+#SOLR_HOST="192.168.1.1"
+
+# By default the start script uses UTC; override the timezone if needed
+#SOLR_TIMEZONE="UTC"
+
+# Set to true to activate the JMX RMI connector to allow remote JMX client applications
+# to monitor the JVM hosting Solr; set to "false" to disable that behavior
+# (false is recommended in production environments)
+ENABLE_REMOTE_JMX_OPTS="true"
+
+# The script will use SOLR_PORT+10000 for the RMI_PORT or you can set it here
+RMI_PORT=18886
+
+# Anything you add to the SOLR_OPTS variable will be included in the java
+# start command line as-is, in ADDITION to other options. If you specify the
+# -a option on start script, those options will be appended as well. Examples:
+#SOLR_OPTS="$SOLR_OPTS -Dsolr.autoSoftCommit.maxTime=3000"
+#SOLR_OPTS="$SOLR_OPTS -Dsolr.autoCommit.maxTime=60000"
+#SOLR_OPTS="$SOLR_OPTS -Dsolr.clustering.enabled=true"
+
+# Location where the bin/solr script will save PID files for running instances
+# If not set, the script will create PID files in $SOLR_TIP/bin
+SOLR_PID_DIR=/var/run/ambari-logsearch-solr
+
+# Path to a directory where Solr creates index files, the specified directory
+# must contain a solr.xml; by default, Solr will use server/solr
+SOLR_HOME=/root/logsearch_solr_index/data
+
+# Solr provides a default Log4J configuration properties file in server/resources
+# however, you may want to customize the log settings and file appender location
+# so you can point the script to use a different log4j.properties file
+LOG4J_PROPS=/root/config/solr/log4j.properties
+
+# Location where Solr should write logs to; should agree with the file appender
+# settings in server/resources/log4j.properties
+SOLR_LOGS_DIR=/var/log/ambari-logsearch-solr
+
+# Sets the port Solr binds to, default is 8983
+SOLR_PORT=8886
+
+SOLR_SSL_KEY_STORE=/root/config/ssl/logsearch.keyStore.jks
+SOLR_SSL_KEY_STORE_PASSWORD=bigdata
+SOLR_SSL_TRUST_STORE=/root/config/ssl/logsearch.trustStore.jks
+SOLR_SSL_TRUST_STORE_PASSWORD=bigdata
+SOLR_SSL_NEED_CLIENT_AUTH=false
+SOLR_SSL_WANT_CLIENT_AUTH=false
+

http://git-wip-us.apache.org/repos/asf/ambari/blob/3f48c53b/ambari-logsearch/docker/test-config/solr/solr-env.sh
----------------------------------------------------------------------
diff --git a/ambari-logsearch/docker/test-config/solr/solr-env.sh b/ambari-logsearch/docker/test-config/solr/solr-env.sh
index 92fa354..11b9fe0 100644
--- a/ambari-logsearch/docker/test-config/solr/solr-env.sh
+++ b/ambari-logsearch/docker/test-config/solr/solr-env.sh
@@ -83,11 +83,11 @@ SOLR_HOME=/root/logsearch_solr_index/data
 # Solr provides a default Log4J configuration properties file in server/resources
 # however, you may want to customize the log settings and file appender location
 # so you can point the script to use a different log4j.properties file
-LOG4J_PROPS=/root/test-config/solr/log4j.properties
+LOG4J_PROPS=/root/config/solr/log4j.properties
 
 # Location where Solr should write logs to; should agree with the file appender
 # settings in server/resources/log4j.properties
 SOLR_LOGS_DIR=/var/log/ambari-logsearch-solr
 
 # Sets the port Solr binds to, default is 8983
-SOLR_PORT=8886
\ No newline at end of file
+SOLR_PORT=8886

http://git-wip-us.apache.org/repos/asf/ambari/blob/3f48c53b/ambari-server/src/main/resources/common-services/AMBARI_INFRA/0.1.0/properties/infra-solr-env.sh.j2
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/AMBARI_INFRA/0.1.0/properties/infra-solr-env.sh.j2 b/ambari-server/src/main/resources/common-services/AMBARI_INFRA/0.1.0/properties/infra-solr-env.sh.j2
index d1c1ef9..8c24fa4 100644
--- a/ambari-server/src/main/resources/common-services/AMBARI_INFRA/0.1.0/properties/infra-solr-env.sh.j2
+++ b/ambari-server/src/main/resources/common-services/AMBARI_INFRA/0.1.0/properties/infra-solr-env.sh.j2
@@ -96,8 +96,8 @@ SOLR_PORT={{infra_solr_port}}
 {% if infra_solr_ssl_enabled %}
 SOLR_SSL_KEY_STORE={{infra_solr_keystore_location}}
 SOLR_SSL_KEY_STORE_PASSWORD={{infra_solr_keystore_password}}
-SOLR_SSL_TRUST_STORE={{infra_solr_keystore_location}}
-SOLR_SSL_TRUST_STORE_PASSWORD={{infra_solr_keystore_password}}
+SOLR_SSL_TRUST_STORE={{infra_solr_truststore_location}}
+SOLR_SSL_TRUST_STORE_PASSWORD={{infra_solr_truststore_password}}
 SOLR_SSL_NEED_CLIENT_AUTH=false
 SOLR_SSL_WANT_CLIENT_AUTH=false
 {% endif %}

http://git-wip-us.apache.org/repos/asf/ambari/blob/3f48c53b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/properties/logsearch-env.sh.j2
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/properties/logsearch-env.sh.j2 b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/properties/logsearch-env.sh.j2
index 501603a..eb7306c 100644
--- a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/properties/logsearch-env.sh.j2
+++ b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/properties/logsearch-env.sh.j2
@@ -38,7 +38,7 @@ export LOGSEARCH_DEBUG={{logsearch_debug_enabled}}
 
 export LOGSEARCH_DEBUG_PORT={{logsearch_debug_port}}
 
-{% if infra_solr_ssl_enabled or logsearch_ui_protocol == 'https' %}
+{% if infra_solr_ssl_enabled or logsearch_ui_protocol == 'https' or ambari_server_use_ssl %}
 export LOGSEARCH_SSL="true"
 export LOGSEARCH_KEYSTORE_LOCATION={{logsearch_keystore_location}}
 export LOGSEARCH_KEYSTORE_PASSWORD={{logsearch_keystore_password}}


[10/58] [abbrv] ambari git commit: AMBARI-18310. Refactor logsearch portal side code (oleewere)

Posted by ol...@apache.org.
http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/manager/LogFileMgr.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/manager/LogFileMgr.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/manager/LogFileMgr.java
deleted file mode 100644
index e227c6c..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/manager/LogFileMgr.java
+++ /dev/null
@@ -1,145 +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.manager;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.ambari.logsearch.common.LogSearchConstants;
-import org.apache.ambari.logsearch.common.MessageEnums;
-import org.apache.ambari.logsearch.common.SearchCriteria;
-import org.apache.ambari.logsearch.dao.AuditSolrDao;
-import org.apache.ambari.logsearch.dao.ServiceLogsSolrDao;
-import org.apache.ambari.logsearch.dao.SolrDaoBase;
-import org.apache.ambari.logsearch.util.RESTErrorUtil;
-import org.apache.ambari.logsearch.util.SolrUtil;
-import org.apache.ambari.logsearch.view.VLogFile;
-import org.apache.ambari.logsearch.view.VLogFileList;
-import org.apache.ambari.logsearch.view.VSolrLogList;
-import org.apache.commons.io.FilenameUtils;
-import org.apache.commons.lang.StringUtils;
-import org.apache.log4j.Logger;
-import org.apache.solr.client.solrj.SolrQuery;
-import org.apache.solr.client.solrj.SolrServerException;
-import org.apache.solr.client.solrj.response.FacetField;
-import org.apache.solr.client.solrj.response.FacetField.Count;
-import org.apache.solr.client.solrj.response.QueryResponse;
-import org.apache.solr.common.SolrException;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-
-
-@Component
-public class LogFileMgr extends MgrBase {
-
-  private static final Logger logger = Logger.getLogger(LogFileMgr.class);
-
-  @Autowired
-  private ServiceLogsSolrDao serviceLogsSolrDao;
-  @Autowired
-  private AuditSolrDao auditSolrDao;
-
-  public String searchLogFiles(SearchCriteria searchCriteria) {
-    VLogFileList logFileList = new VLogFileList();
-    List<VLogFile> logFiles = new ArrayList<VLogFile>();
-    String componentName = (String) searchCriteria.getParamValue("component");
-    String host = (String) searchCriteria.getParamValue("host");
-    int minCount = 1;// to remove zero count facet
-    SolrQuery solrQuery = new SolrQuery();
-    SolrUtil.setMainQuery(solrQuery, null);
-    SolrUtil.setFacetFieldWithMincount(solrQuery, LogSearchConstants.SOLR_PATH, minCount);
-    // adding filter
-    queryGenerator.setSingleIncludeFilter(solrQuery, LogSearchConstants.SOLR_COMPONENT, componentName);
-    queryGenerator.setSingleIncludeFilter(solrQuery, LogSearchConstants.SOLR_HOST, host);
-    try {
-      String logType = (String) searchCriteria.getParamValue("logType");
-      if (StringUtils.isBlank(logType)) {
-        logType = LogType.SERVICE.name();// default is service Log
-      }
-      SolrDaoBase daoMgr = null;
-      if (logType.equalsIgnoreCase(LogType.SERVICE.name())) {
-        daoMgr = serviceLogsSolrDao;
-      } else if (logType.equalsIgnoreCase(LogType.AUDIT.name())) {
-        daoMgr = auditSolrDao;
-      } else {
-        throw RESTErrorUtil.createRESTException(logType + " is not a valid logType", MessageEnums.INVALID_INPUT_DATA);
-      }
-      QueryResponse queryResponse = daoMgr.process(solrQuery);
-      if (queryResponse.getFacetField(LogSearchConstants.SOLR_PATH) != null) {
-        FacetField queryFacetField = queryResponse.getFacetField(LogSearchConstants.SOLR_PATH);
-        if (queryFacetField != null) {
-          List<Count> countList = queryFacetField.getValues();
-          for (Count count : countList) {
-            VLogFile vLogFile = new VLogFile();
-            String filePath = count.getName();
-            String fileName = FilenameUtils.getName(filePath);
-            vLogFile.setPath(filePath);
-            vLogFile.setName(fileName);
-            logFiles.add(vLogFile);
-          }
-        }
-      }
-    } catch (SolrException | SolrServerException | IOException e) {
-      logger.error("Error in solr query  :" + e.getLocalizedMessage() + "\n Query :" + solrQuery.toQueryString(), e.getCause());
-      throw RESTErrorUtil.createRESTException(MessageEnums.SOLR_ERROR.getMessage().getMessage(), MessageEnums.ERROR_SYSTEM);
-    }
-    logFileList.setLogFiles(logFiles);
-    String jsonStr = "";
-    jsonStr = convertObjToString(logFileList);
-
-    return jsonStr;
-  }
-
-  public String getLogFileTail(SearchCriteria searchCriteria) {
-    String host = (String) searchCriteria.getParamValue("host");
-    String logFile = (String) searchCriteria.getParamValue("name");
-    String component = (String) searchCriteria.getParamValue("component");
-    String tailSize = (String) searchCriteria.getParamValue("tailSize");
-    if (StringUtils.isBlank(host)) {
-      throw RESTErrorUtil.createRESTException("missing Host Name", MessageEnums.ERROR_SYSTEM);
-    }
-    tailSize = (StringUtils.isBlank(tailSize)) ? "10" : tailSize;
-    SolrQuery logFileTailQuery = new SolrQuery();
-    try {
-      int tail = Integer.parseInt(tailSize);
-      tail = tail > 100 ? 100 : tail;
-      SolrUtil.setMainQuery(logFileTailQuery, null);
-      queryGenerator.setSingleIncludeFilter(logFileTailQuery, LogSearchConstants.SOLR_HOST, host);
-      if (!StringUtils.isBlank(logFile)) {
-        queryGenerator.setSingleIncludeFilter(logFileTailQuery, LogSearchConstants.SOLR_PATH, SolrUtil.makeSolrSearchString(logFile));
-      } else if (!StringUtils.isBlank(component)) {
-        queryGenerator.setSingleIncludeFilter(logFileTailQuery, LogSearchConstants.SOLR_COMPONENT, component);
-      } else {
-        throw RESTErrorUtil.createRESTException("component or logfile parameter must be present", MessageEnums.ERROR_SYSTEM);
-      }
-
-      SolrUtil.setRowCount(logFileTailQuery, tail);
-      queryGenerator.setSortOrderDefaultServiceLog(logFileTailQuery, new SearchCriteria());
-      VSolrLogList solrLogList = getLogAsPaginationProvided(logFileTailQuery, serviceLogsSolrDao);
-      return convertObjToString(solrLogList);
-
-    } catch (NumberFormatException ne) {
-
-      throw RESTErrorUtil.createRESTException(ne.getMessage(),
-        MessageEnums.ERROR_SYSTEM);
-
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/manager/LogsMgr.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/manager/LogsMgr.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/manager/LogsMgr.java
deleted file mode 100644
index 53e0aab..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/manager/LogsMgr.java
+++ /dev/null
@@ -1,1896 +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.manager;
-
-import java.io.IOException;
-import java.text.ParseException;
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.Collection;
-import java.util.Date;
-import java.util.GregorianCalendar;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Locale;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.TimeZone;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.CopyOnWriteArrayList;
-
-import javax.ws.rs.core.Response;
-
-import org.apache.ambari.logsearch.common.ConfigHelper;
-import org.apache.ambari.logsearch.common.LogSearchConstants;
-import org.apache.ambari.logsearch.common.MessageEnums;
-import org.apache.ambari.logsearch.common.PropertiesHelper;
-import org.apache.ambari.logsearch.common.SearchCriteria;
-import org.apache.ambari.logsearch.dao.ServiceLogsSolrDao;
-import org.apache.ambari.logsearch.graph.GraphDataGenerator;
-import org.apache.ambari.logsearch.query.QueryGenerationBase;
-import org.apache.ambari.logsearch.util.BizUtil;
-import org.apache.ambari.logsearch.util.DateUtil;
-import org.apache.ambari.logsearch.util.FileUtil;
-import org.apache.ambari.logsearch.util.RESTErrorUtil;
-import org.apache.ambari.logsearch.util.SolrUtil;
-import org.apache.ambari.logsearch.view.VBarDataList;
-import org.apache.ambari.logsearch.view.VBarGraphData;
-import org.apache.ambari.logsearch.view.VCount;
-import org.apache.ambari.logsearch.view.VCountList;
-import org.apache.ambari.logsearch.view.VGraphData;
-import org.apache.ambari.logsearch.view.VGraphInfo;
-import org.apache.ambari.logsearch.view.VGroupList;
-import org.apache.ambari.logsearch.view.VNameValue;
-import org.apache.ambari.logsearch.view.VNameValueList;
-import org.apache.ambari.logsearch.view.VNode;
-import org.apache.ambari.logsearch.view.VNodeList;
-import org.apache.ambari.logsearch.view.VSolrLogList;
-import org.apache.ambari.logsearch.view.VSummary;
-import org.apache.commons.lang.StringUtils;
-import org.apache.commons.lang.time.DateUtils;
-import org.apache.log4j.Logger;
-import org.apache.solr.client.solrj.SolrQuery;
-import org.apache.solr.client.solrj.SolrServerException;
-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.SolrDocument;
-import org.apache.solr.common.SolrDocumentList;
-import org.apache.solr.common.SolrException;
-import org.apache.solr.common.util.NamedList;
-import org.apache.solr.common.util.SimpleOrderedMap;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.scheduling.annotation.Scheduled;
-import org.springframework.stereotype.Component;
-
-import com.google.common.collect.Lists;
-
-@Component
-public class LogsMgr extends MgrBase {
-  private static final Logger logger = Logger.getLogger(LogsMgr.class);
-
-  private static List<String> cancelByDate = new CopyOnWriteArrayList<String>();
-
-  private static Map<String, String> mapUniqueId = new ConcurrentHashMap<String, String>();
-  
-  private static enum CONDITION {
-    OR, AND
-  }
-
-  @Autowired
-  private ServiceLogsSolrDao serviceLogsSolrDao;
-  @Autowired
-  private GraphDataGenerator graphDataGenerator;
-
-  public String searchLogs(SearchCriteria searchCriteria) {
-    String keyword = (String) searchCriteria.getParamValue("keyword");
-    String logId = (String) searchCriteria.getParamValue("sourceLogId");
-    String lastPage = (String)  searchCriteria.getParamValue("isLastPage");
-    Boolean isLastPage = Boolean.parseBoolean(lastPage);
-
-    if (!StringUtils.isBlank(keyword)) {
-      try {
-        return getPageByKeyword(searchCriteria);
-      } catch (SolrException | SolrServerException e) {
-        logger.error("Error while getting keyword=" + keyword, e);
-        throw RESTErrorUtil.createRESTException(MessageEnums.SOLR_ERROR
-            .getMessage().getMessage(), MessageEnums.ERROR_SYSTEM);
-      }
-    } else if (!StringUtils.isBlank(logId)) {
-      try {
-        return getPageByLogId(searchCriteria);
-      } catch (SolrException e) {
-        logger.error("Error while getting keyword=" + keyword, e);
-        throw RESTErrorUtil.createRESTException(MessageEnums.SOLR_ERROR
-            .getMessage().getMessage(), MessageEnums.ERROR_SYSTEM);
-      }
-    } else if (isLastPage) {
-      SolrQuery lastPageQuery = queryGenerator.commonServiceFilterQuery(searchCriteria);
-      VSolrLogList collection = getLastPage(searchCriteria,LogSearchConstants.LOGTIME,serviceLogsSolrDao,lastPageQuery);
-      if(collection == null){
-        collection = new VSolrLogList();
-      }
-      return convertObjToString(collection);
-    } else {
-      SolrQuery solrQuery = queryGenerator
-          .commonServiceFilterQuery(searchCriteria);
-
-      solrQuery.setParam("event", "/service/logs");
-
-      VSolrLogList collection = getLogAsPaginationProvided(solrQuery,
-          serviceLogsSolrDao);
-      return convertObjToString(collection);
-    }
-  }
-
-  public String getHosts() {
-    return getFields(LogSearchConstants.SOLR_HOST);
-  }
-  
-  private String getFields(String field){
-
-    SolrQuery solrQuery = new SolrQuery();
-    VGroupList collection = new VGroupList();
-    SolrUtil.setMainQuery(solrQuery, null);
-    SolrUtil.setFacetField(solrQuery,
-        field);
-    SolrUtil.setFacetSort(solrQuery, LogSearchConstants.FACET_INDEX);
-    try {
-      QueryResponse response = serviceLogsSolrDao.process(solrQuery);
-      if(response == null){
-        return convertObjToString(collection);
-      }
-      FacetField facetField = response
-        .getFacetField(field);
-      if (facetField == null){
-        return convertObjToString(collection);
-      }
-      List<Count> fieldList = facetField.getValues();
-      if (fieldList == null){
-        return convertObjToString(collection);
-      }
-      SolrDocumentList docList = response.getResults();
-      if(docList == null){
-        return convertObjToString(collection);
-      }
-      String temp = "";
-      for (Count cnt : fieldList) {
-        SolrDocument solrDoc = new SolrDocument();
-        temp = cnt.getName();
-        solrDoc.put(field, temp);
-        docList.add(solrDoc);
-      }
-
-      collection.setGroupDocuments(docList);
-      if(!docList.isEmpty()){
-        collection.setStartIndex((int) docList.getStart());
-        collection.setTotalCount(docList.getNumFound());
-      }
-      return convertObjToString(collection);
-    } catch (IOException | SolrServerException | SolrException e) {
-      logger.error(e);
-      throw RESTErrorUtil.createRESTException(MessageEnums.SOLR_ERROR
-          .getMessage().getMessage(), MessageEnums.ERROR_SYSTEM);
-    }
-
-  }
-
-  public String getComponents() {
-    return getFields(LogSearchConstants.SOLR_COMPONENT);
-  }
-
-  public String getAggregatedInfo(SearchCriteria searchCriteria) {
-    SolrQuery solrQuery = queryGenerator.commonServiceFilterQuery(searchCriteria);
-    String hierarchy = "host,type,level";
-    VGraphInfo graphInfo = new VGraphInfo();
-    try {
-      SolrUtil.setMainQuery(solrQuery, null);
-      SolrUtil.setFacetPivot(solrQuery, 1, hierarchy);
-      QueryResponse response = serviceLogsSolrDao.process(solrQuery);
-      if (response == null) {
-        return convertObjToString(graphInfo);
-      }
-
-      List<List<PivotField>> hirarchicalPivotField = new ArrayList<List<PivotField>>();
-      List<VGraphData> dataList = new ArrayList<VGraphData>();
-      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 convertObjToString(graphInfo);
-    } catch (SolrException | SolrServerException | IOException e) {
-      logger.error("Error during solrQuery=" + solrQuery, e);
-      throw RESTErrorUtil.createRESTException(MessageEnums.SOLR_ERROR
-          .getMessage().getMessage(), MessageEnums.ERROR_SYSTEM);
-    }
-  }
-
-  public List<VGraphData> buidGraphData(List<PivotField> pivotFields) {
-    List<VGraphData> logList = new ArrayList<VGraphData>();
-    if (pivotFields != null) {
-      for (PivotField pivotField : pivotFields) {
-        if (pivotField != null) {
-          VGraphData logLevel = new VGraphData();
-          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 VCountList getFieldCount(String field){
-    VCountList collection = new VCountList();
-    List<VCount> vCounts = new ArrayList<VCount>();
-    SolrQuery solrQuery = new SolrQuery();
-    SolrUtil.setMainQuery(solrQuery, null);
-    if(field == null){
-      return collection;
-    }
-    SolrUtil.setFacetField(solrQuery, field);
-    try {
-      QueryResponse response = serviceLogsSolrDao.process(solrQuery);
-      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) {
-          VCount vCount = new VCount();
-          vCount.setName(cnt.getName());
-          vCount.setCount(cnt.getCount());
-          vCounts.add(vCount);
-        }
-      }
-
-    } catch (SolrException | SolrServerException | IOException e) {
-      logger.error("Error during solrQuery=" + solrQuery, e);
-      throw RESTErrorUtil.createRESTException(MessageEnums.SOLR_ERROR
-          .getMessage().getMessage(), MessageEnums.ERROR_SYSTEM);
-    }
-
-    collection.setCounts(vCounts);
-    return collection;
-  }
-  
-  public VCountList getLogLevelCount() {
-    return getFieldCount(LogSearchConstants.SOLR_LEVEL);
-  }
-
-  public VCountList getComponentsCount() {
-    return getFieldCount(LogSearchConstants.SOLR_COMPONENT);
-  }
-
-  public VCountList getHostsCount() {
-    return getFieldCount(LogSearchConstants.SOLR_HOST);
-  }
-
-  public List<VNode> buidTreeData(List<PivotField> pivotFields,
-                                  List<PivotField> pivotFieldHost, SolrQuery query,
-                                  String firstPriority, String secondPriority) {
-    List<VNode> extensionTree = new ArrayList<VNode>();
-    String hostQuery = null;
-    if (pivotFields != null) {
-      // For Host
-      for (PivotField pivotHost : pivotFields) {
-        if (pivotHost != null) {
-          VNode hostNode = new VNode();
-          String name = (pivotHost.getValue() == null ? "" : ""+ pivotHost.getValue());
-          String value = "" + pivotHost.getCount();
-          if(!StringUtils.isBlank(name)){
-            hostNode.setName(name);
-          }
-          if(!StringUtils.isBlank(value)){
-            hostNode.setValue(value);
-          }
-          if(!StringUtils.isBlank(firstPriority)){
-            hostNode.setType(firstPriority);
-          }
-
-          hostNode.setParent(true);
-          hostNode.setRoot(true);
-          PivotField hostPivot = null;
-          for (PivotField searchHost : pivotFieldHost) {
-            if (!StringUtils.isBlank(hostNode.getName())
-                && hostNode.getName().equals(searchHost.getValue())) {
-              hostPivot = searchHost;
-              break;
-            }
-          }
-          List<PivotField> pivotLevelHost = hostPivot.getPivot();
-          if (pivotLevelHost != null) {
-            Collection<VNameValue> logLevelCount = new ArrayList<VNameValue>();
-            for (PivotField pivotLevel : pivotLevelHost) {
-              if (pivotLevel != null) {
-                VNameValue vnameValue = new VNameValue();
-                String levelName = (pivotLevel.getValue() == null ? "" : ""
-                    + pivotLevel.getValue());
-                vnameValue.setName(levelName.toUpperCase());
-                vnameValue.setValue("" + pivotLevel.getCount());
-                logLevelCount.add(vnameValue);
-              }
-            }
-            hostNode.setLogLevelCount(logLevelCount);
-          }
-
-          query.addFilterQuery(hostQuery);
-          List<PivotField> pivotComponents = pivotHost.getPivot();
-          // For Components
-          if (pivotComponents != null) {
-            Collection<VNode> componentNodes = new ArrayList<VNode>();
-            for (PivotField pivotComp : pivotComponents) {
-              if (pivotComp != null) {
-                VNode compNode = new VNode();
-                String compName = (pivotComp.getValue() == null ? "" : ""
-                    + pivotComp.getValue());
-                compNode.setName(compName);
-                if (!StringUtils.isBlank(secondPriority)) {
-                  compNode.setType(secondPriority);
-                }
-                compNode.setValue("" + pivotComp.getCount());
-                compNode.setParent(false);
-                compNode.setRoot(false);
-                List<PivotField> pivotLevels = pivotComp.getPivot();
-                if (pivotLevels != null) {
-                  Collection<VNameValue> logLevelCount = new ArrayList<VNameValue>();
-                  for (PivotField pivotLevel : pivotLevels) {
-                    if (pivotLevel != null) {
-                      VNameValue vnameValue = new VNameValue();
-                      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;
-  }
-
-  public VNodeList getTreeExtension(SearchCriteria searchCriteria) {
-    SolrQuery solrQuery = queryGenerator.commonServiceFilterQuery(searchCriteria);
-    solrQuery.setParam("event", "/getTreeExtension");
-
-    if (searchCriteria.getSortBy() == null) {
-      searchCriteria.setSortBy(LogSearchConstants.SOLR_HOST);
-      searchCriteria.setSortType(SolrQuery.ORDER.asc.toString());
-    }
-    queryGenerator.setFilterFacetSort(solrQuery, searchCriteria);
-    String hostName = ""
-      + ((searchCriteria.getParamValue("hostName") == null) ? ""
-      : searchCriteria.getParamValue("hostName"));
-    if (!StringUtils.isBlank(hostName)){
-      solrQuery.addFilterQuery(LogSearchConstants.SOLR_HOST + ":*"
-        + hostName + "*");
-    }
-    String firstHirarchy = "host,type,level";
-    String secondHirarchy = "host,level";
-    VNodeList list = new VNodeList();
-    try {
-
-      SolrUtil.setFacetPivot(solrQuery, 1, firstHirarchy,
-        secondHirarchy);
-
-      QueryResponse response = serviceLogsSolrDao.process(solrQuery);
-      List<List<PivotField>> listFirstHirarchicalPivotFields = new ArrayList<List<PivotField>>();
-      NamedList<List<PivotField>> firstNamedList = response
-        .getFacetPivot();
-      if (firstNamedList != null) {
-        listFirstHirarchicalPivotFields = firstNamedList
-          .getAll(firstHirarchy);
-      }
-      List<List<PivotField>> listSecondHirarchicalPivotFields = new ArrayList<List<PivotField>>();
-      NamedList<List<PivotField>> secondNamedList = response
-        .getFacetPivot();
-      if (secondNamedList != null) {
-        listSecondHirarchicalPivotFields = secondNamedList
-          .getAll(secondHirarchy);
-      }
-      List<PivotField> firstHirarchicalPivotFields = new ArrayList<PivotField>();
-      List<PivotField> secondHirarchicalPivotFields = new ArrayList<PivotField>();
-      if (!listFirstHirarchicalPivotFields.isEmpty()) {
-        firstHirarchicalPivotFields = listFirstHirarchicalPivotFields
-          .get(0);
-      }
-      if (!listSecondHirarchicalPivotFields.isEmpty()) {
-        secondHirarchicalPivotFields = listSecondHirarchicalPivotFields
-          .get(0);
-      }
-      List<VNode> dataList = buidTreeData(firstHirarchicalPivotFields,
-        secondHirarchicalPivotFields, solrQuery,
-        LogSearchConstants.HOST, LogSearchConstants.COMPONENT);
-
-      list.setvNodeList(dataList);
-    } catch (SolrException | SolrServerException | IOException e) {
-      logger.error("Error during solrQuery=" + solrQuery, e);
-      throw RESTErrorUtil.createRESTException(MessageEnums.SOLR_ERROR
-          .getMessage().getMessage(), MessageEnums.ERROR_SYSTEM);
-    }
-
-    return list;
-  }
-
-  public String getHostListByComponent(SearchCriteria searchCriteria) {
-    SolrQuery solrQuery = queryGenerator.commonServiceFilterQuery(searchCriteria);
-    solrQuery.setParam("event", "/service/hosts/component");
-
-    VNodeList list = new VNodeList();
-    if (searchCriteria.getSortBy() == null) {
-      searchCriteria.setSortBy(LogSearchConstants.SOLR_HOST);
-      searchCriteria.setSortType(SolrQuery.ORDER.asc.toString());
-    }
-    queryGenerator.setFilterFacetSort(solrQuery, searchCriteria);
-    String componentName = ""
-      + ((searchCriteria.getParamValue("componentName") == null) ? ""
-      : searchCriteria.getParamValue("componentName"));
-    if (!StringUtils.isBlank(componentName)){
-      solrQuery.addFilterQuery(LogSearchConstants.SOLR_COMPONENT + ":"
-        + componentName);
-    } else {
-      return convertObjToString(list);
-    }
-
-    String firstHirarchy = "type,host,level";
-    String secondHirarchy = "type,level";
-
-    try {
-      SolrUtil.setFacetPivot(solrQuery, 1, firstHirarchy,
-        secondHirarchy);
-      QueryResponse response = serviceLogsSolrDao.process(solrQuery);
-      List<List<PivotField>> firstHirarchicalPivotFields = null;
-      List<List<PivotField>> secondHirarchicalPivotFields = null;
-      NamedList<List<PivotField>> firstNamedList = response
-        .getFacetPivot();
-      if (firstNamedList != null) {
-        firstHirarchicalPivotFields = firstNamedList
-          .getAll(firstHirarchy);
-        secondHirarchicalPivotFields = firstNamedList
-          .getAll(secondHirarchy);
-      }
-
-      if (firstHirarchicalPivotFields == null
-        || secondHirarchicalPivotFields == null) {
-        return convertObjToString(list);
-      }
-
-      List<VNode> dataList = buidTreeData(
-        firstHirarchicalPivotFields.get(0),
-        secondHirarchicalPivotFields.get(0), solrQuery,
-        LogSearchConstants.COMPONENT, LogSearchConstants.HOST);
-      if(dataList == null){
-        return convertObjToString(list);
-      }
-
-      list.setvNodeList(dataList);
-      return convertObjToString(list);
-    } catch (SolrException | SolrServerException | IOException e) {
-      logger.error("Error during solrQuery=" + solrQuery, e);
-      throw RESTErrorUtil.createRESTException(MessageEnums.SOLR_ERROR
-          .getMessage().getMessage(), MessageEnums.ERROR_SYSTEM);
-    }
-  }
-
-  public VNameValueList getLogsLevelCount(SearchCriteria sc) {
-    VNameValueList nameValueList = new VNameValueList();
-    SolrQuery query = queryGenerator.commonServiceFilterQuery(sc);
-    query.setParam("event", "/service/logs/levels/counts/namevalues");
-    List<VNameValue> logsCounts = getLogLevelFacets(query);
-    nameValueList.setVNameValues(logsCounts);
-
-    return nameValueList;
-  }
-
-  public List<VNameValue> getLogLevelFacets(SolrQuery query) {
-    String defalutValue = "0";
-    HashMap<String, String> map = new HashMap<String, String>();
-    List<VNameValue> logsCounts = new ArrayList<VNameValue>();
-    try {
-      SolrUtil.setFacetField(query, LogSearchConstants.SOLR_LEVEL);
-      List<Count> logLevelCounts = getFacetCounts(query,
-          LogSearchConstants.SOLR_LEVEL);
-      if (logLevelCounts == null) {
-        return logsCounts;
-      }
-      for (Count count : logLevelCounts) {
-        map.put(count.getName().toUpperCase(), "" + count.getCount());
-      }
-      for (String level : LogSearchConstants.SUPPORTED_LOG_LEVEL) {
-        VNameValue nameValue = new VNameValue();
-        String value = map.get(level);
-        if (StringUtils.isBlank(value)) {
-          value = defalutValue;
-        }
-        nameValue.setName(level);
-        nameValue.setValue(value);
-        logsCounts.add(nameValue);
-      }
-    } catch (SolrException | SolrServerException | IOException e) {
-      logger.error("Error during solrQuery=" + query, e);
-    }
-    return logsCounts;
-  }
-
-  // Get Facet Count According to FacetFeild
-  public List<Count> getFacetCounts(SolrQuery solrQuery, String facetField)
-    throws SolrServerException, IOException, SolrException {
-    List<Count> list = new ArrayList<FacetField.Count>();
-
-    QueryResponse response = serviceLogsSolrDao.process(solrQuery);
-    if(response == null){
-      return list;
-    }
-
-    FacetField field = response.getFacetField(facetField);
-    if (field == null) {
-      return list;
-    }
-    list = field.getValues();
-
-
-    return list;
-  }
-
-  public String getPageByKeyword(SearchCriteria searchCriteria)
-    throws SolrServerException {
-    String defaultChoice = "0";
-
-    String key = (String) searchCriteria.getParamValue("keyword");
-    if(StringUtils.isBlank(key)){
-      throw RESTErrorUtil.createRESTException("Keyword was not given",
-          MessageEnums.DATA_NOT_FOUND);
-    }
-
-    String keyword = SolrUtil.escapeForStandardTokenizer(key);
-
-    if(keyword.startsWith("\"") && keyword.endsWith("\"")){
-      keyword = keyword.substring(1);
-      keyword = keyword.substring(0, keyword.length()-1);
-    }
-    keyword = "*" + keyword + "*";
-
-
-    String keyType = (String) searchCriteria.getParamValue("keywordType");
-    QueryResponse queryResponse = null;
-
-    if (!defaultChoice.equals(keyType)) {
-      try {
-        int currentPageNumber = searchCriteria.getPage();
-        int maxRows = searchCriteria.getMaxRows();
-        String nextPageLogID = "";
-
-        int lastLogIndexNumber = ((currentPageNumber + 1)
-          * maxRows);
-        String nextPageLogTime = "";
-
-
-        // Next Page Start Time Calculation
-        SolrQuery nextPageLogTimeQuery = queryGenerator
-          .commonServiceFilterQuery(searchCriteria);
-        nextPageLogTimeQuery.remove("start");
-        nextPageLogTimeQuery.remove("rows");
-        nextPageLogTimeQuery.setStart(lastLogIndexNumber);
-        nextPageLogTimeQuery.setRows(1);
-
-        queryResponse = serviceLogsSolrDao.process(
-            nextPageLogTimeQuery);
-        if(queryResponse == null){
-          throw RESTErrorUtil.createRESTException("The keyword "+"\""+key+"\""+" was not found",
-              MessageEnums.ERROR_SYSTEM);
-        }
-
-        SolrDocumentList docList = queryResponse.getResults();
-        if(docList ==null){
-          throw RESTErrorUtil.createRESTException("The keyword "+"\""+key+"\""+" was not found",
-              MessageEnums.ERROR_SYSTEM);
-        }
-
-        SolrDocument solrDoc = docList.get(0);
-
-        Date logDate = (Date) solrDoc.get(LogSearchConstants.LOGTIME);
-        if(logDate == null){
-          throw RESTErrorUtil.createRESTException("The keyword "+"\""+key+"\""+" was not found",
-              MessageEnums.ERROR_SYSTEM);
-        }
-        nextPageLogTime = DateUtil
-          .convertDateWithMillisecondsToSolrDate(logDate);
-        nextPageLogID = ""
-          + solrDoc.get(LogSearchConstants.ID);
-
-        if (StringUtils.isBlank(nextPageLogID)){
-          nextPageLogID = "0";
-        }
-
-        String filterQueryListIds = "";
-        // Remove the same Time Ids
-        SolrQuery listRemoveIds = queryGenerator
-          .commonServiceFilterQuery(searchCriteria);
-        listRemoveIds.remove("start");
-        listRemoveIds.remove("rows");
-        queryGenerator.setSingleIncludeFilter(listRemoveIds,
-          LogSearchConstants.LOGTIME, "\"" + nextPageLogTime + "\"");
-        queryGenerator.setSingleExcludeFilter(listRemoveIds,
-          LogSearchConstants.ID, nextPageLogID);
-        SolrUtil.setFl(listRemoveIds, LogSearchConstants.ID);
-        queryResponse = serviceLogsSolrDao.process(
-            listRemoveIds);
-        if(queryResponse == null){
-          throw RESTErrorUtil.createRESTException("The keyword "+"\""+key+"\""+" was not found",
-              MessageEnums.ERROR_SYSTEM);
-        }
-
-        SolrDocumentList docListIds = queryResponse.getResults();
-        if(docListIds ==null){
-          throw RESTErrorUtil.createRESTException("The keyword "+"\""+key+"\""+" was not found",
-              MessageEnums.ERROR_SYSTEM);
-        }
-        boolean isFirst = true;
-        for (SolrDocument solrDocId :  docListIds ) {
-          String id = "" + solrDocId.get(LogSearchConstants.ID);
-          if (isFirst) {
-            filterQueryListIds += LogSearchConstants.MINUS_OPERATOR + LogSearchConstants.ID + ":" + id;
-            isFirst = false;
-          } else {
-            filterQueryListIds += " "+CONDITION.AND+" " + LogSearchConstants.MINUS_OPERATOR + LogSearchConstants.ID + ":" + id;
-          }
-        }
-
-        // Keyword Sequence Number Calculation
-        String endTime = (String) searchCriteria.getParamValue("to");
-        String startTime = (String) searchCriteria
-          .getParamValue("from");
-        SolrQuery logTimeThroughRangeQuery = queryGenerator
-          .commonServiceFilterQuery(searchCriteria);
-        logTimeThroughRangeQuery.remove("start");
-        logTimeThroughRangeQuery.remove("rows");
-        logTimeThroughRangeQuery.setRows(1);
-        if (!StringUtils.isBlank(filterQueryListIds)){
-          logTimeThroughRangeQuery.setFilterQueries(filterQueryListIds);
-        }
-
-        String sortByType = searchCriteria.getSortType();
-
-        if (!StringUtils.isBlank(sortByType) && sortByType
-          .equalsIgnoreCase(LogSearchConstants.ASCENDING_ORDER)) {
-
-          queryGenerator.setSingleRangeFilter(logTimeThroughRangeQuery,
-            LogSearchConstants.LOGTIME, nextPageLogTime,
-            endTime);
-          logTimeThroughRangeQuery.set(LogSearchConstants.SORT,
-            LogSearchConstants.LOGTIME + " "
-              + LogSearchConstants.ASCENDING_ORDER);
-
-        } else {
-
-          queryGenerator.setSingleRangeFilter(logTimeThroughRangeQuery,
-            LogSearchConstants.LOGTIME, startTime,
-            nextPageLogTime);
-          logTimeThroughRangeQuery.set(LogSearchConstants.SORT,
-            LogSearchConstants.LOGTIME + " "
-              + LogSearchConstants.DESCENDING_ORDER);
-        }
-        queryGenerator.setSingleIncludeFilter(logTimeThroughRangeQuery,
-          LogSearchConstants.SOLR_KEY_LOG_MESSAGE, keyword);
-
-
-        queryResponse = serviceLogsSolrDao.process(
-            logTimeThroughRangeQuery);
-        if(queryResponse == null){
-          throw RESTErrorUtil.createRESTException("The keyword "+"\""+key+"\""+" was not found",
-              MessageEnums.ERROR_SYSTEM);
-        }
-
-        SolrDocumentList documentList = queryResponse.getResults();
-        if(documentList ==null){
-          throw RESTErrorUtil.createRESTException("The keyword "+"\""+key+"\""+" was not found",
-              MessageEnums.ERROR_SYSTEM);
-        }
-
-        SolrDocument solrDocument = new SolrDocument();
-        if (!documentList.isEmpty()){
-          solrDocument = documentList.get(0);
-        }
-
-        Date keywordLogDate = (Date) solrDocument.get(LogSearchConstants.LOGTIME);
-        if(keywordLogDate == null){
-          throw RESTErrorUtil.createRESTException("The keyword "+"\""+key+"\""+" was not found",
-              MessageEnums.ERROR_SYSTEM);
-        }
-        String originalKeywordDate = DateUtil
-          .convertDateWithMillisecondsToSolrDate(keywordLogDate);
-        String keywordId = "" + solrDocument.get(LogSearchConstants.ID);
-
-        // Getting Range Count from StartTime To Keyword Log Time
-        SolrQuery rangeLogQuery = nextPageLogTimeQuery.getCopy();
-        rangeLogQuery.remove("start");
-        rangeLogQuery.remove("rows");
-
-        if (!StringUtils.isBlank(sortByType) && sortByType
-          .equalsIgnoreCase(LogSearchConstants.ASCENDING_ORDER)) {
-          keywordLogDate = DateUtils.addMilliseconds(keywordLogDate, 1);
-          String keywordDateTime = DateUtil
-            .convertDateWithMillisecondsToSolrDate(keywordLogDate);
-          queryGenerator.setSingleRangeFilter(rangeLogQuery,
-            LogSearchConstants.LOGTIME, startTime,
-            keywordDateTime);
-        } else {
-          keywordLogDate = DateUtils.addMilliseconds(keywordLogDate, -1);
-          String keywordDateTime = DateUtil
-            .convertDateWithMillisecondsToSolrDate(keywordLogDate);
-          queryGenerator.setSingleRangeFilter(rangeLogQuery,
-            LogSearchConstants.LOGTIME, keywordDateTime,
-            endTime);
-        }
-
-
-        long countNumberLogs = countQuery(rangeLogQuery,serviceLogsSolrDao) - 1;
-
-
-        //Adding numbers on
-
-
-        try {
-          SolrQuery sameIdQuery = queryGenerator
-            .commonServiceFilterQuery(searchCriteria);
-          queryGenerator.setSingleIncludeFilter(sameIdQuery,
-            LogSearchConstants.LOGTIME, "\"" + originalKeywordDate + "\"");
-          SolrUtil.setFl(sameIdQuery, LogSearchConstants.ID);
-          SolrDocumentList sameQueryDocList = serviceLogsSolrDao.process(sameIdQuery)
-            .getResults();
-          for (SolrDocument solrDocumenent : sameQueryDocList) {
-            String id = (String) solrDocumenent
-              .getFieldValue(LogSearchConstants.ID);
-            countNumberLogs++;
-           
-            if (StringUtils.isBlank(id) && id.equals(keywordId)){
-              break;
-            }
-          }
-        } catch (SolrException | SolrServerException | IOException e) {
-          logger.error(e);
-        }
-
-        int start = (int) ((countNumberLogs / maxRows) * maxRows);
-        SolrQuery logIdQuery = nextPageLogTimeQuery.getCopy();
-        rangeLogQuery.remove("start");
-        rangeLogQuery.remove("rows");
-        logIdQuery.setStart(start);
-        logIdQuery.setRows(searchCriteria.getMaxRows());
-        VSolrLogList vSolrLogList = getLogAsPaginationProvided(logIdQuery, serviceLogsSolrDao);
-        return convertObjToString(vSolrLogList);
-
-      } catch (Exception e) {
-        //do nothing
-      }
-
-    } else {
-      try {
-        int currentPageNumber = searchCriteria.getPage();
-        int maxRows = searchCriteria.getMaxRows();
-
-        if (currentPageNumber == 0) {
-          throw RESTErrorUtil.createRESTException("This is first Page Not",
-            MessageEnums.DATA_NOT_FOUND);
-        }
-
-        int firstLogCurrentPage = (currentPageNumber * maxRows);
-        String lastLogsLogTime = "";
-
-        // Next Page Start Time Calculation
-        SolrQuery lastLogTime = queryGenerator
-          .commonServiceFilterQuery(searchCriteria);
-        lastLogTime.remove("start");
-        lastLogTime.remove("rows");
-
-        lastLogTime.setStart(firstLogCurrentPage);
-        lastLogTime.setRows(1);
-
-        queryResponse = serviceLogsSolrDao.process(
-            lastLogTime);
-        if(queryResponse == null){
-          throw RESTErrorUtil.createRESTException("The keyword "+"\""+key+"\""+" was not found",
-              MessageEnums.ERROR_SYSTEM);
-        }
-
-        SolrDocumentList docList = queryResponse.getResults();
-        if(docList ==null){
-          throw RESTErrorUtil.createRESTException("The keyword "+"\""+key+"\""+" was not found",
-              MessageEnums.ERROR_SYSTEM);
-        }
-        SolrDocument solrDoc = docList.get(0);
-
-        Date logDate = (Date) solrDoc.get(LogSearchConstants.LOGTIME);
-        String sortByType = searchCriteria.getSortType();
-        lastLogsLogTime = DateUtil
-          .convertDateWithMillisecondsToSolrDate(logDate);
-        String lastLogsLogId = ""
-          + solrDoc.get(LogSearchConstants.ID);
-
-
-        String filterQueryListIds = "";
-        // Remove the same Time Ids
-        SolrQuery listRemoveIds = queryGenerator
-          .commonServiceFilterQuery(searchCriteria);
-        listRemoveIds.remove("start");
-        listRemoveIds.remove("rows");
-        queryGenerator.setSingleIncludeFilter(listRemoveIds,
-          LogSearchConstants.LOGTIME, "\"" + lastLogsLogTime + "\"");
-        queryGenerator.setSingleExcludeFilter(listRemoveIds,
-          LogSearchConstants.ID, lastLogsLogId);
-        SolrUtil.setFl(listRemoveIds, LogSearchConstants.ID);
-        queryResponse = serviceLogsSolrDao.process(
-            lastLogTime);
-        if(queryResponse == null){
-          throw RESTErrorUtil.createRESTException("The keyword "+"\""+key+"\""+" was not found",
-              MessageEnums.ERROR_SYSTEM);
-        }
-
-        SolrDocumentList docListIds = queryResponse.getResults();
-        if(docListIds == null){
-          throw RESTErrorUtil.createRESTException("The keyword "+"\""+key+"\""+" was not found",
-              MessageEnums.ERROR_SYSTEM);
-        }
-        boolean isFirst = true;
-        for (SolrDocument solrDocId : docListIds) {
-          if (solrDocId != null) {
-            String id = "" + solrDocId.get(LogSearchConstants.ID);
-            if (isFirst) {
-              filterQueryListIds += LogSearchConstants.MINUS_OPERATOR + LogSearchConstants.ID + ":" + id;
-              isFirst = false;
-            } else {
-              filterQueryListIds += " "+CONDITION.AND+" " + LogSearchConstants.MINUS_OPERATOR + LogSearchConstants.ID + ":"
-                  + id;
-            }
-          }
-        }
-
-
-        // Keyword LogTime Calculation
-        String endTime = (String) searchCriteria.getParamValue("to");
-        String startTime = (String) searchCriteria
-          .getParamValue("from");
-        SolrQuery logTimeThroughRangeQuery = queryGenerator
-          .commonServiceFilterQuery(searchCriteria);
-        logTimeThroughRangeQuery.remove("start");
-        logTimeThroughRangeQuery.remove("rows");
-        logTimeThroughRangeQuery.setRows(1);
-        queryGenerator.setSingleExcludeFilter(logTimeThroughRangeQuery,
-          LogSearchConstants.ID, lastLogsLogId);
-        if (!StringUtils.isBlank(filterQueryListIds)){
-          logTimeThroughRangeQuery.setFilterQueries(filterQueryListIds);
-        }
-
-        if (!StringUtils.isBlank(sortByType) && sortByType
-          .equalsIgnoreCase(LogSearchConstants.ASCENDING_ORDER)) {
-
-          logTimeThroughRangeQuery.remove(LogSearchConstants.SORT);
-          logTimeThroughRangeQuery.set(LogSearchConstants.SORT,
-            LogSearchConstants.LOGTIME + " "
-              + LogSearchConstants.DESCENDING_ORDER);
-
-
-          queryGenerator.setSingleRangeFilter(
-            logTimeThroughRangeQuery,
-            LogSearchConstants.LOGTIME, startTime,
-            lastLogsLogTime);
-
-        } else {
-
-          logTimeThroughRangeQuery.remove(LogSearchConstants.SORT);
-          logTimeThroughRangeQuery.set(LogSearchConstants.SORT,
-            LogSearchConstants.LOGTIME + " "
-              + LogSearchConstants.ASCENDING_ORDER);
-
-
-          queryGenerator.setSingleRangeFilter(logTimeThroughRangeQuery,
-            LogSearchConstants.LOGTIME, lastLogsLogTime, endTime);
-        }
-        queryGenerator.setSingleIncludeFilter(logTimeThroughRangeQuery,
-          LogSearchConstants.SOLR_KEY_LOG_MESSAGE, keyword);
-
-
-        queryResponse = serviceLogsSolrDao.process(
-            logTimeThroughRangeQuery);
-        if(queryResponse == null){
-          throw RESTErrorUtil.createRESTException("The keyword "+"\""+key+"\""+" was not found",
-              MessageEnums.ERROR_SYSTEM);
-        }
-
-        SolrDocumentList documentList = queryResponse.getResults();
-        if(documentList == null){
-          throw RESTErrorUtil.createRESTException("The keyword "+"\""+key+"\""+" was not found",
-              MessageEnums.ERROR_SYSTEM);
-        }
-        SolrDocument solrDocument = new SolrDocument();
-        if (!documentList.isEmpty()){
-          solrDocument = documentList.get(0);
-        }
-
-        Date keywordLogDate = (Date) solrDocument.get(LogSearchConstants.LOGTIME);
-        if(keywordLogDate == null){
-          throw RESTErrorUtil.createRESTException("The keyword "+"\""+key+"\""+" was not found",
-              MessageEnums.ERROR_SYSTEM);
-        }
-        String originalKeywordDate = DateUtil
-          .convertDateWithMillisecondsToSolrDate(keywordLogDate);
-        String keywordId = "" + solrDocument.get(LogSearchConstants.ID);
-
-        // Getting Range Count from StartTime To Keyword Log Time
-        SolrQuery rangeLogQuery = lastLogTime.getCopy();
-        rangeLogQuery.remove("start");
-        rangeLogQuery.remove("rows");
-
-        if (!StringUtils.isBlank(sortByType) && sortByType
-          .equalsIgnoreCase(LogSearchConstants.ASCENDING_ORDER)) {
-       //   keywordLogDate = DateUtil.addMilliSecondsToDate(keywordLogDate, 1);
-          String keywordDateTime = DateUtil
-            .convertDateWithMillisecondsToSolrDate(keywordLogDate);
-          queryGenerator.setSingleRangeFilter(rangeLogQuery,
-            LogSearchConstants.LOGTIME, startTime,
-            keywordDateTime);
-
-
-        } else {
-     //     keywordLogDate = DateUtil.addMilliSecondsToDate(keywordLogDate, -1);
-          String keywordDateTime = DateUtil
-            .convertDateWithMillisecondsToSolrDate(keywordLogDate);
-          queryGenerator.setSingleRangeFilter(rangeLogQuery,
-            LogSearchConstants.LOGTIME, keywordDateTime,
-            endTime);
-        }
-
-
-        long countNumberLogs = countQuery(rangeLogQuery,serviceLogsSolrDao) - 1;
-
-        //Adding numbers on
-        try {
-          SolrQuery sameIdQuery = queryGenerator
-            .commonServiceFilterQuery(searchCriteria);
-          queryGenerator.setSingleIncludeFilter(sameIdQuery,
-            LogSearchConstants.LOGTIME, "\"" + originalKeywordDate + "\"");
-          SolrUtil.setFl(sameIdQuery, LogSearchConstants.ID);
-          SolrDocumentList sameQueryDocList = serviceLogsSolrDao.process(sameIdQuery)
-            .getResults();
-          for (SolrDocument solrDocumenent : sameQueryDocList) {
-            if (solrDocumenent != null) {
-              String id = (String) solrDocumenent
-                  .getFieldValue(LogSearchConstants.ID);
-              countNumberLogs++;
-              if ( StringUtils.isBlank(id) && id.equals(keywordId)) {
-                break;
-              }
-            }
-          }
-        } catch (SolrException | SolrServerException | IOException e) {
-          logger.error(e);
-        }
-        int start = (int) ((countNumberLogs / maxRows) * maxRows);
-
-        SolrQuery logIdQuery = lastLogTime.getCopy();
-        rangeLogQuery.remove("start");
-        rangeLogQuery.remove("rows");
-        logIdQuery.setStart(start);
-        logIdQuery.setRows(searchCriteria.getMaxRows());
-        VSolrLogList vSolrLogList = getLogAsPaginationProvided(logIdQuery, serviceLogsSolrDao);
-        return convertObjToString(vSolrLogList);
-      } catch (Exception e) {
-        //do nothing
-      }
-
-    }
-    throw RESTErrorUtil.createRESTException("The keyword "+"\""+key+"\""+" was not found",
-        MessageEnums.ERROR_SYSTEM);
-  }
-
-  private String getPageByLogId(SearchCriteria searchCriteria) {
-    VSolrLogList vSolrLogList = new VSolrLogList();
-    String endLogTime = (String) searchCriteria.getParamValue("to");
-    if(StringUtils.isBlank(endLogTime)){
-      return convertObjToString(vSolrLogList);
-    }
-    long startIndex = 0l;
-
-    String logId = (String) searchCriteria.getParamValue("sourceLogId");
-    if(StringUtils.isBlank(logId)){
-      return convertObjToString(vSolrLogList);
-    }
-    SolrQuery solrQuery = queryGenerator.commonServiceFilterQuery(searchCriteria);
-
-    String endTimeMinusOneMilli = "";
-    String logTime = "";
-    try {
-
-      SolrQuery logTimeByIdQuery = new SolrQuery();
-      SolrUtil.setMainQuery(logTimeByIdQuery, null);
-      queryGenerator.setSingleIncludeFilter(logTimeByIdQuery,
-          LogSearchConstants.ID, logId);
-      SolrUtil.setRowCount(solrQuery, 1);
-
-      QueryResponse queryResponse = serviceLogsSolrDao
-          .process(logTimeByIdQuery);
-
-      if(queryResponse == null){
-        return convertObjToString(new VSolrLogList());
-      }
-
-      SolrDocumentList docList = queryResponse.getResults();
-      Date dateOfLogId = null;
-      if (docList != null && !docList.isEmpty()) {
-        SolrDocument dateLogIdDoc = docList.get(0);
-        if(dateLogIdDoc != null){
-          dateOfLogId = (Date) dateLogIdDoc.get(LogSearchConstants.LOGTIME);
-        }
-      }
-
-      if (dateOfLogId != null) {
-        logTime = DateUtil.convertDateWithMillisecondsToSolrDate(dateOfLogId);
-        Date endDate = DateUtils.addMilliseconds(dateOfLogId, 1);
-        endTimeMinusOneMilli = (String) DateUtil
-            .convertDateWithMillisecondsToSolrDate(endDate);
-      }
-
-    } catch (SolrException | SolrServerException | IOException e) {
-      logger.error(e);
-    }
-
-    try {
-      solrQuery.remove(LogSearchConstants.ID);
-      solrQuery.remove(LogSearchConstants.LOGTIME);
-      queryGenerator.setSingleRangeFilter(solrQuery,
-          LogSearchConstants.LOGTIME, endTimeMinusOneMilli, endLogTime);
-      SolrUtil.setRowCount(solrQuery, 0);
-      startIndex = countQuery(solrQuery,serviceLogsSolrDao);
-    } catch (SolrException | SolrServerException | IOException e) {
-      logger.error(e);
-    }
-
-    try {
-      SolrQuery sameIdQuery = queryGenerator.commonServiceFilterQuery(searchCriteria);
-      queryGenerator.setSingleIncludeFilter(sameIdQuery,
-          LogSearchConstants.LOGTIME, "\"" + logTime + "\"");
-      sameIdQuery.set("fl", LogSearchConstants.ID);
-
-      QueryResponse sameIdResponse = serviceLogsSolrDao.process(sameIdQuery);
-      SolrDocumentList docList = sameIdResponse.getResults();
-
-      for (SolrDocument solrDocumenent : docList) {
-        String id = (String) solrDocumenent
-            .getFieldValue(LogSearchConstants.ID);
-        startIndex++;
-        if (!StringUtils.isBlank(id)) {
-          if (id.equals(logId)) {
-            break;
-          }
-        }
-      }
-
-      SolrQuery logIdQuery = queryGenerator.commonServiceFilterQuery(searchCriteria);
-      logIdQuery.remove("rows");
-      logIdQuery.remove("start");
-      int start = (int) ((startIndex / searchCriteria.getMaxRows()) * searchCriteria
-          .getMaxRows());
-      logIdQuery.setStart(start);
-      logIdQuery.setRows(searchCriteria.getMaxRows());
-      vSolrLogList = getLogAsPaginationProvided(logIdQuery,
-          serviceLogsSolrDao);
-      return convertObjToString(vSolrLogList);
-    } catch (SolrException | SolrServerException | IOException e) {
-      logger.error(e);
-    }
-
-    throw RESTErrorUtil.createRESTException("LogId not Found",
-        MessageEnums.ERROR_SYSTEM);
-  }
-
-  @SuppressWarnings("unchecked")
-  public List<VNameValue> getHistogramCounts(SolrQuery solrQuery,
-                                             String from, String to, String unit) {
-    List<VNameValue> logsCounts = new ArrayList<VNameValue>();
-    try {
-
-      SolrUtil.setFacetRange(solrQuery, LogSearchConstants.LOGTIME,
-        from, to, unit);
-
-      List<RangeFacet.Count> logLevelCounts = null;
-
-      QueryResponse response = serviceLogsSolrDao.process(solrQuery);
-      if(response == null){
-        return logsCounts;
-      }
-      @SuppressWarnings("rawtypes")
-      List<RangeFacet> rangeFacetList = response.getFacetRanges();
-      if (rangeFacetList == null) {
-        return logsCounts;
-
-      }
-
-      @SuppressWarnings("rawtypes")
-      RangeFacet rangeFacet=rangeFacetList.get(0);
-      if (rangeFacet == null) {
-        return logsCounts;
-      }
-      logLevelCounts = rangeFacet.getCounts();
-
-      if(logLevelCounts == null){
-        return logsCounts;
-      }
-      for (RangeFacet.Count logCount : logLevelCounts) {
-        VNameValue nameValue = new VNameValue();
-        nameValue.setName(logCount.getValue());
-        nameValue.setValue("" + logCount.getCount());
-        logsCounts.add(nameValue);
-      }
-    } catch (SolrException | SolrServerException | IOException e) {
-      logger.error("Error during solrQuery=" + solrQuery, e);
-    }
-    return logsCounts;
-  }
-
-  public List<Count> getFacetCountsByDate(SolrQuery solrQuery,
-                                          String facetField) throws SolrServerException, IOException,
-    SolrException {
-
-    QueryResponse response = serviceLogsSolrDao.process(solrQuery);
-
-    FacetField field = response.getFacetDate(facetField);
-    return field.getValues();
-  }
-
-  @SuppressWarnings("unchecked")
-  public String getHistogramData(SearchCriteria searchCriteria) {
-    String deafalutValue = "0";
-    VBarDataList dataList = new VBarDataList();
-    SolrQuery solrQuery = queryGenerator.commonServiceFilterQuery(searchCriteria);
-    solrQuery.set("event", "/audit/logs/histogram");
-    String from = getFrom((String) searchCriteria.getParamValue("from"));
-    String to = getTo((String) searchCriteria.getParamValue("to"));
-    String unit = getUnit((String) searchCriteria.getParamValue("unit"));
-
-    List<VBarGraphData> histogramData = new ArrayList<VBarGraphData>();
-
-    String jsonHistogramQuery = queryGenerator
-      .buildJSONFacetTermTimeRangeQuery(
-        LogSearchConstants.SOLR_LEVEL,
-        LogSearchConstants.LOGTIME, from, to, unit).replace(
-        "\\", "");
-
-    try {
-      SolrUtil.setJSONFacet(solrQuery, jsonHistogramQuery);
-      SolrUtil.setRowCount(solrQuery,Integer.parseInt(deafalutValue));
-      QueryResponse response = serviceLogsSolrDao.process(solrQuery);
-      if (response == null){
-        return convertObjToString(dataList);
-      }
-      SimpleOrderedMap<Object> jsonFacetResponse = (SimpleOrderedMap<Object>) response
-        .getResponse().get("facets");
-
-      if (jsonFacetResponse == null
-        || jsonFacetResponse.toString().equals("{count=0}")){
-        return convertObjToString(dataList);
-      }
-
-      extractValuesFromBuckets(jsonFacetResponse, "x", "y", histogramData);
-
-      Collection<VNameValue> vNameValues = new ArrayList<VNameValue>();
-      List<VBarGraphData> graphDatas = new ArrayList<VBarGraphData>();
-      for (String level : LogSearchConstants.SUPPORTED_LOG_LEVEL) {
-        boolean isLevelPresent = false;
-        VBarGraphData vData1 = null;
-        for (VBarGraphData vData2 : histogramData) {
-          String name = vData2.getName();
-          if (level.contains(name)) {
-            isLevelPresent = true;
-            vData1 = vData2;
-            break;
-          }
-          if (vNameValues.isEmpty()) {
-            Collection<VNameValue> vNameValues2 = vData2
-              .getDataCount();
-            for (VNameValue value : vNameValues2) {
-              VNameValue value2 = new VNameValue();
-              value2.setValue(deafalutValue);
-              value2.setName(value.getName());
-              vNameValues.add(value2);
-            }
-          }
-        }
-        if (!isLevelPresent) {
-          VBarGraphData vBarGraphData = new VBarGraphData();
-          vBarGraphData.setName(level);
-          vBarGraphData.setDataCounts(vNameValues);
-          graphDatas.add(vBarGraphData);
-        } else {
-          graphDatas.add(vData1);
-        }
-      }
-
-      dataList.setGraphData(graphDatas);
-      return convertObjToString(dataList);
-
-    } catch (SolrServerException | SolrException | IOException e) {
-      logger.error(e);
-      throw RESTErrorUtil.createRESTException(MessageEnums.SOLR_ERROR
-          .getMessage().getMessage(), MessageEnums.ERROR_SYSTEM);
-
-    }
-  }
-
-  public void arrangeLevel(String level,
-                           List<VBarGraphData> histogramDataLocal,
-                           List<VBarGraphData> histogramData) {
-    for (VBarGraphData histData : histogramData) {
-      if (histData != null && level.equals(histData.getName())) {
-        histogramDataLocal.add(histData);
-      }
-    }
-  }
-
-  public String cancelFindRequestByDate(String uniqueId) {
-    if (StringUtils.isEmpty(uniqueId)) {
-      logger.error("Unique id is Empty");
-      throw RESTErrorUtil.createRESTException("Unique id is Empty",
-        MessageEnums.DATA_NOT_FOUND);
-    }
-
-    if (cancelByDate.remove(uniqueId)) {
-      mapUniqueId.remove(uniqueId);
-      return "Cancel Request Successfully Procssed ";
-    }
-    return "Cancel Request Unable to Process";
-  }
-
-  public boolean cancelRequest(String uniqueId) {
-    if (StringUtils.isBlank(uniqueId)) {
-      logger.error("Unique id is Empty");
-      throw RESTErrorUtil.createRESTException("Unique id is Empty",
-        MessageEnums.DATA_NOT_FOUND);
-    }
-    for (String date : cancelByDate) {
-      if (uniqueId.equalsIgnoreCase(date)){
-        return false;
-      }
-    }
-    return true;
-  }
-
-  public Response exportToTextFile(SearchCriteria searchCriteria) {
-    String defaultFormat = "text";
-    SolrQuery solrQuery = queryGenerator.commonServiceFilterQuery(searchCriteria);
-    String from = (String) searchCriteria.getParamValue("from");
-    String to = (String) searchCriteria.getParamValue("to");
-    String utcOffset = (String) searchCriteria.getParamValue("utcOffset");
-    String format = (String) searchCriteria.getParamValue("format");
-
-    format = defaultFormat.equalsIgnoreCase(format) && format != null ? ".txt"
-        : ".json";
-    
-    if(StringUtils.isBlank(utcOffset)){
-      utcOffset = "0";
-    }
-
-    if (!DateUtil.isDateValid(from) || !DateUtil.isDateValid(to)) {
-      logger.error("Not valid date format. Valid format should be"
-          + LogSearchConstants.SOLR_DATE_FORMAT_PREFIX_Z);
-      throw RESTErrorUtil.createRESTException("Not valid date format. Valid format should be"
-          + LogSearchConstants.SOLR_DATE_FORMAT_PREFIX_Z,
-          MessageEnums.INVALID_INPUT_DATA);
-
-    } else {
-      from = from.replace("T", " ");
-      from = from.replace(".", ",");
-
-      to = to.replace("T", " ");
-      to = to.replace(".", ",");
-
-      to = DateUtil.addOffsetToDate(to, Long.parseLong(utcOffset),
-          "yyyy-MM-dd HH:mm:ss,SSS");
-      from = DateUtil.addOffsetToDate(from, Long.parseLong(utcOffset),
-          "yyyy-MM-dd HH:mm:ss,SSS");
-    }
-
-    String fileName = DateUtil.getCurrentDateInString();
-    if (searchCriteria.getParamValue("hostLogFile") != null
-      && searchCriteria.getParamValue("compLogFile") != null) {
-      fileName = searchCriteria.getParamValue("hostLogFile") + "_"
-        + searchCriteria.getParamValue("compLogFile");
-    }
-
-    String textToSave = "";
-    try {
-      QueryResponse response = serviceLogsSolrDao.process(solrQuery);
-      if (response == null) {
-        throw RESTErrorUtil.createRESTException(MessageEnums.SOLR_ERROR
-            .getMessage().getMessage(), MessageEnums.ERROR_SYSTEM);
-      }
-      SolrDocumentList docList = response.getResults();
-      if (docList == null) {
-        throw RESTErrorUtil.createRESTException(MessageEnums.SOLR_ERROR
-            .getMessage().getMessage(), MessageEnums.ERROR_SYSTEM);
-      }
-
-      VSummary vsummary = BizUtil.buildSummaryForLogFile(docList);
-      vsummary.setFormat(format);
-      vsummary.setFrom(from);
-      vsummary.setTo(to);
-
-      String includeString = (String) searchCriteria.getParamValue("iMessage");
-      if (StringUtils.isBlank(includeString)) {
-        includeString = "";
-      }
-
-      String include[] = includeString.split(LogSearchConstants.I_E_SEPRATOR);
-
-      for (String inc : include) {
-        includeString = includeString + ",\"" + inc + "\"";
-      }
-      includeString = includeString.replaceFirst(",", "");
-      if (!StringUtils.isBlank(includeString)) {
-        vsummary.setIncludeString(includeString);
-      }
-
-      String excludeString = null;
-      boolean isNormalExcluded = false;
-
-      excludeString = (String) searchCriteria.getParamValue("eMessage");
-      if (StringUtils.isBlank(excludeString)) {
-        excludeString = "";
-      }
-
-      String exclude[] = excludeString.split(LogSearchConstants.I_E_SEPRATOR);
-      for (String exc : exclude) {
-        excludeString = excludeString + ",\"" + exc + "\"";
-      }
-
-      excludeString = excludeString.replaceFirst(",", "");
-      if (!StringUtils.isBlank(excludeString)) {
-        vsummary.setExcludeString(excludeString);
-        isNormalExcluded = true;
-      }
-
-      String globalExcludeString = (String) searchCriteria
-          .getParamValue("gEMessage");
-      if (StringUtils.isBlank(globalExcludeString)) {
-        globalExcludeString = "";
-      }
-
-      String globalExclude[] = globalExcludeString
-          .split(LogSearchConstants.I_E_SEPRATOR);
-
-      for (String exc : globalExclude) {
-        excludeString = excludeString + ",\"" + exc + "\"";
-      }
-
-      if (!StringUtils.isBlank(excludeString)) {
-        if (!isNormalExcluded) {
-          excludeString = excludeString.replaceFirst(",", "");
-        }
-        vsummary.setExcludeString(excludeString);
-      }
-
-      for (SolrDocument solrDoc : docList) {
-
-        Date logTimeDateObj = (Date) solrDoc.get(LogSearchConstants.LOGTIME);
-        if(logTimeDateObj != null){
-        String logTime = DateUtil.convertSolrDateToNormalDateFormat(
-            logTimeDateObj.getTime(), Long.parseLong(utcOffset));
-        solrDoc.remove(LogSearchConstants.LOGTIME);
-        solrDoc.addField(LogSearchConstants.LOGTIME, logTime);
-        }
-      }
-
-      if (format.toLowerCase(Locale.ENGLISH).equals(".txt")) {
-        textToSave = BizUtil.convertObjectToNormalText(docList);
-      } else if (format.toLowerCase(Locale.ENGLISH).equals(".json")) {
-        textToSave = convertObjToString(docList);
-      } else {
-        throw RESTErrorUtil.createRESTException(
-            "unsoported format either should be json or text",
-            MessageEnums.ERROR_SYSTEM);
-      }
-      return FileUtil.saveToFile(textToSave, fileName, vsummary);
-
-    } catch (SolrException | SolrServerException | IOException
-      | ParseException e) {
-      logger.error("Error during solrQuery=" + solrQuery, e);
-      throw RESTErrorUtil.createRESTException(MessageEnums.SOLR_ERROR
-          .getMessage().getMessage(), MessageEnums.ERROR_SYSTEM);
-    }
-  }
-
-  public String getComponentListWithLevelCounts(SearchCriteria searchCriteria) {
-    SolrQuery solrQuery = queryGenerator.commonServiceFilterQuery(searchCriteria);
-    solrQuery.setParam("event", "/service/logs/components/level/counts");
-
-    if (searchCriteria.getSortBy() == null) {
-      searchCriteria.setSortBy(LogSearchConstants.SOLR_COMPONENT);
-      searchCriteria.setSortType(SolrQuery.ORDER.asc.toString());
-    }
-    queryGenerator.setFilterFacetSort(solrQuery, searchCriteria);
-    String componentLevelHirachy = "type,level";
-    VNodeList list = new VNodeList();
-    try {
-
-      SolrUtil.setFacetPivot(solrQuery, 1, componentLevelHirachy);
-
-      QueryResponse response = serviceLogsSolrDao.process(solrQuery);
-
-      List<List<PivotField>> listPivotField = new ArrayList<List<PivotField>>();
-      NamedList<List<PivotField>> namedList = response.getFacetPivot();
-      if (namedList != null) {
-        listPivotField = namedList.getAll(componentLevelHirachy);
-      }
-      List<PivotField> secondHirarchicalPivotFields = null;
-      if (listPivotField == null || listPivotField.isEmpty()) {
-        return convertObjToString(list);
-      } else {
-        secondHirarchicalPivotFields = listPivotField.get(0);
-      }
-      List<VNode> datatList = new ArrayList<VNode>();
-      for (PivotField singlePivotField : secondHirarchicalPivotFields) {
-        if (singlePivotField != null) {
-          VNode comp = new VNode();
-          comp.setName("" + singlePivotField.getValue());
-          List<PivotField> levelList = singlePivotField.getPivot();
-          List<VNameValue> levelCountList = new ArrayList<VNameValue>();
-          comp.setLogLevelCount(levelCountList);
-          if(levelList != null){
-          for (PivotField levelPivot : levelList) {
-		  VNameValue level = new VNameValue();
-		  level.setName(("" + levelPivot.getValue()).toUpperCase());
-		  level.setValue("" + levelPivot.getCount());
-		  levelCountList.add(level);
-		}
-          }
-          datatList.add(comp);
-        }
-      }
-      list.setvNodeList(datatList);
-      return convertObjToString(list);
-    } catch (SolrException | SolrServerException | IOException e) {
-      logger.error(e.getMessage() + "SolrQuery"+solrQuery);
-      throw RESTErrorUtil.createRESTException(MessageEnums.SOLR_ERROR
-          .getMessage().getMessage(), MessageEnums.ERROR_SYSTEM);
-    }
-  }
-
-  public String getExtremeDatesForBundelId(SearchCriteria searchCriteria) {
-    SolrQuery solrQuery = new SolrQuery();
-    VNameValueList nameValueList = new VNameValueList();
-    try {
-      String bundelId = (String) searchCriteria
-        .getParamValue(LogSearchConstants.BUNDLE_ID);
-      if(StringUtils.isBlank(bundelId)){
-        bundelId = "";
-      }
-
-      queryGenerator.setSingleIncludeFilter(solrQuery,
-        LogSearchConstants.BUNDLE_ID, bundelId);
-
-      SolrUtil.setMainQuery(solrQuery, null);
-      solrQuery.setSort(LogSearchConstants.LOGTIME, SolrQuery.ORDER.asc);
-      SolrUtil.setRowCount(solrQuery, 1);
-
-      List<VNameValue> vNameValues = new ArrayList<VNameValue>();
-      QueryResponse response = serviceLogsSolrDao.process(solrQuery);
-
-      if(response == null){
-        return convertObjToString(nameValueList);
-      }
-
-      SolrDocumentList solrDocList = response.getResults();
-      if(solrDocList == null){
-        return convertObjToString(nameValueList);
-      }
-      for (SolrDocument solrDoc : solrDocList) {
-
-        Date logTimeAsc = (Date) solrDoc
-          .getFieldValue(LogSearchConstants.LOGTIME);
-        if (logTimeAsc != null) {
-          VNameValue nameValue = new VNameValue();
-          nameValue.setName("From");
-          nameValue.setValue("" + logTimeAsc.getTime());
-          vNameValues.add(nameValue);
-        }
-      }
-
-      solrQuery.clear();
-      SolrUtil.setMainQuery(solrQuery, null);
-      queryGenerator.setSingleIncludeFilter(solrQuery,
-        LogSearchConstants.BUNDLE_ID, bundelId);
-      solrQuery.setSort(LogSearchConstants.LOGTIME, SolrQuery.ORDER.desc);
-      SolrUtil.setRowCount(solrQuery, 1);
-
-      solrDocList.clear();
-      response = serviceLogsSolrDao.process(solrQuery);
-
-      solrDocList = response.getResults();
-      for (SolrDocument solrDoc : solrDocList) {
-        if (solrDoc != null) {
-          Date logTimeDesc = (Date) solrDoc
-              .getFieldValue(LogSearchConstants.LOGTIME);
-
-          if (logTimeDesc != null) {
-            VNameValue nameValue = new VNameValue();
-            nameValue.setName("To");
-            nameValue.setValue("" + logTimeDesc.getTime());
-            vNameValues.add(nameValue);
-          }
-        }
-      }
-      nameValueList.setVNameValues(vNameValues);
-
-
-    } catch (SolrServerException | SolrException | IOException e) {
-      logger.error(e.getMessage() + "SolrQuery"+solrQuery);
-      nameValueList=new VNameValueList();
-    }
-    return convertObjToString(nameValueList);
-  }
-
-  protected VGroupList getSolrGroupList(SolrQuery query)
-      throws SolrServerException, IOException, SolrException {
-    VGroupList collection = new VGroupList();
-    QueryResponse response = serviceLogsSolrDao.process(query);
-    if (response == null) {
-      return collection;
-    }
-    SolrDocumentList docList = response.getResults();
-    if (docList != null) {
-      collection.setGroupDocuments(docList);
-      collection.setStartIndex((int) docList.getStart());
-      collection.setTotalCount(docList.getNumFound());
-    }
-
-    return collection;
-  }
-
-  public String getServiceLogsFieldsName() {
-    String fieldsNameStrArry[] = PropertiesHelper
-      .getPropertyStringList("logsearch.service.logs.fields");
-    if (fieldsNameStrArry.length > 0) {
-
-      List<String> uiFieldNames = new ArrayList<String>();
-      String temp = null;
-      for (String field : fieldsNameStrArry) {
-        temp = ConfigHelper.serviceLogsColumnMapping.get(field
-            + LogSearchConstants.SOLR_SUFFIX);
-        if (temp == null){
-          uiFieldNames.add(field);
-        }else{
-          uiFieldNames.add(temp);
-        }
-      }
-      return convertObjToString(uiFieldNames);
-
-    }
-    throw RESTErrorUtil.createRESTException(
-      "No field name found in property file",
-      MessageEnums.DATA_NOT_FOUND);
-
-  }
-
-  public String getServiceLogsSchemaFieldsName() {
-
-    List<String> fieldNames = new ArrayList<String>();
-    String excludeArray[] = PropertiesHelper
-        .getPropertyStringList("logsearch.solr.service.logs.exclude.columnlist");
-
-    HashMap<String, String> uiFieldColumnMapping = new LinkedHashMap<String, String>();
-    ConfigHelper.getSchemaFieldsName(excludeArray, fieldNames,serviceLogsSolrDao);
-
-    for (String fieldName : fieldNames) {
-      String uiField = ConfigHelper.serviceLogsColumnMapping.get(fieldName
-          + LogSearchConstants.SOLR_SUFFIX);
-      if (uiField != null) {
-        uiFieldColumnMapping.put(fieldName, uiField);
-      } else {
-        uiFieldColumnMapping.put(fieldName, fieldName);
-      }
-    }
-
-    HashMap<String, String> uiFieldColumnMappingSorted = new LinkedHashMap<String, String>();
-    uiFieldColumnMappingSorted.put(LogSearchConstants.SOLR_LOG_MESSAGE, LogSearchConstants.SOLR_LOG_MESSAGE);
-
-    Iterator<Entry<String, String>> it = BizUtil
-        .sortHashMapByValues(uiFieldColumnMapping).entrySet().iterator();
-    while (it.hasNext()) {
-      @SuppressWarnings("rawtypes")
-      Map.Entry pair = (Map.Entry) it.next();
-      uiFieldColumnMappingSorted.put("" + pair.getKey(), "" + pair.getValue());
-    }
-
-    return convertObjToString(uiFieldColumnMappingSorted);
-
-  }
-
-  @SuppressWarnings("unchecked")
-  public void extractValuesFromBuckets(
-    SimpleOrderedMap<Object> jsonFacetResponse, String outerField,
-    String innerField, List<VBarGraphData> histogramData) {
-    NamedList<Object> stack = (NamedList<Object>) jsonFacetResponse
-      .get(outerField);
-    ArrayList<Object> stackBuckets = (ArrayList<Object>) stack
-      .get("buckets");
-    for (Object temp : stackBuckets) {
-      VBarGraphData vBarGraphData = new VBarGraphData();
-
-      SimpleOrderedMap<Object> level = (SimpleOrderedMap<Object>) temp;
-      String name = ((String) level.getVal(0)).toUpperCase();
-      vBarGraphData.setName(name);
-
-      Collection<VNameValue> vNameValues = new ArrayList<VNameValue>();
-      vBarGraphData.setDataCounts(vNameValues);
-      ArrayList<Object> levelBuckets = (ArrayList<Object>) ((NamedList<Object>) level
-        .get(innerField)).get("buckets");
-      for (Object temp1 : levelBuckets) {
-        SimpleOrderedMap<Object> countValue = (SimpleOrderedMap<Object>) temp1;
-        String value = DateUtil
-          .convertDateWithMillisecondsToSolrDate((Date) countValue
-            .getVal(0));
-
-        String count = "" + countValue.getVal(1);
-        VNameValue vNameValue = new VNameValue();
-        vNameValue.setName(value);
-        vNameValue.setValue(count);
-        vNameValues.add(vNameValue);
-      }
-      histogramData.add(vBarGraphData);
-    }
-  }
-
-  public String getAnyGraphData(SearchCriteria searchCriteria) {
-    searchCriteria.addParam("fieldTime", LogSearchConstants.LOGTIME);
-    SolrQuery solrQuery = queryGenerator.commonServiceFilterQuery(searchCriteria);
-    VBarDataList result = graphDataGenerator.getAnyGraphData(searchCriteria,
-        serviceLogsSolrDao, solrQuery);
-    if (result == null) {
-      result = new VBarDataList();
-    }
-    return convertObjToString(result);
-
-  }
-
-  public String getAfterBeforeLogs(SearchCriteria searchCriteria) {
-    VSolrLogList vSolrLogList = new VSolrLogList();
-    SolrDocumentList docList = null;
-    String id = (String) searchCriteria
-      .getParamValue(LogSearchConstants.ID);
-    if (StringUtils.isBlank(id)) {
-      return convertObjToString(vSolrLogList);
-
-    }
-    String maxRows = "";
-
-    maxRows = (String) searchCriteria.getParamValue("numberRows");
-    if (StringUtils.isBlank(maxRows)){
-      maxRows = ""+maxRows;
-    }
-    String scrollType = (String) searchCriteria.getParamValue("scrollType");
-    if(StringUtils.isBlank(scrollType)){
-      scrollType = "";
-    }
-
-    String logTime = null;
-    String sequenceId = null;
-    try {
-      SolrQuery solrQuery = new SolrQuery();
-      SolrUtil.setMainQuery(solrQuery,
-        queryGenerator.buildFilterQuery(LogSearchConstants.ID, id));
-      SolrUtil.setRowCount(solrQuery, 1);
-      QueryResponse response = serviceLogsSolrDao.process(solrQuery);
-      if(response == null){
-        return convertObjToString(vSolrLogList);
-      }
-      docList = response.getResults();
-      if (docList != null && !docList.isEmpty()) {
-        Date date = (Date) docList.get(0).getFieldValue(
-          LogSearchConstants.LOGTIME);
-        logTime = DateUtil.convertDateWithMillisecondsToSolrDate(date);
-        sequenceId = ""
-          + docList.get(0).getFieldValue(
-          LogSearchConstants.SEQUNCE_ID);
-      }
-      if (StringUtils.isBlank(logTime)) {
-        return convertObjToString(vSolrLogList);
-      }
-    } catch (SolrServerException | SolrException | IOException e) {
-      throw RESTErrorUtil.createRESTException(MessageEnums.SOLR_ERROR
-          .getMessage().getMessage(), MessageEnums.ERROR_SYSTEM);
-    }
-    if (LogSearchConstants.SCROLL_TYPE_BEFORE.equals(scrollType)) {
-      vSolrLogList = whenScrollUp(searchCriteria, logTime,
-        sequenceId, maxRows);
-
-      SolrDocumentList solrDocList = new SolrDocumentList();
-      for (SolrDocument solrDoc : vSolrLogList.getList()) {
-        solrDocList.add(solrDoc);
-      }
-      vSolrLogList.setSolrDocuments(solrDocList);
-        return convertObjToString(vSolrLogList);
-
-    } else if (LogSearchConstants.SCROLL_TYPE_AFTER.equals(scrollType)) {
-      SolrDocumentList solrDocList = new SolrDocumentList();
-      vSolrLogList = new VSolrLogList();
-      for (SolrDocument solrDoc : whenScrollDown(searchCriteria, logTime,
-          sequenceId, maxRows).getList()) {
-        solrDocList.add(solrDoc);
-      }
-      vSolrLogList.setSolrDocuments(solrDocList);
-      return convertObjToString(vSolrLogList);
-
-    } else {
-      vSolrLogList = new VSolrLogList();
-      SolrDocumentList initial = new SolrDocumentList();
-      SolrDocumentList before = whenScrollUp(searchCriteria, logTime,
-        sequenceId, maxRows).getList();
-      SolrDocumentList after = whenScrollDown(searchCriteria, logTime,
-        sequenceId, maxRows).getList();
-			if (before != null && !before.isEmpty()) {
-				for (SolrDocument solrDoc : Lists.reverse(before)) {
-					initial.add(solrDoc);
-				}
-			}
-
-      initial.add(docList.get(0));
-      if (after != null && !after.isEmpty()){
-        for (SolrDocument solrDoc : after) {
-          initial.add(solrDoc);
-	      }
-      }
-
-      vSolrLogList.setSolrDocuments(initial);
-
-        return convertObjToString(vSolrLogList);
-
-    }
-  }
-
-  private VSolrLogList whenScrollUp(SearchCriteria searchCriteria,
-                                    String logTime, String sequenceId, String maxRows) {
-    SolrQuery solrQuery = new SolrQuery();
-    SolrUtil.setMainQuery(solrQuery, null);
-    /*queryGenerator.setSingleExcludeFilter(solrQuery,
-        LogSearchConstants.SEQUNCE_ID, sequenceId);*/
-    try {
-      int seq_num = Integer.parseInt(sequenceId) - 1;
-      sequenceId = "" + seq_num;
-    } catch (Exception e) {
-
-    }
-    queryGenerator.setSingleRangeFilter(
-      solrQuery,
-      LogSearchConstants.SEQUNCE_ID, "*", sequenceId);
-
-    queryGenerator.applyLogFileFilter(solrQuery, searchCriteria);
-
-    queryGenerator.setSingleRangeFilter(solrQuery,
-      LogSearchConstants.LOGTIME, "*", logTime);
-    SolrUtil.setRowCount(solrQuery, Integer.parseInt(maxRows));
-    String order1 = LogSearchConstants.LOGTIME + " "
-      + LogSearchConstants.DESCENDING_ORDER;
-    String order2 = LogSearchConstants.SEQUNCE_ID + " "
-      + LogSearchConstants.DESCENDING_ORDER;
-    List<String> sortOrder = new ArrayList<String>();
-    sortOrder.add(order1);
-    sortOrder.add(order2);
-    searchCriteria.addParam(LogSearchConstants.SORT, sortOrder);
-    queryGenerator.setMultipleSortOrder(solrQuery, searchCriteria);
-
-    return getLogAsPaginationProvided(solrQuery, serviceLogsSolrDao);
-  }
-
-  private VSolrLogList whenScrollDown(SearchCriteria searchCriteria,
-                                      String logTime, String sequenceId, String maxRows) {
-    SolrQuery solrQuery = new SolrQuery();
-    SolrUtil.setMainQuery(solrQuery, null);
-    queryGenerator.applyLogFileFilter(solrQuery, searchCriteria);
-
-    /*queryGenerator.setSingleExcludeFilter(solrQuery,
-        LogSearchConstants.SEQUNCE_ID, sequenceId);*/
-    try {
-      int seq_num = Integer.parseInt(sequenceId) + 1;
-      sequenceId = "" + seq_num;
-    } catch (Exception e) {
-
-    }
-    queryGenerator.setSingleRangeFilter(
-      solrQuery,
-      LogSearchConstants.SEQUNCE_ID, sequenceId, "*");
-    queryGenerator.setSingleRangeFilter(solrQuery,
-      LogSearchConstants.LOGTIME, logTime, "*");
-    SolrUtil.setRowCount(solrQuery, Integer.parseInt(maxRows));
-
-    String order1 = LogSearchConstants.LOGTIME + " "
-      + LogSearchConstants.ASCENDING_ORDER;
-    String order2 = LogSearchConstants.SEQUNCE_ID + " "
-      + LogSearchConstants.ASCENDING_ORDER;
-    List<String> sortOrder = new ArrayList<String>();
-    sortOrder.add(order1);
-    sortOrder.add(order2);
-    searchCriteria.addParam(LogSearchConstants.SORT, sortOrder);
-    queryGenerator.setMultipleSortOrder(solrQuery, searchCriteria);
-
-    return getLogAsPaginationProvided(solrQuery, serviceLogsSolrDao);
-  }
-
-  @Scheduled(cron = "${logsearch.solr.warming.cron}")
-  public void warmingSolrServer(){
-    logger.info("solr warming triggered.");
-    SolrQuery solrQuery = new SolrQuery();
-    TimeZone gmtTimeZone = TimeZone.getTimeZone("GMT");
-    GregorianCalendar utc = new GregorianCalendar(gmtTimeZone);
-    utc.setTimeInMillis(new Date().getTime());
-    utc.set(Calendar.HOUR, 0);
-    utc.set(Calendar.MINUTE, 0);
-    utc.set(Calendar.MILLISECOND, 001);
-    utc.set(Calendar.SECOND, 0);
-    DateUtil.convertDateWithMillisecondsToSolrDate(utc.getTime());
-    String from = DateUtil.convertDateWithMillisecondsToSolrDate(utc.getTime());
-    utc.set(Calendar.MILLISECOND, 999);
-    utc.set(Calendar.SECOND, 59);
-    utc.set(Calendar.MINUTE, 59);
-    utc.set(Calendar.HOUR, 23);
-    String to = DateUtil.convertDateWithMillisecondsToSolrDate(utc.getTime());
-    queryGenerator.setSingleRangeFilter(solrQuery,
-        LogSearchConstants.LOGTIME, from,to);
-    String level = LogSearchConstants.FATAL+","+LogSearchConstants.ERROR+","+LogSearchConstants.WARN;
-    queryGenerator.setFilterClauseWithFieldName(solrQuery, level,
-        LogSearchConstants.SOLR_LEVEL, "", QueryGenerationBase.Condition.OR);
-    try {
-      serviceLogsSolrDao.process(solrQuery);
-    } catch (SolrServerException | IOException e) {
-      logger.error("Error while warming solr server",e);
-    }
-  }
-
-
-}


[02/58] [abbrv] ambari git commit: AMBARI-18310. Refactor logsearch portal side code (oleewere)

Posted by ol...@apache.org.
http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VCount.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VCount.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VCount.java
deleted file mode 100644
index 7832fcc..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VCount.java
+++ /dev/null
@@ -1,62 +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.view;
-
-import javax.xml.bind.annotation.XmlRootElement;
-
-@XmlRootElement
-public class VCount implements java.io.Serializable {
-  private static final long serialVersionUID = 1L;
-
-  protected String name;
-
-  protected Long count;
-
-  /**
-   * Default constructor. This will set all the attributes to default value.
-   */
-  public VCount() {
-  }
-
-  public String getName() {
-    return name;
-  }
-
-  public void setName(String name) {
-    this.name = name;
-  }
-
-  public Long getCount() {
-    return count;
-  }
-
-  public void setCount(Long count) {
-    this.count = count;
-  }
-
-  public String toString() {
-    String str = "VLogLevel={";
-    str += super.toString();
-    str += "name={" + name + "} ";
-    str += "count={" + count + "} ";
-    str += "}";
-    return str;
-  }
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VCountList.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VCountList.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VCountList.java
deleted file mode 100644
index f105478..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VCountList.java
+++ /dev/null
@@ -1,68 +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.view;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlRootElement;
-
-import org.codehaus.jackson.annotate.JsonAutoDetect;
-import org.codehaus.jackson.annotate.JsonAutoDetect.Visibility;
-import org.codehaus.jackson.map.annotate.JsonSerialize;
-
-@JsonAutoDetect(getterVisibility = Visibility.NONE, setterVisibility = Visibility.NONE, fieldVisibility = Visibility.ANY)
-@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
-@XmlRootElement
-@XmlAccessorType(XmlAccessType.FIELD)
-public class VCountList extends VList {
-  private static final long serialVersionUID = 1L;
-
-  protected List<VCount> vCounts;
-
-  public VCountList() {
-    super();
-    vCounts = new ArrayList<VCount>();
-  }
-
-  public VCountList(List<VCount> logList) {
-    super(logList);
-    this.vCounts = logList;
-  }
-
-  public void setCounts(List<VCount> list) {
-    this.vCounts = list;
-  }
-
-  @Override
-  public int getListSize() {
-    if (vCounts != null)
-      return vCounts.size();
-    return 0;
-  }
-
-  @Override
-  public List<VCount> getList() {
-    return vCounts;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VGraphData.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VGraphData.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VGraphData.java
deleted file mode 100644
index 1eebfac..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VGraphData.java
+++ /dev/null
@@ -1,79 +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.view;
-
-import java.io.Serializable;
-import java.util.List;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlRootElement;
-
-import org.codehaus.jackson.annotate.JsonAutoDetect;
-import org.codehaus.jackson.annotate.JsonAutoDetect.Visibility;
-import org.codehaus.jackson.map.annotate.JsonSerialize;
-
-@JsonAutoDetect(getterVisibility = Visibility.NONE, setterVisibility = Visibility.NONE, fieldVisibility = Visibility.ANY)
-@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
-@XmlRootElement
-@XmlAccessorType(XmlAccessType.FIELD)
-public class VGraphData implements Serializable {
-
-  private static final long serialVersionUID = 1L;
-
-  protected String name;
-
-  protected Long count;
-
-  protected List<VGraphData> dataList;
-
-  public String getName() {
-    return name;
-  }
-
-  public void setName(String name) {
-    this.name = name;
-  }
-
-  public Long getCount() {
-    return count;
-  }
-
-  public void setCount(Long info) {
-    this.count = info;
-  }
-
-  public List<VGraphData> getDataList() {
-    return dataList;
-  }
-
-  public void setDataList(List<VGraphData> dataList) {
-    this.dataList = dataList;
-  }
-
-  @Override
-  public String toString() {
-    String str = "VGraphData={";
-    str += super.toString();
-    str += "info={ " + count + " } ";
-    str += "dataList={ " + dataList + " } ";
-    return str;
-  }
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VGraphInfo.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VGraphInfo.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VGraphInfo.java
deleted file mode 100644
index 2bf75b5..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VGraphInfo.java
+++ /dev/null
@@ -1,62 +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.view;
-
-import java.io.Serializable;
-import java.util.List;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlRootElement;
-
-import org.codehaus.jackson.annotate.JsonAutoDetect;
-import org.codehaus.jackson.annotate.JsonAutoDetect.Visibility;
-import org.codehaus.jackson.map.annotate.JsonSerialize;
-
-@JsonAutoDetect(getterVisibility = Visibility.NONE, setterVisibility = Visibility.NONE, fieldVisibility = Visibility.ANY)
-@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
-@XmlRootElement
-@XmlAccessorType(XmlAccessType.FIELD)
-public class VGraphInfo implements Serializable {
-
-  /**
-   * 
-   */
-  private static final long serialVersionUID = 1L;
-
-  protected List<VGraphData> graphData;
-
-  public List<VGraphData> getGraphData() {
-    return graphData;
-  }
-
-  public void setGraphData(List<VGraphData> graphData) {
-    this.graphData = graphData;
-  }
-
-  @Override
-  public String toString() {
-    String str = "VGraphInfo={";
-    str += super.toString();
-    str += "graphData={ " + graphData + " }";
-    return str;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VGroupList.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VGroupList.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VGroupList.java
deleted file mode 100644
index 5e6c3fa..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VGroupList.java
+++ /dev/null
@@ -1,66 +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.view;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlRootElement;
-
-import org.apache.solr.common.SolrDocumentList;
-import org.codehaus.jackson.annotate.JsonAutoDetect;
-import org.codehaus.jackson.annotate.JsonAutoDetect.Visibility;
-import org.codehaus.jackson.map.annotate.JsonSerialize;
-
-@JsonAutoDetect(getterVisibility = Visibility.NONE, setterVisibility = Visibility.NONE, fieldVisibility = Visibility.ANY)
-@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
-@XmlRootElement
-@XmlAccessorType(XmlAccessType.FIELD)
-public class VGroupList extends VList {
-  private static final long serialVersionUID = 1L;
-
-  protected SolrDocumentList groupList;
-
-  public VGroupList() {
-    super();
-    groupList = new SolrDocumentList();
-  }
-
-  public VGroupList(SolrDocumentList logList) {
-    super(logList);
-    this.groupList = logList;
-  }
-
-  public void setGroupDocuments(SolrDocumentList list) {
-    this.groupList = list;
-  }
-
-  @Override
-  public int getListSize() {
-    if (groupList != null)
-      return groupList.size();
-    return 0;
-  }
-
-  @Override
-  public SolrDocumentList getList() {
-    return groupList;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VLogFile.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VLogFile.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VLogFile.java
deleted file mode 100644
index 57e32d2..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VLogFile.java
+++ /dev/null
@@ -1,56 +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.view;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlRootElement;
-
-import org.codehaus.jackson.annotate.JsonAutoDetect;
-import org.codehaus.jackson.annotate.JsonAutoDetect.Visibility;
-import org.codehaus.jackson.map.annotate.JsonSerialize;
-
-@JsonAutoDetect(getterVisibility = Visibility.NONE, setterVisibility = Visibility.NONE, fieldVisibility = Visibility.ANY)
-@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
-@XmlRootElement
-@XmlAccessorType(XmlAccessType.FIELD)
-public class VLogFile {
-
-  private String name;
-
-  private String path;
-
- 
-  public String getName() {
-    return name;
-  }
-
-  public void setName(String name) {
-    this.name = name;
-  }
-
-  public String getPath() {
-    return path;
-  }
-
-  public void setPath(String path) {
-    this.path = path;
-  }
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VLogFileList.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VLogFileList.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VLogFileList.java
deleted file mode 100644
index a79dae7..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VLogFileList.java
+++ /dev/null
@@ -1,70 +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.view;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlRootElement;
-
-import org.codehaus.jackson.annotate.JsonAutoDetect;
-import org.codehaus.jackson.annotate.JsonAutoDetect.Visibility;
-import org.codehaus.jackson.map.annotate.JsonSerialize;
-
-@JsonAutoDetect(getterVisibility = Visibility.NONE, setterVisibility = Visibility.NONE, fieldVisibility = Visibility.ANY)
-@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
-@XmlRootElement
-@XmlAccessorType(XmlAccessType.FIELD)
-public class VLogFileList extends VList {
-
-  /**
-   * 
-   */
-  private static final long serialVersionUID = 1L;
-
-  private List<VLogFile> logFiles;
-
-  public VLogFileList() {
-    logFiles = new ArrayList<VLogFile>();
-  }
-
-  @Override
-  public int getListSize() {
-    if (logFiles == null) {
-      return 0;
-    }
-    return logFiles.size();
-  }
-
-  @Override
-  public List<?> getList() {
-    return logFiles;
-  }
-
-  public List<VLogFile> getLogFiles() {
-    return logFiles;
-  }
-
-  public void setLogFiles(List<VLogFile> logFiles) {
-    this.logFiles = logFiles;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VNameValue.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VNameValue.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VNameValue.java
deleted file mode 100644
index adbd6e0..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VNameValue.java
+++ /dev/null
@@ -1,123 +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.view;
-
-import javax.xml.bind.annotation.XmlRootElement;
-
-@XmlRootElement
-public class VNameValue implements java.io.Serializable {
-  private static final long serialVersionUID = 1L;
-
-  /**
-   * Name
-   */
-  protected String name;
-  /**
-   * Value
-   */
-  protected String value;
-
-  /**
-   * Default constructor. This will set all the attributes to default value.
-   */
-  public VNameValue() {
-  }
-
-  /**
-   * @param name
-   *            the key
-   * @param value
-   *            the value
-   */
-  public VNameValue(String name, String value) {
-
-    this.name = name;
-    this.value = value;
-  }
-
-  /**
-   * This method sets the value to the member attribute <b>name</b>. You
-   * cannot set null to the attribute.
-   * 
-   * @param name
-   *            Value to set member attribute <b>name</b>
-   */
-  public void setName(String name) {
-    this.name = name;
-  }
-
-  /**
-   * Returns the value for the member attribute <b>name</b>
-   * 
-   * @return String - value of member attribute <b>name</b>.
-   */
-  public String getName() {
-    return this.name;
-  }
-
-  /**
-   * This method sets the value to the member attribute <b>value</b>. You
-   * cannot set null to the attribute.
-   * 
-   * @param value
-   *            Value to set member attribute <b>value</b>
-   */
-  public void setValue(String value) {
-    if(value.contains(".") && (value.contains("e") || value.contains("E"))){
-      this.value=getExponentialValueReplaced(value);
-    }else{
-      this.value = value;
-    }
-  }
-
-  /**
-   * Returns the value for the member attribute <b>value</b>
-   * 
-   * @return String - value of member attribute <b>value</b>.
-   */
-  public String getValue() {
-    return this.value;
-  }
-
-  /**
-   * This return the bean content in string format
-   * 
-   * @return formatedStr
-   */
-  public String toString() {
-    String str = "VNameValue={";
-    str += super.toString();
-    str += "name={" + name + "} ";
-    str += "value={" + value + "} ";
-    str += "}";
-    return str;
-  }
-  
-  private String getExponentialValueReplaced(String value) {
-    try{
-      Double number = Double.parseDouble(value);
-      String newValue = String.format("%.0f", number);
-      return newValue;
-      
-    }catch(Exception e){
-      return value;
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VNameValueList.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VNameValueList.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VNameValueList.java
deleted file mode 100644
index e95249d..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VNameValueList.java
+++ /dev/null
@@ -1,78 +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.view;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlRootElement;
-
-@XmlRootElement
-@XmlAccessorType(XmlAccessType.FIELD)
-public class VNameValueList extends VList {
-  private static final long serialVersionUID = 1L;
-  protected List<VNameValue> vNameValues = new ArrayList<VNameValue>();
-
-  public VNameValueList() {
-    super();
-  }
-
-  public VNameValueList(List<VNameValue> objList) {
-    super(objList);
-    this.vNameValues = objList;
-  }
-
-  /**
-   * @return the vNameValues
-   */
-  public List<VNameValue> getVNameValues() {
-    return vNameValues;
-  }
-
-  /**
-   * @param vNameValues
-   *            the vNameValues to set
-   */
-  public void setVNameValues(List<VNameValue> vNameValues) {
-    this.vNameValues = vNameValues;
-  }
-
-  @Override
-  public int getListSize() {
-    if (vNameValues != null) {
-      return vNameValues.size();
-    }
-    return 0;
-  }
-
-  @Override
-  public List<?> getList() {
-    // TODO Auto-generated method stub
-    return null;
-  }
-
-//  @Override
-//  public List<VNameValue> getList() {
-//    return vNameValues;
-//  }
-
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VNode.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VNode.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VNode.java
deleted file mode 100644
index a16ded8..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VNode.java
+++ /dev/null
@@ -1,122 +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.view;
-
-import java.util.Collection;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlRootElement;
-
-import org.codehaus.jackson.annotate.JsonAutoDetect;
-import org.codehaus.jackson.annotate.JsonAutoDetect.Visibility;
-import org.codehaus.jackson.map.annotate.JsonSerialize;
-
-@JsonAutoDetect(getterVisibility = Visibility.NONE, setterVisibility = Visibility.NONE, fieldVisibility = Visibility.ANY)
-@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
-@XmlRootElement
-@XmlAccessorType(XmlAccessType.FIELD)
-public class VNode {
-
-  private String name;
-
-  private String type;
-  
-  private String value;
-
-  private boolean isRoot;
-
-  private Collection<VNode> childs;
-
-  private Collection<VNameValue> logLevelCount;
-
-  private boolean isParent;
-
-  public String getName() {
-    return name;
-  }
-
-  public void setName(String name) {
-    this.name = name;
-  }
-
-  public String getType() {
-    return type;
-  }
-
-  public void setType(String type) {
-    this.type = type;
-  }
-
-  public boolean isRoot() {
-    return isRoot;
-  }
-
-  public void setRoot(boolean isRoot) {
-    this.isRoot = isRoot;
-  }
-
-  public Collection<VNode> getChilds() {
-    return childs;
-  }
-
-  public void setChilds(Collection<VNode> childs) {
-    this.childs = childs;
-  }
-
-  public boolean isParent() {
-    return isParent;
-  }
-
-  public void setParent(boolean isParent) {
-    this.isParent = isParent;
-  }
-
-  public Collection<VNameValue> getLogLevelCount() {
-    return logLevelCount;
-  }
-
-  public void setLogLevelCount(Collection<VNameValue> logLevelCount) {
-    this.logLevelCount = logLevelCount;
-  }
-  
-  public String getValue() {
-    return value;
-  }
-
-  public void setValue(String value) {
-    this.value = value;
-  }
-
-  @Override
-  public String toString() {
-    String str = "VNode={";
-    str += "name={" + name + "} ";
-    str += "value={" + value + "} ";
-    str += "type={" + type + "} ";
-    str += "isRoot={" + isRoot + "} ";
-    str += "isParent={" + isParent + "} ";
-    str += "logLevelCount={" + logLevelCount + "} ";
-    str += "childs={" + childs + "} ";
-    str += "}";
-    return str;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VNodeList.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VNodeList.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VNodeList.java
deleted file mode 100644
index 78f32ce..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VNodeList.java
+++ /dev/null
@@ -1,55 +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.view;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlRootElement;
-
-@XmlRootElement
-@XmlAccessorType(XmlAccessType.FIELD)
-public class VNodeList extends VList {
-  private static final long serialVersionUID = 1L;
-  protected List<VNode> vNodeList = new ArrayList<VNode>();
-
-  public List<VNode> getvNodeList() {
-    return vNodeList;
-  }
-
-  public void setvNodeList(List<VNode> vNodeList) {
-    this.vNodeList = vNodeList;
-  }
-
-  @Override
-  public int getListSize() {
-    // TODO Auto-generated method stub
-    return 0;
-  }
-
-  @Override
-  public List<VNode> getList() {
-    // TODO Auto-generated method stub
-    return null;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VSolrLogList.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VSolrLogList.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VSolrLogList.java
deleted file mode 100644
index 55cc089..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VSolrLogList.java
+++ /dev/null
@@ -1,67 +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.view;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlRootElement;
-
-import org.apache.solr.common.SolrDocumentList;
-import org.codehaus.jackson.annotate.JsonAutoDetect;
-import org.codehaus.jackson.annotate.JsonAutoDetect.Visibility;
-import org.codehaus.jackson.map.annotate.JsonSerialize;
-
-@JsonAutoDetect(getterVisibility = Visibility.NONE, setterVisibility = Visibility.NONE, fieldVisibility = Visibility.ANY)
-@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
-@XmlRootElement
-@XmlAccessorType(XmlAccessType.FIELD)
-public class VSolrLogList extends VList {
-  private static final long serialVersionUID = 1L;
-
-  protected SolrDocumentList logList;
-
-  public VSolrLogList() {
-    super();
-    logList = new SolrDocumentList();
-  }
-
-  public VSolrLogList(SolrDocumentList logList) {
-    super(logList);
-    this.logList = logList;
-  }
-
-  public void setSolrDocuments(SolrDocumentList list) {
-    this.logList = list;
-  }
-
-  @Override
-  public int getListSize() {
-    if (logList != null){
-      return logList.size();
-    }
-    return 0;
-  }
-
-  @Override
-  public SolrDocumentList getList() {
-    return logList;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VString.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VString.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VString.java
deleted file mode 100644
index bda7565..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VString.java
+++ /dev/null
@@ -1,52 +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.view;
-
-import javax.xml.bind.annotation.XmlRootElement;
-
-@XmlRootElement
-public class VString {
-
-  /**
-   * Value
-   */
-  protected String value;
-
-  /**
-   * Default constructor. This will set all the attributes to default value.
-   */
-  public VString() {
-  }
-
-  public String getValue() {
-    return value;
-  }
-
-  public void setValue(String value) {
-    this.value = value;
-  }
-
-  public String toString() {
-    String str = "VString={";
-    str += super.toString();
-    str += "value={" + value + "} ";
-    str += "}";
-    return str;
-  }
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VSummaryCount.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VSummaryCount.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VSummaryCount.java
deleted file mode 100644
index b8606d0..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VSummaryCount.java
+++ /dev/null
@@ -1,66 +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.view;
-
-import java.util.List;
-
-public class VSummaryCount {
-
-  protected String level;
-
-  protected List<String> cricticalMsg;
-
-  protected List<String> compName;
-
-  protected List<Long> countMsg;
-
-  public String getLevel() {
-    return level;
-  }
-
-  public void setLevel(String level) {
-    this.level = level;
-  }
-
-  public List<String> getCricticalMsg() {
-    return cricticalMsg;
-  }
-
-  public void setCricticalMsg(List<String> cricticalMsg) {
-    this.cricticalMsg = cricticalMsg;
-  }
-
-  public List<String> getCompName() {
-    return compName;
-  }
-
-  public void setCompName(List<String> compName) {
-    this.compName = compName;
-  }
-
-  public List<Long> getCountMsg() {
-    return countMsg;
-  }
-
-  public void setCountMsg(List<Long> countMsg) {
-    this.countMsg = countMsg;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VSummaryCountList.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VSummaryCountList.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VSummaryCountList.java
deleted file mode 100644
index fcab0b7..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VSummaryCountList.java
+++ /dev/null
@@ -1,37 +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.view;
-
-import java.util.ArrayList;
-import java.util.Collection;
-
-public class VSummaryCountList {
-
-  protected Collection<VSummaryCount> countList = new ArrayList<VSummaryCount>();
-
-  public Collection<VSummaryCount> getCountList() {
-    return countList;
-  }
-
-  public void setCountList(Collection<VSummaryCount> countList) {
-    this.countList = countList;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/filters/LogsearchSecurityContextFormationFilter.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/filters/LogsearchSecurityContextFormationFilter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/filters/LogsearchSecurityContextFormationFilter.java
index 9fb285e..a34fbd0 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/filters/LogsearchSecurityContextFormationFilter.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/filters/LogsearchSecurityContextFormationFilter.java
@@ -20,6 +20,7 @@ package org.apache.ambari.logsearch.web.filters;
 
 import java.io.IOException;
 
+import javax.inject.Inject;
 import javax.servlet.FilterChain;
 import javax.servlet.ServletException;
 import javax.servlet.ServletRequest;
@@ -30,11 +31,10 @@ import javax.servlet.http.HttpServletResponse;
 import javax.servlet.http.HttpSession;
 
 import org.apache.ambari.logsearch.common.LogSearchContext;
-import org.apache.ambari.logsearch.manager.SessionMgr;
+import org.apache.ambari.logsearch.manager.SessionManager;
 import org.apache.ambari.logsearch.util.CommonUtil;
 import org.apache.ambari.logsearch.web.model.User;
 import org.apache.log4j.Logger;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.authentication.AnonymousAuthenticationToken;
 import org.springframework.security.core.Authentication;
 import org.springframework.security.core.context.SecurityContextHolder;
@@ -47,8 +47,8 @@ public class LogsearchSecurityContextFormationFilter extends GenericFilterBean {
   public static final String LOGSEARCH_SC_SESSION_KEY = "LOGSEARCH_SECURITY_CONTEXT";
   public static final String USER_AGENT = "User-Agent";
 
-  @Autowired
-  SessionMgr sessionMgr;
+  @Inject
+  SessionManager sessionManager;
 
   public LogsearchSecurityContextFormationFilter() {
   }
@@ -94,7 +94,7 @@ public class LogsearchSecurityContextFormationFilter extends GenericFilterBean {
           httpSession.setAttribute(LOGSEARCH_SC_SESSION_KEY, context);
         }
         LogSearchContext.setContext(context);
-        User user = sessionMgr.processSuccessLogin();
+        User user = sessionManager.processSuccessLogin();
         context.setUser(user);
       }
       chain.doFilter(request, response);

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchAuthenticationProvider.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchAuthenticationProvider.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchAuthenticationProvider.java
index 0f7377d..3534818 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchAuthenticationProvider.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchAuthenticationProvider.java
@@ -23,7 +23,6 @@ import java.util.HashMap;
 import org.apache.ambari.logsearch.dao.UserDao;
 import org.apache.ambari.logsearch.util.JSONUtil;
 import org.apache.log4j.Logger;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
 import org.springframework.security.core.Authentication;
 import org.springframework.security.core.AuthenticationException;
@@ -31,6 +30,8 @@ import org.springframework.security.core.userdetails.UserDetailsService;
 import org.springframework.security.web.authentication.WebAuthenticationDetails;
 import org.springframework.stereotype.Component;
 
+import javax.inject.Inject;
+
 @Component
 public class LogsearchAuthenticationProvider extends
   LogsearchAbstractAuthenticationProvider {
@@ -39,19 +40,19 @@ public class LogsearchAuthenticationProvider extends
   private static Logger auditLogger = Logger
     .getLogger("org.apache.ambari.logsearch.audit");
 
-  @Autowired
+  @Inject
   UserDao userDao;
 
-  @Autowired
+  @Inject
   LogsearchLdapAuthenticationProvider ldapAuthenticationProvider;
 
-  @Autowired
+  @Inject
   LogsearchFileAuthenticationProvider fileAuthenticationProvider;
 
-  @Autowired
+  @Inject
   LogsearchSimpleAuthenticationProvider simpleAuthenticationProvider;
-  
-  @Autowired
+
+  @Inject
   LogsearchExternalServerAuthenticationProvider externalServerAuthenticationProvider;
 
   @Override

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchExternalServerAuthenticationProvider.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchExternalServerAuthenticationProvider.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchExternalServerAuthenticationProvider.java
index 4eea3e1..a06a381 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchExternalServerAuthenticationProvider.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchExternalServerAuthenticationProvider.java
@@ -22,14 +22,15 @@ import java.util.ArrayList;
 import java.util.List;
 
 import javax.annotation.PostConstruct;
+import javax.inject.Inject;
 
 import org.apache.ambari.logsearch.common.ExternalServerClient;
 import org.apache.ambari.logsearch.common.PropertiesHelper;
+import org.apache.ambari.logsearch.conf.AuthConfig;
 import org.apache.ambari.logsearch.util.JSONUtil;
 import org.apache.commons.lang.StringEscapeUtils;
 import org.apache.commons.lang.StringUtils;
 import org.apache.log4j.Logger;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.authentication.BadCredentialsException;
 import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
 import org.springframework.security.core.Authentication;
@@ -95,16 +96,11 @@ public class LogsearchExternalServerAuthenticationProvider extends
     };
   }
 
-  @Autowired
-  ExternalServerClient externalServerClient;
+  @Inject
+  private ExternalServerClient externalServerClient;
 
-  private String loginAPIURL = "/api/v1/users/$USERNAME/privileges?fields=*";// default
-
-  @PostConstruct
-  public void initialization() {
-    loginAPIURL = PropertiesHelper.getProperty(AUTH_METHOD_PROP_START_WITH
-        + "external_auth.login_url", loginAPIURL);
-  }
+  @Inject
+  private AuthConfig authConfig;
 
   /**
    * Authenticating user from external-server using REST call
@@ -134,7 +130,7 @@ public class LogsearchExternalServerAuthenticationProvider extends
     password = StringEscapeUtils.unescapeHtml(password);
     username = StringEscapeUtils.unescapeHtml(username);
     try {
-      String finalLoginUrl = loginAPIURL.replace("$USERNAME", username);
+      String finalLoginUrl = authConfig.getExternalAuthLoginUrl().replace("$USERNAME", username);
       String responseObj = (String) externalServerClient.sendGETRequest(
           finalLoginUrl, String.class, null, username, password);
       if (!isAllowedRole(responseObj)) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchFileAuthenticationProvider.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchFileAuthenticationProvider.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchFileAuthenticationProvider.java
index 44c31c5..180de31 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchFileAuthenticationProvider.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchFileAuthenticationProvider.java
@@ -24,7 +24,6 @@ import org.apache.ambari.logsearch.util.CommonUtil;
 import org.apache.commons.lang.StringEscapeUtils;
 import org.apache.commons.lang.StringUtils;
 import org.apache.log4j.Logger;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.authentication.BadCredentialsException;
 import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
 import org.springframework.security.core.Authentication;
@@ -34,12 +33,14 @@ import org.springframework.security.core.userdetails.UserDetails;
 import org.springframework.security.core.userdetails.UserDetailsService;
 import org.springframework.stereotype.Component;
 
+import javax.inject.Inject;
+
 @Component
 public class LogsearchFileAuthenticationProvider extends LogsearchAbstractAuthenticationProvider {
 
   private static Logger logger = Logger.getLogger(LogsearchFileAuthenticationProvider.class);
 
-  @Autowired
+  @Inject
   private UserDetailsService userDetailsService;
 
   @Override

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/scripts/add_config_set.sh
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/scripts/add_config_set.sh b/ambari-logsearch/ambari-logsearch-portal/src/main/scripts/add_config_set.sh
deleted file mode 100755
index e9d3106..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/scripts/add_config_set.sh
+++ /dev/null
@@ -1,43 +0,0 @@
-#!/bin/bash
-# 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.
-
-if [ $# -ne 4 ]; then
-    echo "Usage: $0 <solr_home> <zk_host_with_path> <config_name> <config_folder>"
-    echo "Example: $0 /opt/solr MY_ZKHOST/solr hadoop_logs `dirname $0`/configsets/hadoop_logs"
-    exit 1
-fi
-
-curr_dir=`pwd`
-cd `dirname $0`; script_dir=`pwd`; cd $curr_dir
-
-
-solr_home=$1
-zk_host=$2
-config_name=$3
-config_folder=$4
-
-tmp_folder=/tmp/solr_config_${config_name}_$USER
-rm -rf $tmp_folder
-
-$solr_home/server/scripts/cloud-scripts/zkcli.sh -zkhost $zk_host -cmd downconfig -confdir $tmp_folder -confname $config_name > /dev/null 2>&1 
-
-if [ -d $tmp_folder ]; then
-    echo "Config $config_name already existing. Will not add to zookeeper"
-else
-    echo "Adding config to $config_name to $zk_host"
-    $solr_home/server/scripts/cloud-scripts/zkcli.sh  -zkhost $zk_host -cmd upconfig -confdir $config_folder -confname $config_name
-    echo "Added config to $config_name to $zk_host"
-fi

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/scripts/create_collections.sh
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/scripts/create_collections.sh b/ambari-logsearch/ambari-logsearch-portal/src/main/scripts/create_collections.sh
deleted file mode 100755
index be728aa..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/scripts/create_collections.sh
+++ /dev/null
@@ -1,37 +0,0 @@
-#!/bin/bash
-# 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.
-
-if [ $# -ne 4 ]; then
-    echo "Usage: $0 <solr_home> <number of shards> <number of replications> [configset folder]"
-    exit 1
-fi
-
-curr_dir=`pwd`
-cd `dirname $0`; script_dir=`pwd`; cd $curr_dir
-
-
-solr_home=$1
-shards=$2
-replications=$3
-
-configsets_folder=$4
-if [ "$configsets_folder" = "" ]; then
-    configsets_folder=${script_dir}/solr_configsets
-fi
-
-${solr_home}/bin/solr create -c hadoop_logs -d ${configsets_folder}/hadoop_logs/conf -s ${shards} -rf ${replications}
-${solr_home}/bin/solr create -c history -d ${configsets_folder}/history/conf -s 1 -rf ${shards}
-${solr_home}/bin/solr create -c audit_logs -d ${configsets_folder}/audit_logs/conf -s ${shards} -rf ${replications}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/META-INF/applicationContext.xml
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/META-INF/applicationContext.xml b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/META-INF/applicationContext.xml
deleted file mode 100644
index b457a1d..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/META-INF/applicationContext.xml
+++ /dev/null
@@ -1,69 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  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.
--->
-<beans xmlns="http://www.springframework.org/schema/beans"
-xmlns:aop="http://www.springframework.org/schema/aop" xmlns:jee="http://www.springframework.org/schema/jee"
-xmlns:tx="http://www.springframework.org/schema/tx" xmlns:context="http://www.springframework.org/schema/context"
-xmlns:task="http://www.springframework.org/schema/task" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-xmlns:util="http://www.springframework.org/schema/util"
-xsi:schemaLocation="http://www.springframework.org/schema/aop
-http://www.springframework.org/schema/aop/spring-aop-4.2.xsd
-http://www.springframework.org/schema/beans
-http://www.springframework.org/schema/beans/spring-beans-4.2.xsd
-http://www.springframework.org/schema/context
-http://www.springframework.org/schema/context/spring-context-4.2.xsd
-http://www.springframework.org/schema/jee
-http://www.springframework.org/schema/jee/spring-jee-4.2.xsd
-http://www.springframework.org/schema/tx
-http://www.springframework.org/schema/tx/spring-tx-4.2.xsd
-http://www.springframework.org/schema/task
-http://www.springframework.org/schema/task/spring-task-4.2.xsd
-http://www.springframework.org/schema/util
-http://www.springframework.org/schema/util/spring-util.xsd">
-
-	<context:component-scan base-package="org.apache.ambari.logsearch" />
-	<task:annotation-driven />
-	<bean id="xmlPropertyConfigurer" class="org.apache.ambari.logsearch.common.XMLPropertiesHelper" />
-	
-	<bean id="propertyConfigurer" class="org.apache.ambari.logsearch.common.PropertiesHelper">
-		<property name="locations">
-			<list>
-				<value>classpath:default.properties</value>
-				<value>classpath:logsearch.properties</value>
-				<value>classpath:logsearch-admin-site.xml</value>
-			</list>
-		</property>
-		<property name="propertiesPersister" ref="xmlPropertyConfigurer" />
-	</bean>
-
-  <bean id="host" class="java.net.InetAddress" factory-method="getLocalHost"/>
-  <bean id="apiListingResource" class="io.swagger.jaxrs.listing.ApiListingResource"/>
-  <bean id="swaggerSerializers" class="io.swagger.jaxrs.listing.SwaggerSerializers" scope="singleton"/>
-  <bean id="beanConfig" class="io.swagger.jaxrs.config.BeanConfig">
-    <property name="schemes" value="http" /> <!-- TODO: set this from property -->
-    <property name="resourcePackage" value="org.apache.ambari.logsearch.rest"/>
-    <property name="version" value="1.0.0"/>
-    <property name="host" value="#{host.hostAddress}:61888"/> <!-- TODO: set port from property -->
-    <property name="basePath" value="/api/v1"/>
-    <property name="title" value="Log Search REST API"/>
-    <property name="description" value="Log aggregation, analysis, and visualization."/>
-    <property name="license" value="Apache 2.0"/>
-    <property name="licenseUrl" value="http://www.apache.org/licenses/LICENSE-2.0.html"/>
-    <property name="scan" value="true"/>
-  </bean>
-	
-</beans>

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/META-INF/security-applicationContext.xml
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/META-INF/security-applicationContext.xml b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/META-INF/security-applicationContext.xml
index 233fad4..9961cd0 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/META-INF/security-applicationContext.xml
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/META-INF/security-applicationContext.xml
@@ -34,6 +34,7 @@ http://www.springframework.org/schema/security/spring-security-4.0.xsd">
     <security:http pattern="/favicon.ico" security="none" />
     <security:http pattern="/api/v1/public/**" security="none" />
     <security:http pattern="/api/v1/swagger.json" security="none"/>
+    <security:http pattern="/api/v1/swagger.yaml" security="none"/>
   	
 	<security:http disable-url-rewriting="true" use-expressions="true" create-session="always" entry-point-ref="authenticationProcessingFilterEntryPoint">
 		<csrf disabled="true"/> 

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/WEB-INF/web.xml
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/WEB-INF/web.xml b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/WEB-INF/web.xml
index dbe5210..0f1beec 100755
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/WEB-INF/web.xml
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/WEB-INF/web.xml
@@ -16,21 +16,20 @@
   limitations under the License.
 -->
 <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
-  
- 
-	<display-name>LogSearch</display-name>
-
-	<context-param>
-		<param-name>contextConfigLocation</param-name>
-		<param-value>META-INF/applicationContext.xml
-					META-INF/security-applicationContext.xml
-		</param-value>
-	</context-param>
-
 
-	<listener>
-		<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
-	</listener>
+  <listener>
+    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
+  </listener>
+  <context-param>
+    <param-name>contextClass</param-name>
+    <param-value>
+      org.springframework.web.context.support.AnnotationConfigWebApplicationContext
+    </param-value>
+  </context-param>
+  <context-param>
+    <param-name>contextConfigLocation</param-name>
+    <param-value>org.apache.ambari.logsearch.conf.ApplicationConfig</param-value>
+  </context-param>
 
 	<listener>
 		<listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/model_bases/VUserFilterBase.js
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/model_bases/VUserFilterBase.js b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/model_bases/VUserFilterBase.js
index da299a0..cd469de 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/model_bases/VUserFilterBase.js
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/model_bases/VUserFilterBase.js
@@ -27,7 +27,7 @@ define(['require',
 	var VUserFilterBase = BaseModel.extend(
 	/** @lends VUserFilterBase.prototype */
 	{
-		urlRoot: Globals.baseURL + 'userconfig/users/filter',
+		urlRoot: Globals.baseURL + 'userconfig/filters',
 
 		defaults: {},
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/dashboard/ComponentListView.js
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/dashboard/ComponentListView.js b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/dashboard/ComponentListView.js
index b8c43bb..2afb4e1 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/dashboard/ComponentListView.js
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/dashboard/ComponentListView.js
@@ -68,7 +68,7 @@ define(['require',
 		                    pageSize: 99999
 		                }
 					});
-					this.componentsList.url = Globals.baseURL + "service/logs/components/level/counts";
+					this.componentsList.url = Globals.baseURL + "service/logs/components/levels/counts";
 					this.hostList = new VNodeList([],{
 						state: {
 		                    firstPage: 0,

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/graphs/GraphLayoutView.js
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/graphs/GraphLayoutView.js b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/graphs/GraphLayoutView.js
index 35d0c9a..728d721 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/graphs/GraphLayoutView.js
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/graphs/GraphLayoutView.js
@@ -84,7 +84,7 @@ define(['require',
                     this.collection.url = Globals.baseURL + "service/logs/histogram";
                     this.collection.modelAttrName = "graphData";
                 } else {
-                    this.collection.url = Globals.baseURL + "audit/logs/linegraph";
+                    this.collection.url = Globals.baseURL + "audit/logs/bargraph";
                     this.collection.modelAttrName = "graphData";
                     this.lineView = true;
                 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/templates/graphs/backup.js
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/templates/graphs/backup.js b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/templates/graphs/backup.js
index 8999e01..e250b02 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/templates/graphs/backup.js
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/templates/graphs/backup.js
@@ -81,7 +81,7 @@ define(['require',
                     this.collection.url = Globals.baseURL + "service/logs/histogram";
                     this.collection.modelAttrName = "graphData";
                 } else {
-                    this.collection.url = Globals.baseURL + "audit/logs/linegraph";
+                    this.collection.url = Globals.baseURL + "audit/logs/bargraph";
                     this.collection.modelAttrName = "graphData";
                     this.lineView = true;
                 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/dao/AuditSolrDaoTest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/dao/AuditSolrDaoTest.java b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/dao/AuditSolrDaoTest.java
index 0b94b60..017d7a8 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/dao/AuditSolrDaoTest.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/dao/AuditSolrDaoTest.java
@@ -21,18 +21,38 @@ package org.apache.ambari.logsearch.dao;
 
 import java.util.ArrayList;
 
+import org.apache.ambari.logsearch.conf.SolrAuditLogConfig;
+import org.apache.ambari.logsearch.conf.SolrKerberosConfig;
 import org.apache.solr.client.solrj.SolrClient;
 import org.apache.solr.client.solrj.request.CollectionAdminRequest;
 import org.apache.solr.common.util.NamedList;
 import org.easymock.Capture;
 import org.easymock.CaptureType;
 import org.easymock.EasyMock;
+import org.easymock.EasyMockSupport;
+import org.easymock.Mock;
+import org.easymock.TestSubject;
+import org.junit.Before;
 import org.junit.Test;
 
 import junit.framework.Assert;
 
 public class AuditSolrDaoTest {
 
+  @TestSubject
+  private AuditSolrDao dao = new AuditSolrDao();
+
+  @Mock
+  private SolrAuditLogConfig configMock;
+
+  @Mock
+  private SolrKerberosConfig kerbConfigMock;
+
+  @Before
+  public void setUp() {
+    EasyMockSupport.injectMocks(this);
+  }
+
   @Test
   public void testAuditSolrDaoPostConstructor() throws Exception {
     SolrClient mockSolrClient = EasyMock.strictMock(SolrClient.class);
@@ -42,6 +62,18 @@ public class AuditSolrDaoTest {
     header.add("status", 0);
     response.add("responseHeader", header);
     response.add("collections", new ArrayList<String>());
+
+    EasyMock.expect(configMock.getSolrUrl()).andReturn(null);
+    EasyMock.expect(configMock.getZkConnectString()).andReturn("dummyHost1:2181,dummyHost2:2181");
+    EasyMock.expect(configMock.getConfigName()).andReturn("test_audit_logs_config_name");
+    EasyMock.expect(configMock.getCollection()).andReturn("test_audit_logs_collection");
+    EasyMock.expect(configMock.getSplitInterval()).andReturn("none");
+    EasyMock.expect(configMock.getNumberOfShards()).andReturn(123);
+    EasyMock.expect(configMock.getReplicationFactor()).andReturn(456);
+    EasyMock.expect(configMock.getAliasNameIn()).andReturn("alias");
+    EasyMock.expect(configMock.getRangerCollection()).andReturn("ranger_audit");
+    EasyMock.expect(kerbConfigMock.isEnabled()).andReturn(false);
+    EasyMock.expect(kerbConfigMock.getJaasFile()).andReturn("jaas_file");
     
     Capture<CollectionAdminRequest.Create> captureCreateRequest = EasyMock.newCapture(CaptureType.LAST);
     
@@ -50,9 +82,8 @@ public class AuditSolrDaoTest {
     mockSolrClient.request(EasyMock.capture(captureCreateRequest), EasyMock.anyString());
     EasyMock.expectLastCall().andReturn(response);
     
-    EasyMock.replay(mockSolrClient);
-    
-    AuditSolrDao dao = new AuditSolrDao();
+    EasyMock.replay(mockSolrClient, configMock, kerbConfigMock);
+
     dao.solrClient = mockSolrClient;
     dao.isZkConnectString = true;
     

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/dao/ServiceLogsSolrDaoTest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/dao/ServiceLogsSolrDaoTest.java b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/dao/ServiceLogsSolrDaoTest.java
index 2985a62..bdee8a8 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/dao/ServiceLogsSolrDaoTest.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/dao/ServiceLogsSolrDaoTest.java
@@ -21,18 +21,38 @@ package org.apache.ambari.logsearch.dao;
 
 import java.util.ArrayList;
 
+import org.apache.ambari.logsearch.conf.SolrKerberosConfig;
+import org.apache.ambari.logsearch.conf.SolrServiceLogConfig;
 import org.apache.solr.client.solrj.SolrClient;
 import org.apache.solr.client.solrj.request.CollectionAdminRequest;
 import org.apache.solr.common.util.NamedList;
 import org.easymock.Capture;
 import org.easymock.CaptureType;
 import org.easymock.EasyMock;
+import org.easymock.EasyMockSupport;
+import org.easymock.Mock;
+import org.easymock.TestSubject;
+import org.junit.Before;
 import org.junit.Test;
 
 import junit.framework.Assert;
 
 public class ServiceLogsSolrDaoTest {
 
+  @TestSubject
+  private ServiceLogsSolrDao dao = new ServiceLogsSolrDao();
+
+  @Mock
+  private SolrKerberosConfig kerbConfigMock;
+
+  @Mock
+  private SolrServiceLogConfig configMock;
+
+  @Before
+  public void setUp() {
+    EasyMockSupport.injectMocks(this);
+  }
+
   @Test
   public void testServiceLogsSolrDaoPostConstructor() throws Exception {
     SolrClient mockSolrClient = EasyMock.strictMock(SolrClient.class);
@@ -42,20 +62,29 @@ public class ServiceLogsSolrDaoTest {
     header.add("status", 0);
     response.add("responseHeader", header);
     response.add("collections", new ArrayList<String>());
+
+    EasyMock.expect(configMock.getSolrUrl()).andReturn(null);
+    EasyMock.expect(configMock.getZkConnectString()).andReturn("dummyHost1:2181,dummyHost2:2181");
+    EasyMock.expect(configMock.getConfigName()).andReturn("test_service_logs_config_name");
+    EasyMock.expect(configMock.getCollection()).andReturn("test_service_logs_collection");
+    EasyMock.expect(configMock.getSplitInterval()).andReturn("none");
+    EasyMock.expect(configMock.getNumberOfShards()).andReturn(789);
+    EasyMock.expect(configMock.getReplicationFactor()).andReturn(987);
+    EasyMock.expect(kerbConfigMock.isEnabled()).andReturn(false);
+    EasyMock.expect(kerbConfigMock.getJaasFile()).andReturn("jaas_file");
     
     Capture<CollectionAdminRequest.Create> captureCreateRequest = EasyMock.newCapture(CaptureType.LAST);
     
     EasyMock.expect(mockSolrClient.request(EasyMock.anyObject(CollectionAdminRequest.List.class), EasyMock.anyString())).andReturn(response);
     mockSolrClient.request(EasyMock.capture(captureCreateRequest), EasyMock.anyString()); EasyMock.expectLastCall().andReturn(response);
     
-    EasyMock.replay(mockSolrClient);
-    
-    ServiceLogsSolrDao dao = new ServiceLogsSolrDao();
+    EasyMock.replay(mockSolrClient, configMock, kerbConfigMock);
+
     dao.solrClient = mockSolrClient;
     dao.isZkConnectString = true;
     
     dao.postConstructor();
-    EasyMock.verify(mockSolrClient);
+    EasyMock.verify(mockSolrClient, configMock, kerbConfigMock);
     
     CollectionAdminRequest.Create createRequest = captureCreateRequest.getValue();
     Assert.assertEquals(createRequest.getConfigName(), "test_service_logs_config_name");

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/dao/SolrDaoBaseTest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/dao/SolrDaoBaseTest.java b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/dao/SolrDaoBaseTest.java
index ba5b074..22b10c3 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/dao/SolrDaoBaseTest.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/dao/SolrDaoBaseTest.java
@@ -24,11 +24,10 @@ import java.util.Arrays;
 
 import javax.ws.rs.WebApplicationException;
 
-import org.apache.ambari.logsearch.manager.MgrBase.LogType;
-import org.apache.ambari.logsearch.util.RESTErrorUtil;
+import org.apache.ambari.logsearch.conf.SolrKerberosConfig;
+import org.apache.ambari.logsearch.manager.ManagerBase.LogType;
 import org.apache.solr.client.solrj.SolrClient;
 import org.apache.solr.client.solrj.SolrQuery;
-import org.apache.solr.client.solrj.SolrRequest;
 import org.apache.solr.client.solrj.SolrRequest.METHOD;
 import org.apache.solr.client.solrj.impl.CloudSolrClient;
 import org.apache.solr.client.solrj.impl.HttpSolrClient;
@@ -38,6 +37,10 @@ import org.apache.solr.client.solrj.response.UpdateResponse;
 import org.apache.solr.common.SolrInputDocument;
 import org.apache.solr.common.util.NamedList;
 import org.easymock.EasyMock;
+import org.easymock.EasyMockSupport;
+import org.easymock.Mock;
+import org.easymock.TestSubject;
+import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.rules.ExpectedException;
@@ -45,14 +48,30 @@ import org.junit.rules.ExpectedException;
 import junit.framework.Assert;
 
 public class SolrDaoBaseTest {
+
+  @TestSubject
+  private SolrDaoBase dao = new SolrDaoBase(LogType.SERVICE) {};
+
   @Rule
   public ExpectedException expectedException = ExpectedException.none();
+
+  @Mock
+  private SolrKerberosConfig kerbConfigMock;
+
+  @Before
+  public void setUp() {
+    EasyMockSupport.injectMocks(this);
+  }
   
   // ----------------------------------------------------------- connectToSolr -----------------------------------------------------------
   
   @Test
   public void testConnectToSolrWithConnectString() throws Exception {
-    SolrDaoBase dao = new SolrDaoBase(null) {};
+    EasyMock.expect(kerbConfigMock.isEnabled()).andReturn(false);
+    EasyMock.expect(kerbConfigMock.getJaasFile()).andReturn("jaas_file");
+
+    EasyMock.replay(kerbConfigMock);
+
     SolrClient solrClient = dao.connectToSolr(null, "zk_connect_string", "collection");
     
     Assert.assertEquals(solrClient.getClass(), CloudSolrClient.class);
@@ -60,7 +79,11 @@ public class SolrDaoBaseTest {
   
   @Test
   public void testConnectToSolrWithUrl() throws Exception {
-    SolrDaoBase dao = new SolrDaoBase(null) {};
+    EasyMock.expect(kerbConfigMock.isEnabled()).andReturn(false);
+    EasyMock.expect(kerbConfigMock.getJaasFile()).andReturn("jaas_file");
+
+    EasyMock.replay(kerbConfigMock);
+
     SolrClient solrClient = dao.connectToSolr("url", null, "collection");
     
     Assert.assertEquals(solrClient.getClass(), HttpSolrClient.class);
@@ -68,7 +91,11 @@ public class SolrDaoBaseTest {
   
   @Test
   public void testConnectToSolrWithBoth() throws Exception {
-    SolrDaoBase dao = new SolrDaoBase(null) {};
+    EasyMock.expect(kerbConfigMock.isEnabled()).andReturn(false);
+    EasyMock.expect(kerbConfigMock.getJaasFile()).andReturn("jaas_file");
+
+    EasyMock.replay(kerbConfigMock);
+
     SolrClient solrClient = dao.connectToSolr("url", "zk_connect_string", "collection");
     
     Assert.assertEquals(solrClient.getClass(), CloudSolrClient.class);
@@ -76,10 +103,14 @@ public class SolrDaoBaseTest {
   
   @Test
   public void testConnectToSolrWithNeither() throws Exception {
+    EasyMock.expect(kerbConfigMock.isEnabled()).andReturn(false);
+    EasyMock.expect(kerbConfigMock.getJaasFile()).andReturn("jaas_file");
+
+    EasyMock.replay(kerbConfigMock);
+
     expectedException.expect(Exception.class);
     expectedException.expectMessage("Both zkConnectString and URL are empty. zkConnectString=null, collection=collection, url=null");
 
-    SolrDaoBase dao = new SolrDaoBase(null) {};
     dao.connectToSolr(null, null, "collection");
   }
   
@@ -88,7 +119,6 @@ public class SolrDaoBaseTest {
     expectedException.expect(Exception.class);
     expectedException.expectMessage("For solr, collection name is mandatory. zkConnectString=zk_connect_string, collection=null, url=url");
 
-    SolrDaoBase dao = new SolrDaoBase(null) {};
     dao.connectToSolr("url", "zk_connect_string", null);
   }
   
@@ -106,8 +136,7 @@ public class SolrDaoBaseTest {
     
     EasyMock.expect(mockSolrClient.request(EasyMock.anyObject(CollectionAdminRequest.List.class), EasyMock.anyString())).andReturn(response);
     EasyMock.replay(mockSolrClient);
-    
-    SolrDaoBase dao = new SolrDaoBase(null) {};
+
     dao.solrClient = mockSolrClient;
     
     boolean status = dao.checkSolrStatus(10000);
@@ -120,8 +149,7 @@ public class SolrDaoBaseTest {
   public void testCheckSolrStatusNotSuccessful() throws Exception {
     SolrClient mockSolrClient = EasyMock.strictMock(SolrClient.class);
     EasyMock.replay(mockSolrClient);
-    
-    SolrDaoBase dao = new SolrDaoBase(null) {};
+
     dao.solrClient = mockSolrClient;
     
     boolean status = dao.checkSolrStatus(10000);
@@ -148,8 +176,7 @@ public class SolrDaoBaseTest {
     mockSolrClouldClient.setDefaultCollection("alias_name"); EasyMock.expectLastCall();
     
     EasyMock.replay(mockSolrClient, mockSolrClouldClient);
-    
-    SolrDaoBase dao = new SolrDaoBase(null) {};
+
     dao.isZkConnectString = true;
     dao.solrClient = mockSolrClient;
     dao.solrClouldClient = mockSolrClouldClient;
@@ -177,8 +204,7 @@ public class SolrDaoBaseTest {
     EasyMock.expect(mockSolrClient.request(EasyMock.anyObject(CollectionAdminRequest.List.class), EasyMock.anyString())).andReturn(response);
     EasyMock.expect(mockSolrClient.request(EasyMock.anyObject(CollectionAdminRequest.Create.class), EasyMock.anyString())).andReturn(response);
     EasyMock.replay(mockSolrClient);
-    
-    SolrDaoBase dao = new SolrDaoBase(null) {};
+
     dao.isZkConnectString = true;
     dao.solrClient = mockSolrClient;
     dao.collectionName = "test_collection";
@@ -201,8 +227,7 @@ public class SolrDaoBaseTest {
     EasyMock.expect(mockSolrClient.request(EasyMock.anyObject(CollectionAdminRequest.List.class), EasyMock.anyString())).andReturn(response);
     EasyMock.expect(mockSolrClient.request(EasyMock.anyObject(CollectionAdminRequest.Create.class), EasyMock.anyString())).andReturn(response);
     EasyMock.replay(mockSolrClient);
-    
-    SolrDaoBase dao = new SolrDaoBase(null) {};
+
     dao.isZkConnectString = true;
     dao.solrClient = mockSolrClient;
     
@@ -218,8 +243,7 @@ public class SolrDaoBaseTest {
     SolrClient mockSolrClient = EasyMock.strictMock(SolrClient.class);
     EasyMock.expect(mockSolrClient.query(EasyMock.anyObject(SolrQuery.class), EasyMock.eq(METHOD.POST))).andReturn(new QueryResponse());
     EasyMock.replay(mockSolrClient);
-    
-    SolrDaoBase dao = new SolrDaoBase(null) {};
+
     dao.solrClient = mockSolrClient;
     
     dao.process(new SolrQuery());
@@ -230,8 +254,7 @@ public class SolrDaoBaseTest {
   @Test
   public void testProcessNoConnection() throws Exception {
     expectedException.expect(WebApplicationException.class);
-    
-    SolrDaoBase dao = new SolrDaoBase(LogType.SERVICE) {};
+
     dao.process(new SolrQuery());
   }
   
@@ -251,8 +274,7 @@ public class SolrDaoBaseTest {
     EasyMock.expect(mockSolrClient.add(EasyMock.anyObject(SolrInputDocument.class))).andReturn(updateResponse);
     EasyMock.expect(mockSolrClient.commit()).andReturn(updateResponse);
     EasyMock.replay(mockSolrClient);
-    
-    SolrDaoBase dao = new SolrDaoBase(null) {};
+
     dao.solrClient = mockSolrClient;
     
     dao.addDocs(new SolrInputDocument());
@@ -274,8 +296,7 @@ public class SolrDaoBaseTest {
     EasyMock.expect(mockSolrClient.deleteByQuery(EasyMock.anyString())).andReturn(updateResponse);
     EasyMock.expect(mockSolrClient.commit()).andReturn(updateResponse);
     EasyMock.replay(mockSolrClient);
-    
-    SolrDaoBase dao = new SolrDaoBase(null) {};
+
     dao.solrClient = mockSolrClient;
     
     dao.removeDoc("query");

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/dao/UserConfigSolrDaoTest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/dao/UserConfigSolrDaoTest.java b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/dao/UserConfigSolrDaoTest.java
index dddbf31..3b01a19 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/dao/UserConfigSolrDaoTest.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/dao/UserConfigSolrDaoTest.java
@@ -20,7 +20,10 @@
 package org.apache.ambari.logsearch.dao;
 
 import java.util.ArrayList;
+import java.util.Arrays;
 
+import org.apache.ambari.logsearch.conf.SolrKerberosConfig;
+import org.apache.ambari.logsearch.conf.SolrUserConfig;
 import org.apache.solr.client.solrj.SolrClient;
 import org.apache.solr.client.solrj.SolrRequest.METHOD;
 import org.apache.solr.client.solrj.request.CollectionAdminRequest;
@@ -32,11 +35,29 @@ import org.apache.solr.common.util.NamedList;
 import org.easymock.Capture;
 import org.easymock.CaptureType;
 import org.easymock.EasyMock;
+import org.easymock.EasyMockSupport;
+import org.easymock.Mock;
+import org.easymock.TestSubject;
+import org.junit.Before;
 import org.junit.Test;
 
 import junit.framework.Assert;
 
 public class UserConfigSolrDaoTest {
+
+  @TestSubject
+  private UserConfigSolrDao dao = new UserConfigSolrDao();
+
+  @Mock
+  private SolrUserConfig configMock;
+
+  @Mock
+  private SolrKerberosConfig kerbConfigMock;
+
+  @Before
+  public void setUp() {
+    EasyMockSupport.injectMocks(this);
+  }
   
   @Test
   public void testUserConfigDaoPostConstructor() throws Exception {
@@ -56,6 +77,17 @@ public class UserConfigSolrDaoTest {
     updateResponseHeader.add("QTime", 1);
     updateResponseContent.add("responseHeader", updateResponseHeader);
     updateResponse.setResponse(updateResponseContent);
+
+    EasyMock.expect(configMock.getSolrUrl()).andReturn(null).times(2);
+    EasyMock.expect(configMock.getZkConnectString()).andReturn("dummyHost1:2181,dummyHost2:2181").times(2);
+    EasyMock.expect(configMock.getConfigName()).andReturn("test_history_logs_config_name").times(2);
+    EasyMock.expect(configMock.getCollection()).andReturn("test_history_logs_collection").times(2);
+    EasyMock.expect(configMock.getSplitInterval()).andReturn("none").times(2);
+    EasyMock.expect(configMock.getNumberOfShards()).andReturn(123).times(2);
+    EasyMock.expect(configMock.getReplicationFactor()).andReturn(234).times(2);
+    EasyMock.expect(configMock.getLogLevels()).andReturn(Arrays.asList("TRACE")).times(2);
+    EasyMock.expect(kerbConfigMock.isEnabled()).andReturn(false).times(2);
+    EasyMock.expect(kerbConfigMock.getJaasFile()).andReturn("jaas_file").times(2);
     
     Capture<CollectionAdminRequest.Create> captureCreateRequest = EasyMock.newCapture(CaptureType.LAST);
     Capture<SolrParams> captureSolrParams = EasyMock.newCapture(CaptureType.LAST);
@@ -67,9 +99,8 @@ public class UserConfigSolrDaoTest {
     mockSolrClient.query(EasyMock.capture(captureSolrParams), EasyMock.capture(captureMethod)); EasyMock.expectLastCall().andReturn(queryResponse);
     mockSolrClient.add(EasyMock.capture(captureSolrInputDocument)); EasyMock.expectLastCall().andReturn(updateResponse);
     EasyMock.expect(mockSolrClient.commit()).andReturn(updateResponse);
-    EasyMock.replay(mockSolrClient);
-    
-    UserConfigSolrDao dao = new UserConfigSolrDao();
+    EasyMock.replay(mockSolrClient, configMock, kerbConfigMock);
+
     dao.postConstructor();
     dao.solrClient = mockSolrClient;
     dao.isZkConnectString = true;
@@ -92,7 +123,7 @@ public class UserConfigSolrDaoTest {
     SolrInputDocument solrInputDocument = captureSolrInputDocument.getValue();
     Assert.assertNotNull(solrInputDocument.getFieldValue("id"));
     Assert.assertEquals(solrInputDocument.getFieldValue("rowtype"), "log_feeder_config");
-    Assert.assertEquals(solrInputDocument.getFieldValue("jsons"), "{\"filter\":{\"test_component2\":{\"label\":\"test_component2\",\"hosts\":[],\"defaultLevels\":[\"FATAL\",\"ERROR\",\"WARN\",\"INFO\",\"DEBUG\",\"TRACE\"],\"overrideLevels\":[]},\"test_component1\":{\"label\":\"test_component1\",\"hosts\":[],\"defaultLevels\":[\"FATAL\",\"ERROR\",\"WARN\",\"INFO\",\"DEBUG\",\"TRACE\"],\"overrideLevels\":[]}},\"id\":\"" + solrInputDocument.getFieldValue("id") + "\"}");
+    Assert.assertEquals(solrInputDocument.getFieldValue("jsons"), "{\"filter\":{\"test_component2\":{\"label\":\"test_component2\",\"hosts\":[],\"defaultLevels\":[\"TRACE\"],\"overrideLevels\":[]},\"test_component1\":{\"label\":\"test_component1\",\"hosts\":[],\"defaultLevels\":[\"TRACE\"],\"overrideLevels\":[]}},\"id\":\"" + solrInputDocument.getFieldValue("id") + "\"}");
     Assert.assertEquals(solrInputDocument.getFieldValue("username"), "log_feeder_config");
     Assert.assertEquals(solrInputDocument.getFieldValue("filtername"), "log_feeder_config");
   }
@@ -107,18 +138,27 @@ public class UserConfigSolrDaoTest {
     header.add("QTime", 1);
     response.add("responseHeader", header);
     updateResponse.setResponse(response);
+
+    EasyMock.expect(configMock.getSolrUrl()).andReturn(null);
+    EasyMock.expect(configMock.getZkConnectString()).andReturn("dummyHost1:2181,dummyHost2:2181");
+    EasyMock.expect(configMock.getConfigName()).andReturn("test_history_logs_config_name");
+    EasyMock.expect(configMock.getCollection()).andReturn("test_history_logs_collection");
+    EasyMock.expect(configMock.getSplitInterval()).andReturn("none");
+    EasyMock.expect(configMock.getNumberOfShards()).andReturn(123);
+    EasyMock.expect(configMock.getReplicationFactor()).andReturn(234);
+    EasyMock.expect(kerbConfigMock.isEnabled()).andReturn(false);
+    EasyMock.expect(kerbConfigMock.getJaasFile()).andReturn("jaas_file");
     
     EasyMock.expect(mockSolrClient.deleteByQuery("id:test_id")).andReturn(updateResponse);
     EasyMock.expect(mockSolrClient.commit()).andReturn(updateResponse);
-    EasyMock.replay(mockSolrClient);
-    
-    UserConfigSolrDao dao = new UserConfigSolrDao();
+    EasyMock.replay(mockSolrClient, configMock, kerbConfigMock);
+
     dao.postConstructor();
     dao.solrClient = mockSolrClient;
     dao.isZkConnectString = true;
     
     dao.deleteUserConfig("test_id");
     
-    EasyMock.verify(mockSolrClient);
+    EasyMock.verify(mockSolrClient, configMock, kerbConfigMock);
   }
 }


[14/58] [abbrv] ambari git commit: AMBARI-18310. Refactor logsearch portal side code (oleewere)

Posted by ol...@apache.org.
AMBARI-18310. Refactor logsearch portal side code (oleewere)


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

Branch: refs/heads/branch-2.5
Commit: 77f9e8ffcf8c8162ccbeadd5069f32390a342cad
Parents: 0998e2b
Author: oleewere <ol...@gmail.com>
Authored: Mon Sep 5 18:27:20 2016 +0200
Committer: oleewere <ol...@gmail.com>
Committed: Sat Nov 5 14:46:43 2016 +0100

----------------------------------------------------------------------
 .../ambari-logsearch-portal/pom.xml             |     2 +-
 .../ambari-logsearch-portal/production/build.js |    28 -
 .../ambari-logsearch-portal/production/r.js     | 32140 -----------------
 .../configsets/audit_logs/conf/managed-schema   |     1 -
 .../configsets/hadoop_logs/conf/managed-schema  |    24 -
 .../src/main/dev/solrcloud/README.md            |    35 -
 .../src/main/dev/solrcloud/reset_collections.sh |    28 -
 .../src/main/dev/solrcloud/restart_solr.sh      |    37 -
 .../src/main/dev/solrcloud/update_config.sh     |    49 -
 .../org/apache/ambari/logsearch/LogSearch.java  |     1 -
 .../ambari/logsearch/common/ConfigHelper.java   |    34 +-
 .../logsearch/common/ExternalServerClient.java  |    17 +-
 .../logsearch/common/LogSearchConstants.java    |    58 +-
 .../apache/ambari/logsearch/common/Marker.java  |    29 +
 .../ambari/logsearch/common/PropertyMapper.java |    59 +
 .../ambari/logsearch/common/SearchCriteria.java |   304 -
 .../ambari/logsearch/conf/ApiDocConfig.java     |    59 +
 .../logsearch/conf/ApplicationConfig.java       |    84 +
 .../ambari/logsearch/conf/AuthConfig.java       |    87 +
 .../logsearch/conf/SolrAuditLogConfig.java      |   181 +
 .../ambari/logsearch/conf/SolrColumnConfig.java |    36 +
 .../ambari/logsearch/conf/SolrConfig.java       |    50 +
 .../logsearch/conf/SolrConnectionConfig.java    |    49 +
 .../logsearch/conf/SolrKerberosConfig.java      |    48 +
 .../logsearch/conf/SolrServiceLogConfig.java    |   144 +
 .../ambari/logsearch/conf/SolrUserConfig.java   |   104 +
 .../ambari/logsearch/dao/AuditSolrDao.java      |    29 +-
 .../logsearch/dao/ServiceLogsSolrDao.java       |    21 +-
 .../ambari/logsearch/dao/SolrDaoBase.java       |    19 +-
 .../ambari/logsearch/dao/UserConfigSolrDao.java |    32 +-
 .../apache/ambari/logsearch/dao/UserDao.java    |    10 +-
 .../ambari/logsearch/doc/DocConstants.java      |    26 +-
 .../logsearch/graph/GraphDataGenerator.java     |    81 +-
 .../logsearch/graph/GraphDataGeneratorBase.java |    34 +-
 .../logsearch/manager/AuditLogsManager.java     |   597 +
 .../ambari/logsearch/manager/AuditMgr.java      |   630 -
 .../logsearch/manager/JsonManagerBase.java      |    69 +
 .../logsearch/manager/LogFileManager.java       |   155 +
 .../ambari/logsearch/manager/LogFileMgr.java    |   145 -
 .../ambari/logsearch/manager/LogsMgr.java       |  1896 -
 .../ambari/logsearch/manager/ManagerBase.java   |   221 +
 .../ambari/logsearch/manager/MgrBase.java       |   256 -
 .../ambari/logsearch/manager/PublicManager.java |    48 +
 .../ambari/logsearch/manager/PublicMgr.java     |    46 -
 .../logsearch/manager/ServiceLogsManager.java   |  1917 +
 .../logsearch/manager/SessionManager.java       |    76 +
 .../ambari/logsearch/manager/SessionMgr.java    |    76 -
 .../logsearch/manager/UserConfigManager.java    |   276 +
 .../ambari/logsearch/manager/UserConfigMgr.java |   276 -
 .../model/request/AnyGraphParamDefinition.java  |    44 +
 .../model/request/BundleIdParamDefinition.java  |    32 +
 .../request/CommonSearchParamDefinition.java    |    69 +
 .../model/request/DateRangeParamDefinition.java |    38 +
 .../model/request/FieldParamDefinition.java     |    32 +
 .../model/request/FormatParamDefinition.java    |    32 +
 .../model/request/LastPageParamDefinition.java  |    31 +
 .../model/request/LogFileParamDefinition.java   |    45 +
 .../request/LogFileTailParamDefinition.java     |    32 +
 .../model/request/LogParamDefinition.java       |    68 +
 .../request/LogTruncatedParamDefinition.java    |    44 +
 .../model/request/QueryParamDefinition.java     |    32 +
 .../logsearch/model/request/SearchRequest.java  |    25 +
 .../request/ServiceLogFileParamDefinition.java  |    38 +
 .../request/ServiceLogParamDefinition.java      |    80 +
 .../ServiceLogSearchParamDefinition.java        |    50 +
 .../model/request/UnitParamDefinition.java      |    33 +
 .../request/UserConfigParamDefinition.java      |    44 +
 .../model/request/UtcOffsetParamDefinition.java |    32 +
 .../model/request/impl/AnyGraphRequest.java     |   109 +
 .../request/impl/AuditBarGraphRequest.java      |    40 +
 .../model/request/impl/AuditLogRequest.java     |    40 +
 .../model/request/impl/BaseAuditLogRequest.java |    53 +
 .../model/request/impl/BaseLogRequest.java      |   118 +
 .../request/impl/BaseServiceLogRequest.java     |   186 +
 .../model/request/impl/CommonSearchRequest.java |   119 +
 .../request/impl/FieldAuditBarGraphRequest.java |    40 +
 .../request/impl/FieldAuditLogRequest.java      |    41 +
 .../model/request/impl/LogFileRequest.java      |    67 +
 .../model/request/impl/LogFileTailRequest.java  |    40 +
 .../model/request/impl/QueryRequest.java        |    40 +
 .../request/impl/ServiceAnyGraphRequest.java    |   109 +
 .../impl/ServiceExtremeDatesRequest.java        |    41 +
 .../model/request/impl/ServiceGraphRequest.java |    40 +
 .../request/impl/ServiceLogExportRequest.java   |    54 +
 .../request/impl/ServiceLogFileRequest.java     |    54 +
 .../model/request/impl/ServiceLogRequest.java   |    93 +
 .../impl/ServiceLogTruncatedRequest.java        |    66 +
 .../model/request/impl/SimpleQueryRequest.java  |    42 +
 .../model/request/impl/UserConfigRequest.java   |    66 +
 .../model/request/impl/UserExportRequest.java   |    40 +
 .../logsearch/model/response/AuditLogData.java  |   149 +
 .../model/response/AuditLogResponse.java        |    48 +
 .../logsearch/model/response/BarGraphData.java  |    53 +
 .../response/BarGraphDataListResponse.java      |    42 +
 .../logsearch/model/response/CommonLogData.java |   113 +
 .../model/response/ComponentTypeLogData.java    |    32 +
 .../logsearch/model/response/CountData.java     |    50 +
 .../model/response/CountDataListResponse.java   |    48 +
 .../logsearch/model/response/GraphData.java     |    64 +
 .../model/response/GraphDataListResponse.java   |    39 +
 .../model/response/GroupListResponse.java       |    48 +
 .../logsearch/model/response/HostLogData.java   |    30 +
 .../logsearch/model/response/LogData.java       |    25 +
 .../logsearch/model/response/LogFileData.java   |    48 +
 .../model/response/LogFileDataListResponse.java |    48 +
 .../model/response/LogListResponse.java         |    27 +
 .../model/response/LogSearchResponse.java       |    22 +
 .../logsearch/model/response/NameValueData.java |    62 +
 .../response/NameValueDataListResponse.java     |    49 +
 .../logsearch/model/response/NodeData.java      |   111 +
 .../model/response/NodeListResponse.java        |    50 +
 .../model/response/SearchResponse.java          |   110 +
 .../model/response/ServiceLogData.java          |    63 +
 .../model/response/ServiceLogResponse.java      |    48 +
 .../ambari/logsearch/query/QueryGeneration.java |    18 +-
 .../logsearch/query/QueryGenerationBase.java    |    12 +-
 .../AbstractCommonAuditLogRequestConverter.java |    48 +
 .../AbstractCommonSearchRequestConverter.java   |    53 +
 ...bstractCommonServiceLogRequestConverter.java |    56 +
 .../converter/AnyGraphRequestConverter.java     |    39 +
 .../AuditBarGraphRequestConverter.java          |    34 +
 .../converter/AuditLogRequestConverter.java     |    34 +
 .../converter/BaseAuditLogRequestConverter.java |    33 +
 .../BaseServiceLogRequestConverter.java         |    32 +
 .../FieldAuditLogRequestConverter.java          |    34 +
 .../FieldBarGraphRequestConverter.java          |    35 +
 .../converter/LogFileRequestConverter.java      |    37 +
 .../converter/LogFileTailRequestConverter.java  |    38 +
 .../ServiceAnyGraphRequestConverter.java        |    39 +
 .../ServiceExtremeDatesRequestConverter.java    |    35 +
 .../converter/ServiceGraphRequestConverter.java |    36 +
 .../ServiceLogExportRequestConverter.java       |    38 +
 .../ServiceLogFileRequestConverter.java         |    36 +
 .../converter/ServiceLogRequestConverter.java   |    41 +
 .../ServiceLogTruncatedRequestConverter.java    |    38 +
 .../converter/SimpleQueryRequestConverter.java  |    34 +
 .../converter/UserConfigRequestConverter.java   |    38 +
 .../converter/UserExportRequestConverter.java   |    35 +
 .../query/model/AnyGraphSearchCriteria.java     |    25 +
 .../model/AuditBarGraphSearchCriteria.java      |    25 +
 .../query/model/AuditLogSearchCriteria.java     |    25 +
 .../query/model/CommonSearchCriteria.java       |   100 +
 .../model/FieldAuditBarGraphSearchCriteria.java |    25 +
 .../model/FieldAuditLogSearchCriteria.java      |    25 +
 .../query/model/LogFileSearchCriteria.java      |    25 +
 .../query/model/LogFileTailSearchCriteria.java  |    25 +
 .../logsearch/query/model/SearchCriteria.java   |   136 +
 .../model/ServiceAnyGraphSearchCriteria.java    |    25 +
 .../model/ServiceExtremeDatesCriteria.java      |    25 +
 .../query/model/ServiceGraphSearchCriteria.java |    25 +
 .../model/ServiceLogExportSearchCriteria.java   |    25 +
 .../model/ServiceLogFileSearchCriteria.java     |    25 +
 .../query/model/ServiceLogSearchCriteria.java   |    25 +
 .../ServiceLogTruncatedSearchCriteria.java      |    25 +
 .../query/model/UserConfigSearchCriteria.java   |    25 +
 .../query/model/UserExportSearchCriteria.java   |    25 +
 .../ambari/logsearch/rest/AuditLogsREST.java    |   283 -
 .../logsearch/rest/AuditLogsResource.java       |   157 +
 .../ambari/logsearch/rest/LogFileREST.java      |    84 -
 .../ambari/logsearch/rest/LogFileResource.java  |    69 +
 .../ambari/logsearch/rest/PublicREST.java       |    48 -
 .../ambari/logsearch/rest/PublicResource.java   |    48 +
 .../ambari/logsearch/rest/ServiceLogsREST.java  |   574 -
 .../logsearch/rest/ServiceLogsResource.java     |   238 +
 .../ambari/logsearch/rest/UserConfigREST.java   |   128 -
 .../logsearch/rest/UserConfigResource.java      |   116 +
 .../ambari/logsearch/service/UserService.java   |     5 +-
 .../logsearch/solr/model/SolrAuditLogData.java  |   339 +
 .../logsearch/solr/model/SolrCommonLogData.java |   248 +
 .../solr/model/SolrComponentTypeLogData.java    |    38 +
 .../logsearch/solr/model/SolrHostLogData.java   |    38 +
 .../solr/model/SolrServiceLogData.java          |   118 +
 .../apache/ambari/logsearch/util/BizUtil.java   |    40 +-
 .../ambari/logsearch/view/VBarDataList.java     |    46 -
 .../ambari/logsearch/view/VBarGraphData.java    |    50 -
 .../apache/ambari/logsearch/view/VCount.java    |    62 -
 .../ambari/logsearch/view/VCountList.java       |    68 -
 .../ambari/logsearch/view/VGraphData.java       |    79 -
 .../ambari/logsearch/view/VGraphInfo.java       |    62 -
 .../ambari/logsearch/view/VGroupList.java       |    66 -
 .../apache/ambari/logsearch/view/VLogFile.java  |    56 -
 .../ambari/logsearch/view/VLogFileList.java     |    70 -
 .../ambari/logsearch/view/VNameValue.java       |   123 -
 .../ambari/logsearch/view/VNameValueList.java   |    78 -
 .../org/apache/ambari/logsearch/view/VNode.java |   122 -
 .../apache/ambari/logsearch/view/VNodeList.java |    55 -
 .../ambari/logsearch/view/VSolrLogList.java     |    67 -
 .../apache/ambari/logsearch/view/VString.java   |    52 -
 .../ambari/logsearch/view/VSummaryCount.java    |    66 -
 .../logsearch/view/VSummaryCountList.java       |    37 -
 ...LogsearchSecurityContextFormationFilter.java |    10 +-
 .../LogsearchAuthenticationProvider.java        |    15 +-
 ...rchExternalServerAuthenticationProvider.java |    18 +-
 .../LogsearchFileAuthenticationProvider.java    |     5 +-
 .../src/main/scripts/add_config_set.sh          |    43 -
 .../src/main/scripts/create_collections.sh      |    37 -
 .../main/webapp/META-INF/applicationContext.xml |    69 -
 .../META-INF/security-applicationContext.xml    |     1 +
 .../src/main/webapp/WEB-INF/web.xml             |    27 +-
 .../scripts/model_bases/VUserFilterBase.js      |     2 +-
 .../views/dashboard/ComponentListView.js        |     2 +-
 .../scripts/views/graphs/GraphLayoutView.js     |     2 +-
 .../src/main/webapp/templates/graphs/backup.js  |     2 +-
 .../ambari/logsearch/dao/AuditSolrDaoTest.java  |    37 +-
 .../logsearch/dao/ServiceLogsSolrDaoTest.java   |    37 +-
 .../ambari/logsearch/dao/SolrDaoBaseTest.java   |    73 +-
 .../logsearch/dao/UserConfigSolrDaoTest.java    |    56 +-
 .../ambari/logsearch/dao/UserDaoTest.java       |    58 -
 .../src/test/resources/applicationContext.xml   |    53 -
 209 files changed, 11313 insertions(+), 38775 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/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 2c7ac87..7b3b174 100755
--- a/ambari-logsearch/ambari-logsearch-portal/pom.xml
+++ b/ambari-logsearch/ambari-logsearch-portal/pom.xml
@@ -548,7 +548,7 @@
     </dependency>
     <dependency>
       <groupId>org.glassfish.jersey.media</groupId>
-      <artifactId>jersey-media-moxy</artifactId>
+      <artifactId>jersey-media-json-jackson</artifactId>
       <version>${jersey.version}</version>
     </dependency>
     <dependency>

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/production/build.js
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/production/build.js b/ambari-logsearch/ambari-logsearch-portal/production/build.js
deleted file mode 100644
index afeea67..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/production/build.js
+++ /dev/null
@@ -1,28 +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.
-*/
-
-{
-    appDir: "../src/main/webapp",
-    baseUrl: "scripts",
-    dir: "../target/webapp-build",
-    modules: [
-        {
-            name: "Init"
-        }
-    ]
-}


[09/58] [abbrv] ambari git commit: AMBARI-18310. Refactor logsearch portal side code (oleewere)

Posted by ol...@apache.org.
http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/manager/ManagerBase.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/manager/ManagerBase.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/manager/ManagerBase.java
new file mode 100644
index 0000000..13df470
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/manager/ManagerBase.java
@@ -0,0 +1,221 @@
+/*
+ * 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.manager;
+
+import java.io.File;
+import java.io.IOException;
+import java.text.ParseException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Date;
+import java.util.List;
+import java.util.Scanner;
+
+import org.apache.ambari.logsearch.common.LogSearchConstants;
+import org.apache.ambari.logsearch.common.MessageEnums;
+import org.apache.ambari.logsearch.model.response.LogData;
+import org.apache.ambari.logsearch.model.response.LogSearchResponse;
+import org.apache.ambari.logsearch.query.model.SearchCriteria;
+import org.apache.ambari.logsearch.dao.SolrDaoBase;
+import org.apache.ambari.logsearch.query.QueryGeneration;
+import org.apache.ambari.logsearch.util.DateUtil;
+import org.apache.ambari.logsearch.util.JSONUtil;
+import org.apache.ambari.logsearch.util.RESTErrorUtil;
+import org.apache.ambari.logsearch.util.SolrUtil;
+import org.apache.commons.lang.StringUtils;
+import org.apache.log4j.Logger;
+import org.apache.solr.client.solrj.SolrQuery;
+import org.apache.solr.client.solrj.SolrServerException;
+import org.apache.solr.client.solrj.response.QueryResponse;
+import org.apache.solr.common.SolrDocumentList;
+import org.apache.solr.common.SolrException;
+
+import javax.inject.Inject;
+
+public abstract class ManagerBase<LOG_DATA_TYPE extends LogData, SEARCH_RESPONSE extends LogSearchResponse> extends JsonManagerBase {
+  private static final Logger logger = Logger.getLogger(ManagerBase.class);
+
+  @Inject
+  protected QueryGeneration queryGenerator;
+
+  public enum LogType {
+    SERVICE("Service"),
+    AUDIT("Audit");
+    
+    private String label;
+    
+    private LogType(String label) {
+      this.label = label;
+    }
+    
+    public String getLabel() {
+      return label;
+    }
+  }
+
+  public ManagerBase() {
+    super();
+  }
+
+  public String getHadoopServiceConfigJSON() {
+    StringBuilder result = new StringBuilder("");
+
+    // Get file from resources folder
+    ClassLoader classLoader = getClass().getClassLoader();
+    File file = new File(classLoader.getResource("HadoopServiceConfig.json").getFile());
+
+    try (Scanner scanner = new Scanner(file)) {
+
+      while (scanner.hasNextLine()) {
+        String line = scanner.nextLine();
+        result.append(line).append("\n");
+      }
+
+      scanner.close();
+
+    } catch (IOException e) {
+      logger.error("Unable to read HadoopServiceConfig.json", e);
+      throw RESTErrorUtil.createRESTException(e.getMessage(), MessageEnums.ERROR_SYSTEM);
+    }
+
+    String hadoopServiceConfig = result.toString();
+    if (JSONUtil.isJSONValid(hadoopServiceConfig)) {
+      return hadoopServiceConfig;
+    }
+    throw RESTErrorUtil.createRESTException("Improper JSON", MessageEnums.ERROR_SYSTEM);
+
+  }
+  
+  protected SEARCH_RESPONSE getLastPage(SearchCriteria searchCriteria, String logTimeField, SolrDaoBase solrDoaBase,
+                                    SolrQuery lastPageQuery) {
+    
+    Integer maxRows = searchCriteria.getMaxRows();
+    String givenSortType = searchCriteria.getSortType();
+    searchCriteria = new SearchCriteria();
+    searchCriteria.setSortBy(logTimeField);
+    if (givenSortType == null || givenSortType.equals(LogSearchConstants.DESCENDING_ORDER)) {
+      lastPageQuery.removeSort(LogSearchConstants.LOGTIME);
+      searchCriteria.setSortType(LogSearchConstants.ASCENDING_ORDER);
+    } else {
+      searchCriteria.setSortType(LogSearchConstants.DESCENDING_ORDER);
+    }
+    queryGenerator.setSingleSortOrder(lastPageQuery, searchCriteria);
+
+
+    Long totalLogs = 0l;
+    int startIndex = 0;
+    int numberOfLogsOnLastPage = 0;
+    SEARCH_RESPONSE logResponse = null;
+    try {
+      SolrUtil.setStart(lastPageQuery, 0);
+      SolrUtil.setRowCount(lastPageQuery, maxRows);
+      logResponse = getLogAsPaginationProvided(lastPageQuery, solrDoaBase);
+      totalLogs = countQuery(lastPageQuery,solrDoaBase);
+      startIndex = Integer.parseInt("" + ((totalLogs / maxRows) * maxRows));
+      numberOfLogsOnLastPage = Integer.parseInt("" + (totalLogs - startIndex));
+      logResponse.setStartIndex(startIndex);
+      logResponse.setTotalCount(totalLogs);
+      logResponse.setPageSize(maxRows);
+      List<LOG_DATA_TYPE> docList = logResponse.getLogList();
+      List<LOG_DATA_TYPE> lastPageDocList = new ArrayList<>();
+      logResponse.setLogList(lastPageDocList);
+      int cnt = 0;
+      for(LOG_DATA_TYPE doc:docList){
+        if(cnt<numberOfLogsOnLastPage){
+          lastPageDocList.add(doc);
+        }
+        cnt++;
+      }
+      Collections.reverse(lastPageDocList);
+
+    } catch (SolrException | SolrServerException | IOException | NumberFormatException e) {
+      logger.error("Count Query was not executed successfully",e);
+      throw RESTErrorUtil.createRESTException(MessageEnums.SOLR_ERROR.getMessage().getMessage(), MessageEnums.ERROR_SYSTEM);
+    }
+    return logResponse;
+  }
+
+  protected SEARCH_RESPONSE getLogAsPaginationProvided(SolrQuery solrQuery, SolrDaoBase solrDaoBase) {
+    try {
+      QueryResponse response = solrDaoBase.process(solrQuery);
+      SEARCH_RESPONSE logResponse = createLogSearchResponse();
+      SolrDocumentList docList = response.getResults();
+      List<LOG_DATA_TYPE> serviceLogDataList = convertToSolrBeans(response);
+      if (docList != null && !docList.isEmpty()) {
+        logResponse.setLogList(serviceLogDataList);
+        logResponse.setStartIndex((int) docList.getStart());
+        logResponse.setTotalCount(docList.getNumFound());
+        Integer rowNumber = solrQuery.getRows();
+        if (rowNumber == null) {
+          logger.error("No RowNumber was set in solrQuery");
+          return createLogSearchResponse();
+        }
+        logResponse.setPageSize(rowNumber);
+      }
+      return logResponse;
+    } catch (SolrException | SolrServerException | IOException e) {
+      logger.error("Error during solrQuery=" + solrQuery, e);
+      throw RESTErrorUtil.createRESTException(MessageEnums.SOLR_ERROR.getMessage().getMessage(), MessageEnums.ERROR_SYSTEM);
+    }
+  }
+  
+  protected Long countQuery(SolrQuery query,SolrDaoBase solrDaoBase) throws SolrException, SolrServerException, IOException {
+    query.setRows(0);
+    QueryResponse response = solrDaoBase.process(query);
+    if (response == null) {
+      return 0l;
+    }
+    SolrDocumentList docList = response.getResults();
+    if (docList == null) {
+      return 0l;
+    }
+    return docList.getNumFound();
+  }
+
+  protected String getUnit(String unit) {
+    if (StringUtils.isBlank(unit)) {
+      unit = "+1HOUR";
+    }
+    return unit;
+  }
+
+  protected String getFrom(String from) {
+    if (StringUtils.isBlank(from)) {
+      Date date = DateUtil.getTodayFromDate();
+      try {
+        from = DateUtil.convertGivenDateFormatToSolrDateFormat(date);
+      } catch (ParseException e) {
+        from = "NOW";
+      }
+    }
+    return from;
+  }
+
+  protected String getTo(String to) {
+    if (StringUtils.isBlank(to)) {
+      to = "NOW";
+    }
+    return to;
+  }
+
+  protected abstract List<LOG_DATA_TYPE> convertToSolrBeans(QueryResponse response);
+
+  protected abstract SEARCH_RESPONSE createLogSearchResponse();
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/manager/MgrBase.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/manager/MgrBase.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/manager/MgrBase.java
deleted file mode 100644
index c0be79d..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/manager/MgrBase.java
+++ /dev/null
@@ -1,256 +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.manager;
-
-import java.io.File;
-import java.io.IOException;
-import java.text.ParseException;
-import java.util.Collections;
-import java.util.Date;
-import java.util.Scanner;
-
-import org.apache.ambari.logsearch.common.LogSearchConstants;
-import org.apache.ambari.logsearch.common.MessageEnums;
-import org.apache.ambari.logsearch.common.SearchCriteria;
-import org.apache.ambari.logsearch.dao.SolrDaoBase;
-import org.apache.ambari.logsearch.query.QueryGeneration;
-import org.apache.ambari.logsearch.util.DateUtil;
-import org.apache.ambari.logsearch.util.JSONUtil;
-import org.apache.ambari.logsearch.util.RESTErrorUtil;
-import org.apache.ambari.logsearch.util.SolrUtil;
-import org.apache.ambari.logsearch.view.VSolrLogList;
-import org.apache.commons.lang.StringUtils;
-import org.apache.log4j.Logger;
-import org.apache.solr.client.solrj.SolrQuery;
-import org.apache.solr.client.solrj.SolrServerException;
-import org.apache.solr.client.solrj.response.QueryResponse;
-import org.apache.solr.common.SolrDocument;
-import org.apache.solr.common.SolrDocumentList;
-import org.apache.solr.common.SolrException;
-import org.springframework.beans.factory.annotation.Autowired;
-
-import com.google.gson.Gson;
-import com.google.gson.GsonBuilder;
-import com.google.gson.JsonDeserializationContext;
-import com.google.gson.JsonDeserializer;
-import com.google.gson.JsonElement;
-import com.google.gson.JsonParseException;
-import com.google.gson.JsonPrimitive;
-import com.google.gson.JsonSerializationContext;
-import com.google.gson.JsonSerializer;
-
-public class MgrBase {
-  private static final Logger logger = Logger.getLogger(MgrBase.class);
-
-  @Autowired
-  protected QueryGeneration queryGenerator;
-
-  private JsonSerializer<Date> jsonDateSerialiazer = null;
-  private JsonDeserializer<Date> jsonDateDeserialiazer = null;
-
-  public enum LogType {
-    SERVICE("Service"),
-    AUDIT("Audit");
-    
-    private String label;
-    
-    private LogType(String label) {
-      this.label = label;
-    }
-    
-    public String getLabel() {
-      return label;
-    }
-  }
-
-  public MgrBase() {
-    jsonDateSerialiazer = new JsonSerializer<Date>() {
-
-      @Override
-      public JsonElement serialize(Date paramT, java.lang.reflect.Type paramType, JsonSerializationContext paramJsonSerializationContext) {
-        return paramT == null ? null : new JsonPrimitive(paramT.getTime());
-      }
-    };
-
-    jsonDateDeserialiazer = new JsonDeserializer<Date>() {
-
-      @Override
-      public Date deserialize(JsonElement json, java.lang.reflect.Type typeOfT, JsonDeserializationContext context)
-          throws JsonParseException {
-        return json == null ? null : new Date(json.getAsLong());
-      }
-
-    };
-  }
-
-  protected String convertObjToString(Object obj) {
-    if (obj == null) {
-      return "";
-    }
-
-    Gson gson = new GsonBuilder()
-        .registerTypeAdapter(Date.class, jsonDateSerialiazer)
-        .registerTypeAdapter(Date.class, jsonDateDeserialiazer).create();
-
-    return gson.toJson(obj);
-  }
-
-  public String getHadoopServiceConfigJSON() {
-    StringBuilder result = new StringBuilder("");
-
-    // Get file from resources folder
-    ClassLoader classLoader = getClass().getClassLoader();
-    File file = new File(classLoader.getResource("HadoopServiceConfig.json").getFile());
-
-    try (Scanner scanner = new Scanner(file)) {
-
-      while (scanner.hasNextLine()) {
-        String line = scanner.nextLine();
-        result.append(line).append("\n");
-      }
-
-      scanner.close();
-
-    } catch (IOException e) {
-      logger.error("Unable to read HadoopServiceConfig.json", e);
-      throw RESTErrorUtil.createRESTException(e.getMessage(), MessageEnums.ERROR_SYSTEM);
-    }
-
-    String hadoopServiceConfig = result.toString();
-    if (JSONUtil.isJSONValid(hadoopServiceConfig)) {
-      return hadoopServiceConfig;
-    }
-    throw RESTErrorUtil.createRESTException("Improper JSON", MessageEnums.ERROR_SYSTEM);
-
-  }
-  
-  protected VSolrLogList getLastPage(SearchCriteria searchCriteria, String logTimeField, SolrDaoBase solrDoaBase,
-      SolrQuery lastPageQuery) {
-    
-    Integer maxRows = searchCriteria.getMaxRows();
-    String givenSortType = searchCriteria.getSortType();
-    searchCriteria = new SearchCriteria();
-    searchCriteria.setSortBy(logTimeField);
-    if (givenSortType == null || givenSortType.equals(LogSearchConstants.DESCENDING_ORDER)) {
-      lastPageQuery.removeSort(LogSearchConstants.LOGTIME);
-      searchCriteria.setSortType(LogSearchConstants.ASCENDING_ORDER);
-    } else {
-      searchCriteria.setSortType(LogSearchConstants.DESCENDING_ORDER);
-    }
-    queryGenerator.setSingleSortOrder(lastPageQuery, searchCriteria);
-
-
-    Long totalLogs = 0l;
-    int startIndex = 0;
-    int numberOfLogsOnLastPage = 0;
-    VSolrLogList collection = null;
-    try {
-      SolrUtil.setStart(lastPageQuery, 0);
-      SolrUtil.setRowCount(lastPageQuery, maxRows);
-      collection = getLogAsPaginationProvided(lastPageQuery, solrDoaBase);
-      totalLogs = countQuery(lastPageQuery,solrDoaBase);
-      if(maxRows != null){
-        startIndex = Integer.parseInt("" + ((totalLogs/maxRows) * maxRows));
-        numberOfLogsOnLastPage = Integer.parseInt("" + (totalLogs-startIndex));
-      }
-      collection.setStartIndex(startIndex);
-      collection.setTotalCount(totalLogs);
-      collection.setPageSize(maxRows);
-      SolrDocumentList docList = collection.getList();
-      SolrDocumentList lastPageDocList = new SolrDocumentList();
-      collection.setSolrDocuments(lastPageDocList);
-      int cnt = 0;
-      for(SolrDocument doc:docList){
-        if(cnt<numberOfLogsOnLastPage){
-          lastPageDocList.add(doc);
-        }
-        cnt++;
-      }
-      Collections.reverse(lastPageDocList);
-
-    } catch (SolrException | SolrServerException | IOException | NumberFormatException e) {
-      logger.error("Count Query was not executed successfully",e);
-      throw RESTErrorUtil.createRESTException(MessageEnums.SOLR_ERROR.getMessage().getMessage(), MessageEnums.ERROR_SYSTEM);
-    }
-    return collection;
-  }
-
-  protected VSolrLogList getLogAsPaginationProvided(SolrQuery solrQuery, SolrDaoBase solrDaoBase) {
-    try {
-      QueryResponse response = solrDaoBase.process(solrQuery);
-      VSolrLogList collection = new VSolrLogList();
-      SolrDocumentList docList = response.getResults();
-      if (docList != null && !docList.isEmpty()) {
-        collection.setSolrDocuments(docList);
-        collection.setStartIndex((int) docList.getStart());
-        collection.setTotalCount(docList.getNumFound());
-        Integer rowNumber = solrQuery.getRows();
-        if (rowNumber == null) {
-          logger.error("No RowNumber was set in solrQuery");
-          return new VSolrLogList();
-        }
-        collection.setPageSize(rowNumber);
-      }
-      return collection;
-    } catch (SolrException | SolrServerException | IOException e) {
-      logger.error("Error during solrQuery=" + solrQuery, e);
-      throw RESTErrorUtil.createRESTException(MessageEnums.SOLR_ERROR.getMessage().getMessage(), MessageEnums.ERROR_SYSTEM);
-    }
-  }
-  
-  protected Long countQuery(SolrQuery query,SolrDaoBase solrDaoBase) throws SolrException, SolrServerException, IOException {
-    query.setRows(0);
-    QueryResponse response = solrDaoBase.process(query);
-    if (response == null) {
-      return 0l;
-    }
-    SolrDocumentList docList = response.getResults();
-    if (docList == null) {
-      return 0l;
-    }
-    return docList.getNumFound();
-  }
-
-  protected String getUnit(String unit) {
-    if (StringUtils.isBlank(unit)) {
-      unit = "+1HOUR";
-    }
-    return unit;
-  }
-
-  protected String getFrom(String from) {
-    if (StringUtils.isBlank(from)) {
-      Date date = DateUtil.getTodayFromDate();
-      try {
-        from = DateUtil.convertGivenDateFormatToSolrDateFormat(date);
-      } catch (ParseException e) {
-        from = "NOW";
-      }
-    }
-    return from;
-  }
-
-  protected String getTo(String to) {
-    if (StringUtils.isBlank(to)) {
-      to = "NOW";
-    }
-    return to;
-  }
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/manager/PublicManager.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/manager/PublicManager.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/manager/PublicManager.java
new file mode 100644
index 0000000..23f62aa
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/manager/PublicManager.java
@@ -0,0 +1,48 @@
+/*
+ * 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.manager;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.ambari.logsearch.model.response.NameValueData;
+import org.apache.ambari.logsearch.model.response.NameValueDataListResponse;
+import org.apache.ambari.logsearch.web.security.LogsearchSimpleAuthenticationProvider;
+import org.springframework.stereotype.Component;
+
+import javax.inject.Inject;
+
+@Component
+public class PublicManager extends JsonManagerBase {
+
+  @Inject
+  private LogsearchSimpleAuthenticationProvider simpleAuthenticationProvider;
+
+  public String getGeneralConfig() {
+    NameValueDataListResponse nameValueList = new NameValueDataListResponse();
+    List<NameValueData> nameValues = new ArrayList<>();
+    NameValueData nameValue = new NameValueData();
+    nameValue.setName("simpleAuth");
+    nameValue.setValue("" + simpleAuthenticationProvider.isEnable());
+    nameValues.add(nameValue);
+    nameValueList.setvNameValues(nameValues);
+    return convertObjToString(nameValueList);
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/manager/PublicMgr.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/manager/PublicMgr.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/manager/PublicMgr.java
deleted file mode 100644
index 398d270..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/manager/PublicMgr.java
+++ /dev/null
@@ -1,46 +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.manager;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.ambari.logsearch.view.VNameValue;
-import org.apache.ambari.logsearch.view.VNameValueList;
-import org.apache.ambari.logsearch.web.security.LogsearchSimpleAuthenticationProvider;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-
-@Component
-public class PublicMgr extends MgrBase {
-  @Autowired
-  private LogsearchSimpleAuthenticationProvider simpleAuthenticationProvider;
-
-  public String getGeneralConfig() {
-    VNameValueList nameValueList = new VNameValueList();
-    List<VNameValue> nameValues = new ArrayList<VNameValue>();
-    VNameValue nameValue = new VNameValue();
-    nameValue.setName("simpleAuth");
-    nameValue.setValue("" + simpleAuthenticationProvider.isEnable());
-    nameValues.add(nameValue);
-    nameValueList.setVNameValues(nameValues);
-    return convertObjToString(nameValueList);
-  }
-}


[30/58] [abbrv] ambari git commit: AMBARI-18310. Refactor logsearch portal side code - Part 2 (oleewere)

Posted by ol...@apache.org.
http://git-wip-us.apache.org/repos/asf/ambari/blob/3d62b004/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AbstractCommonServiceLogRequestConverter.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AbstractCommonServiceLogRequestConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AbstractCommonServiceLogRequestConverter.java
index a02d585..2282c11 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AbstractCommonServiceLogRequestConverter.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AbstractCommonServiceLogRequestConverter.java
@@ -18,37 +18,38 @@
  */
 package org.apache.ambari.logsearch.query.converter;
 
-import org.apache.ambari.logsearch.common.LogSearchConstants;
 import org.apache.ambari.logsearch.model.request.impl.BaseServiceLogRequest;
-import org.apache.ambari.logsearch.query.model.CommonSearchCriteria;
+import org.apache.ambari.logsearch.query.model.CommonServiceLogSearchCriteria;
 import org.apache.commons.lang.StringEscapeUtils;
 
-public abstract class AbstractCommonServiceLogRequestConverter<SOURCE extends BaseServiceLogRequest, RESULT extends CommonSearchCriteria>
+public abstract class AbstractCommonServiceLogRequestConverter<SOURCE extends BaseServiceLogRequest, RESULT extends CommonServiceLogSearchCriteria>
   extends AbstractCommonSearchRequestConverter<SOURCE, RESULT> {
 
   @Override
   public RESULT convertToSearchCriteria(SOURCE request) {
     RESULT criteria = createCriteria(request);
+    // TODO: check are these used from the UI or not?
     criteria.addParam("advanceSearch", StringEscapeUtils.unescapeXml(request.getAdvancedSearch()));
     criteria.addParam("q", request.getQuery());
-    criteria.addParam("treeParams", StringEscapeUtils.unescapeHtml(request.getTreeParams()));
-    criteria.addParam("level", request.getLevel());
     criteria.addParam("gMustNot", request.getgMustNot());
-    criteria.addParam("from", request.getFrom());
-    criteria.addParam("to", request.getTo());
-    criteria.addParam("selectComp", request.getMustBe());
-    criteria.addParam("unselectComp", request.getMustNot());
-    criteria.addParam("iMessage", StringEscapeUtils.unescapeXml(request.getiMessage()));
     criteria.addParam("gEMessage", StringEscapeUtils.unescapeXml(request.getgEMessage()));
-    criteria.addParam("eMessage", StringEscapeUtils.unescapeXml(request.getgEMessage()));
-    criteria.addParam(LogSearchConstants.BUNDLE_ID, request.getBundleId());
-    criteria.addParam("host_name", request.getHostName());
-    criteria.addParam("component_name", request.getComponentName());
-    criteria.addParam("file_name", request.getFileName());
-    criteria.addParam("startDate", request.getStartTime());
-    criteria.addParam("endDate", request.getEndTime());
-    criteria.addParam("excludeQuery", StringEscapeUtils.unescapeXml(request.getExcludeQuery()));
-    criteria.addParam("includeQuery", StringEscapeUtils.unescapeXml(request.getIncludeQuery()));
+    criteria.addParam("unselectComp", request.getMustNot());
+
+    criteria.setTreeParams(StringEscapeUtils.unescapeHtml(request.getTreeParams()));
+    criteria.setLevel(request.getLevel());
+    criteria.setFrom(request.getFrom());
+    criteria.setTo(request.getTo());
+    criteria.setSelectComp(request.getMustBe());
+    criteria.setBundleId(request.getBundleId());
+    criteria.setHostName(request.getHostName());
+    criteria.setComponentName(request.getComponentName());
+    criteria.setFileName(request.getFileName());
+    criteria.setIncludeMessage(StringEscapeUtils.unescapeXml(request.getiMessage()));
+    criteria.setExcludeMessage(StringEscapeUtils.unescapeXml(request.getgEMessage()));
+    criteria.setStartTime(request.getStartTime());
+    criteria.setEndTime(request.getEndTime());
+    criteria.setExcludeQuery(StringEscapeUtils.unescapeXml(request.getExcludeQuery()));
+    criteria.setIncludeQuery(StringEscapeUtils.unescapeXml(request.getIncludeQuery()));
     return criteria;
   }
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/3d62b004/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AbstractConverterAware.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AbstractConverterAware.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AbstractConverterAware.java
new file mode 100644
index 0000000..18a71c1
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AbstractConverterAware.java
@@ -0,0 +1,47 @@
+/*
+ * 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.query.converter;
+
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.core.convert.ConversionService;
+import org.springframework.core.convert.converter.Converter;
+import org.springframework.core.convert.converter.ConverterRegistry;
+
+import javax.annotation.PostConstruct;
+import javax.inject.Inject;
+
+public abstract class AbstractConverterAware<SOURCE, RESULT> implements Converter<SOURCE, RESULT> {
+
+  @Inject
+  @Qualifier("conversionService")
+  private ConversionService conversionService;
+
+  public ConversionService getConversionService() {
+    return conversionService;
+  }
+
+  @PostConstruct
+  private void register() {
+    if (conversionService instanceof ConverterRegistry) {
+      ((ConverterRegistry) conversionService).addConverter(this);
+    } else {
+      throw new IllegalStateException("Can't register Converter to ConverterRegistry");
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/3d62b004/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AnyGraphRequestConverter.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AnyGraphRequestConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AnyGraphRequestConverter.java
index 0372168..1639563 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AnyGraphRequestConverter.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AnyGraphRequestConverter.java
@@ -28,12 +28,12 @@ public class AnyGraphRequestConverter extends AbstractCommonSearchRequestConvert
   @Override
   public AnyGraphSearchCriteria convertToSearchCriteria(AnyGraphRequest anyGraphRequest) {
     AnyGraphSearchCriteria criteria = new AnyGraphSearchCriteria();
-    criteria.addParam("xAxis", anyGraphRequest.getxAxis());
-    criteria.addParam("yAxis", anyGraphRequest.getyAxis());
-    criteria.addParam("stackBy", anyGraphRequest.getStackBy());
-    criteria.addParam("unit", anyGraphRequest.getUnit());
-    criteria.addParam("from", anyGraphRequest.getFrom());
-    criteria.addParam("to", anyGraphRequest.getTo());
+    criteria.setxAxis(anyGraphRequest.getxAxis());
+    criteria.setyAxis(anyGraphRequest.getyAxis());
+    criteria.setStackBy(anyGraphRequest.getStackBy());
+    criteria.setUnit(anyGraphRequest.getUnit());
+    criteria.setFrom(anyGraphRequest.getFrom());
+    criteria.setTo(anyGraphRequest.getTo());
     return criteria;
   }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/3d62b004/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AuditBarGraphRequestConverter.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AuditBarGraphRequestConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AuditBarGraphRequestConverter.java
index f72a673..ac74287 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AuditBarGraphRequestConverter.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AuditBarGraphRequestConverter.java
@@ -28,7 +28,7 @@ public class AuditBarGraphRequestConverter extends AbstractCommonAuditLogRequest
   @Override
   public AuditBarGraphSearchCriteria createCriteria(AuditBarGraphRequest request) {
     AuditBarGraphSearchCriteria criteria = new AuditBarGraphSearchCriteria();
-    criteria.addParam("unit", request.getUnit());
+    criteria.setUnit(request.getUnit());
     return criteria;
   }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/3d62b004/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AuditLogRequestConverter.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AuditLogRequestConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AuditLogRequestConverter.java
index 27d314d..5ec7632 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AuditLogRequestConverter.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AuditLogRequestConverter.java
@@ -28,7 +28,7 @@ public class AuditLogRequestConverter extends AbstractCommonAuditLogRequestConve
   @Override
   public AuditLogSearchCriteria createCriteria(AuditLogRequest request) {
     AuditLogSearchCriteria criteria = new AuditLogSearchCriteria();
-    criteria.addParam("isLastPage", request.isLastPage());
+    criteria.setLastPage(request.isLastPage());
     return criteria;
   }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/3d62b004/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/BaseServiceLogRequestConverter.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/BaseServiceLogRequestConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/BaseServiceLogRequestConverter.java
index cfd544c..efc9bc9 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/BaseServiceLogRequestConverter.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/BaseServiceLogRequestConverter.java
@@ -20,13 +20,14 @@ package org.apache.ambari.logsearch.query.converter;
 
 import org.apache.ambari.logsearch.model.request.impl.BaseServiceLogRequest;
 import org.apache.ambari.logsearch.query.model.CommonSearchCriteria;
+import org.apache.ambari.logsearch.query.model.CommonServiceLogSearchCriteria;
 import org.springframework.stereotype.Component;
 
 @Component
-public class BaseServiceLogRequestConverter extends AbstractCommonServiceLogRequestConverter<BaseServiceLogRequest, CommonSearchCriteria> {
+public class BaseServiceLogRequestConverter extends AbstractCommonServiceLogRequestConverter<BaseServiceLogRequest, CommonServiceLogSearchCriteria> {
 
   @Override
-  public CommonSearchCriteria createCriteria(BaseServiceLogRequest request) {
-    return new CommonSearchCriteria();
+  public CommonServiceLogSearchCriteria createCriteria(BaseServiceLogRequest request) {
+    return new CommonServiceLogSearchCriteria();
   }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/3d62b004/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/FieldAuditLogRequestConverter.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/FieldAuditLogRequestConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/FieldAuditLogRequestConverter.java
index 089b593..6197d48 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/FieldAuditLogRequestConverter.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/FieldAuditLogRequestConverter.java
@@ -28,7 +28,7 @@ public class FieldAuditLogRequestConverter extends AbstractCommonAuditLogRequest
   @Override
   public FieldAuditLogSearchCriteria createCriteria(FieldAuditLogRequest request) {
     FieldAuditLogSearchCriteria criteria = new FieldAuditLogSearchCriteria();
-    criteria.addParam("field", request.getField());
+    criteria.setField(request.getField());
     return criteria;
   }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/3d62b004/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/FieldBarGraphRequestConverter.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/FieldBarGraphRequestConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/FieldBarGraphRequestConverter.java
index dd518f8..74b0dac 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/FieldBarGraphRequestConverter.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/FieldBarGraphRequestConverter.java
@@ -28,8 +28,8 @@ public class FieldBarGraphRequestConverter extends AbstractCommonAuditLogRequest
   @Override
   public FieldAuditBarGraphSearchCriteria createCriteria(FieldAuditBarGraphRequest request) {
     FieldAuditBarGraphSearchCriteria criteria = new FieldAuditBarGraphSearchCriteria();
-    criteria.addParam("unit", request.getUnit());
-    criteria.addParam("field", request.getField());
+    criteria.setUnit(request.getUnit());
+    criteria.setField(request.getField());
     return criteria;
   }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/3d62b004/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/LogFileRequestConverter.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/LogFileRequestConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/LogFileRequestConverter.java
index 7c3038e..62c2fbe 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/LogFileRequestConverter.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/LogFileRequestConverter.java
@@ -29,9 +29,9 @@ public class LogFileRequestConverter implements Converter<LogFileRequest, LogFil
   @Override
   public LogFileSearchCriteria convert(LogFileRequest request) {
     LogFileSearchCriteria criteria = new LogFileSearchCriteria();
-    criteria.addParam("component", request.getComponent());
-    criteria.addParam("host", request.getHost());
-    criteria.addParam("logType", request.getLogType());
+    criteria.setLogFileComponent(request.getComponent());
+    criteria.setLogFileHost(request.getHost());
+    criteria.setLogType(request.getLogType());
     return criteria;
   }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/3d62b004/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/LogFileTailRequestConverter.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/LogFileTailRequestConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/LogFileTailRequestConverter.java
index 88b1a34..08c6ecc 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/LogFileTailRequestConverter.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/LogFileTailRequestConverter.java
@@ -29,10 +29,10 @@ public class LogFileTailRequestConverter implements Converter<LogFileTailRequest
   @Override
   public LogFileTailSearchCriteria convert(LogFileTailRequest request) {
     LogFileTailSearchCriteria criteria = new LogFileTailSearchCriteria();
-    criteria.addParam("component", request.getComponent());
-    criteria.addParam("host", request.getHost());
-    criteria.addParam("logType", request.getLogType());
-    criteria.addParam("tailSize", request.getTailSize());
+    criteria.setLogFileComponent(request.getComponent());
+    criteria.setLogFileHost(request.getHost());
+    criteria.setLogType(request.getLogType());
+    criteria.setLogTailSize(request.getTailSize());
     return criteria;
   }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/3d62b004/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceAnyGraphRequestConverter.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceAnyGraphRequestConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceAnyGraphRequestConverter.java
index 7a559de..8f1aaf0 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceAnyGraphRequestConverter.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceAnyGraphRequestConverter.java
@@ -28,12 +28,12 @@ public class ServiceAnyGraphRequestConverter extends AbstractCommonServiceLogReq
   @Override
   public ServiceAnyGraphSearchCriteria createCriteria(ServiceAnyGraphRequest anyGraphRequest) {
     ServiceAnyGraphSearchCriteria criteria = new ServiceAnyGraphSearchCriteria();
-    criteria.addParam("xAxis", anyGraphRequest.getxAxis());
-    criteria.addParam("yAxis", anyGraphRequest.getyAxis());
-    criteria.addParam("stackBy", anyGraphRequest.getStackBy());
-    criteria.addParam("unit", anyGraphRequest.getUnit());
-    criteria.addParam("from", anyGraphRequest.getFrom());
-    criteria.addParam("to", anyGraphRequest.getTo());
+    criteria.setxAxis(anyGraphRequest.getxAxis());
+    criteria.setyAxis(anyGraphRequest.getyAxis());
+    criteria.setStackBy(anyGraphRequest.getStackBy());
+    criteria.setUnit(anyGraphRequest.getUnit());
+    criteria.setFrom(anyGraphRequest.getFrom());
+    criteria.setTo(anyGraphRequest.getTo());
     return criteria;
   }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/3d62b004/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceExtremeDatesRequestConverter.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceExtremeDatesRequestConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceExtremeDatesRequestConverter.java
index fe81468..489e879 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceExtremeDatesRequestConverter.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceExtremeDatesRequestConverter.java
@@ -18,7 +18,6 @@
  */
 package org.apache.ambari.logsearch.query.converter;
 
-import org.apache.ambari.logsearch.common.LogSearchConstants;
 import org.apache.ambari.logsearch.model.request.impl.ServiceExtremeDatesRequest;
 import org.apache.ambari.logsearch.query.model.ServiceExtremeDatesCriteria;
 import org.springframework.stereotype.Component;
@@ -29,7 +28,7 @@ public class ServiceExtremeDatesRequestConverter extends AbstractCommonSearchReq
   @Override
   public ServiceExtremeDatesCriteria convertToSearchCriteria(ServiceExtremeDatesRequest request) {
     ServiceExtremeDatesCriteria criteria = new ServiceExtremeDatesCriteria();
-    criteria.addParam(LogSearchConstants.BUNDLE_ID, request.getBundleId());
+    criteria.setBundleId(request.getBundleId());
     return criteria;
   }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/3d62b004/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceGraphRequestConverter.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceGraphRequestConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceGraphRequestConverter.java
index 19165c0..6c501ae 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceGraphRequestConverter.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceGraphRequestConverter.java
@@ -28,9 +28,9 @@ public class ServiceGraphRequestConverter extends AbstractCommonServiceLogReques
   @Override
   public ServiceGraphSearchCriteria createCriteria(ServiceGraphRequest request) {
     ServiceGraphSearchCriteria criteria = new ServiceGraphSearchCriteria();
-    criteria.addParam("hostLogFile", request.getHostLogFile());
-    criteria.addParam("compLogFile", request.getComponentLogFile());
-    criteria.addParam("unit", request.getUnit());
+    criteria.setLogFileHostName(request.getHostLogFile());
+    criteria.setLogFileComponentName(request.getComponentLogFile());
+    criteria.setUnit(request.getUnit());
     return criteria;
   }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/3d62b004/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceLogExportRequestConverter.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceLogExportRequestConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceLogExportRequestConverter.java
index 7d83e49..bd06546 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceLogExportRequestConverter.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceLogExportRequestConverter.java
@@ -28,11 +28,10 @@ public class ServiceLogExportRequestConverter extends AbstractCommonServiceLogRe
   @Override
   public ServiceLogExportSearchCriteria createCriteria(ServiceLogExportRequest request) {
     ServiceLogExportSearchCriteria criteria = new ServiceLogExportSearchCriteria();
-    criteria.addParam("hostLogFile", request.getHostLogFile());
-    criteria.addParam("compLogFile",
-      request.getComponentLogFile());
-    criteria.addParam("format", request.getFormat());
-    criteria.addParam("utcOffset", request.getUtcOffset());
+    criteria.setLogFileHostName(request.getHostLogFile());
+    criteria.setLogFileComponentName(request.getComponentLogFile());
+    criteria.setFormat(request.getFormat());
+    criteria.setUtcOffset(request.getUtcOffset());
     return criteria;
   }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/3d62b004/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceLogFileRequestConverter.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceLogFileRequestConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceLogFileRequestConverter.java
index f5148f3..392c9d3 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceLogFileRequestConverter.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceLogFileRequestConverter.java
@@ -29,8 +29,8 @@ public class ServiceLogFileRequestConverter
   @Override
   public ServiceLogFileSearchCriteria createCriteria(ServiceLogFileRequest request) {
     ServiceLogFileSearchCriteria criteria = new ServiceLogFileSearchCriteria();
-    criteria.addParam("hostLogFile", request.getHostLogFile());
-    criteria.addParam("compLogFile", request.getComponentLogFile());
+    criteria.setLogFileHostName(request.getHostLogFile());
+    criteria.setLogFileComponentName(request.getComponentLogFile());
     return criteria;
   }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/3d62b004/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceLogRequestConverter.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceLogRequestConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceLogRequestConverter.java
index 6a70d55..aa93c6a 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceLogRequestConverter.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceLogRequestConverter.java
@@ -29,13 +29,13 @@ public class ServiceLogRequestConverter extends AbstractCommonServiceLogRequestC
   @Override
   public ServiceLogSearchCriteria createCriteria(ServiceLogRequest request) {
     ServiceLogSearchCriteria criteria = new ServiceLogSearchCriteria();
-    criteria.addParam("hostLogFile", request.getHostLogFile());
-    criteria.addParam("compLogFile", request.getComponentLogFile());
-    criteria.addParam("keyword", StringEscapeUtils.unescapeXml(request.getKeyWord()));
-    criteria.addParam("sourceLogId", request.getSourceLogId());
-    criteria.addParam("keywordType", request.getKeywordType());
-    criteria.addParam("token", request.getToken());
-    criteria.addParam("isLastPage", request.isLastPage());
+    criteria.setLogFileComponentName(request.getHostLogFile());
+    criteria.setLogFileComponentName(request.getComponentLogFile());
+    criteria.setKeyword(StringEscapeUtils.unescapeXml(request.getKeyWord()));
+    criteria.setKeywordType(request.getKeywordType());
+    criteria.setSourceLogId(request.getSourceLogId());
+    criteria.setToken(request.getToken());
+    criteria.setLastPage(request.isLastPage());
     return criteria;
   }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/3d62b004/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceLogTruncatedRequestConverter.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceLogTruncatedRequestConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceLogTruncatedRequestConverter.java
index 676f049..1e58b79 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceLogTruncatedRequestConverter.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/ServiceLogTruncatedRequestConverter.java
@@ -28,11 +28,11 @@ public class ServiceLogTruncatedRequestConverter extends AbstractCommonServiceLo
   @Override
   public ServiceLogTruncatedSearchCriteria createCriteria(ServiceLogTruncatedRequest request) {
     ServiceLogTruncatedSearchCriteria criteria = new ServiceLogTruncatedSearchCriteria();
-    criteria.addParam("hostLogFile", request.getHostLogFile());
-    criteria.addParam("compLogFile", request.getComponentLogFile());
-    criteria.addParam("id", request.getId());
-    criteria.addParam("scrollType", request.getScrollType());
-    criteria.addParam("numberRows", request.getNumberRows());
+    criteria.setLogFileHostName(request.getHostLogFile());
+    criteria.setLogFileComponentName(request.getComponentLogFile());
+    criteria.setId(request.getId());
+    criteria.setScrollType(request.getScrollType());
+    criteria.setNumberRows(request.getNumberRows());
     return criteria;
   }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/3d62b004/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/SimpleQueryRequestConverter.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/SimpleQueryRequestConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/SimpleQueryRequestConverter.java
index 8c50f66..1f084fd 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/SimpleQueryRequestConverter.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/SimpleQueryRequestConverter.java
@@ -19,16 +19,17 @@
 package org.apache.ambari.logsearch.query.converter;
 
 import org.apache.ambari.logsearch.model.request.impl.SimpleQueryRequest;
-import org.apache.ambari.logsearch.query.model.SearchCriteria;
-import org.springframework.core.convert.converter.Converter;
+import org.apache.ambari.logsearch.query.model.CommonSearchCriteria;
 import org.springframework.stereotype.Component;
 
 @Component
-public class SimpleQueryRequestConverter implements Converter<SimpleQueryRequest, SearchCriteria> {
+public class SimpleQueryRequestConverter extends AbstractConverterAware<SimpleQueryRequest, CommonSearchCriteria> {
+
   @Override
-  public SearchCriteria convert(SimpleQueryRequest simpleQueryRequest) {
-    SearchCriteria searchCriteria = new SearchCriteria();
+  public CommonSearchCriteria convert(SimpleQueryRequest simpleQueryRequest) {
+    CommonSearchCriteria searchCriteria = new CommonSearchCriteria();
     searchCriteria.addParam("q", simpleQueryRequest.getQuery());
     return searchCriteria;
   }
+
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/3d62b004/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/UserConfigRequestConverter.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/UserConfigRequestConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/UserConfigRequestConverter.java
index 50847c7..8f2aaa0 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/UserConfigRequestConverter.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/UserConfigRequestConverter.java
@@ -18,21 +18,19 @@
  */
 package org.apache.ambari.logsearch.query.converter;
 
-import org.apache.ambari.logsearch.common.LogSearchConstants;
 import org.apache.ambari.logsearch.model.request.impl.UserConfigRequest;
 import org.apache.ambari.logsearch.query.model.UserConfigSearchCriteria;
-import org.springframework.core.convert.converter.Converter;
 import org.springframework.stereotype.Component;
 
 @Component
-public class UserConfigRequestConverter implements Converter<UserConfigRequest, UserConfigSearchCriteria> {
+public class UserConfigRequestConverter extends AbstractConverterAware<UserConfigRequest, UserConfigSearchCriteria> {
 
   @Override
   public UserConfigSearchCriteria convert(UserConfigRequest request) {
     UserConfigSearchCriteria criteria = new UserConfigSearchCriteria();
-    criteria.addParam(LogSearchConstants.USER_NAME, request.getUserId());
-    criteria.addParam(LogSearchConstants.FILTER_NAME, request.getFilterName());
-    criteria.addParam(LogSearchConstants.ROW_TYPE, request.getRowType());
+    criteria.setUserName(request.getUserId());
+    criteria.setFilterName(request.getFilterName());
+    criteria.setRowType(request.getRowType());
     return criteria;
   }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/3d62b004/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/UserExportRequestConverter.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/UserExportRequestConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/UserExportRequestConverter.java
index a0b5f0f..c7f738e 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/UserExportRequestConverter.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/UserExportRequestConverter.java
@@ -28,7 +28,8 @@ public class UserExportRequestConverter extends AbstractCommonAuditLogRequestCon
   @Override
   public UserExportSearchCriteria createCriteria(UserExportRequest request) {
     UserExportSearchCriteria criteria = new UserExportSearchCriteria();
-    criteria.addParam("field", request.getField());
+    criteria.setField(request.getField());
+    criteria.setFormat(request.getFormat());
     return criteria;
   }
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/3d62b004/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/AnyGraphSearchCriteria.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/AnyGraphSearchCriteria.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/AnyGraphSearchCriteria.java
index a11c056..aa61851 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/AnyGraphSearchCriteria.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/AnyGraphSearchCriteria.java
@@ -18,8 +18,60 @@
  */
 package org.apache.ambari.logsearch.query.model;
 
-import org.apache.ambari.logsearch.common.Marker;
+import static org.apache.ambari.logsearch.query.SearchCriteriaConstants.PARAM_FROM;
+import static org.apache.ambari.logsearch.query.SearchCriteriaConstants.PARAM_STACK_BY;
+import static org.apache.ambari.logsearch.query.SearchCriteriaConstants.PARAM_TO;
+import static org.apache.ambari.logsearch.query.SearchCriteriaConstants.PARAM_UNIT;
+import static org.apache.ambari.logsearch.query.SearchCriteriaConstants.PARAM_X_AXIS;
+import static org.apache.ambari.logsearch.query.SearchCriteriaConstants.PARAM_Y_AXIS;
 
-@Marker
 public class AnyGraphSearchCriteria extends CommonSearchCriteria {
+
+  public String getxAxis() {
+    return getParam(PARAM_X_AXIS, String.class);
+  }
+
+  public void setxAxis(String xAxis) {
+    addParam(PARAM_X_AXIS, xAxis);
+  }
+
+  public String getyAxis() {
+    return getParam(PARAM_Y_AXIS, String.class);
+  }
+
+  public void setyAxis(String yAxis) {
+    addParam(PARAM_Y_AXIS, yAxis);
+  }
+
+  public String getStackBy() {
+    return getParam(PARAM_STACK_BY, String.class);
+  }
+
+  public void setStackBy(String stackBy) {
+    addParam(PARAM_STACK_BY, stackBy);
+  }
+
+  public String getUnit() {
+    return getParam(PARAM_UNIT, String.class);
+  }
+
+  public void setUnit(String unit) {
+    addParam(PARAM_UNIT, unit);
+  }
+
+  public String getFrom() {
+    return getParam(PARAM_FROM, String.class);
+  }
+
+  public void setFrom(String from) {
+    addParam(PARAM_FROM, from);
+  }
+
+  public String getTo() {
+    return getParam(PARAM_TO, String.class);
+  }
+
+  public void setTo(String to) {
+    addParam(PARAM_TO, to);
+  }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/3d62b004/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/AuditBarGraphSearchCriteria.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/AuditBarGraphSearchCriteria.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/AuditBarGraphSearchCriteria.java
index c41ec15..49304c4 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/AuditBarGraphSearchCriteria.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/AuditBarGraphSearchCriteria.java
@@ -18,8 +18,16 @@
  */
 package org.apache.ambari.logsearch.query.model;
 
-import org.apache.ambari.logsearch.common.Marker;
+import static org.apache.ambari.logsearch.query.SearchCriteriaConstants.PARAM_UNIT;
 
-@Marker
 public class AuditBarGraphSearchCriteria extends CommonSearchCriteria {
+
+  public void setUnit(String unit) {
+    addParam(PARAM_UNIT, unit);
+  }
+
+  public String getUnit() {
+    return getParam(PARAM_UNIT, String.class);
+  }
+
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/3d62b004/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/AuditLogSearchCriteria.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/AuditLogSearchCriteria.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/AuditLogSearchCriteria.java
index f4fe207..03df3ad 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/AuditLogSearchCriteria.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/AuditLogSearchCriteria.java
@@ -18,8 +18,16 @@
  */
 package org.apache.ambari.logsearch.query.model;
 
-import org.apache.ambari.logsearch.common.Marker;
+import static org.apache.ambari.logsearch.query.SearchCriteriaConstants.PARAM_IS_LAST_PAGE;
 
-@Marker
 public class AuditLogSearchCriteria extends CommonSearchCriteria {
+
+  public void setLastPage(boolean lastPage) {
+    addParam(PARAM_IS_LAST_PAGE, lastPage);
+  }
+
+  public boolean isLastPage() {
+    return getParam(PARAM_IS_LAST_PAGE, Boolean.class);
+  }
+
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/3d62b004/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/CommonSearchCriteria.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/CommonSearchCriteria.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/CommonSearchCriteria.java
index 47d12e5..ffdb2c7 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/CommonSearchCriteria.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/CommonSearchCriteria.java
@@ -18,83 +18,78 @@
  */
 package org.apache.ambari.logsearch.query.model;
 
+import static org.apache.ambari.logsearch.query.SearchCriteriaConstants.PARAM_END_TIME;
+import static org.apache.ambari.logsearch.query.SearchCriteriaConstants.PARAM_EXCLUDE_MESSAGE;
+import static org.apache.ambari.logsearch.query.SearchCriteriaConstants.PARAM_EXCLUDE_QUERY;
+import static org.apache.ambari.logsearch.query.SearchCriteriaConstants.PARAM_INCLUDE_MESSAGE;
+import static org.apache.ambari.logsearch.query.SearchCriteriaConstants.PARAM_INCLUDE_QUERY;
+import static org.apache.ambari.logsearch.query.SearchCriteriaConstants.PARAM_MUST_BE_STRING;
+import static org.apache.ambari.logsearch.query.SearchCriteriaConstants.PARAM_MUST_NOT_STRING;
+import static org.apache.ambari.logsearch.query.SearchCriteriaConstants.PARAM_START_TIME;
+
 public class CommonSearchCriteria extends SearchCriteria {
-  private int startIndex = 0;
-  private int maxRows = Integer.MAX_VALUE;
-  private String sortBy = null;
-  private String sortType = null;
-  private int page = 0;
 
-  private String globalStartTime = null;
-  private String globalEndTime = null;
+  public String getIncludeMessage() {
+    return getParam(PARAM_INCLUDE_MESSAGE, String.class);
+  }
+
+  public void setIncludeMessage(String includeMessage) {
+    addParam(PARAM_INCLUDE_MESSAGE, includeMessage);
+  }
 
-  @Override
-  public int getStartIndex() {
-    return startIndex;
+  public String getExcludeMessage() {
+    return getParam(PARAM_EXCLUDE_MESSAGE, String.class);
   }
 
-  @Override
-  public void setStartIndex(int startIndex) {
-    this.startIndex = startIndex;
+  public void setExcludeMessage(String excludeMessage) {
+    addParam(PARAM_EXCLUDE_MESSAGE, excludeMessage);
   }
 
-  @Override
-  public int getMaxRows() {
-    return maxRows;
+  public String getMustBe() {
+    return getParam(PARAM_MUST_BE_STRING, String.class);
   }
 
-  @Override
-  public void setMaxRows(int maxRows) {
-    this.maxRows = maxRows;
+  public void setMustBe(String mustHave) {
+    addParam(PARAM_MUST_BE_STRING, mustHave);
   }
 
-  @Override
-  public String getSortType() {
-    return sortType;
+  public String getMustNot() {
+    return getParam(PARAM_MUST_NOT_STRING, String.class);
   }
 
-  @Override
-  public void setSortType(String sortType) {
-    this.sortType = sortType;
+  public void setMustNot(String mustNot) {
+    addParam(PARAM_MUST_NOT_STRING, mustNot);
   }
 
-  @Override
-  public String getSortBy() {
-    return sortBy;
+  public String getIncludeQuery() {
+    return getParam(PARAM_INCLUDE_QUERY, String.class);
   }
 
-  @Override
-  public void setSortBy(String sortBy) {
-    this.sortBy = sortBy;
+  public void setIncludeQuery(String includeQuery) {
+    addParam(PARAM_INCLUDE_QUERY, includeQuery);
   }
 
-  @Override
-  public int getPage() {
-    return page;
+  public String getExcludeQuery() {
+    return getParam(PARAM_EXCLUDE_QUERY, String.class);
   }
 
-  @Override
-  public void setPage(int page) {
-    this.page = page;
+  public void setExcludeQuery(String excludeQuery) {
+    addParam(PARAM_EXCLUDE_QUERY, excludeQuery);
   }
 
-  @Override
-  public String getGlobalStartTime() {
-    return globalStartTime;
+  public String getStartTime() {
+    return getParam(PARAM_START_TIME, String.class);
   }
 
-  @Override
-  public void setGlobalStartTime(String globalStartTime) {
-    this.globalStartTime = globalStartTime;
+  public void setStartTime(String startTime) {
+    addParam(PARAM_START_TIME, startTime);
   }
 
-  @Override
-  public String getGlobalEndTime() {
-    return globalEndTime;
+  public String getEndTime() {
+    return getParam(PARAM_END_TIME, String.class);
   }
 
-  @Override
-  public void setGlobalEndTime(String globalEndTime) {
-    this.globalEndTime = globalEndTime;
+  public void setEndTime(String endTime) {
+    addParam(PARAM_END_TIME, endTime);
   }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/3d62b004/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/CommonServiceLogSearchCriteria.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/CommonServiceLogSearchCriteria.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/CommonServiceLogSearchCriteria.java
new file mode 100644
index 0000000..4c79c69
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/CommonServiceLogSearchCriteria.java
@@ -0,0 +1,96 @@
+/*
+ * 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.query.model;
+
+import org.apache.ambari.logsearch.query.SearchCriteriaConstants;
+
+public class CommonServiceLogSearchCriteria extends CommonSearchCriteria {
+
+  public String getTreeParams() {
+    return getParam(SearchCriteriaConstants.PARAM_TREE_PARAMS, String.class);
+  }
+
+  public void setTreeParams(String treeParams) {
+    addParam(SearchCriteriaConstants.PARAM_TREE_PARAMS, treeParams);
+  }
+
+  public String getLevel() {
+    return getParam(SearchCriteriaConstants.PARAM_LEVEL, String.class);
+  }
+
+  public void setLevel(String level) {
+    addParam(SearchCriteriaConstants.PARAM_LEVEL, level);
+  }
+
+  public String getSelectComp() {
+    return getParam(SearchCriteriaConstants.PARAM_SELECT_COMP, String.class);
+  }
+
+  public void setSelectComp(String selectComp) {
+    addParam(SearchCriteriaConstants.PARAM_SELECT_COMP, selectComp);
+  }
+
+  public String getBundleId() {
+    return getParam(SearchCriteriaConstants.PARAM_BUNDLE_ID, String.class);
+  }
+
+  public void setBundleId(String bunldeId) {
+    addParam(SearchCriteriaConstants.PARAM_BUNDLE_ID, bunldeId);
+  }
+
+  public String getFrom() {
+    return getParam(SearchCriteriaConstants.PARAM_FROM ,String.class);
+  }
+
+  public void setFrom(String from) {
+    addParam(SearchCriteriaConstants.PARAM_FROM, from);
+  }
+
+  public String getTo() {
+    return getParam(SearchCriteriaConstants.PARAM_TO ,String.class);
+  }
+
+  public void setTo(String to) {
+    addParam(SearchCriteriaConstants.PARAM_TO, to);
+  }
+
+  public String getHostName() {
+    return getParam(SearchCriteriaConstants.PARAM_HOST_NAME ,String.class);
+  }
+
+  public void setHostName(String hostName) {
+    addParam(SearchCriteriaConstants.PARAM_HOST_NAME, hostName);
+  }
+
+  public String getComponentName() {
+    return getParam(SearchCriteriaConstants.PARAM_COMPONENT_NAME ,String.class);
+  }
+
+  public void setComponentName(String componentName) {
+    addParam(SearchCriteriaConstants.PARAM_COMPONENT_NAME, componentName);
+  }
+
+  public String getFileName() {
+    return getParam(SearchCriteriaConstants.PARAM_FILE_NAME ,String.class);
+  }
+
+  public void setFileName(String fileName) {
+    addParam(SearchCriteriaConstants.PARAM_FILE_NAME, fileName);
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/3d62b004/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/FieldAuditBarGraphSearchCriteria.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/FieldAuditBarGraphSearchCriteria.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/FieldAuditBarGraphSearchCriteria.java
index f931f5d..381b3c2 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/FieldAuditBarGraphSearchCriteria.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/FieldAuditBarGraphSearchCriteria.java
@@ -18,8 +18,15 @@
  */
 package org.apache.ambari.logsearch.query.model;
 
-import org.apache.ambari.logsearch.common.Marker;
+import static org.apache.ambari.logsearch.query.SearchCriteriaConstants.PARAM_FIELD;
 
-@Marker
 public class FieldAuditBarGraphSearchCriteria extends AuditBarGraphSearchCriteria {
+
+  public String getField() {
+    return getParam(PARAM_FIELD, String.class);
+  }
+
+  public void setField(String field) {
+    addParam(PARAM_FIELD, field);
+  }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/3d62b004/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/FieldAuditLogSearchCriteria.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/FieldAuditLogSearchCriteria.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/FieldAuditLogSearchCriteria.java
index 8dd5854..9d5d225 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/FieldAuditLogSearchCriteria.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/FieldAuditLogSearchCriteria.java
@@ -18,8 +18,15 @@
  */
 package org.apache.ambari.logsearch.query.model;
 
-import org.apache.ambari.logsearch.common.Marker;
+import static org.apache.ambari.logsearch.query.SearchCriteriaConstants.PARAM_FIELD;
 
-@Marker
 public class FieldAuditLogSearchCriteria extends CommonSearchCriteria {
+
+  public String getField() {
+    return getParam(PARAM_FIELD, String.class);
+  }
+
+  public void setField(String field) {
+    addParam(PARAM_FIELD, field);
+  }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/3d62b004/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/LogFileSearchCriteria.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/LogFileSearchCriteria.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/LogFileSearchCriteria.java
index e4e2a14..e33e5eb 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/LogFileSearchCriteria.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/LogFileSearchCriteria.java
@@ -20,6 +20,33 @@ package org.apache.ambari.logsearch.query.model;
 
 import org.apache.ambari.logsearch.common.Marker;
 
-@Marker
+import static org.apache.ambari.logsearch.query.SearchCriteriaConstants.PARAM_LOG_FILE_COMPONENT;
+import static org.apache.ambari.logsearch.query.SearchCriteriaConstants.PARAM_LOG_FILE_HOST;
+import static org.apache.ambari.logsearch.query.SearchCriteriaConstants.PARAM_LOG_FILE_TYPE;
+
 public class LogFileSearchCriteria extends SearchCriteria {
+
+  public String getLogFileComponent() {
+    return getParam(PARAM_LOG_FILE_COMPONENT, String.class);
+  }
+
+  public void setLogFileComponent(String logFileComponent) {
+    addParam(PARAM_LOG_FILE_COMPONENT, logFileComponent);
+  }
+
+  public String getLogFileHost() {
+    return getParam(PARAM_LOG_FILE_HOST, String.class);
+  }
+
+  public void setLogFileHost(String logFileHost) {
+    addParam(PARAM_LOG_FILE_HOST, logFileHost);
+  }
+
+  public String getLogType() {
+    return getParam(PARAM_LOG_FILE_TYPE, String.class);
+  }
+
+  public void setLogType(String logType) {
+    addParam(PARAM_LOG_FILE_TYPE, logType);
+  }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/3d62b004/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/LogFileTailSearchCriteria.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/LogFileTailSearchCriteria.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/LogFileTailSearchCriteria.java
index fecb396..ccea4ab 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/LogFileTailSearchCriteria.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/LogFileTailSearchCriteria.java
@@ -18,8 +18,15 @@
  */
 package org.apache.ambari.logsearch.query.model;
 
-import org.apache.ambari.logsearch.common.Marker;
+import static org.apache.ambari.logsearch.query.SearchCriteriaConstants.PARAM_LOG_TAIL_SIZE;
 
-@Marker
-public class LogFileTailSearchCriteria extends SearchCriteria {
+public class LogFileTailSearchCriteria extends LogFileSearchCriteria {
+
+  public String getLogTailSize() {
+    return getParam(PARAM_LOG_TAIL_SIZE, String.class);
+  }
+
+  public void setLogTailSize(String logTailSize) {
+    addParam(PARAM_LOG_TAIL_SIZE, logTailSize);
+  }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/3d62b004/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/SearchCriteria.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/SearchCriteria.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/SearchCriteria.java
index 091194e..661337f 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/SearchCriteria.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/SearchCriteria.java
@@ -25,6 +25,7 @@ import java.util.Map;
 import org.apache.ambari.logsearch.common.PropertiesHelper;
 
 public class SearchCriteria {
+
   private int startIndex = 0;
   private int maxRows = Integer.MAX_VALUE;
   private String sortBy = null;
@@ -42,6 +43,30 @@ public class SearchCriteria {
     // Auto-generated constructor stub
   }
 
+
+  public void addParam(String name, Object value) {
+    paramList.put(name, value);
+  }
+
+  public Object getParamValue(String name) {
+    return paramList.get(name);
+  }
+
+  public <T> T getParam(String key, Class<T> type) {
+    if (getParamValue(key) != null) {
+      return (T) getParamValue(key);
+    }
+    return null;
+  }
+
+  public Map<String, Object> getUrlParamMap() {
+    return urlParamMap;
+  }
+
+  public void setUrlParamMap(Map<String, Object> urlParamMap) {
+    this.urlParamMap = urlParamMap;
+  }
+
   public int getStartIndex() {
     return startIndex;
   }
@@ -62,33 +87,6 @@ public class SearchCriteria {
     return sortType;
   }
 
-
-  public void addParam(String name, Object value) {
-    String solrValue = PropertiesHelper.getProperty(name);
-    if (solrValue == null || solrValue.isEmpty()) {
-      paramList.put(name, value);
-    } else {
-      try {
-        String propertyFieldMappings[] = solrValue.split(",");
-        HashMap<String, String> propertyFieldValue = new HashMap<String, String>();
-        for (String temp : propertyFieldMappings) {
-          String arrayValue[] = temp.split(":");
-          propertyFieldValue.put(arrayValue[0].toLowerCase(Locale.ENGLISH), arrayValue[1].toLowerCase(Locale.ENGLISH));
-        }
-        String originalValue = propertyFieldValue.get(value.toString().toLowerCase(Locale.ENGLISH));
-        if (originalValue != null && !originalValue.isEmpty())
-          paramList.put(name, originalValue);
-
-      } catch (Exception e) {
-        //do nothing
-      }
-    }
-  }
-
-  public Object getParamValue(String name) {
-    return paramList.get(name);
-  }
-
   public String getSortBy() {
     return sortBy;
   }
@@ -125,12 +123,4 @@ public class SearchCriteria {
     this.globalEndTime = globalEndTime;
   }
 
-  public Map<String, Object> getUrlParamMap() {
-    return urlParamMap;
-  }
-
-  public void setUrlParamMap(Map<String, Object> urlParamMap) {
-    this.urlParamMap = urlParamMap;
-  }
-
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/3d62b004/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceAnyGraphSearchCriteria.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceAnyGraphSearchCriteria.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceAnyGraphSearchCriteria.java
index 0ef5bdf..cd852b5 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceAnyGraphSearchCriteria.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceAnyGraphSearchCriteria.java
@@ -20,6 +20,41 @@ package org.apache.ambari.logsearch.query.model;
 
 import org.apache.ambari.logsearch.common.Marker;
 
-@Marker
+import static org.apache.ambari.logsearch.query.SearchCriteriaConstants.PARAM_STACK_BY;
+import static org.apache.ambari.logsearch.query.SearchCriteriaConstants.PARAM_UNIT;
+import static org.apache.ambari.logsearch.query.SearchCriteriaConstants.PARAM_X_AXIS;
+import static org.apache.ambari.logsearch.query.SearchCriteriaConstants.PARAM_Y_AXIS;
+
 public class ServiceAnyGraphSearchCriteria extends ServiceLogFileSearchCriteria {
+  public String getxAxis() {
+    return getParam(PARAM_X_AXIS, String.class);
+  }
+
+  public void setxAxis(String xAxis) {
+    addParam(PARAM_X_AXIS, xAxis);
+  }
+
+  public String getyAxis() {
+    return getParam(PARAM_Y_AXIS, String.class);
+  }
+
+  public void setyAxis(String yAxis) {
+    addParam(PARAM_Y_AXIS, yAxis);
+  }
+
+  public String getStackBy() {
+    return getParam(PARAM_STACK_BY, String.class);
+  }
+
+  public void setStackBy(String stackBy) {
+    addParam(PARAM_STACK_BY, stackBy);
+  }
+
+  public String getUnit() {
+    return getParam(PARAM_UNIT, String.class);
+  }
+
+  public void setUnit(String unit) {
+    addParam(PARAM_UNIT, unit);
+  }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/3d62b004/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceExtremeDatesCriteria.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceExtremeDatesCriteria.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceExtremeDatesCriteria.java
index 3fc6ff8..d89ab3b 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceExtremeDatesCriteria.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceExtremeDatesCriteria.java
@@ -18,8 +18,15 @@
  */
 package org.apache.ambari.logsearch.query.model;
 
-import org.apache.ambari.logsearch.common.Marker;
+import org.apache.ambari.logsearch.query.SearchCriteriaConstants;
 
-@Marker
 public class ServiceExtremeDatesCriteria extends CommonSearchCriteria {
+
+  public String getBundleId() {
+    return getParam(SearchCriteriaConstants.PARAM_BUNDLE_ID, String.class);
+  }
+
+  public void setBundleId(String bunldeId) {
+    addParam(SearchCriteriaConstants.PARAM_BUNDLE_ID, bunldeId);
+  }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/3d62b004/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceGraphSearchCriteria.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceGraphSearchCriteria.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceGraphSearchCriteria.java
index 31a57a4..8988af1 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceGraphSearchCriteria.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceGraphSearchCriteria.java
@@ -18,8 +18,15 @@
  */
 package org.apache.ambari.logsearch.query.model;
 
-import org.apache.ambari.logsearch.common.Marker;
+import org.apache.ambari.logsearch.query.SearchCriteriaConstants;
 
-@Marker
 public class ServiceGraphSearchCriteria extends ServiceLogFileSearchCriteria {
+
+  public String getUnit() {
+    return getParam(SearchCriteriaConstants.PARAM_UNIT, String.class);
+  }
+
+  public void setUnit(String unit) {
+    addParam(SearchCriteriaConstants.PARAM_UNIT, unit);
+  }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/3d62b004/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceLogExportSearchCriteria.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceLogExportSearchCriteria.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceLogExportSearchCriteria.java
index 8bab7f0..c7b7a39 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceLogExportSearchCriteria.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceLogExportSearchCriteria.java
@@ -18,8 +18,23 @@
  */
 package org.apache.ambari.logsearch.query.model;
 
-import org.apache.ambari.logsearch.common.Marker;
+import org.apache.ambari.logsearch.query.SearchCriteriaConstants;
 
-@Marker
 public class ServiceLogExportSearchCriteria extends ServiceLogFileSearchCriteria {
+
+  public void setFormat(String format) {
+    addParam(SearchCriteriaConstants.PARAM_FORMAT, format);
+  }
+
+  public String getFormat() {
+    return getParam(SearchCriteriaConstants.PARAM_FORMAT, String.class);
+  }
+
+  public void setUtcOffset(String utcOffset) {
+    addParam(SearchCriteriaConstants.PARAM_UTC_OFFSET, utcOffset);
+  }
+
+  public String getUtcOffset() {
+    return getParam(SearchCriteriaConstants.PARAM_UTC_OFFSET, String.class);
+  }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/3d62b004/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceLogFileSearchCriteria.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceLogFileSearchCriteria.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceLogFileSearchCriteria.java
index a9f5926..a80a3ce 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceLogFileSearchCriteria.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceLogFileSearchCriteria.java
@@ -18,8 +18,23 @@
  */
 package org.apache.ambari.logsearch.query.model;
 
-import org.apache.ambari.logsearch.common.Marker;
+import org.apache.ambari.logsearch.query.SearchCriteriaConstants;
 
-@Marker
-public class ServiceLogFileSearchCriteria extends CommonSearchCriteria {
+public class ServiceLogFileSearchCriteria extends CommonServiceLogSearchCriteria {
+
+  public void setLogFileHostName(String logFileHostName) {
+    addParam(SearchCriteriaConstants.PARAM_HOST_LOG_FILE, logFileHostName);
+  }
+
+  public String getLogFileHostName() {
+    return getParam(SearchCriteriaConstants.PARAM_HOST_LOG_FILE, String.class);
+  }
+
+  public void setLogFileComponentName(String logFileComponentName) {
+    addParam(SearchCriteriaConstants.PARAM_COMPONENT_LOG_FILE, logFileComponentName);
+  }
+
+  public String getLogFileComponentName() {
+    return getParam(SearchCriteriaConstants.PARAM_COMPONENT_LOG_FILE, String.class);
+  }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/3d62b004/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceLogSearchCriteria.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceLogSearchCriteria.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceLogSearchCriteria.java
index d41c589..b3a6bf7 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceLogSearchCriteria.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceLogSearchCriteria.java
@@ -18,8 +18,48 @@
  */
 package org.apache.ambari.logsearch.query.model;
 
-import org.apache.ambari.logsearch.common.Marker;
+import org.apache.ambari.logsearch.query.SearchCriteriaConstants;
 
-@Marker
 public class ServiceLogSearchCriteria extends ServiceLogFileSearchCriteria {
+
+  public void setKeyword(String keyword) {
+    addParam(SearchCriteriaConstants.PARAM_KEYWORD, keyword);
+  }
+
+  public String getKeyword() {
+    return getParam(SearchCriteriaConstants.PARAM_KEYWORD, String.class);
+  }
+
+  public void setKeywordType(String keywordType) {
+    addParam(SearchCriteriaConstants.PARAM_KEYWORD_TYPE, keywordType);
+  }
+
+  public String getKeywordType() {
+    return getParam(SearchCriteriaConstants.PARAM_KEYWORD_TYPE, String.class);
+  }
+
+  public void setSourceLogId(String sourceLogId) {
+    addParam(SearchCriteriaConstants.PARAM_SOURCE_LOG_ID, sourceLogId);
+  }
+
+  public String getSourceLogId() {
+    return getParam(SearchCriteriaConstants.PARAM_SOURCE_LOG_ID, String.class);
+  }
+
+  public void setToken(String token) {
+    addParam(SearchCriteriaConstants.PARAM_TOKEN, token);
+  }
+
+  public String getToken() {
+    return getParam(SearchCriteriaConstants.PARAM_TOKEN, String.class);
+  }
+
+  public void setLastPage(boolean lastPage) {
+    addParam(SearchCriteriaConstants.PARAM_IS_LAST_PAGE, lastPage);
+  }
+
+  public boolean isLastPage() {
+    return getParam(SearchCriteriaConstants.PARAM_IS_LAST_PAGE, Boolean.class);
+  }
+
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/3d62b004/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceLogTruncatedSearchCriteria.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceLogTruncatedSearchCriteria.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceLogTruncatedSearchCriteria.java
index 24dc9a8..bcdac5b 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceLogTruncatedSearchCriteria.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceLogTruncatedSearchCriteria.java
@@ -18,8 +18,31 @@
  */
 package org.apache.ambari.logsearch.query.model;
 
-import org.apache.ambari.logsearch.common.Marker;
+import org.apache.ambari.logsearch.query.SearchCriteriaConstants;
 
-@Marker
 public class ServiceLogTruncatedSearchCriteria extends ServiceLogFileSearchCriteria {
+
+  public String getId() {
+    return getParam(SearchCriteriaConstants.PARAM_ID, String.class);
+  }
+
+  public void setId(String id) {
+    addParam(SearchCriteriaConstants.PARAM_ID, id);
+  }
+
+  public String getScrollType() {
+    return getParam(SearchCriteriaConstants.PARAM_SCROLL_TYPE, String.class);
+  }
+
+  public void setScrollType(String scrollType) {
+    addParam(SearchCriteriaConstants.PARAM_SCROLL_TYPE, scrollType);
+  }
+
+  public String getNumberRows() {
+    return getParam(SearchCriteriaConstants.PARAM_NUMBER_ROWS, String.class);
+  }
+
+  public void setNumberRows(String numberRows) {
+    addParam(SearchCriteriaConstants.PARAM_NUMBER_ROWS, numberRows);
+  }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/3d62b004/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/UserConfigSearchCriteria.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/UserConfigSearchCriteria.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/UserConfigSearchCriteria.java
index 8798cd6..eafff69 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/UserConfigSearchCriteria.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/UserConfigSearchCriteria.java
@@ -18,8 +18,31 @@
  */
 package org.apache.ambari.logsearch.query.model;
 
-import org.apache.ambari.logsearch.common.Marker;
+import org.apache.ambari.logsearch.query.SearchCriteriaConstants;
 
-@Marker
 public class UserConfigSearchCriteria extends CommonSearchCriteria {
+
+  public String getUserName() {
+    return getParam(SearchCriteriaConstants.PARAM_USER_NAME, String.class);
+  }
+
+  public void setUserName(String userName) {
+    addParam(SearchCriteriaConstants.PARAM_USER_NAME, userName);
+  }
+
+  public String getFilterName() {
+    return getParam(SearchCriteriaConstants.PARAM_FILTER_NAME, String.class);
+  }
+
+  public void setFilterName(String filterName) {
+    addParam(SearchCriteriaConstants.PARAM_FILTER_NAME, filterName);
+  }
+
+  public String getRowType() {
+    return getParam(SearchCriteriaConstants.PARAM_ROW_TYPE, String.class);
+  }
+
+  public void setRowType(String rowType) {
+    addParam(SearchCriteriaConstants.PARAM_ROW_TYPE, rowType);
+  }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/3d62b004/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/UserExportSearchCriteria.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/UserExportSearchCriteria.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/UserExportSearchCriteria.java
index 755c673..46d13cc 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/UserExportSearchCriteria.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/UserExportSearchCriteria.java
@@ -18,8 +18,14 @@
  */
 package org.apache.ambari.logsearch.query.model;
 
-import org.apache.ambari.logsearch.common.Marker;
+import org.apache.ambari.logsearch.query.SearchCriteriaConstants;
 
-@Marker
 public class UserExportSearchCriteria extends FieldAuditLogSearchCriteria {
+  public void setFormat(String format) {
+    addParam(SearchCriteriaConstants.PARAM_FORMAT, format);
+  }
+
+  public String getFormat() {
+    return getParam(SearchCriteriaConstants.PARAM_FORMAT, String.class);
+  }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/3d62b004/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/AuditLogsResource.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/AuditLogsResource.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/AuditLogsResource.java
index 82e21e8..ff185f8 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/AuditLogsResource.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/AuditLogsResource.java
@@ -87,7 +87,7 @@ public class AuditLogsResource {
   @Produces({"application/json"})
   @ApiOperation(GET_AUDIT_COMPONENTS_OD)
   public GroupListResponse getAuditComponents(@BeanParam SimpleQueryRequest request) {
-    return auditLogsManager.getAuditComponents(conversionService.convert(request, SearchCriteria.class));
+    return auditLogsManager.getAuditComponents(conversionService.convert(request, CommonSearchCriteria.class));
   }
 
   @GET

http://git-wip-us.apache.org/repos/asf/ambari/blob/3d62b004/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 5400825..6cc69d4 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
@@ -45,6 +45,7 @@ import org.apache.ambari.logsearch.model.response.NameValueDataListResponse;
 import org.apache.ambari.logsearch.model.response.NodeListResponse;
 import org.apache.ambari.logsearch.model.response.ServiceLogResponse;
 import org.apache.ambari.logsearch.query.model.CommonSearchCriteria;
+import org.apache.ambari.logsearch.query.model.CommonServiceLogSearchCriteria;
 import org.apache.ambari.logsearch.query.model.SearchCriteria;
 import org.apache.ambari.logsearch.manager.ServiceLogsManager;
 import org.apache.ambari.logsearch.query.model.ServiceAnyGraphSearchCriteria;
@@ -100,7 +101,7 @@ public class ServiceLogsResource {
   @Produces({"application/json"})
   @ApiOperation(GET_AGGREGATED_INFO_OD)
   public GraphDataListResponse getAggregatedInfo(@BeanParam BaseServiceLogRequest request) {
-    return serviceLogsManager.getAggregatedInfo(conversionService.convert(request, CommonSearchCriteria.class));
+    return serviceLogsManager.getAggregatedInfo(conversionService.convert(request, CommonServiceLogSearchCriteria.class));
   }
 
   @GET
@@ -132,7 +133,7 @@ public class ServiceLogsResource {
   @Produces({"application/json"})
   @ApiOperation(GET_TREE_EXTENSION_OD)
   public NodeListResponse getTreeExtension(@QueryParam("hostName") @ApiParam String hostName, @BeanParam ServiceLogFileRequest request) {
-    SearchCriteria searchCriteria = conversionService.convert(request, ServiceLogFileSearchCriteria.class);
+    ServiceLogFileSearchCriteria searchCriteria = conversionService.convert(request, ServiceLogFileSearchCriteria.class);
     searchCriteria.addParam("hostName", hostName); // TODO: use host_name instead - needs UI change
     return serviceLogsManager.getTreeExtension(searchCriteria);
   }
@@ -175,7 +176,7 @@ public class ServiceLogsResource {
   @Produces({"application/json"})
   @ApiOperation(GET_HOST_LIST_BY_COMPONENT_OD)
   public NodeListResponse getHostListByComponent(@BeanParam ServiceLogFileRequest request, @QueryParam("componentName") @ApiParam String componentName) {
-    SearchCriteria searchCriteria = conversionService.convert(request, ServiceLogFileSearchCriteria.class);
+    ServiceLogFileSearchCriteria searchCriteria = conversionService.convert(request, ServiceLogFileSearchCriteria.class);
     searchCriteria.addParam("componentName", componentName); // TODO: use component_name instead - needs UI change
     return serviceLogsManager.getHostListByComponent(searchCriteria);
   }

http://git-wip-us.apache.org/repos/asf/ambari/blob/3d62b004/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/metrics/SolrJmxAdapter.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/metrics/SolrJmxAdapter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/metrics/SolrJmxAdapter.java
deleted file mode 100644
index fc58661..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/metrics/SolrJmxAdapter.java
+++ /dev/null
@@ -1,134 +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.solr.metrics;
-
-import java.io.IOException;
-import java.lang.management.MemoryMXBean;
-import java.net.MalformedURLException;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
-
-import javax.management.JMX;
-import javax.management.MBeanServerConnection;
-import javax.management.MalformedObjectNameException;
-import javax.management.ObjectName;
-import javax.management.remote.JMXConnector;
-import javax.management.remote.JMXConnectorFactory;
-import javax.management.remote.JMXServiceURL;
-
-import com.sun.management.OperatingSystemMXBean;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-@SuppressWarnings("restriction")
-public class SolrJmxAdapter {
-  private static final Logger LOG = LoggerFactory.getLogger(SolrJmxAdapter.class);
-
-  private static final String JMX_SERVICE_URL = "service:jmx:rmi:///jndi/rmi://%s:%d/jmxrmi";
-
-  private final JMXServiceURL jmxServiceUrl;
-
-  private JMXConnector jmxConnector;
-  private MBeanServerConnection conn;
-
-  public SolrJmxAdapter(String host, int port) throws MalformedURLException {
-    String url = String.format(JMX_SERVICE_URL, host, port);
-    jmxServiceUrl = new JMXServiceURL(url);
-  }
-
-  public double getProcessCpuLoad() throws MalformedObjectNameException {
-    ObjectName objectName = new ObjectName("java.lang:type=OperatingSystem");
-    OperatingSystemMXBean mxBean = JMX.newMXBeanProxy(conn, objectName, OperatingSystemMXBean.class);
-    return mxBean.getProcessCpuLoad();
-  }
-
-  public Map<String, Long> getMemoryData() throws MalformedObjectNameException {
-    Map<String, Long> memoryData = new HashMap<>();
-    
-    ObjectName objectName = new ObjectName("java.lang:type=Memory");
-    MemoryMXBean mxBean = JMX.newMXBeanProxy(conn, objectName, MemoryMXBean.class);
-    
-    memoryData.put("heapMemoryUsed", mxBean.getHeapMemoryUsage().getUsed());
-    memoryData.put("heapMemoryCommitted", mxBean.getHeapMemoryUsage().getCommitted());
-    memoryData.put("heapMemoryMax", mxBean.getHeapMemoryUsage().getMax());
-    memoryData.put("nonHeapMemoryUsed", mxBean.getNonHeapMemoryUsage().getUsed());
-    memoryData.put("nonHeapMemoryCommitted", mxBean.getNonHeapMemoryUsage().getCommitted());
-    memoryData.put("nonHeapMemoryMax", mxBean.getNonHeapMemoryUsage().getMax());
-    
-    return memoryData;
-  }
-
-  public long getIndexSize() throws Exception {
-    long indexSize = 0;
-
-    ObjectName objectNamePattern = new ObjectName(
-        "solr/*shard*replica*:type=/replication,id=org.apache.solr.handler.ReplicationHandler");
-    Set<ObjectName> objectNames = conn.queryNames(objectNamePattern, null);
-    for (ObjectName objectName : objectNames) {
-      String indexSizeString = (String) conn.getAttribute(objectName, "indexSize");
-      indexSize += getIndexSizeInBytes(indexSizeString);
-    }
-
-    return indexSize;
-  }
-
-  private long getIndexSizeInBytes(String indexSizeString) {
-    String[] tokens = indexSizeString.split(" ");
-    double number = Double.parseDouble(tokens[0]);
-
-    long multiplier = 0;
-    switch (tokens[1]) {
-      case "bytes":
-        multiplier = 1;
-        break;
-      case "KB":
-        multiplier = 1024;
-        break;
-      case "MB":
-        multiplier = 1024 * 1024;
-        break;
-      case "GB":
-        multiplier = 1024 * 1024 * 1024;
-        break;
-      default:
-        throw new IllegalArgumentException("Unknown unit: " + tokens[1]);
-    }
-    
-    return (long)(number * multiplier);
-  }
-
-  public void reConnect() throws IOException {
-    if (jmxConnector != null) {
-      try {
-        jmxConnector.close();
-      } catch (IOException e) {
-        LOG.info("Could not close jmxConnector", e);
-      }
-    }
-
-    connect();
-  }
-
-  public void connect() throws IOException {
-    jmxConnector = JMXConnectorFactory.connect(jmxServiceUrl);
-    conn = jmxConnector.getMBeanServerConnection();
-  }
-}


[23/58] [abbrv] ambari git commit: AMBARI-18246. Clean up Log Feeder (Miklos Gergely via oleewere)

Posted by ol...@apache.org.
http://git-wip-us.apache.org/repos/asf/ambari/blob/1b07a6dd/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/util/FileUtil.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/util/FileUtil.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/util/FileUtil.java
index ec26a88..ffd6cec 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/util/FileUtil.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/util/FileUtil.java
@@ -20,25 +20,73 @@
 package org.apache.ambari.logfeeder.util;
 
 import java.io.File;
+import java.io.IOException;
+import java.net.URL;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.nio.file.attribute.BasicFileAttributes;
 import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
 
 import org.apache.commons.io.FileUtils;
 import org.apache.log4j.Logger;
+import org.codehaus.jackson.map.ObjectMapper;
+import org.codehaus.jackson.type.TypeReference;
 
 public class FileUtil {
-  private static final Logger logger = Logger.getLogger(FileUtil.class);
-
-  public static List<File> getAllFileFromDir(File directory,
-      String[] searchFileWithExtensions, boolean checkInSubDir) {
+  private static final Logger LOG = Logger.getLogger(FileUtil.class);
+  
+  private FileUtil() {
+    throw new UnsupportedOperationException();
+  }
+  
+  public static List<File> getAllFileFromDir(File directory, String extension, boolean checkInSubDir) {
     if (!directory.exists()) {
-      logger.error(directory.getAbsolutePath() + " is not exists ");
-    } else if (directory.isDirectory()) {
-      return (List<File>) FileUtils.listFiles(directory,
-          searchFileWithExtensions, checkInSubDir);
+      LOG.error(directory.getAbsolutePath() + " is not exists ");
+    } else if (!directory.isDirectory()) {
+      LOG.error(directory.getAbsolutePath() + " is not Directory ");
     } else {
-      logger.error(directory.getAbsolutePath() + " is not Directory ");
+      return (List<File>) FileUtils.listFiles(directory, new String[]{extension}, checkInSubDir);
     }
     return new ArrayList<File>();
   }
+
+
+  public static Object getFileKey(File file) {
+    try {
+      Path fileFullPath = Paths.get(file.getAbsolutePath());
+      if (fileFullPath != null) {
+        BasicFileAttributes basicAttr = Files.readAttributes(fileFullPath, BasicFileAttributes.class);
+        return basicAttr.fileKey();
+      }
+    } catch (Throwable ex) {
+      LOG.error("Error getting file attributes for file=" + file, ex);
+    }
+    return file.toString();
+  }
+
+  public static File getFileFromClasspath(String filename) {
+    URL fileCompleteUrl = Thread.currentThread().getContextClassLoader().getResource(filename);
+    LOG.debug("File Complete URI :" + fileCompleteUrl);
+    File file = null;
+    try {
+      file = new File(fileCompleteUrl.toURI());
+    } catch (Exception exception) {
+      LOG.debug(exception.getMessage(), exception.getCause());
+    }
+    return file;
+  }
+
+  public static HashMap<String, Object> readJsonFromFile(File jsonFile) {
+    ObjectMapper mapper = new ObjectMapper();
+    try {
+      HashMap<String, Object> jsonmap = mapper.readValue(jsonFile, new TypeReference<HashMap<String, Object>>() {});
+      return jsonmap;
+    } catch (IOException e) {
+      LOG.error(e, e.getCause());
+    }
+    return new HashMap<String, Object>();
+  }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/1b07a6dd/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/util/LogFeederUtil.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/util/LogFeederUtil.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/util/LogFeederUtil.java
index 32029ff..5bf600e 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/util/LogFeederUtil.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/util/LogFeederUtil.java
@@ -22,36 +22,23 @@ package org.apache.ambari.logfeeder.util;
 import java.io.BufferedInputStream;
 import java.io.File;
 import java.io.FileInputStream;
-import java.io.IOException;
 import java.lang.reflect.Type;
 import java.net.InetAddress;
-import java.net.URL;
 import java.net.UnknownHostException;
-import java.text.SimpleDateFormat;
-import java.util.Date;
 import java.util.HashMap;
 import java.util.Hashtable;
 import java.util.List;
 import java.util.Map;
 import java.util.Properties;
-import java.util.TimeZone;
 
 import org.apache.ambari.logfeeder.LogFeeder;
-import org.apache.ambari.logfeeder.filter.Filter;
-import org.apache.ambari.logfeeder.input.Input;
-import org.apache.ambari.logfeeder.logconfig.LogFeederConstants;
-import org.apache.ambari.logfeeder.mapper.Mapper;
-import org.apache.ambari.logfeeder.metrics.MetricCount;
-import org.apache.ambari.logfeeder.output.Output;
+import org.apache.ambari.logfeeder.common.LogFeederConstants;
+import org.apache.ambari.logfeeder.metrics.MetricData;
+import org.apache.commons.collections.MapUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.log4j.Level;
 import org.apache.log4j.Logger;
-import org.codehaus.jackson.JsonParseException;
-import org.codehaus.jackson.map.JsonMappingException;
-import org.codehaus.jackson.map.ObjectMapper;
-import org.codehaus.jackson.type.TypeReference;
 
-import com.google.common.collect.ObjectArrays;
 import com.google.gson.Gson;
 import com.google.gson.GsonBuilder;
 import com.google.gson.reflect.TypeToken;
@@ -60,109 +47,80 @@ import com.google.gson.reflect.TypeToken;
  * This class contains utility methods used by LogFeeder
  */
 public class LogFeederUtil {
-  private static final Logger logger = Logger.getLogger(LogFeederUtil.class);
+  private static final Logger LOG = Logger.getLogger(LogFeederUtil.class);
 
-  private static final int HASH_SEED = 31174077;
-  public final static String DATE_FORMAT = "yyyy-MM-dd HH:mm:ss.SSS";
-  public final static String SOLR_DATE_FORMAT = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'";
-  private static Gson gson = new GsonBuilder().setDateFormat(DATE_FORMAT).create();
-
-  private static Properties props;
-
-  private static Map<String, LogHistory> logHistoryList = new Hashtable<String, LogHistory>();
-  private static int logInterval = 30000; // 30 seconds
+  private final static String GSON_DATE_FORMAT = "yyyy-MM-dd HH:mm:ss.SSS";
+  private static Gson gson = new GsonBuilder().setDateFormat(GSON_DATE_FORMAT).create();
+  
+  public static Gson getGson() {
+    return gson;
+  }
 
   public static String hostName = null;
   public static String ipAddress = null;
   
-  private static String logfeederTempDir = null;
-  
-  private static final Object _LOCK = new Object();
-  
   static{
-    setHostNameAndIP();
+    try {
+      InetAddress ip = InetAddress.getLocalHost();
+      ipAddress = ip.getHostAddress();
+      String getHostName = ip.getHostName();
+      String getCanonicalHostName = ip.getCanonicalHostName();
+      if (!getCanonicalHostName.equalsIgnoreCase(ipAddress)) {
+        LOG.info("Using getCanonicalHostName()=" + getCanonicalHostName);
+        hostName = getCanonicalHostName;
+      } else {
+        LOG.info("Using getHostName()=" + getHostName);
+        hostName = getHostName;
+      }
+      LOG.info("ipAddress=" + ipAddress + ", getHostName=" + getHostName + ", getCanonicalHostName=" + getCanonicalHostName +
+          ", hostName=" + hostName);
+    } catch (UnknownHostException e) {
+      LOG.error("Error getting hostname.", e);
+    }
   }
   
-  public static Gson getGson() {
-    return gson;
-  }
-
-  private static ThreadLocal<SimpleDateFormat> dateFormatter = new ThreadLocal<SimpleDateFormat>() {
-    @Override
-    protected SimpleDateFormat initialValue() {
-      SimpleDateFormat sdf = new SimpleDateFormat(SOLR_DATE_FORMAT);
-      sdf.setTimeZone(TimeZone.getTimeZone("UTC"));
-      return sdf;
-    }
-  };
+  private static Properties props;
 
   /**
-   * This method will read the properties from System, followed by propFile
-   * and finally from the map
+   * This method will read the properties from System, followed by propFile and finally from the map
    */
-  public static void loadProperties(String propFile, String[] propNVList)
-    throws Exception {
-    logger.info("Loading properties. propFile=" + propFile);
+  public static void loadProperties(String propFile, String[] propNVList) throws Exception {
+    LOG.info("Loading properties. propFile=" + propFile);
     props = new Properties(System.getProperties());
     boolean propLoaded = false;
 
     // First get properties file path from environment value
     String propertiesFilePath = System.getProperty("properties");
-    if (propertiesFilePath != null && !propertiesFilePath.isEmpty()) {
+    if (StringUtils.isNotEmpty(propertiesFilePath)) {
       File propertiesFile = new File(propertiesFilePath);
       if (propertiesFile.exists() && propertiesFile.isFile()) {
-        logger.info("Properties file path set in environment. Loading properties file="
-          + propertiesFilePath);
-        FileInputStream fileInputStream = null;
-        try {
-          fileInputStream = new FileInputStream(propertiesFile);
-          props.load(fileInputStream);
+        LOG.info("Properties file path set in environment. Loading properties file=" + propertiesFilePath);
+        try (FileInputStream fis = new FileInputStream(propertiesFile)) {
+          props.load(fis);
           propLoaded = true;
         } catch (Throwable t) {
-          logger.error("Error loading properties file. properties file="
-            + propertiesFile.getAbsolutePath());
-        } finally {
-          if (fileInputStream != null) {
-            try {
-              fileInputStream.close();
-            } catch (Throwable t) {
-              // Ignore error
-            }
-          }
+          LOG.error("Error loading properties file. properties file=" + propertiesFile.getAbsolutePath());
         }
       } else {
-        logger.error("Properties file path set in environment, but file not found. properties file="
-          + propertiesFilePath);
+        LOG.error("Properties file path set in environment, but file not found. properties file=" + propertiesFilePath);
       }
     }
 
     if (!propLoaded) {
-      BufferedInputStream fileInputStream = null;
-      try {
+      try (BufferedInputStream bis = (BufferedInputStream) LogFeeder.class.getClassLoader().getResourceAsStream(propFile)) {
         // Properties not yet loaded, let's try from class loader
-        fileInputStream = (BufferedInputStream) LogFeeder.class
-          .getClassLoader().getResourceAsStream(propFile);
-        if (fileInputStream != null) {
-          logger.info("Loading properties file " + propFile
-            + " from classpath");
-          props.load(fileInputStream);
+        if (bis != null) {
+          LOG.info("Loading properties file " + propFile + " from classpath");
+          props.load(bis);
           propLoaded = true;
         } else {
-          logger.fatal("Properties file not found in classpath. properties file name= "
-            + propFile);
-        }
-      } finally {
-        if (fileInputStream != null) {
-          try {
-            fileInputStream.close();
-          } catch (IOException e) {
-          }
+          LOG.fatal("Properties file not found in classpath. properties file name= " + propFile);
         }
       }
     }
 
     if (!propLoaded) {
-      logger.fatal("Properties file is not loaded.");
+      LOG.fatal("Properties file is not loaded.");
       throw new Exception("Properties not loaded");
     } else {
       updatePropertiesFromMap(propNVList);
@@ -173,162 +131,124 @@ public class LogFeederUtil {
     if (nvList == null) {
       return;
     }
-    logger.info("Trying to load additional proeprties from argument paramters. nvList.length="
-      + nvList.length);
-    if (nvList != null && nvList.length > 0) {
-      for (String nv : nvList) {
-        logger.info("Passed nv=" + nv);
-        if (nv.startsWith("-") && nv.length() > 1) {
-          nv = nv.substring(1);
-          logger.info("Stripped nv=" + nv);
-          int i = nv.indexOf("=");
-          if (nv.length() > i) {
-            logger.info("Candidate nv=" + nv);
-            String name = nv.substring(0, i);
-            String value = nv.substring(i + 1);
-            logger.info("Adding property from argument to properties. name="
-              + name + ", value=" + value);
-            props.put(name, value);
-          }
+    LOG.info("Trying to load additional proeprties from argument paramters. nvList.length=" + nvList.length);
+    for (String nv : nvList) {
+      LOG.info("Passed nv=" + nv);
+      if (nv.startsWith("-") && nv.length() > 1) {
+        nv = nv.substring(1);
+        LOG.info("Stripped nv=" + nv);
+        int i = nv.indexOf("=");
+        if (nv.length() > i) {
+          LOG.info("Candidate nv=" + nv);
+          String name = nv.substring(0, i);
+          String value = nv.substring(i + 1);
+          LOG.info("Adding property from argument to properties. name=" + name + ", value=" + value);
+          props.put(name, value);
         }
       }
     }
   }
 
-  static public String getStringProperty(String key) {
-    if (props != null) {
-      return props.getProperty(key);
-    }
-    return null;
+  public static String getStringProperty(String key) {
+    return props == null ? null : props.getProperty(key);
   }
 
-  static public String getStringProperty(String key, String defaultValue) {
-    if (props != null) {
-      return props.getProperty(key, defaultValue);
-    }
-    return defaultValue;
+  public static String getStringProperty(String key, String defaultValue) {
+    return props == null ? defaultValue : props.getProperty(key, defaultValue);
   }
 
-  static public boolean getBooleanProperty(String key, boolean defaultValue) {
-    String strValue = getStringProperty(key);
-    return toBoolean(strValue, defaultValue);
+  public static boolean getBooleanProperty(String key, boolean defaultValue) {
+    String value = getStringProperty(key);
+    return toBoolean(value, defaultValue);
   }
 
-  private static boolean toBoolean(String strValue, boolean defaultValue) {
-    boolean retValue = defaultValue;
-    if (!StringUtils.isEmpty(strValue)) {
-      if (strValue.equalsIgnoreCase("true")
-        || strValue.equalsIgnoreCase("yes")) {
-        retValue = true;
-      } else {
-        retValue = false;
-      }
+  private static boolean toBoolean(String value, boolean defaultValue) {
+    if (StringUtils.isEmpty(value)) {
+      return defaultValue;
     }
-    return retValue;
+    
+    return "true".equalsIgnoreCase(value) || "yes".equalsIgnoreCase(value);
   }
 
-  static public int getIntProperty(String key, int defaultValue) {
-    String strValue = getStringProperty(key);
-    int retValue = defaultValue;
-    retValue = objectToInt(strValue, retValue, ", key=" + key);
+  public static int getIntProperty(String key, int defaultValue) {
+    String value = getStringProperty(key);
+    int retValue = objectToInt(value, defaultValue, ", key=" + key);
     return retValue;
   }
 
-  public static int objectToInt(Object objValue, int retValue,
-                                String errMessage) {
+  public static int objectToInt(Object objValue, int retValue, String errMessage) {
     if (objValue == null) {
       return retValue;
     }
     String strValue = objValue.toString();
-    if (!StringUtils.isEmpty(strValue)) {
+    if (StringUtils.isNotEmpty(strValue)) {
       try {
         retValue = Integer.parseInt(strValue);
       } catch (Throwable t) {
-        logger.error("Error parsing integer value. str=" + strValue
-          + ", " + errMessage);
+        LOG.error("Error parsing integer value. str=" + strValue + ", " + errMessage);
       }
     }
     return retValue;
   }
 
-  public static boolean isEnabled(Map<String, Object> conditionConfigs,
-                                  Map<String, Object> valueConfigs) {
-    boolean allow = toBoolean((String) valueConfigs.get("is_enabled"), true);
-    @SuppressWarnings("unchecked")
-    Map<String, Object> conditions = (Map<String, Object>) conditionConfigs
-      .get("conditions");
-    if (conditions != null && conditions.size() > 0) {
-      allow = false;
-      for (String conditionType : conditions.keySet()) {
-        if (conditionType.equalsIgnoreCase("fields")) {
-          @SuppressWarnings("unchecked")
-          Map<String, Object> fields = (Map<String, Object>) conditions
-            .get("fields");
-          for (String fieldName : fields.keySet()) {
-            Object values = fields.get(fieldName);
-            if (values instanceof String) {
-              allow = isFieldConditionMatch(valueConfigs,
-                fieldName, (String) values);
-            } else {
-              @SuppressWarnings("unchecked")
-              List<String> listValues = (List<String>) values;
-              for (String stringValue : listValues) {
-                allow = isFieldConditionMatch(valueConfigs,
-                  fieldName, stringValue);
-                if (allow) {
-                  break;
-                }
-              }
-            }
-            if (allow) {
-              break;
+  @SuppressWarnings("unchecked")
+  public static boolean isEnabled(Map<String, Object> conditionConfigs, Map<String, Object> valueConfigs) {
+    Map<String, Object> conditions = (Map<String, Object>) conditionConfigs.get("conditions");
+    if (MapUtils.isEmpty(conditions)) {
+      return toBoolean((String) valueConfigs.get("is_enabled"), true);
+    }
+    
+    for (String conditionType : conditions.keySet()) {
+      if (!conditionType.equalsIgnoreCase("fields")) {
+        continue;
+      }
+      
+      Map<String, Object> fields = (Map<String, Object>) conditions.get("fields");
+      for (Map.Entry<String, Object> field : fields.entrySet()) {
+        if (field.getValue() instanceof String) {
+          if (isFieldConditionMatch(valueConfigs, field.getKey(), (String) field.getValue())) {
+            return true;
+          }
+        } else {
+          for (String stringValue : (List<String>) field.getValue()) {
+            if (isFieldConditionMatch(valueConfigs, field.getKey(), stringValue)) {
+              return true;
             }
           }
         }
-        if (allow) {
-          break;
-        }
       }
     }
-    return allow;
+    
+    return false;
   }
 
-  public static boolean isFieldConditionMatch(Map<String, Object> configs,
-                                              String fieldName, String stringValue) {
+  private static boolean isFieldConditionMatch(Map<String, Object> configs, String fieldName, String stringValue) {
     boolean allow = false;
     String fieldValue = (String) configs.get(fieldName);
     if (fieldValue != null && fieldValue.equalsIgnoreCase(stringValue)) {
       allow = true;
     } else {
       @SuppressWarnings("unchecked")
-      Map<String, Object> addFields = (Map<String, Object>) configs
-        .get("add_fields");
+      Map<String, Object> addFields = (Map<String, Object>) configs.get("add_fields");
       if (addFields != null && addFields.get(fieldName) != null) {
         String addFieldValue = (String) addFields.get(fieldName);
         if (stringValue.equalsIgnoreCase(addFieldValue)) {
           allow = true;
         }
       }
-
     }
     return allow;
   }
 
-  public static void logStatForMetric(MetricCount metric, String prefixStr,
-                                      String postFix) {
-    long currStat = metric.count;
+  public static void logStatForMetric(MetricData metric, String prefixStr, String postFix) {
+    long currStat = metric.value;
     long currMS = System.currentTimeMillis();
-    if (currStat > metric.prevLogCount) {
-      if (postFix == null) {
-        postFix = "";
-      }
-      logger.info(prefixStr + ": total_count=" + metric.count
-        + ", duration=" + (currMS - metric.prevLogMS) / 1000
-        + " secs, count=" + (currStat - metric.prevLogCount)
-        + postFix);
+    if (currStat > metric.prevLogValue) {
+      LOG.info(prefixStr + ": total_count=" + metric.value + ", duration=" + (currMS - metric.prevLogTime) / 1000 +
+          " secs, count=" + (currStat - metric.prevLogValue) + postFix);
     }
-    metric.prevLogCount = currStat;
-    metric.prevLogMS = currMS;
+    metric.prevLogValue = currStat;
+    metric.prevLogTime = currMS;
   }
 
   public static Map<String, Object> cloneObject(Map<String, Object> map) {
@@ -336,221 +256,74 @@ public class LogFeederUtil {
       return null;
     }
     String jsonStr = gson.toJson(map);
-    Type type = new TypeToken<Map<String, Object>>() {
-    }.getType();
+    Type type = new TypeToken<Map<String, Object>>() {}.getType();
     return gson.fromJson(jsonStr, type);
   }
 
   public static Map<String, Object> toJSONObject(String jsonStr) {
-    if(jsonStr==null || jsonStr.trim().isEmpty()){
+    if (StringUtils.isBlank(jsonStr)) {
       return new HashMap<String, Object>();
     }
-    Type type = new TypeToken<Map<String, Object>>() {
-    }.getType();
+    Type type = new TypeToken<Map<String, Object>>() {}.getType();
     return gson.fromJson(jsonStr, type);
   }
 
-  static public boolean logErrorMessageByInterval(String key, String message,
-                                                  Throwable e, Logger callerLogger, Level level) {
+  private static class LogHistory {
+    private long lastLogTime = 0;
+    private int counter = 0;
+  }
+
+  private static Map<String, LogHistory> logHistoryList = new Hashtable<String, LogHistory>();
 
+  public static boolean logErrorMessageByInterval(String key, String message, Throwable e, Logger callerLogger, Level level) {
     LogHistory log = logHistoryList.get(key);
     if (log == null) {
       log = new LogHistory();
       logHistoryList.put(key, log);
     }
-    if ((System.currentTimeMillis() - log.lastLogTime) > logInterval) {
+    
+    if ((System.currentTimeMillis() - log.lastLogTime) > 30 * 1000) {
       log.lastLogTime = System.currentTimeMillis();
-      int counter = log.counter;
-      log.counter = 0;
-      if (counter > 0) {
-        message += ". Messages suppressed before: " + counter;
-      }
-      if (e == null) {
-        callerLogger.log(level, message);
-      } else {
-        callerLogger.log(level, message, e);
+      if (log.counter > 0) {
+        message += ". Messages suppressed before: " + log.counter;
       }
+      log.counter = 0;
+      callerLogger.log(level, message, e);
 
       return true;
     } else {
       log.counter++;
-    }
-    return false;
-
-  }
-
-  static public String subString(String str, int maxLength) {
-    if (str == null || str.length() == 0) {
-      return "";
-    }
-    maxLength = str.length() < maxLength ? str.length() : maxLength;
-    return str.substring(0, maxLength);
-  }
-
-  public static long genHash(String value) {
-    if (value == null) {
-      value = "null";
-    }
-    return MurmurHash.hash64A(value.getBytes(), HASH_SEED);
-  }
-
-  private static class LogHistory {
-    private long lastLogTime = 0;
-    private int counter = 0;
-  }
-
-  public static String getDate(String timeStampStr) {
-    try {
-      return dateFormatter.get().format(new Date(Long.parseLong(timeStampStr)));
-    } catch (Exception ex) {
-      logger.error(ex);
-      return null;
+      return false;
     }
   }
 
-  public static String getActualDateStr() {
-    try {
-      return dateFormatter.get().format(new Date());
-    } catch (Exception ex) {
-      logger.error(ex);
-      return null;
-    }
-  }
-
-  public static File getFileFromClasspath(String filename) {
-    URL fileCompleteUrl = Thread.currentThread().getContextClassLoader()
-      .getResource(filename);
-    logger.debug("File Complete URI :" + fileCompleteUrl);
-    File file = null;
-    try {
-      file = new File(fileCompleteUrl.toURI());
-    } catch (Exception exception) {
-      logger.debug(exception.getMessage(), exception.getCause());
-    }
-    return file;
-  }
-
-  public static Object getClassInstance(String classFullName, AliasUtil.ALIAS_TYPE aliasType) {
-    Object instance = null;
-    try {
-      instance = (Object) Class.forName(classFullName).getConstructor().newInstance();
-    } catch (Exception exception) {
-      logger.error("Unsupported class =" + classFullName, exception.getCause());
+  public static boolean isListContains(List<String> list, String str, boolean caseSensitive) {
+    if (list == null) {
+      return false;
     }
-    // check instance class as par aliasType
-    if (instance != null) {
-      boolean isValid = false;
-      switch (aliasType) {
-        case FILTER:
-          isValid = Filter.class.isAssignableFrom(instance.getClass());
-          break;
-        case INPUT:
-          isValid = Input.class.isAssignableFrom(instance.getClass());
-          break;
-        case OUTPUT:
-          isValid = Output.class.isAssignableFrom(instance.getClass());
-          break;
-        case MAPPER:
-          isValid = Mapper.class.isAssignableFrom(instance.getClass());
-          break;
-        default:
-          // by default consider all are valid class
-          isValid = true;
+    
+    for (String value : list) {
+      if (value == null) {
+        continue;
       }
-      if (!isValid) {
-        logger.error("Not a valid class :" + classFullName + " AliasType :" + aliasType.name());
-      }
-    }
-    return instance;
-  }
-
-  public static HashMap<String, Object> readJsonFromFile(File jsonFile) {
-    ObjectMapper mapper = new ObjectMapper();
-    try {
-      HashMap<String, Object> jsonmap = mapper.readValue(jsonFile, new TypeReference<HashMap<String, Object>>() {
-      });
-      return jsonmap;
-    } catch (JsonParseException e) {
-      logger.error(e, e.getCause());
-    } catch (JsonMappingException e) {
-      logger.error(e, e.getCause());
-    } catch (IOException e) {
-      logger.error(e, e.getCause());
-    }
-    return new HashMap<String, Object>();
-  }
-
-  public static boolean isListContains(List<String> list, String str, boolean caseSensitive) {
-    if (list != null) {
-      for (String value : list) {
-        if (value != null) {
-          if (caseSensitive) {
-            if (value.equals(str)) {
-              return true;
-            }
-          } else {
-            if (value.equalsIgnoreCase(str)) {
-              return true;
-            }
-          }
-          if (value.equalsIgnoreCase(LogFeederConstants.ALL)) {
-            return true;
-          }
-        }
+      
+      if (caseSensitive ? value.equals(str) : value.equalsIgnoreCase(str) ||
+          value.equalsIgnoreCase(LogFeederConstants.ALL)) {
+        return true;
       }
     }
     return false;
   }
   
+  private static String logfeederTempDir = null;
   
-  private static synchronized String setHostNameAndIP() {
-    if (hostName == null || ipAddress == null) {
-      try {
-        InetAddress ip = InetAddress.getLocalHost();
-        ipAddress = ip.getHostAddress();
-        String getHostName = ip.getHostName();
-        String getCanonicalHostName = ip.getCanonicalHostName();
-        if (!getCanonicalHostName.equalsIgnoreCase(ipAddress)) {
-          logger.info("Using getCanonicalHostName()=" + getCanonicalHostName);
-          hostName = getCanonicalHostName;
-        } else {
-          logger.info("Using getHostName()=" + getHostName);
-          hostName = getHostName;
-        }
-        logger.info("ipAddress=" + ipAddress + ", getHostName=" + getHostName
-            + ", getCanonicalHostName=" + getCanonicalHostName + ", hostName="
-            + hostName);
-      } catch (UnknownHostException e) {
-        logger.error("Error getting hostname.", e);
-      }
-    }
-    return hostName;
-  }
-
-  public static String[] mergeArray(String[] first, String[] second) {
-    if (first == null) {
-      first = new String[0];
-    }
-    if (second == null) {
-      second = new String[0];
-    }
-    String[] mergedArray = ObjectArrays.concat(first, second, String.class);
-    return mergedArray;
-  }
-  
-  public static String getLogfeederTempDir() {
+  public synchronized static String getLogfeederTempDir() {
     if (logfeederTempDir == null) {
-      synchronized (_LOCK) {
-        if (logfeederTempDir == null) {
-          String tempDirValue = getStringProperty("logfeeder.tmp.dir",
-              "/tmp/$username/logfeeder/");
-          HashMap<String, String> contextParam = new HashMap<String, String>();
-          String username = System.getProperty("user.name");
-          contextParam.put("username", username);
-          logfeederTempDir = PlaceholderUtil.replaceVariables(tempDirValue,
-              contextParam);
-        }
-      }
+      String tempDirValue = getStringProperty("logfeeder.tmp.dir", "/tmp/$username/logfeeder/");
+      HashMap<String, String> contextParam = new HashMap<String, String>();
+      String username = System.getProperty("user.name");
+      contextParam.put("username", username);
+      logfeederTempDir = PlaceholderUtil.replaceVariables(tempDirValue, contextParam);
     }
     return logfeederTempDir;
   }

http://git-wip-us.apache.org/repos/asf/ambari/blob/1b07a6dd/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/util/LogfeederHDFSUtil.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/util/LogfeederHDFSUtil.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/util/LogfeederHDFSUtil.java
index fd96f8a..c975b99 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/util/LogfeederHDFSUtil.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/util/LogfeederHDFSUtil.java
@@ -25,71 +25,53 @@ import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
 import org.apache.log4j.Logger;
 
-public enum LogfeederHDFSUtil {
-  INSTANCE;
-  private static Logger logger = Logger.getLogger(LogfeederHDFSUtil.class);
+public class LogfeederHDFSUtil {
+  private static final Logger LOG = Logger.getLogger(LogfeederHDFSUtil.class);
 
-  public void createHDFSDir(String dirPath, FileSystem dfs) {
-    Path src = new Path(dirPath);
-    try {
-      if (dfs.isDirectory(src)) {
-        logger.info("hdfs dir dirPath=" + dirPath + "  is already exist.");
-        return;
-      }
-      boolean isDirCreated = dfs.mkdirs(src);
-      if (isDirCreated) {
-        logger.debug("HDFS dirPath=" + dirPath + " created successfully.");
-      } else {
-        logger.warn("HDFS dir creation failed dirPath=" + dirPath);
-      }
-    } catch (IOException e) {
-      logger.error("HDFS dir creation failed dirPath=" + dirPath, e.getCause());
-    }
+  private LogfeederHDFSUtil() {
+    throw new UnsupportedOperationException();
   }
-
-  public boolean copyFromLocal(String sourceFilepath, String destFilePath,
-      FileSystem fileSystem, boolean overwrite, boolean delSrc) {
+  
+  public static boolean copyFromLocal(String sourceFilepath, String destFilePath, FileSystem fileSystem, boolean overwrite,
+      boolean delSrc) {
     Path src = new Path(sourceFilepath);
     Path dst = new Path(destFilePath);
     boolean isCopied = false;
     try {
-      logger.info("copying localfile := " + sourceFilepath + " to hdfsPath := "
-          + destFilePath);
+      LOG.info("copying localfile := " + sourceFilepath + " to hdfsPath := " + destFilePath);
       fileSystem.copyFromLocalFile(delSrc, overwrite, src, dst);
       isCopied = true;
     } catch (Exception e) {
-      logger.error("Error copying local file :" + sourceFilepath
-          + " to hdfs location : " + destFilePath, e);
+      LOG.error("Error copying local file :" + sourceFilepath + " to hdfs location : " + destFilePath, e);
     }
     return isCopied;
   }
 
-  public FileSystem buildFileSystem(String hdfsHost, String hdfsPort) {
+  public static FileSystem buildFileSystem(String hdfsHost, String hdfsPort) {
     try {
       Configuration configuration = buildHdfsConfiguration(hdfsHost, hdfsPort);
       FileSystem fs = FileSystem.get(configuration);
       return fs;
     } catch (Exception e) {
-      logger.error("Exception is buildFileSystem :", e);
+      LOG.error("Exception is buildFileSystem :", e);
     }
     return null;
   }
 
-  public void closeFileSystem(FileSystem fileSystem) {
+  private static Configuration buildHdfsConfiguration(String hdfsHost, String hdfsPort) {
+    String url = "hdfs://" + hdfsHost + ":" + hdfsPort + "/";
+    Configuration configuration = new Configuration();
+    configuration.set("fs.default.name", url);
+    return configuration;
+  }
+
+  public static void closeFileSystem(FileSystem fileSystem) {
     if (fileSystem != null) {
       try {
         fileSystem.close();
       } catch (IOException e) {
-        logger.error(e.getLocalizedMessage(), e.getCause());
+        LOG.error(e.getLocalizedMessage(), e.getCause());
       }
     }
   }
-
-  public Configuration buildHdfsConfiguration(String hdfsHost, String hdfsPort) {
-    String url = "hdfs://" + hdfsHost + ":" + hdfsPort + "/";
-    Configuration configuration = new Configuration();
-    configuration.set("fs.default.name", url);
-    return configuration;
-  }
-
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/1b07a6dd/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/util/PlaceholderUtil.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/util/PlaceholderUtil.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/util/PlaceholderUtil.java
index d6c3117..13f2865 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/util/PlaceholderUtil.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/util/PlaceholderUtil.java
@@ -1,4 +1,4 @@
-/**
+/*
  * 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
@@ -21,38 +21,34 @@ import java.util.HashMap;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
-public class PlaceholderUtil {
+import org.apache.commons.lang3.StringUtils;
 
-  private static Pattern placeHolderPattern;
-  static {
-    placeHolderPattern = Pattern.compile("\\$\\s*(\\w+)");
+public class PlaceholderUtil {
+  private PlaceholderUtil() {
+    throw new UnsupportedOperationException();
   }
+  
+  private static final Pattern placeHolderPattern = Pattern.compile("\\$\\s*(\\w+)");
 
-  public static String replaceVariables(String inputStr,
-      HashMap<String, String> contextParam) {
+  public static String replaceVariables(String inputStr, HashMap<String, String> contextParam) {
     Matcher m = placeHolderPattern.matcher(inputStr);
-    String placeholder;
-    String replacement;
     String output = new String(inputStr);
     while (m.find()) {
-      placeholder = m.group();
+      String placeholder = m.group();
       if (placeholder != null && !placeholder.isEmpty()) {
-        String key = placeholder.replace("$","").toLowerCase();// remove
-                                                                   // brace
-        replacement = getFromContext(contextParam, placeholder, key);
+        String key = placeholder.replace("$","").toLowerCase();// remove brace
+        String replacement = getFromContext(contextParam, placeholder, key);
         output = output.replace(placeholder, replacement);
       }
     }
     return output;
   }
 
-  private static String getFromContext(HashMap<String, String> contextParam,
-      String defaultValue, String key) {
-    String returnValue = defaultValue;// by default set default value as a
-                                      // return
+  private static String getFromContext(HashMap<String, String> contextParam, String defaultValue, String key) {
+    String returnValue = defaultValue; // by default set default value as a return
     if (contextParam != null) {
       String value = contextParam.get(key);
-      if (value != null && !value.trim().isEmpty()) {
+      if (StringUtils.isNotBlank(value)) {
         returnValue = value;
       }
     }

http://git-wip-us.apache.org/repos/asf/ambari/blob/1b07a6dd/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/util/S3Util.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/util/S3Util.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/util/S3Util.java
index 10ea2c2..31a38d0 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/util/S3Util.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/util/S3Util.java
@@ -19,7 +19,6 @@
 package org.apache.ambari.logfeeder.util;
 
 import java.io.BufferedReader;
-import java.io.File;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.InputStreamReader;
@@ -27,6 +26,7 @@ import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.zip.GZIPInputStream;
 
+import org.apache.ambari.logfeeder.common.LogFeederConstants;
 import org.apache.commons.io.IOUtils;
 import org.apache.log4j.Logger;
 
@@ -39,22 +39,19 @@ import com.amazonaws.services.s3.model.ObjectMetadata;
 import com.amazonaws.services.s3.model.PutObjectRequest;
 import com.amazonaws.services.s3.model.S3Object;
 import com.amazonaws.services.s3.transfer.TransferManager;
-import com.amazonaws.services.s3.transfer.Upload;
 
 /**
  * Utility to connect to s3
  */
 public class S3Util {
-  public static final S3Util INSTANCE = new S3Util();
-
   private static final Logger LOG = Logger.getLogger(S3Util.class);
 
-  public static final String S3_PATH_START_WITH = "s3://";
-  public static final String S3_PATH_SEPARATOR = "/";
-
-  public AmazonS3 getS3Client(String accessKey, String secretKey) {
-    AWSCredentials awsCredentials = AWSUtil.INSTANCE.createAWSCredentials(
-        accessKey, secretKey);
+  private S3Util() {
+    throw new UnsupportedOperationException();
+  }
+  
+  public static AmazonS3 getS3Client(String accessKey, String secretKey) {
+    AWSCredentials awsCredentials = AWSUtil.createAWSCredentials(accessKey, secretKey);
     AmazonS3 s3client;
     if (awsCredentials != null) {
       s3client = new AmazonS3Client(awsCredentials);
@@ -64,9 +61,8 @@ public class S3Util {
     return s3client;
   }
 
-  public TransferManager getTransferManager(String accessKey, String secretKey) {
-    AWSCredentials awsCredentials = AWSUtil.INSTANCE.createAWSCredentials(
-        accessKey, secretKey);
+  public static TransferManager getTransferManager(String accessKey, String secretKey) {
+    AWSCredentials awsCredentials = AWSUtil.createAWSCredentials(accessKey, secretKey);
     TransferManager transferManager;
     if (awsCredentials != null) {
       transferManager = new TransferManager(awsCredentials);
@@ -76,35 +72,31 @@ public class S3Util {
     return transferManager;
   }
 
-  public void shutdownTransferManager(TransferManager transferManager) {
+  public static void shutdownTransferManager(TransferManager transferManager) {
     if (transferManager != null) {
       transferManager.shutdownNow();
     }
   }
 
-  public String getBucketName(String s3Path) {
+  public static String getBucketName(String s3Path) {
     String bucketName = null;
     // s3path
     if (s3Path != null) {
-      String[] s3PathParts = s3Path.replace(S3_PATH_START_WITH, "").split(
-          S3_PATH_SEPARATOR);
+      String[] s3PathParts = s3Path.replace(LogFeederConstants.S3_PATH_START_WITH, "").split(LogFeederConstants.S3_PATH_SEPARATOR);
       bucketName = s3PathParts[0];
     }
     return bucketName;
   }
 
-  public String getS3Key(String s3Path) {
+  public static String getS3Key(String s3Path) {
     StringBuilder s3Key = new StringBuilder();
-    // s3path
     if (s3Path != null) {
-      String[] s3PathParts = s3Path.replace(S3_PATH_START_WITH, "").split(
-          S3_PATH_SEPARATOR);
-      ArrayList<String> s3PathList = new ArrayList<String>(
-          Arrays.asList(s3PathParts));
+      String[] s3PathParts = s3Path.replace(LogFeederConstants.S3_PATH_START_WITH, "").split(LogFeederConstants.S3_PATH_SEPARATOR);
+      ArrayList<String> s3PathList = new ArrayList<String>(Arrays.asList(s3PathParts));
       s3PathList.remove(0);// remove bucketName
       for (int index = 0; index < s3PathList.size(); index++) {
         if (index > 0) {
-          s3Key.append(S3_PATH_SEPARATOR);
+          s3Key.append(LogFeederConstants.S3_PATH_SEPARATOR);
         }
         s3Key.append(s3PathList.get(index));
       }
@@ -112,63 +104,41 @@ public class S3Util {
     return s3Key.toString();
   }
 
-  public void uploadFileTos3(String bucketName, String s3Key, File localFile,
-      String accessKey, String secretKey) {
-    TransferManager transferManager = getTransferManager(accessKey, secretKey);
-    try {
-      Upload upload = transferManager.upload(bucketName, s3Key, localFile);
-      upload.waitForUploadResult();
-    } catch (AmazonClientException | InterruptedException e) {
-      LOG.error("s3 uploading failed for file :" + localFile.getAbsolutePath(),
-          e);
-    } finally {
-      shutdownTransferManager(transferManager);
-    }
-  }
-
   /**
    * Get the buffer reader to read s3 file as a stream
    */
-  public BufferedReader getReader(String s3Path, String accessKey,
-      String secretKey) throws IOException {
+  public static BufferedReader getReader(String s3Path, String accessKey, String secretKey) throws IOException {
     // TODO error handling
     // Compression support
     // read header and decide the compression(auto detection)
     // For now hard-code GZIP compression
     String s3Bucket = getBucketName(s3Path);
     String s3Key = getS3Key(s3Path);
-    S3Object fileObj = getS3Client(accessKey, secretKey).getObject(
-        new GetObjectRequest(s3Bucket, s3Key));
-    GZIPInputStream objectInputStream;
+    S3Object fileObj = getS3Client(accessKey, secretKey).getObject(new GetObjectRequest(s3Bucket, s3Key));
     try {
-      objectInputStream = new GZIPInputStream(fileObj.getObjectContent());
-      BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(
-          objectInputStream));
+      GZIPInputStream objectInputStream = new GZIPInputStream(fileObj.getObjectContent());
+      BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(objectInputStream));
       return bufferedReader;
     } catch (IOException e) {
-      LOG.error("Error in creating stream reader for s3 file :" + s3Path,
-          e.getCause());
+      LOG.error("Error in creating stream reader for s3 file :" + s3Path, e.getCause());
       throw e;
     }
   }
 
-  public void writeIntoS3File(String data, String bucketName, String s3Key,
-      String accessKey, String secretKey) {
+  public static void writeIntoS3File(String data, String bucketName, String s3Key, String accessKey, String secretKey) {
     InputStream in = null;
     try {
       in = IOUtils.toInputStream(data, "UTF-8");
     } catch (IOException e) {
       LOG.error(e);
     }
+    
     if (in != null) {
       TransferManager transferManager = getTransferManager(accessKey, secretKey);
       try {
         if (transferManager != null) {
-          transferManager.upload(
-                  new PutObjectRequest(bucketName, s3Key, in,
-                  new ObjectMetadata())).waitForUploadResult();
-          LOG.debug("Data Uploaded to s3 file :" + s3Key + " in bucket :"
-              + bucketName);
+          transferManager.upload(new PutObjectRequest(bucketName, s3Key, in, new ObjectMetadata())).waitForUploadResult();
+          LOG.debug("Data Uploaded to s3 file :" + s3Key + " in bucket :" + bucketName);
         }
       } catch (AmazonClientException | InterruptedException e) {
         LOG.error(e);
@@ -182,5 +152,4 @@ public class S3Util {
       }
     }
   }
-
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/1b07a6dd/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/util/SolrUtil.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/util/SolrUtil.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/util/SolrUtil.java
deleted file mode 100644
index 44113e1..0000000
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/util/SolrUtil.java
+++ /dev/null
@@ -1,186 +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.logfeeder.util;
-
-import java.io.IOException;
-import java.util.HashMap;
-
-import org.apache.ambari.logfeeder.logconfig.LogFeederConstants;
-import org.apache.log4j.Level;
-import org.apache.log4j.Logger;
-import org.apache.solr.client.solrj.SolrClient;
-import org.apache.solr.client.solrj.SolrQuery;
-import org.apache.solr.client.solrj.SolrServerException;
-import org.apache.solr.client.solrj.SolrRequest.METHOD;
-import org.apache.solr.client.solrj.impl.CloudSolrClient;
-import org.apache.solr.client.solrj.impl.HttpSolrClient;
-import org.apache.solr.client.solrj.request.CollectionAdminRequest;
-import org.apache.solr.client.solrj.response.CollectionAdminResponse;
-import org.apache.solr.client.solrj.response.QueryResponse;
-import org.apache.solr.common.SolrDocument;
-import org.apache.solr.common.SolrDocumentList;
-import org.apache.solr.common.SolrException;
-
-public class SolrUtil {
-
-  private static final Logger logger = Logger.getLogger(SolrUtil.class);
-
-  private static SolrUtil instance = null;
-  
-  private SolrClient solrClient = null;
-  private CloudSolrClient solrClouldClient = null;
-
-  private String solrDetail = "";
-
-  private SolrUtil() throws Exception {
-    String url = LogFeederUtil.getStringProperty("logfeeder.solr.url");
-    String zkConnectString = LogFeederUtil.getStringProperty("logfeeder.solr.zk_connect_string");
-    String collection = LogFeederUtil.getStringProperty("logfeeder.solr.core.config.name", "history");
-    connectToSolr(url, zkConnectString, collection);
-  }
-
-  public static SolrUtil getInstance() {
-    if (instance == null) {
-      synchronized (SolrUtil.class) {
-        if (instance == null) {
-          try {
-            instance = new SolrUtil();
-          } catch (Exception e) {
-            final String LOG_MESSAGE_KEY = SolrUtil.class
-                .getSimpleName() + "_SOLR_UTIL";
-              LogFeederUtil.logErrorMessageByInterval(
-                LOG_MESSAGE_KEY,
-                "Error constructing solrUtil", e, logger,
-                Level.WARN);
-          }
-        }
-      }
-    }
-    return instance;
-  }
-
-  private SolrClient connectToSolr(String url, String zkConnectString,
-                                  String collection) throws Exception {
-    solrDetail = "zkConnectString=" + zkConnectString + ", collection=" + collection
-      + ", url=" + url;
-
-    logger.info("connectToSolr() " + solrDetail);
-    if (collection == null || collection.isEmpty()) {
-      throw new Exception("For solr, collection name is mandatory. "
-        + solrDetail);
-    }
-    if (zkConnectString != null && !zkConnectString.isEmpty()) {
-      solrDetail = "zkConnectString=" + zkConnectString + ", collection=" + collection;
-      logger.info("Using zookeepr. " + solrDetail);
-      solrClouldClient = new CloudSolrClient(zkConnectString);
-      solrClouldClient.setDefaultCollection(collection);
-      solrClient = solrClouldClient;
-      int waitDurationMS = 3 * 60 * 1000;
-      checkSolrStatus(waitDurationMS);
-    } else {
-      if (url == null || url.trim().isEmpty()) {
-        throw new Exception("Both zkConnectString and URL are empty. zkConnectString="
-          + zkConnectString + ", collection=" + collection + ", url="
-          + url);
-      }
-      solrDetail = "collection=" + collection + ", url=" + url;
-      String collectionURL = url + "/" + collection;
-      logger.info("Connecting to  solr : " + collectionURL);
-      solrClient = new HttpSolrClient(collectionURL);
-
-    }
-    return solrClient;
-  }
-
-  private boolean checkSolrStatus(int waitDurationMS) {
-    boolean status = false;
-    try {
-      long beginTimeMS = System.currentTimeMillis();
-      long waitIntervalMS = 2000;
-      int pingCount = 0;
-      while (true) {
-        pingCount++;
-        CollectionAdminResponse response = null;
-        try {
-          CollectionAdminRequest.List colListReq = new CollectionAdminRequest.List();
-          response = colListReq.process(solrClient);
-        } catch (Exception ex) {
-          logger.error("Con't connect to Solr. solrDetail=" + solrDetail, ex);
-        }
-        if (response != null && response.getStatus() == 0) {
-          logger.info("Solr getCollections() is success. solr=" + solrDetail);
-          status = true;
-          break;
-        }
-        if (System.currentTimeMillis() - beginTimeMS > waitDurationMS) {
-          logger.error("Solr is not reachable even after "
-            + (System.currentTimeMillis() - beginTimeMS)
-            + " ms. If you are using alias, then you might have to restart LogSearch after Solr is up and running. solr="
-            + solrDetail + ", response=" + response);
-          break;
-        } else {
-          logger.warn("Solr is not reachable yet. getCollections() attempt count=" + pingCount
-            + ". Will sleep for " + waitIntervalMS + " ms and try again." + " solr=" + solrDetail
-            + ", response=" + response);
-
-        }
-        Thread.sleep(waitIntervalMS);
-      }
-    } catch (Throwable t) {
-      logger.error("Seems Solr is not up. solrDetail=" + solrDetail);
-    }
-    return status;
-  }
-
-  private QueryResponse process(SolrQuery solrQuery) throws SolrServerException, IOException, SolrException {
-    if (solrClient != null) {
-      QueryResponse queryResponse = solrClient.query(solrQuery, METHOD.POST);
-      return queryResponse;
-    } else {
-      logger.error("solrClient can't be null");
-      return null;
-    }
-  }
-
-  public HashMap<String, Object> getConfigDoc() {
-    HashMap<String, Object> configMap = new HashMap<String, Object>();
-    SolrQuery solrQuery = new SolrQuery();
-    solrQuery.setQuery("*:*");
-    String fq = LogFeederConstants.ROW_TYPE + ":" + LogFeederConstants.LOGFEEDER_FILTER_NAME;
-    solrQuery.setFilterQueries(fq);
-    try {
-      QueryResponse response = process(solrQuery);
-      if (response != null) {
-        SolrDocumentList documentList = response.getResults();
-        if (documentList != null && documentList.size() > 0) {
-          SolrDocument configDoc = documentList.get(0);
-          String configJson = LogFeederUtil.getGson().toJson(configDoc);
-          configMap = (HashMap<String, Object>) LogFeederUtil
-              .toJSONObject(configJson);
-        }
-      }
-    } catch (Exception e) {
-      final String logMessageKey = this.getClass().getSimpleName()
-          + "_FETCH_FILTER_CONFIG_ERROR";
-      LogFeederUtil.logErrorMessageByInterval(logMessageKey,
-          "Error getting filter config from solr", e, logger, Level.ERROR);
-    }
-    return configMap;
-  }
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/1b07a6dd/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/view/VLogfeederFilter.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/view/VLogfeederFilter.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/view/VLogfeederFilter.java
deleted file mode 100644
index f030040..0000000
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/view/VLogfeederFilter.java
+++ /dev/null
@@ -1,90 +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.logfeeder.view;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlRootElement;
-
-import org.codehaus.jackson.annotate.JsonAutoDetect;
-import org.codehaus.jackson.annotate.JsonAutoDetect.Visibility;
-import org.codehaus.jackson.map.annotate.JsonSerialize;
-
-@JsonAutoDetect(getterVisibility = Visibility.NONE, setterVisibility = Visibility.NONE, fieldVisibility = Visibility.ANY)
-@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
-@XmlRootElement
-@XmlAccessorType(XmlAccessType.FIELD)
-public class VLogfeederFilter {
-
-  private String label;
-  private List<String> hosts;
-  private List<String> defaultLevels;
-  private List<String> overrideLevels;
-  private String expiryTime;
-
-  public VLogfeederFilter() {
-    hosts = new ArrayList<String>();
-    defaultLevels = new ArrayList<String>();
-    overrideLevels = new ArrayList<String>();
-  }
-
-  public String getLabel() {
-    return label;
-  }
-
-  public void setLabel(String label) {
-    this.label = label;
-  }
-
-  public List<String> getHosts() {
-    return hosts;
-  }
-
-  public void setHosts(List<String> hosts) {
-    this.hosts = hosts;
-  }
-
-  public List<String> getDefaultLevels() {
-    return defaultLevels;
-  }
-
-  public void setDefaultLevels(List<String> defaultLevels) {
-    this.defaultLevels = defaultLevels;
-  }
-
-  public List<String> getOverrideLevels() {
-    return overrideLevels;
-  }
-
-  public void setOverrideLevels(List<String> overrideLevels) {
-    this.overrideLevels = overrideLevels;
-  }
-
-  public String getExpiryTime() {
-    return expiryTime;
-  }
-
-  public void setExpiryTime(String expiryTime) {
-    this.expiryTime = expiryTime;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/1b07a6dd/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/view/VLogfeederFilterWrapper.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/view/VLogfeederFilterWrapper.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/view/VLogfeederFilterWrapper.java
deleted file mode 100644
index 4ddef3f..0000000
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/view/VLogfeederFilterWrapper.java
+++ /dev/null
@@ -1,55 +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.logfeeder.view;
-
-import java.util.HashMap;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlRootElement;
-
-import org.codehaus.jackson.annotate.JsonAutoDetect;
-import org.codehaus.jackson.annotate.JsonAutoDetect.Visibility;
-import org.codehaus.jackson.map.annotate.JsonSerialize;
-
-@JsonAutoDetect(getterVisibility = Visibility.NONE, setterVisibility = Visibility.NONE, fieldVisibility = Visibility.ANY)
-@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
-@XmlRootElement
-@XmlAccessorType(XmlAccessType.FIELD)
-public class VLogfeederFilterWrapper {
-
-  private HashMap<String, VLogfeederFilter> filter;
-  private String id;
-
-  public HashMap<String, VLogfeederFilter> getFilter() {
-    return filter;
-  }
-
-  public void setFilter(HashMap<String, VLogfeederFilter> filter) {
-    this.filter = filter;
-  }
-
-  public String getId() {
-    return id;
-  }
-
-  public void setId(String id) {
-    this.id = id;
-  }
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/1b07a6dd/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/AppTest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/AppTest.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/AppTest.java
deleted file mode 100644
index 193cb48..0000000
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/AppTest.java
+++ /dev/null
@@ -1,116 +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.logfeeder;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.ambari.logfeeder.filter.FilterGrok;
-import org.apache.log4j.Logger;
-
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
-/**
- * Unit test for simple App.
- */
-public class AppTest extends TestCase {
-  static Logger logger = Logger.getLogger(AppTest.class);
-
-  /**
-   * Create the test case
-   *
-   * @param testName name of the test case
-   */
-  public AppTest(String testName) {
-    super(testName);
-  }
-
-  /**
-   * @return the suite of tests being tested
-   */
-  public static Test suite() {
-    return new TestSuite(AppTest.class);
-  }
-
-  /**
-   * Rigourous Test :-)
-   */
-  public void testApp() {
-    assertTrue(true);
-  }
-
-  public void testGrok() {
-    logger.info("testGrok()");
-    FilterGrok grokFilter = new FilterGrok();
-    try {
-      Map<String, Object> map = new HashMap<String, Object>();
-      map.put("message_pattern",
-        "^%{LOGLEVEL:level}%{SPACE}%{GREEDYDATA:log_message}");
-      grokFilter.loadConfig(map);
-      grokFilter.init();
-      String out = grokFilter.grokParse("INFO This is a test");
-      logger.info("out=" + out);
-
-    } catch (Exception e) {
-      // TODO Auto-generated catch block
-      e.printStackTrace();
-      assertFalse(true);
-    }
-
-    assertTrue(true);
-  }
-
-  public void testGrokUGI() {
-    logger.info("testGrok()");
-    String[] ugis = new String[]{"user1@xyz.com (auth:TOKEN)",
-      "ambari-qa@example.com (auth:kerberos)",
-      "my_user@example.com (auth:kerberos)",
-      "hive/bdurai-dojran-2.novalocal@example.com (auth:kerberos)",
-      "just_me",
-      "ambari-qa (auth:PROXY) via hive/myhost.novalocal@EXAMPLE.COM (auth:KERBEROS)"};
-
-    FilterGrok grokFilter = new FilterGrok();
-    try {
-      Map<String, Object> map = new HashMap<String, Object>();
-      // map.put("message_pattern",
-      // "(?<user>([\\w\\d\\-]+))\\/|(?<user>([\\w\\d\\-]+))@|(?<user>([\\w\\d\\-]+))/[\\w\\d\\-.]+@|(?<user>([\\w\\d.\\-_]+))[\\s(]+");
-      // map.put("message_pattern",
-      // "(?<user>([\\w\\d\\-]+))/[\\w\\d\\-.]+@");
-      // *(auth:(?<auth>[\\w\\d\\-]+))
-      // GOOD: map.put("message_pattern", "(?<user>([\\w\\d\\-]+)).+auth:(?<auth>([\\w\\d\\-]+))");
-      // OK: map.put("message_pattern", "(?<user>([\\w\\d\\-]+)).+auth:(?<auth>([\\w\\d\\-]+))|%{USERNAME:xuser}");
-      //map.put("message_pattern", "%{USERNAME:user}.+auth:%{USERNAME:authType}|%{USERNAME:x_user}");
-      map.put("message_pattern", "%{USERNAME:p_user}.+auth:%{USERNAME:p_authType}.+via %{USERNAME:k_user}.+auth:%{USERNAME:k_authType}|%{USERNAME:user}.+auth:%{USERNAME:authType}|%{USERNAME:x_user}");
-      grokFilter.loadConfig(map);
-      grokFilter.init();
-      for (String ugi : ugis) {
-        String out = grokFilter.grokParse(ugi);
-        logger.info(ugi + "=" + out);
-      }
-
-    } catch (Exception e) {
-      // TODO Auto-generated catch block
-      e.printStackTrace();
-      assertFalse(true);
-    }
-    assertTrue(true);
-  }
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/1b07a6dd/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/filter/FilterGrokTest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/filter/FilterGrokTest.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/filter/FilterGrokTest.java
index 3aa8d7b..99565c5 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/filter/FilterGrokTest.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/filter/FilterGrokTest.java
@@ -1,4 +1,4 @@
-/**
+/*
  * 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
@@ -23,7 +23,7 @@ import java.util.Map;
 
 import org.apache.ambari.logfeeder.input.Input;
 import org.apache.ambari.logfeeder.input.InputMarker;
-import org.apache.ambari.logfeeder.output.OutputMgr;
+import org.apache.ambari.logfeeder.output.OutputManager;
 import org.apache.log4j.Logger;
 import org.easymock.Capture;
 import org.easymock.CaptureType;
@@ -40,16 +40,16 @@ public class FilterGrokTest {
   private static final Logger LOG = Logger.getLogger(FilterGrokTest.class);
 
   private FilterGrok filterGrok;
-  private OutputMgr mockOutputMgr;
+  private OutputManager mockOutputManager;
   private Capture<Map<String, Object>> capture;
 
   public void init(Map<String, Object> config) throws Exception {
-    mockOutputMgr = EasyMock.strictMock(OutputMgr.class);
+    mockOutputManager = EasyMock.strictMock(OutputManager.class);
     capture = EasyMock.newCapture(CaptureType.LAST);
 
     filterGrok = new FilterGrok();
     filterGrok.loadConfig(config);
-    filterGrok.setOutputMgr(mockOutputMgr);
+    filterGrok.setOutputManager(mockOutputManager);
     filterGrok.setInput(EasyMock.mock(Input.class));
     filterGrok.init();
   }
@@ -59,19 +59,18 @@ public class FilterGrokTest {
     LOG.info("testFilterGrok_parseMessage()");
 
     Map<String, Object> config = new HashMap<String, Object>();
-    config.put("message_pattern",
-        "(?m)^%{TIMESTAMP_ISO8601:logtime}%{SPACE}%{LOGLEVEL:level}%{SPACE}%{GREEDYDATA:log_message}");
+    config.put("message_pattern", "(?m)^%{TIMESTAMP_ISO8601:logtime}%{SPACE}%{LOGLEVEL:level}%{SPACE}%{GREEDYDATA:log_message}");
     config.put("multiline_pattern", "^(%{TIMESTAMP_ISO8601:logtime})");
     init(config);
 
-    mockOutputMgr.write(EasyMock.capture(capture), EasyMock.anyObject(InputMarker.class));
+    mockOutputManager.write(EasyMock.capture(capture), EasyMock.anyObject(InputMarker.class));
     EasyMock.expectLastCall();
-    EasyMock.replay(mockOutputMgr);
+    EasyMock.replay(mockOutputManager);
 
-    filterGrok.apply("2016-04-08 15:55:23,548 INFO This is a test", new InputMarker());
-    filterGrok.apply("2016-04-08 15:55:24,548 WARN Next message", new InputMarker());
+    filterGrok.apply("2016-04-08 15:55:23,548 INFO This is a test", new InputMarker(null, null, 0));
+    filterGrok.apply("2016-04-08 15:55:24,548 WARN Next message", new InputMarker(null, null, 0));
 
-    EasyMock.verify(mockOutputMgr);
+    EasyMock.verify(mockOutputManager);
     Map<String, Object> jsonParams = capture.getValue();
 
     assertNotNull(jsonParams);
@@ -86,23 +85,22 @@ public class FilterGrokTest {
     LOG.info("testFilterGrok_parseMultiLineMessage()");
 
     Map<String, Object> config = new HashMap<String, Object>();
-    config.put("message_pattern",
-        "(?m)^%{TIMESTAMP_ISO8601:logtime}%{SPACE}%{LOGLEVEL:level}%{SPACE}%{GREEDYDATA:log_message}");
+    config.put("message_pattern", "(?m)^%{TIMESTAMP_ISO8601:logtime}%{SPACE}%{LOGLEVEL:level}%{SPACE}%{GREEDYDATA:log_message}");
     config.put("multiline_pattern", "^(%{TIMESTAMP_ISO8601:logtime})");
     init(config);
 
-    mockOutputMgr.write(EasyMock.capture(capture), EasyMock.anyObject(InputMarker.class));
+    mockOutputManager.write(EasyMock.capture(capture), EasyMock.anyObject(InputMarker.class));
     EasyMock.expectLastCall();
-    EasyMock.replay(mockOutputMgr);
+    EasyMock.replay(mockOutputManager);
 
     String multiLineMessage = "This is a multiline test message\r\n" + "having multiple lines\r\n"
         + "as one may expect";
     String[] messageLines = multiLineMessage.split("\r\n");
     for (int i = 0; i < messageLines.length; i++)
-      filterGrok.apply((i == 0 ? "2016-04-08 15:55:23,548 INFO " : "") + messageLines[i], new InputMarker());
+      filterGrok.apply((i == 0 ? "2016-04-08 15:55:23,548 INFO " : "") + messageLines[i], new InputMarker(null, null, 0));
     filterGrok.flush();
 
-    EasyMock.verify(mockOutputMgr);
+    EasyMock.verify(mockOutputManager);
     Map<String, Object> jsonParams = capture.getValue();
 
     assertNotNull(jsonParams);
@@ -117,19 +115,18 @@ public class FilterGrokTest {
     LOG.info("testFilterGrok_notMatchingMesagePattern()");
 
     Map<String, Object> config = new HashMap<String, Object>();
-    config.put("message_pattern",
-        "(?m)^%{TIMESTAMP_ISO8601:logtime}%{SPACE}%{LOGLEVEL:level}%{SPACE}%{GREEDYDATA:log_message}");
+    config.put("message_pattern", "(?m)^%{TIMESTAMP_ISO8601:logtime}%{SPACE}%{LOGLEVEL:level}%{SPACE}%{GREEDYDATA:log_message}");
     config.put("multiline_pattern", "^(%{TIMESTAMP_ISO8601:logtime})");
     init(config);
 
-    mockOutputMgr.write(EasyMock.capture(capture), EasyMock.anyObject(InputMarker.class));
+    mockOutputManager.write(EasyMock.capture(capture), EasyMock.anyObject(InputMarker.class));
     EasyMock.expectLastCall().anyTimes();
-    EasyMock.replay(mockOutputMgr);
+    EasyMock.replay(mockOutputManager);
 
-    filterGrok.apply("04/08/2016 15:55:23,548 INFO This is a test", new InputMarker());
-    filterGrok.apply("04/08/2016 15:55:24,548 WARN Next message", new InputMarker());
+    filterGrok.apply("04/08/2016 15:55:23,548 INFO This is a test", new InputMarker(null, null, 0));
+    filterGrok.apply("04/08/2016 15:55:24,548 WARN Next message", new InputMarker(null, null, 0));
 
-    EasyMock.verify(mockOutputMgr);
+    EasyMock.verify(mockOutputManager);
     assertFalse("Something was captured!", capture.hasCaptured());
   }
 
@@ -141,12 +138,12 @@ public class FilterGrokTest {
     config.put("multiline_pattern", "^(%{TIMESTAMP_ISO8601:logtime})");
     init(config);
 
-    EasyMock.replay(mockOutputMgr);
+    EasyMock.replay(mockOutputManager);
 
-    filterGrok.apply("2016-04-08 15:55:23,548 INFO This is a test", new InputMarker());
-    filterGrok.apply("2016-04-08 15:55:24,548 WARN Next message", new InputMarker());
+    filterGrok.apply("2016-04-08 15:55:23,548 INFO This is a test", new InputMarker(null, null, 0));
+    filterGrok.apply("2016-04-08 15:55:24,548 WARN Next message", new InputMarker(null, null, 0));
 
-    EasyMock.verify(mockOutputMgr);
+    EasyMock.verify(mockOutputManager);
     assertFalse("Something was captured", capture.hasCaptured());
   }
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/1b07a6dd/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/filter/FilterJSONTest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/filter/FilterJSONTest.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/filter/FilterJSONTest.java
index 64e9b69..06d8db2 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/filter/FilterJSONTest.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/filter/FilterJSONTest.java
@@ -1,4 +1,4 @@
-/**
+/*
  * 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
@@ -27,8 +27,7 @@ import java.util.TimeZone;
 
 import org.apache.ambari.logfeeder.common.LogfeederException;
 import org.apache.ambari.logfeeder.input.InputMarker;
-import org.apache.ambari.logfeeder.output.OutputMgr;
-import org.apache.ambari.logfeeder.util.LogFeederUtil;
+import org.apache.ambari.logfeeder.output.OutputManager;
 import org.apache.log4j.Logger;
 import org.easymock.Capture;
 import org.easymock.CaptureType;
@@ -44,16 +43,16 @@ public class FilterJSONTest {
   private static final Logger LOG = Logger.getLogger(FilterJSONTest.class);
 
   private FilterJSON filterJson;
-  private OutputMgr mockOutputMgr;
+  private OutputManager mockOutputManager;
   private Capture<Map<String, Object>> capture;
 
   public void init(Map<String, Object> params) throws Exception {
-    mockOutputMgr = EasyMock.strictMock(OutputMgr.class);
+    mockOutputManager = EasyMock.strictMock(OutputManager.class);
     capture = EasyMock.newCapture(CaptureType.LAST);
 
     filterJson = new FilterJSON();
     filterJson.loadConfig(params);
-    filterJson.setOutputMgr(mockOutputMgr);
+    filterJson.setOutputManager(mockOutputManager);
     filterJson.init();
   }
 
@@ -63,17 +62,17 @@ public class FilterJSONTest {
 
     init(new HashMap<String, Object>());
 
-    mockOutputMgr.write(EasyMock.capture(capture), EasyMock.anyObject(InputMarker.class));
+    mockOutputManager.write(EasyMock.capture(capture), EasyMock.anyObject(InputMarker.class));
     EasyMock.expectLastCall();
-    EasyMock.replay(mockOutputMgr);
+    EasyMock.replay(mockOutputManager);
 
     Date d = new Date();
-    DateFormat sdf = new SimpleDateFormat(LogFeederUtil.SOLR_DATE_FORMAT);
+    DateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
     sdf.setTimeZone(TimeZone.getTimeZone("UTC"));
     String dateString = sdf.format(d);
-    filterJson.apply("{ logtime: '" + d.getTime() + "', line_number: 100 }", new InputMarker());
+    filterJson.apply("{ logtime: '" + d.getTime() + "', line_number: 100 }", new InputMarker(null, null, 0));
 
-    EasyMock.verify(mockOutputMgr);
+    EasyMock.verify(mockOutputManager);
     Map<String, Object> jsonParams = capture.getValue();
 
     assertEquals("Incorrect decoding: log time", dateString, jsonParams.remove("logtime"));
@@ -87,17 +86,17 @@ public class FilterJSONTest {
 
     init(new HashMap<String, Object>());
 
-    mockOutputMgr.write(EasyMock.capture(capture), EasyMock.anyObject(InputMarker.class));
+    mockOutputManager.write(EasyMock.capture(capture), EasyMock.anyObject(InputMarker.class));
     EasyMock.expectLastCall();
-    EasyMock.replay(mockOutputMgr);
+    EasyMock.replay(mockOutputManager);
 
     Date d = new Date();
-    DateFormat sdf = new SimpleDateFormat(LogFeederUtil.SOLR_DATE_FORMAT);
+    DateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
     sdf.setTimeZone(TimeZone.getTimeZone("UTC"));
     String dateString = sdf.format(d);
-    filterJson.apply("{ logtime: '" + d.getTime() + "', some_field: 'abc' }", new InputMarker());
+    filterJson.apply("{ logtime: '" + d.getTime() + "', some_field: 'abc' }", new InputMarker(null, null, 0));
 
-    EasyMock.verify(mockOutputMgr);
+    EasyMock.verify(mockOutputManager);
     Map<String, Object> jsonParams = capture.getValue();
 
     assertEquals("Incorrect decoding: log time", dateString, jsonParams.remove("logtime"));
@@ -111,13 +110,13 @@ public class FilterJSONTest {
 
     init(new HashMap<String, Object>());
 
-    mockOutputMgr.write(EasyMock.capture(capture), EasyMock.anyObject(InputMarker.class));
+    mockOutputManager.write(EasyMock.capture(capture), EasyMock.anyObject(InputMarker.class));
     EasyMock.expectLastCall();
-    EasyMock.replay(mockOutputMgr);
+    EasyMock.replay(mockOutputManager);
 
-    filterJson.apply("{ line_number: 100, some_field: 'abc' }", new InputMarker());
+    filterJson.apply("{ line_number: 100, some_field: 'abc' }", new InputMarker(null, null, 0));
 
-    EasyMock.verify(mockOutputMgr);
+    EasyMock.verify(mockOutputManager);
     Map<String, Object> jsonParams = capture.getValue();
 
     assertEquals("Incorrect decoding: line number", 100l, jsonParams.remove("line_number"));
@@ -132,7 +131,7 @@ public class FilterJSONTest {
     init(new HashMap<String, Object>());
     String inputStr="invalid json";
     try{
-    filterJson.apply(inputStr,new InputMarker());
+    filterJson.apply(inputStr,new InputMarker(null, null, 0));
     fail("Expected LogfeederException was not occured");
     }catch(LogfeederException logfeederException){
       assertEquals("Json parsing failed for inputstr = "+inputStr, logfeederException.getLocalizedMessage());

http://git-wip-us.apache.org/repos/asf/ambari/blob/1b07a6dd/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/filter/FilterKeyValueTest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/filter/FilterKeyValueTest.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/filter/FilterKeyValueTest.java
index 849e4c3..30cee42 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/filter/FilterKeyValueTest.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/filter/FilterKeyValueTest.java
@@ -1,4 +1,4 @@
-/**
+/*
  * 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
@@ -22,7 +22,7 @@ import java.util.HashMap;
 import java.util.Map;
 
 import org.apache.ambari.logfeeder.input.InputMarker;
-import org.apache.ambari.logfeeder.output.OutputMgr;
+import org.apache.ambari.logfeeder.output.OutputManager;
 import org.apache.log4j.Logger;
 import org.easymock.Capture;
 import org.easymock.CaptureType;
@@ -38,16 +38,16 @@ public class FilterKeyValueTest {
   private static final Logger LOG = Logger.getLogger(FilterKeyValueTest.class);
 
   private FilterKeyValue filterKeyValue;
-  private OutputMgr mockOutputMgr;
+  private OutputManager mockOutputManager;
   private Capture<Map<String, Object>> capture;
 
   public void init(Map<String, Object> config) throws Exception {
-    mockOutputMgr = EasyMock.strictMock(OutputMgr.class);
+    mockOutputManager = EasyMock.strictMock(OutputManager.class);
     capture = EasyMock.newCapture(CaptureType.LAST);
 
     filterKeyValue = new FilterKeyValue();
     filterKeyValue.loadConfig(config);
-    filterKeyValue.setOutputMgr(mockOutputMgr);
+    filterKeyValue.setOutputManager(mockOutputManager);
     filterKeyValue.init();
   }
 
@@ -61,13 +61,13 @@ public class FilterKeyValueTest {
     // using default value split:
     init(config);
 
-    mockOutputMgr.write(EasyMock.capture(capture), EasyMock.anyObject(InputMarker.class));
+    mockOutputManager.write(EasyMock.capture(capture), EasyMock.anyObject(InputMarker.class));
     EasyMock.expectLastCall();
-    EasyMock.replay(mockOutputMgr);
+    EasyMock.replay(mockOutputManager);
 
-    filterKeyValue.apply("{ keyValueField: 'name1=value1&name2=value2' }", new InputMarker());
+    filterKeyValue.apply("{ keyValueField: 'name1=value1&name2=value2' }", new InputMarker(null, null, 0));
 
-    EasyMock.verify(mockOutputMgr);
+    EasyMock.verify(mockOutputManager);
     Map<String, Object> jsonParams = capture.getValue();
 
     assertEquals("Original missing!", "name1=value1&name2=value2", jsonParams.remove("keyValueField"));
@@ -85,13 +85,13 @@ public class FilterKeyValueTest {
     // using default value split: =
     init(config);
 
-    mockOutputMgr.write(EasyMock.capture(capture), EasyMock.anyObject(InputMarker.class));
+    mockOutputManager.write(EasyMock.capture(capture), EasyMock.anyObject(InputMarker.class));
     EasyMock.expectLastCall().anyTimes();
-    EasyMock.replay(mockOutputMgr);
+    EasyMock.replay(mockOutputManager);
 
-    filterKeyValue.apply("{ keyValueField: 'name1=value1&name2=value2' }", new InputMarker());
+    filterKeyValue.apply("{ keyValueField: 'name1=value1&name2=value2' }", new InputMarker(null, null, 0));
 
-    EasyMock.verify(mockOutputMgr);
+    EasyMock.verify(mockOutputManager);
     assertFalse("Something was captured!", capture.hasCaptured());
   }
 
@@ -105,13 +105,13 @@ public class FilterKeyValueTest {
     init(config);
 
     // using default value split: =
-    mockOutputMgr.write(EasyMock.capture(capture), EasyMock.anyObject(InputMarker.class));
+    mockOutputManager.write(EasyMock.capture(capture), EasyMock.anyObject(InputMarker.class));
     EasyMock.expectLastCall().anyTimes();
-    EasyMock.replay(mockOutputMgr);
+    EasyMock.replay(mockOutputManager);
 
-    filterKeyValue.apply("{ otherField: 'name1=value1&name2=value2' }", new InputMarker());
+    filterKeyValue.apply("{ otherField: 'name1=value1&name2=value2' }", new InputMarker(null, null, 0));
 
-    EasyMock.verify(mockOutputMgr);
+    EasyMock.verify(mockOutputManager);
     Map<String, Object> jsonParams = capture.getValue();
 
     assertEquals("Original missing!", "name1=value1&name2=value2", jsonParams.remove("otherField"));

http://git-wip-us.apache.org/repos/asf/ambari/blob/1b07a6dd/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/input/InputFileTest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/input/InputFileTest.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/input/InputFileTest.java
index 42e81da..08aa564 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/input/InputFileTest.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/input/InputFileTest.java
@@ -1,4 +1,4 @@
-/**
+/*
  * 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
@@ -104,7 +104,7 @@ public class InputFileTest {
 
     inputFile = new InputFile();
     inputFile.loadConfig(config);
-    inputFile.setFirstFilter(capture);
+    inputFile.addFilter(capture);
     inputFile.init();
   }
 
@@ -117,10 +117,10 @@ public class InputFileTest {
 
     init(testFile.getAbsolutePath());
 
-    InputMgr inputMgr = EasyMock.createStrictMock(InputMgr.class);
-    EasyMock.expect(inputMgr.getCheckPointFolderFile()).andReturn(checkPointDir);
-    EasyMock.replay(inputMgr);
-    inputFile.setInputMgr(inputMgr);
+    InputManager inputManager = EasyMock.createStrictMock(InputManager.class);
+    EasyMock.expect(inputManager.getCheckPointFolderFile()).andReturn(checkPointDir);
+    EasyMock.replay(inputManager);
+    inputFile.setInputManager(inputManager);
 
     inputFile.isReady();
     inputFile.start();
@@ -129,7 +129,7 @@ public class InputFileTest {
     for (int row = 0; row < 3; row++)
       assertEquals("Row #" + (row + 1) + " not correct", TEST_LOG_FILE_ROWS[row], rows.get(row));
 
-    EasyMock.verify(inputMgr);
+    EasyMock.verify(inputManager);
   }
 
   @Test
@@ -140,10 +140,10 @@ public class InputFileTest {
     File testFile = createFile("process6.log");
     init(testFile.getAbsolutePath());
 
-    InputMgr inputMgr = EasyMock.createStrictMock(InputMgr.class);
-    EasyMock.expect(inputMgr.getCheckPointFolderFile()).andReturn(checkPointDir).times(2);
-    EasyMock.replay(inputMgr);
-    inputFile.setInputMgr(inputMgr);
+    InputManager inputMabager = EasyMock.createStrictMock(InputManager.class);
+    EasyMock.expect(inputMabager.getCheckPointFolderFile()).andReturn(checkPointDir).times(2);
+    EasyMock.replay(inputMabager);
+    inputFile.setInputManager(inputMabager);
 
     inputFile.isReady();
     inputFile.start();
@@ -155,7 +155,7 @@ public class InputFileTest {
     for (int row = 0; row < 6; row++)
       assertEquals("Row #" + (row + 1) + " not correct", TEST_LOG_FILE_ROWS[row], rows.get(row));
 
-    EasyMock.verify(inputMgr);
+    EasyMock.verify(inputMabager);
   }
 
   @Test


[20/58] [abbrv] ambari git commit: AMBARI-18310. Refactor logsearch portal code - part 3 (oleewere)

Posted by ol...@apache.org.
AMBARI-18310. Refactor logsearch portal code - part 3 (oleewere)

Change-Id: Ibb5fc43360da84ae8d21f064d39f0f1ef7b82e1e


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

Branch: refs/heads/branch-2.5
Commit: 6fa4abfeadfcb3b942ab4f677c16a2031f14327b
Parents: 199c6e3
Author: oleewere <ol...@gmail.com>
Authored: Sat Sep 10 21:15:02 2016 +0200
Committer: oleewere <ol...@gmail.com>
Committed: Sat Nov 5 14:46:44 2016 +0100

----------------------------------------------------------------------
 .../test-output/service-log-schema.json         |  38 +-
 .../ambari/logsearch/common/ConfigHelper.java   | 106 ---
 .../logsearch/common/ExternalServerClient.java  |   7 +-
 .../logsearch/common/LogSearchConstants.java    |  14 +-
 .../logsearch/common/PropertiesHelper.java      |  44 -
 .../ambari/logsearch/common/PropertyMapper.java |  59 --
 .../ambari/logsearch/conf/AuthConfig.java       |  97 ---
 .../ambari/logsearch/conf/AuthPropsConfig.java  |  97 +++
 .../logsearch/conf/SolrAuditLogConfig.java      | 181 ----
 .../logsearch/conf/SolrAuditLogPropsConfig.java | 142 +++
 .../ambari/logsearch/conf/SolrColumnConfig.java |  36 -
 .../ambari/logsearch/conf/SolrConfig.java       |  88 +-
 .../logsearch/conf/SolrConnectionConfig.java    |  49 --
 .../conf/SolrConnectionPropsConfig.java         |  49 ++
 .../ambari/logsearch/conf/SolrPropsConfig.java  |  50 ++
 .../logsearch/conf/SolrServiceLogConfig.java    | 144 ---
 .../conf/SolrServiceLogPropsConfig.java         |  94 ++
 .../ambari/logsearch/conf/SolrUserConfig.java   | 104 ---
 .../logsearch/conf/SolrUserPropsConfig.java     | 104 +++
 .../ambari/logsearch/dao/AuditSolrDao.java      |  59 +-
 .../logsearch/dao/ServiceLogsSolrDao.java       |  47 +-
 .../ambari/logsearch/dao/SolrAliasDao.java      | 123 +++
 .../ambari/logsearch/dao/SolrCollectionDao.java | 259 ++++++
 .../ambari/logsearch/dao/SolrDaoBase.java       | 508 +----------
 .../logsearch/dao/SolrSchemaFieldDao.java       | 159 ++++
 .../ambari/logsearch/dao/UserConfigSolrDao.java |  63 +-
 .../apache/ambari/logsearch/dao/UserDao.java    |  10 +-
 .../ambari/logsearch/doc/DocConstants.java      |  21 +-
 .../logsearch/graph/GraphDataGenerator.java     |   2 +-
 .../logsearch/manager/AuditLogsManager.java     | 162 +---
 .../logsearch/manager/LogFileManager.java       | 155 ----
 .../ambari/logsearch/manager/PublicManager.java |   6 +-
 .../logsearch/manager/ServiceLogsManager.java   | 122 +--
 .../logsearch/manager/UserConfigManager.java    |   1 -
 .../model/request/LogFileParamDefinition.java   |  45 -
 .../request/LogFileTailParamDefinition.java     |  32 -
 .../model/request/LogParamDefinition.java       |  13 -
 .../request/ServiceLogFileParamDefinition.java  |  38 -
 .../request/ServiceLogParamDefinition.java      |  17 -
 .../model/request/impl/BaseLogRequest.java      |  25 -
 .../request/impl/BaseServiceLogRequest.java     |  39 -
 .../model/request/impl/LogFileRequest.java      |  67 --
 .../model/request/impl/LogFileTailRequest.java  |  40 -
 .../model/request/impl/ServiceGraphRequest.java |   2 +-
 .../request/impl/ServiceLogExportRequest.java   |   2 +-
 .../request/impl/ServiceLogFileRequest.java     |  54 --
 .../model/request/impl/ServiceLogRequest.java   |   2 +-
 .../impl/ServiceLogTruncatedRequest.java        |   2 +-
 .../ambari/logsearch/query/QueryGeneration.java |  96 +-
 .../logsearch/query/QueryGenerationBase.java    |  28 -
 .../query/SearchCriteriaConstants.java          |   8 -
 .../AbstractCommonAuditLogRequestConverter.java |   4 -
 ...bstractCommonServiceLogRequestConverter.java |   6 -
 .../converter/LogFileRequestConverter.java      |  37 -
 .../converter/LogFileTailRequestConverter.java  |  38 -
 .../converter/ServiceGraphRequestConverter.java |   2 -
 .../ServiceLogExportRequestConverter.java       |   2 -
 .../ServiceLogFileRequestConverter.java         |  36 -
 .../converter/ServiceLogRequestConverter.java   |   2 -
 .../ServiceLogTruncatedRequestConverter.java    |   2 -
 .../model/CommonServiceLogSearchCriteria.java   |   8 -
 .../query/model/LogFileSearchCriteria.java      |  52 --
 .../query/model/LogFileTailSearchCriteria.java  |  32 -
 .../logsearch/query/model/SearchCriteria.java   |   9 +
 .../model/ServiceAnyGraphSearchCriteria.java    |   2 +-
 .../query/model/ServiceGraphSearchCriteria.java |   2 +-
 .../model/ServiceLogExportSearchCriteria.java   |   2 +-
 .../model/ServiceLogFileSearchCriteria.java     |  40 -
 .../query/model/ServiceLogSearchCriteria.java   |   2 +-
 .../ServiceLogTruncatedSearchCriteria.java      |   2 +-
 .../logsearch/rest/AuditLogsResource.java       |   1 -
 .../ambari/logsearch/rest/LogFileResource.java  |  69 --
 .../logsearch/rest/ServiceLogsResource.java     |  28 +-
 ...rchExternalServerAuthenticationProvider.java |   8 +-
 .../LogsearchFileAuthenticationProvider.java    |   6 +-
 .../LogsearchLdapAuthenticationProvider.java    |   8 +-
 .../LogsearchSimpleAuthenticationProvider.java  |   6 +-
 .../src/main/resources/default.properties       |  21 -
 .../src/main/webapp/scripts/App.js              |   4 +-
 .../collection_bases/VAuditLogListBase.js       |   2 +-
 .../scripts/collection_bases/VLogListBase.js    |  19 +-
 .../scripts/collections/BaseCollection.js       |   1 -
 .../scripts/collections/SchemaFieldList.js      |  29 +
 .../src/main/webapp/scripts/mgrs/SessionMgr.js  | 137 ---
 .../src/main/webapp/scripts/utils/Globals.js    | 158 ++--
 .../src/main/webapp/scripts/utils/ViewUtils.js  | 423 ++++-----
 .../scripts/views/audit/AuditTabLayoutView.js   | 858 +++++++++---------
 .../scripts/views/common/CustomBackgrid.js      |   1 -
 .../main/webapp/scripts/views/common/Header.js  |   6 +-
 .../webapp/scripts/views/common/ProfileBar.js   |   3 +-
 .../dashboard/BubbleGraphTableLayoutView.js     | 164 +---
 .../views/dashboard/ComponentListView.js        |   4 +-
 .../scripts/views/dashboard/DashboardView.js    |   4 -
 .../scripts/views/dashboard/HostListView.js     |   4 +-
 .../scripts/views/dashboard/MainLayoutView.js   |  15 +-
 .../scripts/views/dialog/DetailLogFileView.js   |   4 +-
 .../views/filter/CreateLogfeederFilterView.js   |   6 +-
 .../webapp/scripts/views/tabs/ComparisonView.js |  15 +-
 .../views/tabs/HierarchyTabLayoutView.js        | 871 +++++++++----------
 .../webapp/scripts/views/tabs/LogFileView.js    |  73 +-
 .../main/webapp/scripts/views/tabs/TreeView.js  |   6 +-
 .../scripts/views/tabs/VisualSearchView.js      | 437 ++++------
 .../src/main/webapp/static/schema_fields.json   |  71 ++
 .../dashboard/MainLayoutView_tmpl.html          | 121 ---
 .../main/webapp/templates/helpers/Helpers.js    |  39 -
 .../ambari/logsearch/dao/AuditSolrDaoTest.java  |  99 ---
 .../logsearch/dao/ServiceLogsSolrDaoTest.java   |  95 --
 .../ambari/logsearch/dao/SolrDaoBaseTest.java   | 306 -------
 .../logsearch/dao/UserConfigSolrDaoTest.java    | 164 ----
 .../test-config/logsearch/logsearch.properties  |   2 -
 110 files changed, 2946 insertions(+), 5332 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/6fa4abfe/ambari-logsearch/ambari-logsearch-it/src/test/resources/test-output/service-log-schema.json
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-it/src/test/resources/test-output/service-log-schema.json b/ambari-logsearch/ambari-logsearch-it/src/test/resources/test-output/service-log-schema.json
index 9efa58b..2933123 100644
--- a/ambari-logsearch/ambari-logsearch-it/src/test/resources/test-output/service-log-schema.json
+++ b/ambari-logsearch/ambari-logsearch-it/src/test/resources/test-output/service-log-schema.json
@@ -1,18 +1,24 @@
 {
-  "log_message": "Log Message",
-  "bundle_id": "Bundle Id",
-  "case_id": "Case Id",
-  "cluster": "Cluster",
-  "event_count": "Event Count",
-  "file": "File",
-  "host": "Host",
-  "id": "Id",
-  "ip": "IP",
-  "level": "Level",
-  "logfile_line_number": "Logfile Line Number",
-  "logger_name": "Logger Name",
-  "method": "method",
-  "path": "Path",
-  "text": "Text",
-  "type": "Type"
+  "logfile_line_number": "tint",
+  "logtime": "tdate",
+  "text": "text_std_token_lower_case",
+  "host": "key_lower_case",
+  "seq_num": "tlong",
+  "logtype": "key_lower_case",
+  "rowtype": "key_lower_case",
+  "log_message": "text_std_token_lower_case",
+  "line_number": "tint",
+  "type": "key_lower_case",
+  "ip": "string",
+  "id": "string",
+  "thread_name": "key_lower_case",
+  "level": "key_lower_case",
+  "file": "key_lower_case",
+  "bundle_id": "key_lower_case",
+  "path": "key_lower_case",
+  "cluster": "key_lower_case",
+  "case_id": "key_lower_case",
+  "logger_name": "key_lower_case",
+  "method": "key_lower_case",
+  "event_count": "tlong"
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/6fa4abfe/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/common/ConfigHelper.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/common/ConfigHelper.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/common/ConfigHelper.java
deleted file mode 100644
index a3a71ea..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/common/ConfigHelper.java
+++ /dev/null
@@ -1,106 +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.common;
-
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.ambari.logsearch.dao.SolrDaoBase;
-import org.apache.ambari.logsearch.manager.ManagerBase;
-import org.apache.commons.lang.ArrayUtils;
-import org.apache.log4j.Logger;
-import org.codehaus.jettison.json.JSONArray;
-import org.codehaus.jettison.json.JSONObject;
-
-public class ConfigHelper {
-  private static final Logger logger = Logger.getLogger(ManagerBase.class);
-
-  private ConfigHelper() {
-    throw new UnsupportedOperationException();
-  }
-
-  public static void extractSchemaFieldsName(String responseString, HashMap<String, String> schemaFieldsNameMap,
-      HashMap<String, String> schemaFieldTypeMap) {
-    try {
-      JSONObject jsonObject = new JSONObject(responseString);
-      JSONObject schemajsonObject = jsonObject.getJSONObject("schema");
-      JSONArray jsonArrayList = schemajsonObject.getJSONArray("fields");
-      JSONArray fieldTypeJsonArray = schemajsonObject
-          .getJSONArray("fieldTypes");
-      if (jsonArrayList == null) {
-        return;
-      }
-      if (fieldTypeJsonArray == null) {
-        return;
-      }
-      HashMap<String, String> _schemaFieldTypeMap = new HashMap<String, String>();
-      HashMap<String, String> _schemaFieldsNameMap = new HashMap<String, String>();
-      for (int i = 0; i < fieldTypeJsonArray.length(); i++) {
-        JSONObject typeObject = fieldTypeJsonArray.getJSONObject(i);
-        String name = typeObject.getString("name");
-        String fieldTypeJson = typeObject.toString();
-        _schemaFieldTypeMap.put(name, fieldTypeJson);
-      }
-
-      for (int i = 0; i < jsonArrayList.length(); i++) {
-        JSONObject explrObject = jsonArrayList.getJSONObject(i);
-        String name = explrObject.getString("name");
-        String type = explrObject.getString("type");
-        if (!name.contains("@") && !name.startsWith("_") && !name.contains("_md5") && !name.contains("_ms") &&
-            !name.contains(LogSearchConstants.NGRAM_SUFFIX) && !name.contains("tags") && !name.contains("_str")) {
-          _schemaFieldsNameMap.put(name, type);
-        }
-      }
-      schemaFieldsNameMap.clear();
-      schemaFieldTypeMap.clear();
-      schemaFieldsNameMap.putAll(_schemaFieldsNameMap);
-      schemaFieldTypeMap.putAll(_schemaFieldTypeMap);
-    } catch (Exception e) {
-      logger.error(e + "Credentials not specified in logsearch.properties " + MessageEnums.ERROR_SYSTEM);
-    }
-  }
-
-  @SuppressWarnings("rawtypes")
-  public static void getSchemaFieldsName(String excludeArray[], List<String> fieldNames, SolrDaoBase solrDaoBase) {
-    if (!solrDaoBase.schemaFieldsNameMap.isEmpty()) {
-      Iterator iteratorSechmaFieldsName = solrDaoBase.schemaFieldsNameMap.entrySet().iterator();
-      while (iteratorSechmaFieldsName.hasNext()) {
-        Map.Entry fieldName = (Map.Entry) iteratorSechmaFieldsName.next();
-        String field = "" + fieldName.getKey();
-        if (!isExclude(field, excludeArray)) {
-          fieldNames.add(field);
-        }
-      }
-    }
-  }
-
-  private static boolean isExclude(String name, String excludeArray[]) {
-    if (!ArrayUtils.isEmpty(excludeArray)) {
-      for (String exclude : excludeArray) {
-        if (name.equals(exclude)){
-          return true;
-        }
-      }
-    }
-    return false;
-  }
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/6fa4abfe/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 2590dfe..9682a3d 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
@@ -27,13 +27,12 @@ import javax.ws.rs.client.WebTarget;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.MultivaluedMap;
 
-import org.apache.ambari.logsearch.conf.AuthConfig;
+import org.apache.ambari.logsearch.conf.AuthPropsConfig;
 import org.apache.commons.lang.StringUtils;
 import org.apache.log4j.Logger;
 import org.glassfish.jersey.client.JerseyClient;
 import org.glassfish.jersey.client.JerseyClientBuilder;
 import org.glassfish.jersey.client.authentication.HttpAuthenticationFeature;
-import org.glassfish.jersey.filter.LoggingFilter;
 import org.springframework.stereotype.Component;
 
 /**
@@ -51,7 +50,7 @@ public class ExternalServerClient {
   };
 
   @Inject
-  private AuthConfig authConfig;
+  private AuthPropsConfig authPropsConfig;
 
   /**
    * Send GET request to an external server
@@ -59,7 +58,7 @@ public class ExternalServerClient {
   public Object sendGETRequest(String url, Class klass, MultivaluedMap<String, String> queryParam,
                                String username, String password)
       throws Exception {
-    url = authConfig.getExternalAuthHostUrl() + url;
+    url = authPropsConfig.getExternalAuthHostUrl() + url;
     JerseyClient client = localJerseyClient.get();
     HttpAuthenticationFeature authFeature = HttpAuthenticationFeature.basicBuilder()
       .credentials(username, password)

http://git-wip-us.apache.org/repos/asf/ambari/blob/6fa4abfe/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/common/LogSearchConstants.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/common/LogSearchConstants.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/common/LogSearchConstants.java
index 36ecb81..d9d3b86 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/common/LogSearchConstants.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/common/LogSearchConstants.java
@@ -73,7 +73,6 @@ public class LogSearchConstants {
   //operation
   public static final String EXCLUDE_QUERY = "excludeQuery";
   public static final String INCLUDE_QUERY = "includeQuery";
-  public static final String COLUMN_QUERY = "columnQuery";
 
   // Seprator's
   public static final String I_E_SEPRATOR = "\\|i\\:\\:e\\|";
@@ -139,13 +138,8 @@ public class LogSearchConstants {
   public static final String REQUEST_PARAM_FIELD = "field";
   public static final String REQUEST_PARAM_FORMAT = "format";
   public static final String REQUEST_PARAM_LAST_PAGE = "lastPage";
-  public static final String REQUEST_PARAM_LOG_TYPE = "logType";
-  public static final String REQUEST_PARAM_COMPONENT = "component";
-  public static final String REQUEST_PARAM_HOST = "host";
-  public static final String REQUEST_PARAM_TAIL_SIZE = "tailSize";
-  public static final String REQUEST_PARAM_COLUMN_QUERY = "columnQuery";
   public static final String REQUEST_PARAM_I_MESSAGE = "iMessage";
-  public static final String REQUEST_PARAM_G_E_MESSAGE = "gEMessage";
+  public static final String REQUEST_PARAM_E_MESSAGE = "eMessage";
   public static final String REQUEST_PARAM_MUST_BE = "mustBe";
   public static final String REQUEST_PARAM_MUST_NOT = "mustNot";
   public static final String REQUEST_PARAM_INCLUDE_QUERY = "includeQuery";
@@ -153,13 +147,7 @@ public class LogSearchConstants {
   public static final String REQUEST_PARAM_ID = "id";
   public static final String REQUEST_PARAM_SCROLL_TYPE = "scrollType";
   public static final String REQUEST_PARAM_NUMBER_ROWS = "numberRows";
-  public static final String REQUEST_PARAM_HOST_LOG_FILE = "host";
-  public static final String REQUEST_PARAM_COMPONENT_LOG_FILE = "component";
   public static final String REQUEST_PARAM_LEVEL = "level";
-  public static final String REQUEST_PARAM_ADVANCED_SEARCH = "advancedSearch";
-  public static final String REQUEST_PARAM_TREE_PARAMS = "treeParams";
-  public static final String REQUEST_PARAM_E_MESSAGE = "eMessage";
-  public static final String REQUEST_PARAM_G_MUST_NOT = "gMustNot";
   public static final String REQUEST_PARAM_HOST_NAME = "host_name";
   public static final String REQUEST_PARAM_COMPONENT_NAME = "component_name";
   public static final String REQUEST_PARAM_FILE_NAME = "file_name";

http://git-wip-us.apache.org/repos/asf/ambari/blob/6fa4abfe/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/common/PropertiesHelper.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/common/PropertiesHelper.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/common/PropertiesHelper.java
index adb0699..1844d8f 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/common/PropertiesHelper.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/common/PropertiesHelper.java
@@ -124,50 +124,6 @@ public class PropertiesHelper extends PropertyPlaceholderConfigurer {
     }
   }
 
-  public static Integer getIntProperty(String key, int defaultValue) {
-    if (key == null) {
-      return null;
-    }
-    String rtrnVal = propertiesMap.get(key);
-    if (rtrnVal == null) {
-      return defaultValue;
-    }
-    return Integer.valueOf(rtrnVal);
-  }
-
-  public static Integer getIntProperty(String key) {
-    if (key == null) {
-      return null;
-    }
-    String rtrnVal = propertiesMap.get(key);
-    if (rtrnVal == null) {
-      return null;
-    }
-    return Integer.valueOf(rtrnVal);
-  }
-
-  public static Long getLongProperty(String key, long defaultValue) {
-    if (key == null) {
-      return null;
-    }
-    String rtrnVal = propertiesMap.get(key);
-    if (rtrnVal == null) {
-      return defaultValue;
-    }
-    return Long.valueOf(rtrnVal);
-  }
-
-  public static Long getLongProperty(String key) {
-    if (key == null) {
-      return null;
-    }
-    String rtrnVal = propertiesMap.get(key);
-    if (rtrnVal == null) {
-      return null;
-    }
-    return Long.valueOf(rtrnVal);
-  }
-
   public static boolean getBooleanProperty(String key, boolean defaultValue) {
     if (key == null) {
       return defaultValue;

http://git-wip-us.apache.org/repos/asf/ambari/blob/6fa4abfe/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/common/PropertyMapper.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/common/PropertyMapper.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/common/PropertyMapper.java
deleted file mode 100644
index 90e2114..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/common/PropertyMapper.java
+++ /dev/null
@@ -1,59 +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.common;
-
-import com.google.common.base.Splitter;
-import org.springframework.stereotype.Component;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-@Component("propertyMapper")
-public class PropertyMapper {
-
-  public Map<String, String> map(String property) {
-    return this.map(property, ",");
-  }
-
-  public List<String> list(String property) {
-    return this.list(property, ",");
-  }
-
-  public Map<String, String> solrUiMap(String property) { return this.solrUiMap(property, ","); }
-
-  private List<String> list(String property, String splitter) {
-    return Splitter.on(splitter).omitEmptyStrings().trimResults().splitToList(property);
-  }
-
-  private Map<String, String> map(String property, String splitter) {
-    return Splitter.on(splitter).omitEmptyStrings().trimResults().withKeyValueSeparator(":").split(property);
-  }
-
-  private Map<String, String> solrUiMap(String property, String splitter) {
-    Map<String, String> result = new HashMap<>();
-    Map<String, String> map = this.map(property, splitter);
-    for (Map.Entry<String, String> propEntry : map.entrySet()) {
-      result.put(propEntry.getKey() + LogSearchConstants.SOLR_SUFFIX, propEntry.getValue());
-      result.put(propEntry.getValue() + LogSearchConstants.UI_SUFFIX, propEntry.getKey());
-    }
-    return result;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/6fa4abfe/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/AuthConfig.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/AuthConfig.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/AuthConfig.java
deleted file mode 100644
index 46d07bd..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/AuthConfig.java
+++ /dev/null
@@ -1,97 +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.conf;
-
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.context.annotation.Configuration;
-
-@Configuration
-public class AuthConfig {
-
-  @Value("${logsearch.auth.file.enable:true}")
-  boolean authFileEnabled;
-  @Value("${logsearch.auth.ldap.enable:false}")
-  boolean authLdapEnabled;
-  @Value("${logsearch.auth.simple.enable:false}")
-  boolean authSimpleEnabled;
-  @Value("${logsearch.auth.external_auth.enable:false}")
-  boolean authExternalEnabled;
-  @Value("${logsearch.auth.external_auth.host_url:'http://ip:port'}")
-  private String externalAuthHostUrl;
-  @Value("${logsearch.auth.external_auth.login_url:/api/v1/users/$USERNAME/privileges?fields=*}")
-  private String externalAuthLoginUrl;
-  @Value("${logsearch.login.credentials.file:user_pass.json}")
-  private String credentialsFile;
-
-  public boolean isAuthFileEnabled() {
-    return authFileEnabled;
-  }
-
-  public void setAuthFileEnabled(boolean authFileEnabled) {
-    this.authFileEnabled = authFileEnabled;
-  }
-
-  public boolean isAuthLdapEnabled() {
-    return authLdapEnabled;
-  }
-
-  public void setAuthLdapEnabled(boolean authLdapEnabled) {
-    this.authLdapEnabled = authLdapEnabled;
-  }
-
-  public boolean isAuthSimpleEnabled() {
-    return authSimpleEnabled;
-  }
-
-  public void setAuthSimpleEnabled(boolean authSimpleEnabled) {
-    this.authSimpleEnabled = authSimpleEnabled;
-  }
-
-  public String getCredentialsFile() {
-    return credentialsFile;
-  }
-
-  public void setCredentialsFile(String credentialsFile) {
-    this.credentialsFile = credentialsFile;
-  }
-
-  public String getExternalAuthHostUrl() {
-    return externalAuthHostUrl;
-  }
-
-  public void setExternalAuthHostUrl(String externalAuthHostUrl) {
-    this.externalAuthHostUrl = externalAuthHostUrl;
-  }
-
-  public String getExternalAuthLoginUrl() {
-    return externalAuthLoginUrl;
-  }
-
-  public void setExternalAuthLoginUrl(String externalAuthLoginUrl) {
-    this.externalAuthLoginUrl = externalAuthLoginUrl;
-  }
-
-  public boolean isAuthExternalEnabled() {
-    return authExternalEnabled;
-  }
-
-  public void setAuthExternalEnabled(boolean authExternalEnabled) {
-    this.authExternalEnabled = authExternalEnabled;
-  }
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/6fa4abfe/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/AuthPropsConfig.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/AuthPropsConfig.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/AuthPropsConfig.java
new file mode 100644
index 0000000..11b1cda
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/AuthPropsConfig.java
@@ -0,0 +1,97 @@
+/*
+ * 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.conf;
+
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.Configuration;
+
+@Configuration
+public class AuthPropsConfig {
+
+  @Value("${logsearch.auth.file.enable:true}")
+  boolean authFileEnabled;
+  @Value("${logsearch.auth.ldap.enable:false}")
+  boolean authLdapEnabled;
+  @Value("${logsearch.auth.simple.enable:false}")
+  boolean authSimpleEnabled;
+  @Value("${logsearch.auth.external_auth.enable:false}")
+  boolean authExternalEnabled;
+  @Value("${logsearch.auth.external_auth.host_url:'http://ip:port'}")
+  private String externalAuthHostUrl;
+  @Value("${logsearch.auth.external_auth.login_url:/api/v1/users/$USERNAME/privileges?fields=*}")
+  private String externalAuthLoginUrl;
+  @Value("${logsearch.login.credentials.file:user_pass.json}")
+  private String credentialsFile;
+
+  public boolean isAuthFileEnabled() {
+    return authFileEnabled;
+  }
+
+  public void setAuthFileEnabled(boolean authFileEnabled) {
+    this.authFileEnabled = authFileEnabled;
+  }
+
+  public boolean isAuthLdapEnabled() {
+    return authLdapEnabled;
+  }
+
+  public void setAuthLdapEnabled(boolean authLdapEnabled) {
+    this.authLdapEnabled = authLdapEnabled;
+  }
+
+  public boolean isAuthSimpleEnabled() {
+    return authSimpleEnabled;
+  }
+
+  public void setAuthSimpleEnabled(boolean authSimpleEnabled) {
+    this.authSimpleEnabled = authSimpleEnabled;
+  }
+
+  public String getCredentialsFile() {
+    return credentialsFile;
+  }
+
+  public void setCredentialsFile(String credentialsFile) {
+    this.credentialsFile = credentialsFile;
+  }
+
+  public String getExternalAuthHostUrl() {
+    return externalAuthHostUrl;
+  }
+
+  public void setExternalAuthHostUrl(String externalAuthHostUrl) {
+    this.externalAuthHostUrl = externalAuthHostUrl;
+  }
+
+  public String getExternalAuthLoginUrl() {
+    return externalAuthLoginUrl;
+  }
+
+  public void setExternalAuthLoginUrl(String externalAuthLoginUrl) {
+    this.externalAuthLoginUrl = externalAuthLoginUrl;
+  }
+
+  public boolean isAuthExternalEnabled() {
+    return authExternalEnabled;
+  }
+
+  public void setAuthExternalEnabled(boolean authExternalEnabled) {
+    this.authExternalEnabled = authExternalEnabled;
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/6fa4abfe/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/SolrAuditLogConfig.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/SolrAuditLogConfig.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/SolrAuditLogConfig.java
deleted file mode 100644
index ae4dca9..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/SolrAuditLogConfig.java
+++ /dev/null
@@ -1,181 +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.conf;
-
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.context.annotation.Configuration;
-
-import java.util.List;
-import java.util.Map;
-
-@Configuration
-public class SolrAuditLogConfig implements SolrConfig, SolrColumnConfig {
-
-  @Value("${logsearch.solr.audit.logs.url:}")
-  private String solrUrl;
-
-  @Value("${logsearch.solr.audit.logs.zk_connect_string:}")
-  private String zkConnectString;
-
-  @Value("${logsearch.solr.collection.audit.logs:audit_logs}")
-  private String collection;
-
-  @Value("${logsearch.ranger.audit.logs.collection.name:}")
-  private String rangerCollection;
-
-  @Value("${logsearch.solr.audit.logs.config.name:audit_logs}")
-  private String configName;
-
-  @Value("${logsearch.solr.audit.logs.alias.name:audit_logs_alias}")
-  private String aliasNameIn;
-
-  @Value("${logsearch.audit.logs.split.interval.mins:none}")
-  private String splitInterval;
-
-  @Value("${logsearch.collection.audit.logs.numshards:1}")
-  private Integer numberOfShards;
-
-  @Value("${logsearch.collection.audit.logs.replication.factor:1}")
-  private Integer replicationFactor;
-
-  @Value("#{propertyMapper.map('${logsearch.solr.audit.logs.column.mapping}')}")
-  private Map<String, String> columnMapping;
-
-  @Value("#{propertyMapper.list('${logsearch.solr.audit.logs.exclude.columnlist}')}")
-  private List<String> excludeColumnList;
-
-  @Value("#{propertyMapper.solrUiMap('${logsearch.solr.audit.logs.column.mapping}')}")
-  private Map<String, String> solrAndUiColumns;
-
-  @Override
-  public String getSolrUrl() {
-    return solrUrl;
-  }
-
-  @Override
-  public void setSolrUrl(String solrUrl) {
-    this.solrUrl = solrUrl;
-  }
-
-  @Override
-  public String getCollection() {
-    return collection;
-  }
-
-  @Override
-  public void setCollection(String collection) {
-    this.collection = collection;
-  }
-
-  @Override
-  public String getZkConnectString() {
-    return zkConnectString;
-  }
-
-  @Override
-  public void setZkConnectString(String zkConnectString) {
-    this.zkConnectString = zkConnectString;
-  }
-
-  @Override
-  public String getConfigName() {
-    return configName;
-  }
-
-  @Override
-  public void setConfigName(String configName) {
-    this.configName = configName;
-  }
-
-  @Override
-  public Integer getNumberOfShards() {
-    return numberOfShards;
-  }
-
-  @Override
-  public void setNumberOfShards(Integer numberOfShards) {
-    this.numberOfShards = numberOfShards;
-  }
-
-  @Override
-  public Integer getReplicationFactor() {
-    return replicationFactor;
-  }
-
-  @Override
-  public void setReplicationFactor(Integer replicationFactor) {
-    this.replicationFactor = replicationFactor;
-  }
-
-  @Override
-  public String getSplitInterval() {
-    return splitInterval;
-  }
-
-  @Override
-  public void setSplitInterval(String splitInterval) {
-    this.splitInterval = splitInterval;
-  }
-
-  @Override
-  public List<String> getExcludeColumnList() {
-    return excludeColumnList;
-  }
-
-  @Override
-  public void setExcludeColumnList(List<String> excludeColumnList) {
-    this.excludeColumnList = excludeColumnList;
-  }
-
-  @Override
-  public Map<String, String> getColumnMapping() {
-    return columnMapping;
-  }
-
-  @Override
-  public void setColumnMapping(Map<String, String> columnMappings) {
-    this.columnMapping = columnMappings;
-  }
-
-  @Override
-  public Map<String, String> getSolrAndUiColumns() {
-    return solrAndUiColumns;
-  }
-
-  @Override
-  public void setSolrAndUiColumns(Map<String, String> solrAndUiColumns) {
-    this.solrAndUiColumns = solrAndUiColumns;
-  }
-
-  public String getRangerCollection() {
-    return rangerCollection;
-  }
-
-  public void setRangerCollection(String rangerCollection) {
-    this.rangerCollection = rangerCollection;
-  }
-
-  public String getAliasNameIn() {
-    return aliasNameIn;
-  }
-
-  public void setAliasNameIn(String aliasNameIn) {
-    this.aliasNameIn = aliasNameIn;
-  }
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/6fa4abfe/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/SolrAuditLogPropsConfig.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/SolrAuditLogPropsConfig.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/SolrAuditLogPropsConfig.java
new file mode 100644
index 0000000..d270b13
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/SolrAuditLogPropsConfig.java
@@ -0,0 +1,142 @@
+/*
+ * 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.conf;
+
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.Configuration;
+
+import java.util.List;
+import java.util.Map;
+
+@Configuration
+public class SolrAuditLogPropsConfig implements SolrPropsConfig {
+
+  @Value("${logsearch.solr.audit.logs.url:}")
+  private String solrUrl;
+
+  @Value("${logsearch.solr.audit.logs.zk_connect_string:}")
+  private String zkConnectString;
+
+  @Value("${logsearch.solr.collection.audit.logs:audit_logs}")
+  private String collection;
+
+  @Value("${logsearch.ranger.audit.logs.collection.name:}")
+  private String rangerCollection;
+
+  @Value("${logsearch.solr.audit.logs.config.name:audit_logs}")
+  private String configName;
+
+  @Value("${logsearch.solr.audit.logs.alias.name:audit_logs_alias}")
+  private String aliasNameIn;
+
+  @Value("${logsearch.audit.logs.split.interval.mins:none}")
+  private String splitInterval;
+
+  @Value("${logsearch.collection.audit.logs.numshards:1}")
+  private Integer numberOfShards;
+
+  @Value("${logsearch.collection.audit.logs.replication.factor:1}")
+  private Integer replicationFactor;
+
+  @Override
+  public String getSolrUrl() {
+    return solrUrl;
+  }
+
+  @Override
+  public void setSolrUrl(String solrUrl) {
+    this.solrUrl = solrUrl;
+  }
+
+  @Override
+  public String getCollection() {
+    return collection;
+  }
+
+  @Override
+  public void setCollection(String collection) {
+    this.collection = collection;
+  }
+
+  @Override
+  public String getZkConnectString() {
+    return zkConnectString;
+  }
+
+  @Override
+  public void setZkConnectString(String zkConnectString) {
+    this.zkConnectString = zkConnectString;
+  }
+
+  @Override
+  public String getConfigName() {
+    return configName;
+  }
+
+  @Override
+  public void setConfigName(String configName) {
+    this.configName = configName;
+  }
+
+  @Override
+  public Integer getNumberOfShards() {
+    return numberOfShards;
+  }
+
+  @Override
+  public void setNumberOfShards(Integer numberOfShards) {
+    this.numberOfShards = numberOfShards;
+  }
+
+  @Override
+  public Integer getReplicationFactor() {
+    return replicationFactor;
+  }
+
+  @Override
+  public void setReplicationFactor(Integer replicationFactor) {
+    this.replicationFactor = replicationFactor;
+  }
+
+  @Override
+  public String getSplitInterval() {
+    return splitInterval;
+  }
+
+  @Override
+  public void setSplitInterval(String splitInterval) {
+    this.splitInterval = splitInterval;
+  }
+
+  public String getRangerCollection() {
+    return rangerCollection;
+  }
+
+  public void setRangerCollection(String rangerCollection) {
+    this.rangerCollection = rangerCollection;
+  }
+
+  public String getAliasNameIn() {
+    return aliasNameIn;
+  }
+
+  public void setAliasNameIn(String aliasNameIn) {
+    this.aliasNameIn = aliasNameIn;
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/6fa4abfe/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/SolrColumnConfig.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/SolrColumnConfig.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/SolrColumnConfig.java
deleted file mode 100644
index a12b2ce..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/SolrColumnConfig.java
+++ /dev/null
@@ -1,36 +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.conf;
-
-import java.util.List;
-import java.util.Map;
-
-public interface SolrColumnConfig {
-  Map<String, String> getColumnMapping();
-
-  void setColumnMapping(Map<String, String> columnMapping);
-
-  List<String> getExcludeColumnList();
-
-  void setExcludeColumnList(List<String> excludeColumnList);
-
-  Map<String, String> getSolrAndUiColumns();
-
-  void setSolrAndUiColumns(Map<String, String> solrAndUiColumns);
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/6fa4abfe/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/SolrConfig.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/SolrConfig.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/SolrConfig.java
index cfbe097..7508fb1 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/SolrConfig.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/SolrConfig.java
@@ -18,33 +18,87 @@
  */
 package org.apache.ambari.logsearch.conf;
 
-public interface SolrConfig {
-  String getSolrUrl();
+import org.apache.ambari.logsearch.solr.AmbariSolrCloudClient;
+import org.apache.ambari.logsearch.solr.AmbariSolrCloudClientBuilder;
+import org.apache.commons.lang.StringUtils;
+import org.apache.solr.client.solrj.impl.CloudSolrClient;
+import org.apache.solr.client.solrj.impl.HttpClientUtil;
+import org.apache.solr.client.solrj.impl.Krb5HttpClientConfigurer;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.DependsOn;
+import org.springframework.data.solr.core.SolrTemplate;
+import org.springframework.data.solr.repository.config.EnableSolrRepositories;
 
-  void setSolrUrl(String solrUrl);
+import javax.inject.Inject;
 
-  String getZkConnectString();
+@Configuration
+@EnableSolrRepositories
+public class SolrConfig {
 
-  void setZkConnectString(String zkConnectString);
+  private static final Logger LOG = LoggerFactory.getLogger(SolrConfig.class);
 
-  String getCollection();
+  @Inject
+  private SolrServiceLogPropsConfig solrServiceLogPropsConfig;
 
-  void setCollection(String collection);
+  @Inject
+  private SolrAuditLogPropsConfig solrAuditLogPropsConfig;
 
-  String getConfigName();
+  @Inject
+  private SolrUserPropsConfig solrUserConfigPropsConfig;
 
-  void setConfigName(String configName);
+  @Inject
+  private SolrKerberosConfig solrKerberosConfig;
 
-  Integer getNumberOfShards();
+  @Bean(name = "serviceSolrTemplate")
+  public SolrTemplate serviceSolrTemplate() {
+    setupSecurity();
+    return new SolrTemplate(createClient(
+      solrServiceLogPropsConfig.getSolrUrl(),
+      solrServiceLogPropsConfig.getZkConnectString(),
+      solrServiceLogPropsConfig.getCollection()));
+  }
 
-  void setNumberOfShards(Integer numberOfShards);
+  @Bean(name = "auditSolrTemplate")
+  @DependsOn("serviceSolrTemplate")
+  public SolrTemplate auditSolrTemplate() {
+    return new SolrTemplate(createClient(
+      solrAuditLogPropsConfig.getSolrUrl(),
+      solrAuditLogPropsConfig.getZkConnectString(),
+      solrAuditLogPropsConfig.getCollection()));
+  }
 
-  Integer getReplicationFactor();
+  @Bean(name = "userConfigSolrTemplate")
+  @DependsOn("serviceSolrTemplate")
+  public SolrTemplate userConfigSolrTemplate() {
+    return new SolrTemplate(createClient(
+      solrUserConfigPropsConfig.getSolrUrl(),
+      solrUserConfigPropsConfig.getZkConnectString(),
+      solrUserConfigPropsConfig.getCollection()));
+  }
 
-  void setReplicationFactor(Integer replicationFactor);
-
-  String getSplitInterval();
-
-  void setSplitInterval(String splitInterval);
+  private CloudSolrClient createClient(String solrUrl, String zookeeperConnectString, String defaultCollection) {
+    if (StringUtils.isNotEmpty(zookeeperConnectString)) {
+      CloudSolrClient cloudSolrClient = new CloudSolrClient(zookeeperConnectString);
+      cloudSolrClient.setDefaultCollection(defaultCollection);
+      return cloudSolrClient;
+    } else if (StringUtils.isNotEmpty(solrUrl)) {
+      throw new UnsupportedOperationException("Currently only cloud mode is supported. Set zookeeper connect string.");
+    }
+    throw new IllegalStateException(
+      "Solr url or zookeeper connection string is missing. collection: " + defaultCollection);
+  }
 
+  private void setupSecurity() {
+    String jaasFile = solrKerberosConfig.getJaasFile();
+    boolean securityEnabled = solrKerberosConfig.isEnabled();
+    if (securityEnabled) {
+      System.setProperty("java.security.auth.login.config", jaasFile);
+      HttpClientUtil.setConfigurer(new Krb5HttpClientConfigurer());
+      LOG.info("setupSecurity() called for kerberos configuration, jaas file: " + jaasFile);
+    }
+  }
 }
+

http://git-wip-us.apache.org/repos/asf/ambari/blob/6fa4abfe/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/SolrConnectionConfig.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/SolrConnectionConfig.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/SolrConnectionConfig.java
deleted file mode 100644
index b3dceea..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/SolrConnectionConfig.java
+++ /dev/null
@@ -1,49 +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.conf;
-
-import org.springframework.beans.factory.annotation.Value;
-
-public abstract class SolrConnectionConfig implements SolrConfig {
-  @Value("${logsearch.solr.url:}")
-  private String solrUrl;
-
-  @Value("${logsearch.solr.zk_connect_string:}")
-  private String zkConnectString;
-
-  @Override
-  public String getSolrUrl() {
-    return solrUrl;
-  }
-
-  @Override
-  public void setSolrUrl(String solrUrl) {
-    this.solrUrl = solrUrl;
-  }
-
-  @Override
-  public String getZkConnectString() {
-    return zkConnectString;
-  }
-
-  @Override
-  public void setZkConnectString(String zkConnectString) {
-    this.zkConnectString = zkConnectString;
-  }
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/6fa4abfe/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/SolrConnectionPropsConfig.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/SolrConnectionPropsConfig.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/SolrConnectionPropsConfig.java
new file mode 100644
index 0000000..82dd7df
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/SolrConnectionPropsConfig.java
@@ -0,0 +1,49 @@
+/*
+ * 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.conf;
+
+import org.springframework.beans.factory.annotation.Value;
+
+public abstract class SolrConnectionPropsConfig implements SolrPropsConfig {
+  @Value("${logsearch.solr.url:}")
+  private String solrUrl;
+
+  @Value("${logsearch.solr.zk_connect_string:}")
+  private String zkConnectString;
+
+  @Override
+  public String getSolrUrl() {
+    return solrUrl;
+  }
+
+  @Override
+  public void setSolrUrl(String solrUrl) {
+    this.solrUrl = solrUrl;
+  }
+
+  @Override
+  public String getZkConnectString() {
+    return zkConnectString;
+  }
+
+  @Override
+  public void setZkConnectString(String zkConnectString) {
+    this.zkConnectString = zkConnectString;
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/6fa4abfe/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/SolrPropsConfig.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/SolrPropsConfig.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/SolrPropsConfig.java
new file mode 100644
index 0000000..78012b0
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/SolrPropsConfig.java
@@ -0,0 +1,50 @@
+/*
+ * 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.conf;
+
+public interface SolrPropsConfig {
+  String getSolrUrl();
+
+  void setSolrUrl(String solrUrl);
+
+  String getZkConnectString();
+
+  void setZkConnectString(String zkConnectString);
+
+  String getCollection();
+
+  void setCollection(String collection);
+
+  String getConfigName();
+
+  void setConfigName(String configName);
+
+  Integer getNumberOfShards();
+
+  void setNumberOfShards(Integer numberOfShards);
+
+  Integer getReplicationFactor();
+
+  void setReplicationFactor(Integer replicationFactor);
+
+  String getSplitInterval();
+
+  void setSplitInterval(String splitInterval);
+
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/6fa4abfe/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/SolrServiceLogConfig.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/SolrServiceLogConfig.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/SolrServiceLogConfig.java
deleted file mode 100644
index e768402..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/SolrServiceLogConfig.java
+++ /dev/null
@@ -1,144 +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.conf;
-
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.context.annotation.Configuration;
-
-import java.util.List;
-import java.util.Map;
-
-@Configuration
-public class SolrServiceLogConfig extends SolrConnectionConfig implements SolrColumnConfig {
-
-  @Value("${logsearch.solr.collection.service.logs:hadoop_logs}")
-  private String collection;
-
-  @Value("${logsearch.service.logs.split.interval.mins:none}")
-  private String splitInterval;
-
-  @Value("${logsearch.solr.service.logs.config.name:hadoop_logs}")
-  private String configName;
-
-  @Value("${logsearch.collection.service.logs.numshards:1}")
-  private Integer numberOfShards;
-
-  @Value("${logsearch.collection.service.logs.replication.factor:1}")
-  private Integer replicationFactor;
-
-  @Value("#{propertyMapper.list('${logsearch.service.logs.fields}')}")
-  private List<String> fields;
-
-  @Value("#{propertyMapper.map('${logsearch.solr.audit.logs.column.mapping}')}")
-  private Map<String, String> columnMapping;
-
-  @Value("#{propertyMapper.list('${logsearch.solr.audit.logs.exclude.columnlist}')}")
-  private List<String> excludeColumnList;
-
-  @Value("#{propertyMapper.solrUiMap('${logsearch.solr.audit.logs.column.mapping}}')}")
-  private Map<String, String> solrAndUiColumns;
-
-  @Override
-  public String getCollection() {
-    return collection;
-  }
-
-  @Override
-  public void setCollection(String collection) {
-    this.collection = collection;
-  }
-
-  @Override
-  public String getSplitInterval() {
-    return splitInterval;
-  }
-
-  @Override
-  public void setSplitInterval(String splitInterval) {
-    this.splitInterval = splitInterval;
-  }
-
-  @Override
-  public String getConfigName() {
-    return configName;
-  }
-
-  @Override
-  public void setConfigName(String configName) {
-    this.configName = configName;
-  }
-
-  @Override
-  public Integer getNumberOfShards() {
-    return numberOfShards;
-  }
-
-  @Override
-  public void setNumberOfShards(Integer numberOfShards) {
-    this.numberOfShards = numberOfShards;
-  }
-
-  @Override
-  public Integer getReplicationFactor() {
-    return replicationFactor;
-  }
-
-  @Override
-  public void setReplicationFactor(Integer replicationFactor) {
-    this.replicationFactor = replicationFactor;
-  }
-
-  @Override
-  public Map<String, String> getColumnMapping() {
-    return columnMapping;
-  }
-
-  @Override
-  public void setColumnMapping(Map<String, String> columnMapping) {
-    this.columnMapping = columnMapping;
-  }
-
-  @Override
-  public List<String> getExcludeColumnList() {
-    return excludeColumnList;
-  }
-
-  @Override
-  public void setExcludeColumnList(List<String> excludeColumnList) {
-    this.excludeColumnList = excludeColumnList;
-  }
-
-  @Override
-  public Map<String, String> getSolrAndUiColumns() {
-    return solrAndUiColumns;
-  }
-
-  @Override
-  public void setSolrAndUiColumns(Map<String, String> solrAndUiColumns) {
-    this.solrAndUiColumns = solrAndUiColumns;
-  }
-
-  public List<String> getFields() {
-    return fields;
-  }
-
-  public void setFields(List<String> fields) {
-    this.fields = fields;
-  }
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/6fa4abfe/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/SolrServiceLogPropsConfig.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/SolrServiceLogPropsConfig.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/SolrServiceLogPropsConfig.java
new file mode 100644
index 0000000..81935d4
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/SolrServiceLogPropsConfig.java
@@ -0,0 +1,94 @@
+/*
+ * 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.conf;
+
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.Configuration;
+
+import java.util.List;
+import java.util.Map;
+
+@Configuration
+public class SolrServiceLogPropsConfig extends SolrConnectionPropsConfig {
+
+  @Value("${logsearch.solr.collection.service.logs:hadoop_logs}")
+  private String collection;
+
+  @Value("${logsearch.service.logs.split.interval.mins:none}")
+  private String splitInterval;
+
+  @Value("${logsearch.solr.service.logs.config.name:hadoop_logs}")
+  private String configName;
+
+  @Value("${logsearch.collection.service.logs.numshards:1}")
+  private Integer numberOfShards;
+
+  @Value("${logsearch.collection.service.logs.replication.factor:1}")
+  private Integer replicationFactor;
+
+  @Override
+  public String getCollection() {
+    return collection;
+  }
+
+  @Override
+  public void setCollection(String collection) {
+    this.collection = collection;
+  }
+
+  @Override
+  public String getSplitInterval() {
+    return splitInterval;
+  }
+
+  @Override
+  public void setSplitInterval(String splitInterval) {
+    this.splitInterval = splitInterval;
+  }
+
+  @Override
+  public String getConfigName() {
+    return configName;
+  }
+
+  @Override
+  public void setConfigName(String configName) {
+    this.configName = configName;
+  }
+
+  @Override
+  public Integer getNumberOfShards() {
+    return numberOfShards;
+  }
+
+  @Override
+  public void setNumberOfShards(Integer numberOfShards) {
+    this.numberOfShards = numberOfShards;
+  }
+
+  @Override
+  public Integer getReplicationFactor() {
+    return replicationFactor;
+  }
+
+  @Override
+  public void setReplicationFactor(Integer replicationFactor) {
+    this.replicationFactor = replicationFactor;
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/6fa4abfe/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/SolrUserConfig.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/SolrUserConfig.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/SolrUserConfig.java
deleted file mode 100644
index 8ae630a..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/SolrUserConfig.java
+++ /dev/null
@@ -1,104 +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.conf;
-
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.context.annotation.Configuration;
-
-import java.util.List;
-
-@Configuration
-public class SolrUserConfig extends SolrConnectionConfig {
-
-  @Value("${logsearch.solr.collection.history:history}")
-  private String collection;
-
-  @Value("${logsearch.history.split.interval.mins:none}")
-  private String splitInterval;
-
-  @Value("${logsearch.solr.history.config.name:history}")
-  private String configName;
-
-  @Value("${logsearch.collection.history.numshards:1}")
-  private Integer numberOfShards;
-
-  @Value("${logsearch.collection.history.replication.factor:2}")
-  private Integer replicationFactor;
-
-  @Value("#{'${logsearch.logfeeder.include.default.level:FATAL,ERROR,WARN,INFO,DEBUG,TRACE,UNKNOWN}'.split(',')}")
-  private List<String> logLevels;
-
-  @Override
-  public String getCollection() {
-    return collection;
-  }
-
-  @Override
-  public void setCollection(String collection) {
-    this.collection = collection;
-  }
-
-  @Override
-  public String getSplitInterval() {
-    return splitInterval;
-  }
-
-  @Override
-  public void setSplitInterval(String splitInterval) {
-    this.splitInterval = splitInterval;
-  }
-
-  @Override
-  public String getConfigName() {
-    return configName;
-  }
-
-  @Override
-  public void setConfigName(String configName) {
-    this.configName = configName;
-  }
-
-  @Override
-  public Integer getNumberOfShards() {
-    return numberOfShards;
-  }
-
-  @Override
-  public void setNumberOfShards(Integer numberOfShards) {
-    this.numberOfShards = numberOfShards;
-  }
-
-  @Override
-  public Integer getReplicationFactor() {
-    return replicationFactor;
-  }
-
-  @Override
-  public void setReplicationFactor(Integer replicationFactor) {
-    this.replicationFactor = replicationFactor;
-  }
-
-  public List<String> getLogLevels() {
-    return logLevels;
-  }
-
-  public void setLogLevels(List<String> logLevels) {
-    this.logLevels = logLevels;
-  }
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/6fa4abfe/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/SolrUserPropsConfig.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/SolrUserPropsConfig.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/SolrUserPropsConfig.java
new file mode 100644
index 0000000..38366d5
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/SolrUserPropsConfig.java
@@ -0,0 +1,104 @@
+/*
+ * 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.conf;
+
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.Configuration;
+
+import java.util.List;
+
+@Configuration
+public class SolrUserPropsConfig extends SolrConnectionPropsConfig {
+
+  @Value("${logsearch.solr.collection.history:history}")
+  private String collection;
+
+  @Value("${logsearch.history.split.interval.mins:none}")
+  private String splitInterval;
+
+  @Value("${logsearch.solr.history.config.name:history}")
+  private String configName;
+
+  @Value("${logsearch.collection.history.numshards:1}")
+  private Integer numberOfShards;
+
+  @Value("${logsearch.collection.history.replication.factor:2}")
+  private Integer replicationFactor;
+
+  @Value("#{'${logsearch.logfeeder.include.default.level:FATAL,ERROR,WARN,INFO,DEBUG,TRACE,UNKNOWN}'.split(',')}")
+  private List<String> logLevels;
+
+  @Override
+  public String getCollection() {
+    return collection;
+  }
+
+  @Override
+  public void setCollection(String collection) {
+    this.collection = collection;
+  }
+
+  @Override
+  public String getSplitInterval() {
+    return splitInterval;
+  }
+
+  @Override
+  public void setSplitInterval(String splitInterval) {
+    this.splitInterval = splitInterval;
+  }
+
+  @Override
+  public String getConfigName() {
+    return configName;
+  }
+
+  @Override
+  public void setConfigName(String configName) {
+    this.configName = configName;
+  }
+
+  @Override
+  public Integer getNumberOfShards() {
+    return numberOfShards;
+  }
+
+  @Override
+  public void setNumberOfShards(Integer numberOfShards) {
+    this.numberOfShards = numberOfShards;
+  }
+
+  @Override
+  public Integer getReplicationFactor() {
+    return replicationFactor;
+  }
+
+  @Override
+  public void setReplicationFactor(Integer replicationFactor) {
+    this.replicationFactor = replicationFactor;
+  }
+
+  public List<String> getLogLevels() {
+    return logLevels;
+  }
+
+  public void setLogLevels(List<String> logLevels) {
+    this.logLevels = logLevels;
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/6fa4abfe/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/AuditSolrDao.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/AuditSolrDao.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/AuditSolrDao.java
index 4f5e734..8d6a4da 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/AuditSolrDao.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/AuditSolrDao.java
@@ -19,58 +19,65 @@
 
 package org.apache.ambari.logsearch.dao;
 
-import java.util.Arrays;
-import java.util.Collection;
-
 import javax.annotation.PostConstruct;
 import javax.inject.Inject;
 
-import org.apache.ambari.logsearch.common.PropertiesHelper;
-import org.apache.ambari.logsearch.conf.SolrAuditLogConfig;
+import org.apache.ambari.logsearch.conf.SolrAuditLogPropsConfig;
 import org.apache.ambari.logsearch.manager.ManagerBase.LogType;
 import org.apache.commons.lang.StringUtils;
 import org.apache.log4j.Logger;
+import org.apache.solr.client.solrj.impl.CloudSolrClient;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.data.solr.core.SolrTemplate;
 import org.springframework.stereotype.Component;
 
 @Component
 public class AuditSolrDao extends SolrDaoBase {
 
-  private static final Logger logger = Logger.getLogger(AuditSolrDao.class);
+  private static final Logger LOG = Logger.getLogger(AuditSolrDao.class);
+
+  @Inject
+  private SolrAuditLogPropsConfig solrAuditLogPropsConfig;
+
+  @Inject
+  @Qualifier("auditSolrTemplate")
+  private SolrTemplate auditSolrTemplate;
 
   @Inject
-  private SolrAuditLogConfig solrAuditLogConfig;
+  private SolrAliasDao solrAliasDao;
+
+  @Inject
+  private SolrCollectionDao solrCollectionDao;
+
+  @Inject
+  private SolrSchemaFieldDao solrSchemaFieldDao;
 
   public AuditSolrDao() {
     super(LogType.AUDIT);
   }
 
+  @Override
+  public CloudSolrClient getSolrClient() {
+    return (CloudSolrClient) auditSolrTemplate.getSolrClient();
+  }
+
   @PostConstruct
   public void postConstructor() {
-    String solrUrl = solrAuditLogConfig.getSolrUrl();
-    String zkConnectString = solrAuditLogConfig.getZkConnectString();
-    String collection = solrAuditLogConfig.getCollection();
-    String aliasNameIn = solrAuditLogConfig.getAliasNameIn();
-    String rangerAuditCollection = solrAuditLogConfig.getRangerCollection();
-    String splitInterval = solrAuditLogConfig.getSplitInterval();
-    String configName = solrAuditLogConfig.getConfigName();
-    int numberOfShards = solrAuditLogConfig.getNumberOfShards();
-    int replicationFactor = solrAuditLogConfig.getReplicationFactor();
+    String aliasNameIn = solrAuditLogPropsConfig.getAliasNameIn();
+    String rangerAuditCollection = solrAuditLogPropsConfig.getRangerCollection();
 
     try {
-      connectToSolr(solrUrl, zkConnectString, collection);
-      
+      solrCollectionDao.checkSolrStatus(getSolrClient());
       boolean createAlias = (aliasNameIn != null && !StringUtils.isBlank(rangerAuditCollection));
-      boolean needToPopulateSchemaField = !createAlias;
-      
-      setupCollections(splitInterval, configName, numberOfShards, replicationFactor, needToPopulateSchemaField);
-      
+      solrCollectionDao.setupCollections(getSolrClient(), solrAuditLogPropsConfig);
       if (createAlias) {
-        Collection<String> collectionsIn = Arrays.asList(collection, rangerAuditCollection.trim());
-        setupAlias(aliasNameIn, collectionsIn);
+        solrAliasDao.setupAlias(solrSchemaFieldDao, getSolrClient(), solrAuditLogPropsConfig, this);
+      } else {
+        solrSchemaFieldDao.populateSchemaFields(getSolrClient(), solrAuditLogPropsConfig, this);
       }
     } catch (Exception e) {
-      logger.error("Error while connecting to Solr for audit logs : solrUrl=" + solrUrl + ", zkConnectString=" +
-          zkConnectString + ", collection=" + collection, e);
+      LOG.error("Error while connecting to Solr for audit logs : solrUrl=" + solrAuditLogPropsConfig.getSolrUrl() + ", zkConnectString=" +
+          solrAuditLogPropsConfig.getZkConnectString() + ", collection=" + solrAuditLogPropsConfig.getCollection(), e);
     }
   }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/6fa4abfe/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/ServiceLogsSolrDao.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/ServiceLogsSolrDao.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/ServiceLogsSolrDao.java
index e338b7c..a6f5acf 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/ServiceLogsSolrDao.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/ServiceLogsSolrDao.java
@@ -22,41 +22,52 @@ package org.apache.ambari.logsearch.dao;
 import javax.annotation.PostConstruct;
 import javax.inject.Inject;
 
-import org.apache.ambari.logsearch.common.PropertiesHelper;
-import org.apache.ambari.logsearch.conf.SolrServiceLogConfig;
+import org.apache.ambari.logsearch.conf.SolrServiceLogPropsConfig;
 import org.apache.ambari.logsearch.manager.ManagerBase.LogType;
 import org.apache.log4j.Logger;
+import org.apache.solr.client.solrj.impl.CloudSolrClient;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.data.solr.core.SolrTemplate;
 import org.springframework.stereotype.Component;
 
 @Component
 public class ServiceLogsSolrDao extends SolrDaoBase {
 
-  private static final Logger logger = Logger.getLogger(ServiceLogsSolrDao.class);
+  private static final Logger LOG = Logger.getLogger(ServiceLogsSolrDao.class);
 
   @Inject
-  private SolrServiceLogConfig solrServiceLogConfig;
-  
+  private SolrCollectionDao solrCollectionDao;
+
+  @Inject
+  private SolrServiceLogPropsConfig solrServiceLogPropsConfig;
+
+  @Inject
+  @Qualifier("serviceSolrTemplate")
+  private SolrTemplate serviceSolrTemplate;
+
+  @Inject
+  private SolrSchemaFieldDao solrSchemaFieldDao;
+
   public ServiceLogsSolrDao() {
     super(LogType.SERVICE);
   }
 
+  @Override
+  public CloudSolrClient getSolrClient() {
+    return (CloudSolrClient) serviceSolrTemplate.getSolrClient();
+  }
+
   @PostConstruct
   public void postConstructor() {
-    logger.info("postConstructor() called.");
-    String solrUrl = solrServiceLogConfig.getSolrUrl();
-    String zkConnectString = solrServiceLogConfig.getZkConnectString();
-    String collection = solrServiceLogConfig.getCollection();
-    String splitInterval = solrServiceLogConfig.getSplitInterval();
-    String configName = solrServiceLogConfig.getConfigName();
-    int numberOfShards = solrServiceLogConfig.getNumberOfShards();
-    int replicationFactor = solrServiceLogConfig.getReplicationFactor();
-
+    LOG.info("postConstructor() called.");
     try {
-      connectToSolr(solrUrl, zkConnectString, collection);
-      setupCollections(splitInterval, configName, numberOfShards, replicationFactor, true);
+      solrCollectionDao.checkSolrStatus(getSolrClient());
+      solrCollectionDao.setupCollections(getSolrClient(), solrServiceLogPropsConfig);
+      solrSchemaFieldDao.populateSchemaFields(getSolrClient(), solrServiceLogPropsConfig, this);
     } catch (Exception e) {
-      logger.error("error while connecting to Solr for service logs : solrUrl=" + solrUrl + ", zkConnectString=" +
-          zkConnectString + ", collection=" + collection, e);
+      LOG.error("error while connecting to Solr for service logs : solrUrl=" + solrServiceLogPropsConfig.getSolrUrl()
+        + ", zkConnectString=" + solrServiceLogPropsConfig.getZkConnectString()
+        + ", collection=" + solrServiceLogPropsConfig.getCollection(), e);
     }
   }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/6fa4abfe/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/SolrAliasDao.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/SolrAliasDao.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/SolrAliasDao.java
new file mode 100644
index 0000000..81471d3
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/SolrAliasDao.java
@@ -0,0 +1,123 @@
+/*
+ * 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.dao;
+
+import org.apache.ambari.logsearch.conf.SolrAuditLogPropsConfig;
+import org.apache.commons.lang.StringUtils;
+import org.apache.solr.client.solrj.SolrServerException;
+import org.apache.solr.client.solrj.impl.CloudSolrClient;
+import org.apache.solr.client.solrj.request.CollectionAdminRequest;
+import org.apache.solr.client.solrj.response.CollectionAdminResponse;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Component;
+
+import javax.inject.Inject;
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+
+@Component
+public class SolrAliasDao {
+
+  private static final Logger LOG = LoggerFactory.getLogger(SolrAliasDao.class);
+
+  private static final int ALIAS_SETUP_RETRY_SECOND = 30*60;
+
+  @Inject
+  private SolrCollectionDao solrCollectionDao;
+
+  protected void setupAlias(final SolrSchemaFieldDao solrSchemaFieldDao, final CloudSolrClient solrClient,
+                            final SolrAuditLogPropsConfig solrPropsConfig, final SolrDaoBase solrDaoBase) throws Exception {
+    final Collection<String> collectionListIn = Arrays.asList(solrPropsConfig.getCollection(), solrPropsConfig.getRangerCollection().trim());
+
+    if (solrPropsConfig.getAliasNameIn() == null || collectionListIn.size() == 0 || solrClient == null) {
+      LOG.info("Will not create alias " + solrPropsConfig.getAliasNameIn() + " for " +
+        collectionListIn.toString() + ", solrCloudClient=" + solrClient);
+      return;
+    }
+
+    LOG.info("setupAlias " + solrPropsConfig.getAliasNameIn() + " for " + collectionListIn.toString());
+    // Start a background thread to do setup
+    Thread setupThread = new Thread("setup_alias_" + solrPropsConfig.getAliasNameIn()) {
+      @Override
+      public void run() {
+        LOG.info("Started monitoring thread to check availability of Solr server. alias=" + solrPropsConfig.getAliasNameIn() +
+          ", collections=" + collectionListIn.toString());
+        int retryCount = 0;
+        while (true) {
+          try {
+            int count = createAlias(solrClient, solrPropsConfig.getAliasNameIn(), collectionListIn);
+            if (count > 0) {
+              solrClient.setDefaultCollection(solrPropsConfig.getAliasNameIn());
+              if (count == collectionListIn.size()) {
+                LOG.info("Setup for alias " + solrPropsConfig.getAliasNameIn() + " is successful. Exiting setup retry thread. " +
+                  "Collections=" + collectionListIn);
+                solrSchemaFieldDao.populateSchemaFields(solrClient, solrPropsConfig, solrDaoBase);
+                break;
+              }
+            } else {
+              LOG.warn("Not able to create alias=" + solrPropsConfig.getAliasNameIn() + ", retryCount=" + retryCount);
+            }
+          } catch (Exception e) {
+            LOG.error("Error setting up alias=" + solrPropsConfig.getAliasNameIn(), e);
+          }
+          try {
+            Thread.sleep(ALIAS_SETUP_RETRY_SECOND * 1000);
+          } catch (InterruptedException sleepInterrupted) {
+            LOG.info("Sleep interrupted while setting up alias " + solrPropsConfig.getAliasNameIn());
+            break;
+          }
+          retryCount++;
+        }
+      }
+    };
+    setupThread.setDaemon(true);
+    setupThread.start();
+  }
+
+  private int createAlias(final CloudSolrClient solrClient, String aliasNameIn, Collection<String> collectionListIn)
+    throws SolrServerException, IOException {
+    List<String> collectionToAdd = solrCollectionDao.getCollections(solrClient);
+    collectionToAdd.retainAll(collectionListIn);
+
+    String collectionsCSV = null;
+    if (!collectionToAdd.isEmpty()) {
+      collectionsCSV = StringUtils.join(collectionToAdd, ',');
+      CollectionAdminRequest.CreateAlias aliasCreateRequest = new CollectionAdminRequest.CreateAlias();
+      aliasCreateRequest.setAliasName(aliasNameIn);
+      aliasCreateRequest.setAliasedCollections(collectionsCSV);
+      CollectionAdminResponse createResponse = aliasCreateRequest.process(solrClient);
+      if (createResponse.getStatus() != 0) {
+        LOG.error("Error creating alias. alias=" + aliasNameIn + ", collectionList=" + collectionsCSV
+          + ", response=" + createResponse);
+        return 0;
+      }
+    }
+    if ( collectionToAdd.size() == collectionListIn.size()) {
+      LOG.info("Created alias for all collections. alias=" + aliasNameIn + ", collectionsCSV=" + collectionsCSV);
+    } else {
+      LOG.info("Created alias for " + collectionToAdd.size() + " out of " + collectionListIn.size() + " collections. " +
+        "alias=" + aliasNameIn + ", collectionsCSV=" + collectionsCSV);
+    }
+    return collectionToAdd.size();
+  }
+}


[52/58] [abbrv] ambari git commit: AMBARI-18548. Declarative Logsearch/Logfeeder Component Metadata for Stack Component (oleewere)

Posted by ol...@apache.org.
http://git-wip-us.apache.org/repos/asf/ambari/blob/559fc2e4/ambari-server/src/main/resources/common-services/KNOX/0.5.0.2.2/configuration/knox-logsearch-conf.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/KNOX/0.5.0.2.2/configuration/knox-logsearch-conf.xml b/ambari-server/src/main/resources/common-services/KNOX/0.5.0.2.2/configuration/knox-logsearch-conf.xml
new file mode 100644
index 0000000..528b011
--- /dev/null
+++ b/ambari-server/src/main/resources/common-services/KNOX/0.5.0.2.2/configuration/knox-logsearch-conf.xml
@@ -0,0 +1,93 @@
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
+<!--
+/**
+ * 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.
+ */
+-->
+<configuration supports_final="false" supports_adding_forbidden="true">
+  <property>
+    <name>service_name</name>
+    <display-name>Service name</display-name>
+    <description>Service name for Logsearch Portal (label)</description>
+    <value>Knox</value>
+    <on-ambari-upgrade add="true"/>
+  </property>
+  <property>
+    <name>component_mappings</name>
+    <display-name>Component mapping</display-name>
+    <description>Logsearch component logid mapping list (e.g.: COMPONENT1:logid1,logid2;COMPONENT2:logid3)</description>
+    <value>KNOX_GATEWAY:knox_gateway,knox_cli,knox_ldap</value>
+    <on-ambari-upgrade add="true"/>
+  </property>
+  <property>
+    <name>content</name>
+    <display-name>Logfeeder Config</display-name>
+    <description>Metadata jinja template for Logfeeder which contains grok patterns for reading service specific logs.</description>
+    <value>
+{
+  "input":[
+    {
+      "type":"knox_gateway",
+      "rowtype":"service",
+      "path":"/var/log/knox/gateway.log"
+    },
+    {
+      "type":"knox_cli",
+      "rowtype":"service",
+      "path":"/var/log/knox/knoxcli.log"
+    },
+    {
+      "type":"knox_ldap",
+      "rowtype":"service",
+      "path":"/var/log/knox/ldap.log"
+    }
+   ],
+  "filter":[
+    {
+      "filter":"grok",
+      "conditions":{
+        "fields":{
+          "type":[
+            "knox_gateway",
+            "knox_cli",
+            "knox_ldap"
+          ]
+
+        }
+       },
+      "log4j_format":"%d{ISO8601} %-5p %c{2} (%F:%M(%L)) - %m%n",
+      "multiline_pattern":"^(%{TIMESTAMP_ISO8601:logtime})",
+      "message_pattern":"(?m)^%{TIMESTAMP_ISO8601:logtime}%{SPACE}%{LOGLEVEL:level}%{SPACE}%{JAVACLASS:logger_name}%{SPACE}\\(%{JAVAFILE:file}:%{JAVAMETHOD:method}\\(%{INT:line_number}\\)\\)%{SPACE}-%{SPACE}%{GREEDYDATA:log_message}",
+      "post_map_values":{
+        "logtime":{
+          "map_date":{
+            "target_date_pattern":"yyyy-MM-dd HH:mm:ss,SSS"
+          }
+         }
+       }
+     }
+   ]
+ }
+    </value>
+    <value-attributes>
+      <type>content</type>
+      <show-property-name>false</show-property-name>
+    </value-attributes>
+    <on-ambari-upgrade add="true"/>
+  </property>
+</configuration>

http://git-wip-us.apache.org/repos/asf/ambari/blob/559fc2e4/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/configuration/logfeeder-system_log-env.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/configuration/logfeeder-system_log-env.xml b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/configuration/logfeeder-system_log-env.xml
new file mode 100644
index 0000000..b8dd4b9
--- /dev/null
+++ b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/configuration/logfeeder-system_log-env.xml
@@ -0,0 +1,59 @@
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
+<!--
+/**
+ * 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.
+ */
+-->
+<configuration supports_adding_forbidden="true">
+
+  <property>
+    <name>logfeeder_system_messages_content</name>
+    <display-name>System messages grok filter</display-name>
+    <description>This is the jinja template for input.config.system_messages.json file</description>
+    <value/>
+    <property-type>VALUE_FROM_PROPERTY_FILE</property-type>
+    <value-attributes>
+      <property-file-name>system_messages.json</property-file-name>
+      <property-file-type>text</property-file-type>
+    </value-attributes>
+    <on-ambari-upgrade add="true"/>
+  </property>
+
+  <property>
+    <name>logfeeder_secure_log_content</name>
+    <display-name>Secure log grok filter</display-name>
+    <description>This is the jinja template for input.config.secure_log.json file</description>
+    <value/>
+    <property-type>VALUE_FROM_PROPERTY_FILE</property-type>
+    <value-attributes>
+      <property-file-name>secure_log.json</property-file-name>
+      <property-file-type>text</property-file-type>
+    </value-attributes>
+    <on-ambari-upgrade add="true"/>
+  </property>
+
+  <property>
+    <name>logfeeder_system_log_enabled</name>
+    <value>false</value>
+    <value-attributes>
+      <type>boolean</type>
+    </value-attributes>
+    <on-ambari-upgrade add="true"/>
+  </property>
+
+</configuration>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/559fc2e4/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/logfeeder.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/logfeeder.py b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/logfeeder.py
index cfc6c91..fbc29c8 100644
--- a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/logfeeder.py
+++ b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/logfeeder.py
@@ -25,7 +25,6 @@ from resource_management.libraries.script.script import Script
 from setup_logfeeder import setup_logfeeder
 from logsearch_common import kill_process
 
-
 class LogFeeder(Script):
   def install(self, env):
     import params

http://git-wip-us.apache.org/repos/asf/ambari/blob/559fc2e4/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/logsearch.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/logsearch.py b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/logsearch.py
index 9c5215d..4410712 100644
--- a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/logsearch.py
+++ b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/logsearch.py
@@ -24,7 +24,6 @@ from resource_management.libraries.script.script import Script
 from setup_logsearch import setup_logsearch
 from logsearch_common import kill_process
 
-
 class LogSearch(Script):
   def install(self, env):
     import params

http://git-wip-us.apache.org/repos/asf/ambari/blob/559fc2e4/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/logsearch_config_aggregator.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/logsearch_config_aggregator.py b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/logsearch_config_aggregator.py
new file mode 100644
index 0000000..ad515ee
--- /dev/null
+++ b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/logsearch_config_aggregator.py
@@ -0,0 +1,67 @@
+"""
+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.
+
+"""
+from resource_management import Logger
+
+def __parse_component_mappings(component_mappings):
+  components = list()
+  component_mappings_list = component_mappings.split(';')
+  if component_mappings_list and len(component_mappings_list) > 0:
+    metadata_list = map(lambda x : x.split(':'), component_mappings_list)
+    if metadata_list and len(metadata_list) > 0:
+      for metadata in metadata_list:
+        if (len(metadata) == 2):
+          logids = metadata[1].split(',')
+          components.extend(logids)
+          Logger.info("Found logids for logsearch component %s - (%s) " % (metadata[0], metadata[1]))
+  return components
+
+def get_logsearch_meta_configs(configurations):
+  logsearch_meta_configs = {}
+  for key, value in configurations.iteritems():  # iter on both keys and values
+    if str(key).endswith('logsearch-conf'):
+      logsearch_meta_configs[key] = value
+      Logger.info("Found logsearch config entry : " + key)
+  return logsearch_meta_configs
+
+def get_logfeeder_metadata(logsearch_meta_configs):
+  """
+  get logfeeder pattern metadata list, an element: (e.g.) :
+  ['service_config_name' : 'pattern json content']
+  """
+  logfeeder_contents = {}
+  for key, value in logsearch_meta_configs.iteritems():
+    if 'content' in logsearch_meta_configs[key]:
+      logfeeder_contents[key] = logsearch_meta_configs[key]['content']
+      Logger.info("Found logfeeder pattern content in " + key)
+  return logfeeder_contents
+
+def get_logsearch_metadata(logsearch_meta_configs):
+  """
+  get logsearch metadata list, an element (e.g.) :
+  ['service_name_key' : {component1 : [logid1, logid2]}, {component2 : [logid1, logid2]}]
+  """
+  logsearch_service_component_mappings = {}
+  for key, value in logsearch_meta_configs.iteritems():
+    if 'service_name' in logsearch_meta_configs[key] and 'component_mappings' in logsearch_meta_configs[key]:
+      service_name = logsearch_meta_configs[key]['service_name']
+      component_mappings = __parse_component_mappings(logsearch_meta_configs[key]['component_mappings'])
+      logsearch_service_component_mappings[service_name] = component_mappings
+
+  return logsearch_service_component_mappings
+

http://git-wip-us.apache.org/repos/asf/ambari/blob/559fc2e4/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/params.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/params.py b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/params.py
index 4526640..1f5064a 100644
--- a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/params.py
+++ b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/params.py
@@ -19,6 +19,7 @@ limitations under the License.
 
 """
 from ambari_commons.constants import AMBARI_SUDO_BINARY
+from logsearch_config_aggregator import get_logfeeder_metadata, get_logsearch_metadata, get_logsearch_meta_configs
 from resource_management.libraries.functions.default import default
 from resource_management.libraries.functions.format import format
 from resource_management.libraries.functions.is_empty import is_empty
@@ -66,6 +67,11 @@ zookeeper_hosts = ",".join(zookeeper_hosts_list)
 cluster_name = str(config['clusterName'])
 availableServices = config['availableServices']
 
+configurations = config['configurations'] # need reference inside logfeeder jinja templates
+logserch_meta_configs = get_logsearch_meta_configs(configurations)
+logsearch_metadata = get_logsearch_metadata(logserch_meta_configs)
+logfeeder_metadata = get_logfeeder_metadata(logserch_meta_configs)
+
 # for now just pick first collector
 if 'metrics_collector_hosts' in config['clusterHostInfo']:
   metrics_collector_hosts_list = ",".join(config['clusterHostInfo']['metrics_collector_hosts'])
@@ -139,41 +145,13 @@ logsearch_app_log4j_content = config['configurations']['logsearch-log4j']['conte
 # Log dirs
 ambari_server_log_dir = '/var/log/ambari-server'
 ambari_agent_log_dir = '/var/log/ambari-agent'
-knox_log_dir = '/var/log/knox'
 hst_log_dir = '/var/log/hst'
 hst_activity_log_dir = '/var/log/smartsense-activity'
 
-metrics_collector_log_dir = default('/configurations/ams-env/metrics_collector_log_dir', '/var/log/ambari-metrics-collector')
-metrics_monitor_log_dir = default('/configurations/ams-env/metrics_monitor_log_dir', '/var/log/ambari-metrics-monitor')
-metrics_grafana_log_dir = default('/configurations/ams-grafana-env/metrics_grafana_log_dir', '/var/log/ambari-metrics-grafana')
-
-atlas_log_dir = default('/configurations/atlas-env/metadata_log_dir', '/var/log/atlas')
-accumulo_log_dir = default('/configurations/accumulo-env/accumulo_log_dir', '/var/log/accumulo')
-falcon_log_dir = default('/configurations/falcon-env/falcon_log_dir', '/var/log/falcon')
-flume_log_dir = default('/configurations/flume-env/flume_log_dir', '/var/log/flume')
-hbase_log_dir = default('/configurations/hbase-env/hbase_log_dir', '/var/log/hbase')
-hdfs_log_dir_prefix = default('/configurations/hadoop-env/hdfs_log_dir_prefix', '/var/log/hadoop')
-hive_log_dir = default('/configurations/hive-env/hive_log_dir', '/var/log/hive')
-hcat_log_dir = default('configurations/hive-env/hcat_log_dir', '/var/log/webhcat')
-infra_solr_log_dir = default('configurations/infra-solr-env/infra_solr_log_dir', '/var/log/ambari-infra-solr')
-kafka_log_dir = default('/configurations/kafka-env/kafka_log_dir', '/var/log/kafka')
-nifi_log_dir = default('/configurations/nifi-env/nifi_node_log_dir', '/var/log/nifi')
-oozie_log_dir = default('/configurations/oozie-env/oozie_log_dir', '/var/log/oozie')
-ranger_usersync_log_dir = default('/configurations/ranger-env/ranger_usersync_log_dir', '/var/log/ranger/usersync')
-ranger_admin_log_dir = default('/configurations/ranger-env/ranger_admin_log_dir', '/var/log/ranger/admin')
-ranger_kms_log_dir = default('/configurations/kms-env/kms_log_dir', '/var/log/ranger/kms')
-storm_log_dir = default('/configurations/storm-env/storm_log_dir', '/var/log/storm')
-yarn_log_dir_prefix = default('/configurations/yarn-env/yarn_log_dir_prefix', '/var/log/hadoop')
-mapred_log_dir_prefix = default('/configurations/mapred-env/mapred_log_dir_prefix', '/var/log/hadoop')
-zeppelin_log_dir = default('/configurations/zeppelin-env/zeppelin_log_dir', '/var/log/zeppelin')
-zk_log_dir = default('/configurations/zookeeper-env/zk_log_dir', '/var/log/zookeeper')
-spark_log_dir = default('/configurations/spark-env/spark_log_dir', '/var/log/spark')
-livy_log_dir = default('/configurations/livy-env/livy_log_dir', '/var/log/livy')
-spark2_log_dir = default('/configurations/spark2-env/spark_log_dir', '/var/log/spark2')
-
-hdfs_user = default('configurations/hadoop-env/hdfs_user', 'hdfs')
-mapred_user =  default('configurations/mapred-env/mapred_user', 'mapred')
-yarn_user =  default('configurations/yarn-env/yarn_user', 'yarn')
+# System logs
+logfeeder_system_messages_content = config['configurations']['logfeeder-system_log-env']['logfeeder_system_messages_content']
+logfeeder_secure_log_content = config['configurations']['logfeeder-system_log-env']['logfeeder_secure_log_content']
+logfeeder_system_log_enabled = default('/configurations/logfeeder-system_log-env/logfeeder_system_log_enabled', False)
 
 # Logsearch auth configs
 
@@ -272,14 +250,17 @@ logfeeder_truststore_location = config['configurations']['logfeeder-env']['logfe
 logfeeder_truststore_password = config['configurations']['logfeeder-env']['logfeeder_truststore_password']
 logfeeder_truststore_type = config['configurations']['logfeeder-env']['logfeeder_truststore_type']
 
-logfeeder_supported_services = ['accumulo', 'ambari', 'ams', 'atlas', 'falcon', 'flume', 'hbase', 'hdfs', 'hive', 'hst', 'infra',
-                                'kafka', 'knox', 'logsearch', 'nifi', 'oozie', 'ranger', 'spark', 'spark2', 'storm', 'yarn',
-                                'zeppelin', 'zookeeper']
+logfeeder_default_services = ['ambari', 'logsearch']
+logfeeder_default_config_file_names = ['global.config.json', 'output.config.json'] + ['input.config-%s.json' % (tag) for tag in logfeeder_default_services]
+logfeeder_custom_config_file_names = ['input.config-%s.json' % (tag.replace('-logsearch-conf', ''))
+                                      for tag, content in logfeeder_metadata.iteritems() if any(logfeeder_metadata)]
 
-logfeeder_config_file_names = \
-  ['global.config.json', 'output.config.json'] + ['input.config-%s.json' % (tag) for tag in logfeeder_supported_services]
+if logfeeder_system_log_enabled:
+  default_config_files = ','.join(logfeeder_default_config_file_names + logfeeder_custom_config_file_names
+                                  + ['input.config-system_messages.json', 'input.config-secure_log.json'])
+else:
+  default_config_files = ','.join(logfeeder_default_config_file_names + logfeeder_custom_config_file_names)
 
-default_config_files = ','.join(logfeeder_config_file_names)
 
 logfeeder_grok_patterns = config['configurations']['logfeeder-grok']['default_grok_patterns']
 if config['configurations']['logfeeder-grok']['custom_grok_patterns'].strip():
@@ -292,8 +273,6 @@ if config['configurations']['logfeeder-grok']['custom_grok_patterns'].strip():
     '\n' + \
     config['configurations']['logfeeder-grok']['custom_grok_patterns']
 
-logfeeder_properties = dict(config['configurations']['logfeeder-properties'])
-
 # logfeeder properties
 
 # load default values

http://git-wip-us.apache.org/repos/asf/ambari/blob/559fc2e4/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/setup_logfeeder.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/setup_logfeeder.py b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/setup_logfeeder.py
index ad16958..e90d623 100644
--- a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/setup_logfeeder.py
+++ b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/setup_logfeeder.py
@@ -17,6 +17,7 @@ limitations under the License.
 
 """
 
+from resource_management.libraries.functions.default import default
 from resource_management.core.resources.system import Directory, File
 from resource_management.libraries.functions.format import format
 from resource_management.core.source import InlineTemplate, Template
@@ -61,11 +62,25 @@ def setup_logfeeder():
        encoding="utf-8"
        )
 
-  for file_name in params.logfeeder_config_file_names:
+  for file_name in params.logfeeder_default_config_file_names:
     File(format("{logsearch_logfeeder_conf}/" + file_name),
          content=Template(file_name + ".j2")
          )
 
+  for service, pattern_content in params.logfeeder_metadata.iteritems():
+    File(format("{logsearch_logfeeder_conf}/input.config-" + service.replace('-logsearch-conf', '') + ".json"),
+      content=InlineTemplate(pattern_content, extra_imports=[default])
+    )
+
+  if params.logfeeder_system_log_enabled:
+    File(format("{logsearch_logfeeder_conf}/input.config-system_messages.json"),
+         content=params.logfeeder_system_messages_content
+         )
+    File(format("{logsearch_logfeeder_conf}/input.config-secure_log.json"),
+         content=params.logfeeder_secure_log_content
+         )
+
+
   if params.security_enabled:
     File(format("{logfeeder_jaas_file}"),
          content=Template("logfeeder_jaas.conf.j2")

http://git-wip-us.apache.org/repos/asf/ambari/blob/559fc2e4/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/templates/HadoopServiceConfig.json.j2
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/templates/HadoopServiceConfig.json.j2 b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/templates/HadoopServiceConfig.json.j2
index 7982631..7e9153f 100644
--- a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/templates/HadoopServiceConfig.json.j2
+++ b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/templates/HadoopServiceConfig.json.j2
@@ -15,520 +15,86 @@
  # See the License for the specific language governing permissions and
  # limitations under the License.
  #}
-{
-  "service": {
-{% if "ACCUMULO" in availableServices %}
-    "accumulo": {
-      "label": "Accumulo",
+ {
+   "service": {
+{% if logsearch_metadata and logsearch_metadata.keys()|length > 0 %}
+  {% for metadata_key, component_list in logsearch_metadata.iteritems() %}
+    "{{ metadata_key.lower() }}": {
+      "label": "{{ metadata_key }}",
       "components": [
+    {% for component in component_list %}
         {
-          "name": "accumulo_gc"
-        },
-        {
-          "name": "accumulo_master"
-        },
-        {
-          "name": "accumulo_monitor"
-        },
-        {
-          "name": "accumulo_tracer"
-        },
-        {
-          "name": "accumulo_tserver"
-        }
-      ],
-      "dependencies": [
-      ]
-    },
-{% endif %}
-{% if "ATLAS" in availableServices %}
-    "atlas": {
-      "label": "Atlas",
-      "components": [
-        {
-          "name": "atlas_app"
-        }
-      ],
-      "dependencies": [
-      ]
-    },
-{% endif %}
-    "ambari": {
-      "label": "Ambari",
-      "components": [
-        {
-          "name": "ambari_agent"
-        },
-        {
-          "name": "ambari_server"
-        },
-        {
-          "name": "ambari_alerts"
-        },
-        {
-          "name": "ambari_audit"
-        },
-        {
-          "name": "ambari_config_changes"
-        },
-        {
-          "name": "ambari_eclipselink"
-        },
-        {
-          "name": "ambari_server_check_database"
-        }
-      ],
-      "dependencies": [
-      ]
-    },
-{% if "AMBARI_METRICS" in availableServices %}
-    "ams": {
-      "label": "AMS",
-      "components": [
-        {
-          "name": "ams_hbase_master"
-        },
-        {
-          "name": "ams_hbase_regionserver"
-        },
-        {
-          "name": "ams_collector"
-        },
-        {
-          "name": "ams_monitor"
-        },
-        {
-          "name": "ams_grafana"
-        }
-      ],
-      "dependencies": [
-      ]
-    },
-{% endif %}
-{% if "FALCON" in availableServices %}
-    "falcon": {
-      "label": "Falcon",
-      "components": [
-        {
-          "name": "falcon_app"
-        }
-      ],
-      "dependencies": [
-      ]
-    },
-{% endif %}
-{% if "FLUME" in availableServices %}
-    "flume": {
-      "label": "Flume",
-      "components": [
-        {
-          "name": "flume_handler"
-        }
-      ],
-      "dependencies": [
-      ]
-    },
-{% endif %}
-{% if "HBASE" in availableServices %}
-    "hbase": {
-      "label": "HBase",
-      "components": [
-        {
-          "name": "hbase_master"
-        },
-        {
-          "name": "hbase_regionserver"
-        },
-        {
-          "name": "hbase_phoenix_server"
-        }
-      ],
-      "dependencies": [
-        {
-          "service": "hdfs",
-          "components": [
-            "hdfs_namenode"
-          ]
-        }
-      ]
-    },
-{% endif %}
-{% if "HDFS" in availableServices %}
-    "hdfs": {
-      "label": "HDFS",
-      "components": [
-        {
-          "name": "hdfs_datanode"
-        },
-        {
-          "name": "hdfs_namenode"
-        },
-        {
-          "name": "hdfs_journalnode"
-        },
-        {
-          "name": "hdfs_secondarynamenode"
-        },
-        {
-          "name": "hdfs_zkfc"
-        },
-        {
-          "name": "hdfs_nfs3"
-        },
-        {
-          "name": "hdfs_audit",
-          "rowtype": "audit"
-        }
-      ],
-      "dependencies": [
-      ]
-    },
-{% endif %}
-{% if "HIVE" in availableServices %}
-    "hive": {
-      "label": "Hive",
-      "components": [
-        {
-          "name": "hive_hiveserver2"
-        },
-        {
-          "name": "hive_metastore"
-        },
-        {
-          "name": "webhcat_server"
-        }
-      ],
-      "dependencies": [
-        {
-          "service": "hdfs",
-          "components": [
-            "hdfs_namenode"
-          ]
-        }
-      ]
-    },
-{% endif %}
-{% if "KAFKA" in availableServices %}
-    "kafka": {
-      "label": "Kafka",
-      "components": [
-        {
-          "name": "kafka_controller"
-        },
-        {
-          "name": "kafka_request"
-        },
-        {
-          "name": "kafka_logcleaner"
-        },
-        {
-          "name": "kafka_server"
-        },
-        {
-          "name": "kafka_statechange"
-        }
-      ],
-      "dependencies": [
-        {
-          "service": "zookeeper",
-          "components": [
-            "zookeeper"
-          ]
-        }
-      ]
-    },
-{% endif %}
-    "ambari_infra" : {
-      "label": "Infra",
-      "components" : [
-        {
-          "name": "infra_solr"
-        }
-      ],
-      "dependencies": [
-      ]
-    },
-{% if "KNOX" in availableServices %}
-    "knox": {
-      "label": "Knox",
-      "components": [
-        {
-          "name": "knox_gateway"
-        },
-        {
-          "name": "knox_cli"
-        },
-        {
-          "name": "knox_ldap"
-        }
-      ],
-      "dependencies": [
-      ]
-    },
-{% endif %}
-{% if "NIFI" in availableServices %}
-    "nifi": {
-      "label": "NiFi",
-      "components": [
-        {
-          "name": "nifi_app"
-        },
-        {
-          "name": "nifi_bootstrap"
-        },
-        {
-          "name": "nifi_setup"
-        },
-        {
-          "name": "nifi_user"
-        },
-        {
-          "name": "nifi_ca"
-        }
-      ],
-      "dependencies": [
-      ]
-    },
-{% endif %}
-{% if "MAPREDUCE2" in availableServices %}
-    "mapred": {
-      "label": "MapReduce",
-      "components": [
-        {
-          "name": "mapred_historyserver"
-        }
-      ],
-      "dependencies": [
-      ]
-    },
-{% endif %}
-    "logsearch": {
-      "label": "Logsearch",
-      "components": [
-        {
-          "name": "logsearch_app"
-        },
-        {
-          "name": "logsearch_feeder"
-        },
-        {
-          "name": "logsearch_perf"
-        }
-      ],
-      "dependencies": [
-      ]
-    },
-{% if "RANGER" in availableServices %}
-    "ranger": {
-      "label": "Ranger",
-      "components": [
-        {
-          "name": "ranger_admin"
-        },
-        {
-          "name": "ranger_dbpatch"
-        },
-        {
-          "name": "ranger_kms"
-        },
-        {
-          "name": "ranger_usersync"
-        }
-      ],
-      "dependencies": [
-        {
-          "service": "hdfs",
-          "required": "optional",
-          "components": [
-            "hdfs_namenode"
-          ]
-        },
-        {
-          "service": "hbase",
-          "required": "optional",
-          "components": [
-            "hbase_master",
-            "hbase_regionserver"
-          ]
-        },
-        {
-          "service": "hive",
-          "required": "optional",
-          "components": [
-            "hive_hiveserver2"
-          ]
-        },
-        {
-          "service": "kafka",
-          "required": "optional",
-          "components": [
-            "kafka_ranger"
-          ]
-        },
-        {
-          "service": "knox",
-          "required": "optional",
-          "components": [
-            "knox_gateway"
-          ]
-        },
-        {
-          "service": "storm",
-          "required": "optional",
-          "components": [
-            "storm_supervisor"
-          ]
-        },
-        {
-          "service": "yarn",
-          "required": "optional",
-          "components": [
-            "yarn_resourcemanager"
-          ]
-        }
-      ]
-    },
-{% endif %}
-{% if "OOZIE" in availableServices %}
-    "oozie": {
-      "label": "Oozie",
-      "components": [
-        {
-          "name": "oozie_app"
-        }
-      ],
-      "dependencies": [
-      ]
-    },
-{% endif %}
-{% if "SMARTSENSE" in availableServices %}
-    "hst": {
-      "label": "SmartSense",
-      "components": [
-        {
-          "name": "hst_server"
-        },
-        {
-          "name": "hst_agent"
-        },
-        {
-          "name": "activity_analyzer"
-        },
-        {
-          "name": "activity_explorer"
-        }
-      ],
-      "dependencies": [
-      ]
-    },
-{% endif %}
-{% if "SPARK" in availableServices %}
-    "spark": {
-      "label": "Spark",
-      "components": [
-        {
-          "name": "spark_jobhistory_server"
-        },
-        {
-          "name": "spark_thriftserver"
-        },
-        {
-          "name": "livy_server"
-        }
-      ],
-      "dependencies": [
-      ]
-    },
-{% endif %}
-{% if "SPARK2" in availableServices %}
-    "spark2": {
-      "label": "Spark 2",
-      "components": [
-        {
-          "name": "spark2_jobhistory_server"
-        },
-        {
-          "name": "spark2_thriftserver"
-        }
-      ],
-      "dependencies": [
-      ]
-    },
-{% endif %}
-{% if "STORM" in availableServices %}
-    "storm": {
-      "label": "Storm",
-      "components": [
-        {
-          "name": "storm_drpc"
-        },
-        {
-          "name": "storm_logviewer"
-        },
-        {
-          "name": "storm_nimbus"
-        },
-        {
-          "name": "storm_supervisor"
-        },
-        {
-          "name": "storm_ui"
-        },
-        {
-          "name": "storm_worker"
-        }
-      ],
-      "dependencies": [
-      ]
-    },
-{% endif %}
-{% if "YARN" in availableServices %}
-    "yarn": {
-      "label": "YARN",
-      "components": [
-        {
-          "name": "yarn_nodemanager"
-        },
-        {
-          "name": "yarn_resourcemanager"
-        },
-        {
-          "name": "yarn_timelineserver"
-        },
-        {
-          "name": "yarn_historyserver"
-        },
-        {
-          "name": "yarn_jobsummary"
-        }
-      ],
-      "dependencies": [
-      ]
-    },
-{% endif %}
-{% if "ZEPPELIN" in availableServices %}
-    "zeppelin": {
-      "label": "Zeppelin",
-      "components": [
-        {
-          "name": "zeppelin"
-        }
-      ],
-      "dependencies": [
-      ]
-    },
-{% endif %}
-{% if "ZOOKEEPER" in availableServices %}
-    "zookeeper": {
-      "label": "ZooKeeper",
-      "components": [
-        {
-          "name": "zookeeper"
+          "name": "{{ component }}"
         }
+      {% if not loop.last %}
+        ,
+      {% endif %}
+    {% endfor %}
       ],
       "dependencies": [
       ]
     }
-{% endif %}
+     ,
+  {% endfor %}
+{% endif %}
+{% if logfeeder_system_log_enabled %}
+     "system" : {
+       "label" : "System",
+       "components" : [
+        {
+          "name": "system_message"
+        },
+        {
+          "name": "secure_log"
+        }
+       ],
+       "dependencies": [
+       ]
+     },
+{% endif %}
+     "ambari": {
+       "label": "Ambari",
+       "components": [
+         {
+           "name": "ambari_agent"
+         },
+         {
+           "name": "ambari_server"
+         },
+         {
+           "name": "ambari_alerts"
+         },
+         {
+           "name": "ambari_audit"
+         },
+         {
+           "name": "ambari_config_changes"
+         },
+         {
+           "name": "ambari_eclipselink"
+         },
+         {
+           "name": "ambari_server_check_database"
+         }
+       ],
+       "dependencies": [
+       ]
+     },
+     "logsearch": {
+       "label": "Logsearch",
+       "components": [
+       {
+         "name": "logsearch_app"
+       },
+       {
+         "name": "logsearch_feeder"
+       },
+       {
+         "name": "logsearch_perf"
+       }
+       ],
+       "dependencies": [
+       ]
+      }
   }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/559fc2e4/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/templates/input.config-accumulo.json.j2
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/templates/input.config-accumulo.json.j2 b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/templates/input.config-accumulo.json.j2
deleted file mode 100644
index 1fd93cf..0000000
--- a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/templates/input.config-accumulo.json.j2
+++ /dev/null
@@ -1,105 +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.
- #}
-{
-  "input":[
-    {
-      "type":"accumulo_gc",
-      "rowtype":"service",
-      "path":"{{accumulo_log_dir}}/gc_*.log"
-    },
-    {
-      "type":"accumulo_master",
-      "rowtype":"service",
-      "path":"{{accumulo_log_dir}}/master_*.log"
-    },
-    {
-      "type":"accumulo_monitor",
-      "rowtype":"service",
-      "path":"{{accumulo_log_dir}}/monitor_*.log"
-    },
-    {
-      "type":"accumulo_tracer",
-      "rowtype":"service",
-      "path":"{{accumulo_log_dir}}/tracer_*.log"
-    },
-    {
-      "type":"accumulo_tserver",
-      "rowtype":"service",
-      "path":"{{accumulo_log_dir}}/tserver_*.log"
-    }
-
-  ],
-  "filter":[
-    {
-      "filter":"grok",
-      "conditions":{
-        "fields":{
-          "type":[
-            "accumulo_master"
-          ]
-
-        }
-
-      },
-      "log4j_format":"%d{ISO8601} [%-8c{2}] %-5p: %m%n",
-      "multiline_pattern":"^(%{TIMESTAMP_ISO8601:logtime})",
-      "message_pattern":"(?m)^%{TIMESTAMP_ISO8601:logtime}%{SPACE}\\[%{JAVACLASS:logger_name}\\]%{SPACE}%{LOGLEVEL:level}:%{SPACE}%{GREEDYDATA:log_message}",
-      "post_map_values":{
-        "logtime":{
-          "map_date":{
-            "target_date_pattern":"yyyy-MM-dd HH:mm:ss,SSS"
-          }
-
-        }
-
-      }
-
-    },
-    {
-      "filter":"grok",
-      "comment":"This one has one extra space after LEVEL",
-      "conditions":{
-        "fields":{
-          "type":[
-            "accumulo_gc",
-            "accumulo_monitor",
-            "accumulo_tracer",
-            "accumulo_tserver"
-          ]
-
-        }
-
-      },
-      "log4j_format":"%d{ISO8601} [%-8c{2}] %-5p: %X{application} %m%n",
-      "multiline_pattern":"^(%{TIMESTAMP_ISO8601:logtime})",
-      "message_pattern":"(?m)^%{TIMESTAMP_ISO8601:logtime}%{SPACE}\\[%{JAVACLASS:logger_name}\\]%{SPACE}%{LOGLEVEL:level}%{SPACE}:%{SPACE}%{GREEDYDATA:log_message}",
-      "post_map_values":{
-        "logtime":{
-          "map_date":{
-            "target_date_pattern":"yyyy-MM-dd HH:mm:ss,SSS"
-          }
-          
-        }
-
-      }
-
-    }
-
-  ]
-
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/559fc2e4/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/templates/input.config-ambari.json.j2
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/templates/input.config-ambari.json.j2 b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/templates/input.config-ambari.json.j2
index 36507c9..ad4adb2 100644
--- a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/templates/input.config-ambari.json.j2
+++ b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/templates/input.config-ambari.json.j2
@@ -31,7 +31,7 @@
       "type":"ambari_alerts",
       "rowtype":"service",
       "add_fields":{
-        "level":"INFO"
+        "level":"UNKNOWN"
       },
       "path":"{{ambari_server_log_dir}}/ambari-alerts.log"
     },

http://git-wip-us.apache.org/repos/asf/ambari/blob/559fc2e4/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/templates/input.config-ams.json.j2
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/templates/input.config-ams.json.j2 b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/templates/input.config-ams.json.j2
deleted file mode 100644
index 0bcaf56..0000000
--- a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/templates/input.config-ams.json.j2
+++ /dev/null
@@ -1,191 +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.
- #}
-{
-  "input":[
-    {
-      "type":"ams_hbase_master",
-      "rowtype":"service",
-      "path":"{{metrics_collector_log_dir}}/hbase-ams-master-*.log"
-    },
-    {
-      "type":"ams_hbase_regionserver",
-      "rowtype":"service",
-      "path":"{{metrics_collector_log_dir}}/hbase-ams-regionserver-*.log"
-    },
-    {
-      "type":"ams_collector",
-      "rowtype":"service",
-      "path":"{{metrics_collector_log_dir}}/ambari-metrics-collector.log"
-    },
-    {
-      "type":"ams_monitor",
-      "rowtype":"service",
-      "path":"{{metrics_monitor_log_dir}}/ambari-metrics-monitor.out"
-    },
-    {
-      "type":"ams_grafana",
-      "rowtype":"service",
-      "path":"{{metrics_grafana_log_dir}}/grafana.log"
-    }
-  ],
-  "filter":[
-    {
-      "filter":"grok",
-      "conditions":{
-        "fields":{
-          "type":[
-            "ams_collector"
-          ]
-
-        }
-
-      },
-      "log4j_format":"%d{ISO8601} %p %c: %m%n",
-      "multiline_pattern":"^(%{TIMESTAMP_ISO8601:logtime})",
-      "message_pattern":"(?m)^%{TIMESTAMP_ISO8601:logtime}%{SPACE}%{LOGLEVEL:level}%{SPACE}%{JAVACLASS:logger_name}:%{SPACE}%{GREEDYDATA:log_message}",
-      "post_map_values":{
-        "logtime":{
-          "map_date":{
-            "target_date_pattern":"yyyy-MM-dd HH:mm:ss,SSS"
-          }
-
-        }
-
-      }
-
-    },
-    {
-      "filter":"grok",
-      "conditions":{
-        "fields":{
-          "type":[
-            "ams_hbase_master",
-            "ams_hbase_regionserver"
-          ]
-
-        }
-
-      },
-      "log4j_format":"%d{ISO8601} %-5p [%t] %c{2}: %m%n",
-      "multiline_pattern":"^(%{TIMESTAMP_ISO8601:logtime})",
-      "message_pattern":"(?m)^%{TIMESTAMP_ISO8601:logtime}%{SPACE}%{LOGLEVEL:level}%{SPACE}\\[%{DATA:thread_name}\\]%{SPACE}%{JAVACLASS:logger_name}:%{SPACE}%{GREEDYDATA:log_message}",
-      "post_map_values":{
-        "logtime":{
-          "map_date":{
-            "target_date_pattern":"yyyy-MM-dd HH:mm:ss,SSS"
-          }
-
-        }
-
-      }
-
-    },
-    {
-      "filter":"grok",
-      "conditions":{
-        "fields":{
-          "type":[
-            "ams_grafana"
-          ]
-
-        }
-
-      },
-      "log4j_format":"%d{ISO8601} %-5p [%t] %c{2}: %m%n",
-      "multiline_pattern":"^(%{DATESTAMP:logtime})",
-      "message_pattern":"(?m)^%{DATESTAMP:logtime}%{SPACE}\\[%{WORD:level}\\]%{SPACE}%{GREEDYDATA:log_message}",
-      "post_map_values":{
-        "logtime":{
-          "map_date":{
-            "target_date_pattern":"yyyy/MM/dd HH:mm:ss"
-          }
-
-        },
-        "level":[
-          {
-            "map_fieldvalue":{
-              "pre_value":"I",
-              "post_value":"INFO"
-            }
-          },
-          {
-            "map_fieldvalue":{
-              "pre_value":"W",
-              "post_value":"WARN"
-            }
-          },
-          {
-            "map_fieldvalue":{
-              "pre_value":"D",
-              "post_value":"DEBUG"
-             }
-           },
-           {
-             "map_fieldvalue":{
-               "pre_value":"E",
-               "post_value":"ERROR"
-             }
-           },
-           {
-             "map_fieldvalue":{
-               "pre_value":"F",
-               "post_value":"FATAL"
-             }
-           }
-         ]
-
-      }
-
-    },
-    {
-      "filter":"grok",
-      "conditions":{
-        "fields":{
-          "type":[
-            "ams_monitor"
-          ]
- 
-        }
- 
-      },
-      "log4j_format":"",
-      "multiline_pattern":"^(%{TIMESTAMP_ISO8601:logtime})",
-      "message_pattern":"(?m)^%{TIMESTAMP_ISO8601:logtime}%{SPACE}\\[%{LOGLEVEL:level}\\]%{SPACE}%{JAVAFILE:file}:%{INT:line_number}%{SPACE}-%{SPACE}%{GREEDYDATA:log_message}",
-      "post_map_values":{
-        "logtime":{
-          "map_date":{
-            "target_date_pattern":"yyyy-MM-dd HH:mm:ss,SSS"
-          }
-
-        }
-
-      },
-      "level":[
-        {
-          "map_fieldvalue":{
-            "pre_value":"WARNING",
-            "post_value":"WARN"
-          }
-        }
-      ]
-
-    }
-
-  ]
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/559fc2e4/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/templates/input.config-atlas.json.j2
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/templates/input.config-atlas.json.j2 b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/templates/input.config-atlas.json.j2
deleted file mode 100644
index 53912c8..0000000
--- a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/templates/input.config-atlas.json.j2
+++ /dev/null
@@ -1,55 +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.
- #}
-{
-  "input":[
-    {
-      "type":"atlas_app",
-      "rowtype":"service",
-      "path":"{{atlas_log_dir}}/application.log"
-    }
-  ],
-  "filter":[
-    {
-      "filter":"grok",
-      "conditions":{
-        "fields":{
-          "type":[
-            "atlas_app"
-          ]
-
-        }
-
-      },
-      "log4j_format":"%d %-5p - [%t:%x] ~ %m (%c{1}:%L)%n",
-      "multiline_pattern":"^(%{TIMESTAMP_ISO8601:logtime})",
-      "message_pattern":"(?m)^%{TIMESTAMP_ISO8601:logtime}%{SPACE}%{LOGLEVEL:level}%{SPACE}%{SPACE}-%{SPACE}\\[%{DATA:thread_name}\\]%{SPACE}~%{SPACE}%{GREEDYDATA:log_message}",
-      "post_map_values":{
-        "logtime":{
-          "map_date":{
-            "target_date_pattern":"yyyy-MM-dd HH:mm:ss,SSS"
-          }
-
-        }
-
-      }
-
-    }
-
-  ]
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/559fc2e4/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/templates/input.config-falcon.json.j2
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/templates/input.config-falcon.json.j2 b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/templates/input.config-falcon.json.j2
deleted file mode 100644
index a40e52d..0000000
--- a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/templates/input.config-falcon.json.j2
+++ /dev/null
@@ -1,55 +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.
- #}
-{
-  "input":[
-    {
-      "type":"falcon_app",
-      "rowtype":"service",
-      "path":"{{falcon_log_dir}}/falcon.application.log"
-    }
-  ],
-  "filter":[
-    {
-      "filter":"grok",
-      "conditions":{
-        "fields":{
-          "type":[
-            "falcon_app"
-          ]
-
-        }
-
-      },
-      "log4j_format":"%d %-5p - [%t:%x] ~ %m (%c{1}:%L)%n",
-      "multiline_pattern":"^(%{TIMESTAMP_ISO8601:logtime})",
-      "message_pattern":"(?m)^%{TIMESTAMP_ISO8601:logtime}%{SPACE}%{LOGLEVEL:level}%{SPACE}%{SPACE}-%{SPACE}\\[%{DATA:thread_name}\\]%{SPACE}~%{SPACE}%{GREEDYDATA:log_message}",
-      "post_map_values":{
-        "logtime":{
-          "map_date":{
-            "target_date_pattern":"yyyy-MM-dd HH:mm:ss,SSS"
-          }
-
-        }
-
-      }
-
-    }
-
-  ]
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/559fc2e4/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/templates/input.config-flume.json.j2
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/templates/input.config-flume.json.j2 b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/templates/input.config-flume.json.j2
deleted file mode 100644
index b31054b..0000000
--- a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/templates/input.config-flume.json.j2
+++ /dev/null
@@ -1,56 +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.
- #}
-{
-  "input":[
-    {
-      "type":"flume_handler",
-      "rowtype":"service",
-      "path":"{{flume_log_dir}}/flume.log"
-    }
-
-  ],
-  "filter":[
-    {
-      "filter":"grok",
-      "conditions":{
-        "fields":{
-          "type":[
-            "flume_handler"
-          ]
-
-        }
-
-      },
-      "log4j_format":"",
-      "multiline_pattern":"^(%{USER_SYNC_DATE:logtime})",
-      "message_pattern":"(?m)^%{USER_SYNC_DATE:logtime}%{SPACE}%{LOGLEVEL:level}%{SPACE}\\[%{DATA:thread_name}\\]%{SPACE}\\(%{JAVACLASS:class}\\.%{JAVAMETHOD:method}:%{INT:line_number}\\)%{SPACE}-%{SPACE}%{GREEDYDATA:log_message}",
-      "post_map_values":{
-        "logtime":{
-          "map_date":{
-            "target_date_pattern":"dd MMM yyyy HH:mm:ss,SSS"
-          }
-
-        }
-
-      }
-
-    }
-
-  ]
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/559fc2e4/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/templates/input.config-hbase.json.j2
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/templates/input.config-hbase.json.j2 b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/templates/input.config-hbase.json.j2
deleted file mode 100644
index 0c04052..0000000
--- a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/templates/input.config-hbase.json.j2
+++ /dev/null
@@ -1,91 +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.
- #}
-{
-  "input":[
-    {
-      "type":"hbase_master",
-      "rowtype":"service",
-      "path":"{{hbase_log_dir}}/hbase-*-master-*.log"
-    },
-    {
-      "type":"hbase_regionserver",
-      "rowtype":"service",
-      "path":"{{hbase_log_dir}}/hbase-*-regionserver-*.log"
-    },
-    {
-      "type":"hbase_phoenix_server",
-      "rowtype":"service",
-      "path":"{{hbase_log_dir}}/phoenix-*-server.log"
-    }
-
-  ],
-  "filter":[
-    {
-      "filter":"grok",
-      "conditions":{
-        "fields":{
-          "type":[
-            "hbase_master",
-            "hbase_regionserver"
-          ]
-
-        }
-
-      },
-      "log4j_format":"%d{ISO8601} %-5p [%t] %c{2}: %m%n",
-      "multiline_pattern":"^(%{TIMESTAMP_ISO8601:logtime})",
-      "message_pattern":"(?m)^%{TIMESTAMP_ISO8601:logtime}%{SPACE}%{LOGLEVEL:level}%{SPACE}\\[%{DATA:thread_name}\\]%{SPACE}%{JAVACLASS:logger_name}:%{SPACE}%{GREEDYDATA:log_message}",
-      "post_map_values":{
-        "logtime":{
-          "map_date":{
-            "target_date_pattern":"yyyy-MM-dd HH:mm:ss,SSS"
-          }
-
-        }
-
-      }
-
-    },
-    {
-      "filter":"grok",
-      "conditions":{
-        "fields":{
-          "type":[
-            "hbase_phoenix_server"
-          ]
-
-        }
-      },
-      "log4j_format":"%d{ISO8601} %-5p [%t] %c{2}: %m%n",
-      "multiline_pattern":"^(%{TIMESTAMP_ISO8601:logtime})",
-      "message_pattern":"(?m)^%{TIMESTAMP_ISO8601:logtime}%{SPACE}%{LOGLEVEL:level}%{SPACE}%{JAVACLASS:logger_name}:%{SPACE}%{GREEDYDATA:log_message}",
-      "post_map_values":{
-        "logtime":{
-          "map_date":{
-            "target_date_pattern":"yyyy-MM-dd HH:mm:ss,SSS"
-          }
-
-        }
-
-      }
-
-    }
-
-  ]
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/559fc2e4/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/templates/input.config-hdfs.json.j2
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/templates/input.config-hdfs.json.j2 b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/templates/input.config-hdfs.json.j2
deleted file mode 100644
index 3dff6f5..0000000
--- a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/templates/input.config-hdfs.json.j2
+++ /dev/null
@@ -1,251 +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.
- #}
-{
-  "input":[
-    {
-      "type":"hdfs_datanode",
-      "rowtype":"service",
-      "path":"{{hdfs_log_dir_prefix}}/{{hdfs_user}}/hadoop-{{hdfs_user}}-datanode-*.log"
-    },
-    {
-      "type":"hdfs_namenode",
-      "rowtype":"service",
-      "path":"{{hdfs_log_dir_prefix}}/{{hdfs_user}}/hadoop-{{hdfs_user}}-namenode-*.log"
-    },
-    {
-      "type":"hdfs_journalnode",
-      "rowtype":"service",
-      "path":"{{hdfs_log_dir_prefix}}/{{hdfs_user}}/hadoop-{{hdfs_user}}-journalnode-*.log"
-    },
-    {
-      "type":"hdfs_secondarynamenode",
-      "rowtype":"service",
-      "path":"{{hdfs_log_dir_prefix}}/{{hdfs_user}}/hadoop-{{hdfs_user}}-secondarynamenode-*.log"
-    },
-    {
-      "type":"hdfs_zkfc",
-      "rowtype":"service",
-      "path":"{{hdfs_log_dir_prefix}}/{{hdfs_user}}/hadoop-{{hdfs_user}}-zkfc-*.log"
-    },
-    {
-      "type":"hdfs_nfs3",
-      "rowtype":"service",
-      "path":"{{hdfs_log_dir_prefix}}/{{hdfs_user}}/hadoop-{{hdfs_user}}-nfs3-*.log"
-    },
-    {
-      "type":"hdfs_audit",
-      "rowtype":"audit",
-      "is_enabled":"true",
-      "add_fields":{
-        "logType":"HDFSAudit",
-        "enforcer":"hadoop-acl",
-        "repoType":"1",
-        "repo":"hdfs"
-      },
-      "path":"{{hdfs_log_dir_prefix}}/{{hdfs_user}}/hdfs-audit.log"
-    }
-
-  ],
-  "filter":[
-    {
-      "filter":"grok",
-      "conditions":{
-        "fields":{
-          "type":[
-            "hdfs_datanode",
-            "hdfs_journalnode",
-            "hdfs_secondarynamenode",
-            "hdfs_namenode",
-            "hdfs_zkfc",
-            "hdfs_nfs3"
-          ]
-
-        }
-
-      },
-      "log4j_format":"%d{ISO8601} %-5p %c{2} (%F:%M(%L)) - %m%n",
-      "multiline_pattern":"^(%{TIMESTAMP_ISO8601:logtime})",
-      "message_pattern":"(?m)^%{TIMESTAMP_ISO8601:logtime}%{SPACE}%{LOGLEVEL:level}%{SPACE}%{JAVACLASS:logger_name}%{SPACE}\\(%{JAVAFILE:file}:%{JAVAMETHOD:method}\\(%{INT:line_number}\\)\\)%{SPACE}-%{SPACE}%{GREEDYDATA:log_message}",
-      "post_map_values":{
-        "logtime":{
-          "map_date":{
-            "target_date_pattern":"yyyy-MM-dd HH:mm:ss,SSS"
-          }
-        }
-
-      }
-
-    },
-    {
-      "filter":"grok",
-      "conditions":{
-        "fields":{
-          "type":[
-            "hdfs_audit"
-          ]
-
-        }
-
-      },
-      "log4j_format":"%d{ISO8601} %-5p %c{2} (%F:%M(%L)) - %m%n",
-      "multiline_pattern":"^(%{TIMESTAMP_ISO8601:evtTime})",
-      "message_pattern":"(?m)^%{TIMESTAMP_ISO8601:evtTime}%{SPACE}%{LOGLEVEL:level}%{SPACE}%{JAVACLASS:logger_name}:%{SPACE}%{GREEDYDATA:log_message}",
-      "post_map_values":{
-        "evtTime":{
-          "map_date":{
-            "target_date_pattern":"yyyy-MM-dd HH:mm:ss,SSS"
-          }
-
-        }
-
-      }
-
-    },
-    {
-      "filter":"keyvalue",
-      "sort_order":1,
-      "conditions":{
-        "fields":{
-          "type":[
-            "hdfs_audit"
-          ]
-
-        }
-
-      },
-      "source_field":"log_message",
-      "value_split":"=",
-      "field_split":"\t",
-      "post_map_values":{
-        "src":{
-          "map_fieldname":{
-            "new_fieldname":"resource"
-          }
-
-        },
-        "ip":{
-          "map_fieldname":{
-            "new_fieldname":"cliIP"
-          }
-
-        },
-        "allowed":[
-          {
-            "map_fieldvalue":{
-              "pre_value":"true",
-              "post_value":"1"
-            }
-
-          },
-          {
-            "map_fieldvalue":{
-              "pre_value":"false",
-              "post_value":"0"
-            }
-
-          },
-          {
-            "map_fieldname":{
-              "new_fieldname":"result"
-            }
-
-          }
-
-        ],
-        "cmd":{
-          "map_fieldname":{
-            "new_fieldname":"action"
-          }
-
-        },
-        "proto":{
-          "map_fieldname":{
-            "new_fieldname":"cliType"
-          }
-
-        },
-        "callerContext":{
-          "map_fieldname":{
-            "new_fieldname":"req_caller_id"
-          }
-
-        }
-
-      }
-
-    },
-    {
-      "filter":"grok",
-      "sort_order":2,
-      "source_field":"ugi",
-      "remove_source_field":"false",
-      "conditions":{
-        "fields":{
-          "type":[
-            "hdfs_audit"
-          ]
-
-        }
-
-      },
-      "message_pattern":"%{USERNAME:p_user}.+auth:%{USERNAME:p_authType}.+via %{USERNAME:k_user}.+auth:%{USERNAME:k_authType}|%{USERNAME:user}.+auth:%{USERNAME:authType}|%{USERNAME:x_user}",
-      "post_map_values":{
-        "user":{
-          "map_fieldname":{
-            "new_fieldname":"reqUser"
-          }
-
-        },
-        "x_user":{
-          "map_fieldname":{
-            "new_fieldname":"reqUser"
-          }
-
-        },
-        "p_user":{
-          "map_fieldname":{
-            "new_fieldname":"reqUser"
-          }
-
-        },
-        "k_user":{
-          "map_fieldname":{
-            "new_fieldname":"proxyUsers"
-          }
-
-        },
-        "p_authType":{
-          "map_fieldname":{
-            "new_fieldname":"authType"
-          }
-
-        },
-        "k_authType":{
-          "map_fieldname":{
-            "new_fieldname":"proxyAuthType"
-          }
-
-        }
-
-      }
-
-    }
-
-  ]
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/559fc2e4/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/templates/input.config-hive.json.j2
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/templates/input.config-hive.json.j2 b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/templates/input.config-hive.json.j2
deleted file mode 100644
index f96b16f..0000000
--- a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/templates/input.config-hive.json.j2
+++ /dev/null
@@ -1,97 +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.
- #}
-{
-  "input":[
-    {
-      "type":"hive_hiveserver2",
-      "rowtype":"service",
-      "path":"{{hive_log_dir}}/hiveserver2.log"
-    },
-    {
-      "type":"hive_metastore",
-      "rowtype":"service",
-      "path":"{{hive_log_dir}}/hivemetastore.log"
-    },
-    {
-      "type": "webhcat_server",
-      "rowntype":"service",
-      "path":"{{hcat_log_dir}}/webhcat.log"
-    }
-  ],
-  "filter":[
-    {
-      "filter":"grok",
-      "conditions":{
-        "fields":{
-          "type":[
-            "hive_hiveserver2",
-            "hive_metastore"
-          ]
-
-        }
-
-      },
-      "log4j_format":"%d{ISO8601} %-5p [%t]: %c{2} (%F:%M(%L)) - %m%n",
-      "multiline_pattern":"^(%{TIMESTAMP_ISO8601:logtime})",
-      "message_pattern":"(?m)^%{TIMESTAMP_ISO8601:logtime}%{SPACE}%{LOGLEVEL:level}%{SPACE}\\[%{DATA:thread_name}\\]:%{SPACE}%{JAVACLASS:logger_name}%{SPACE}\\(%{JAVAFILE:file}:%{JAVAMETHOD:method}\\(%{INT:line_number}\\)\\)%{SPACE}-%{SPACE}%{GREEDYDATA:log_message}",
-      "post_map_values":{
-        "logtime":{
-          "map_date":{
-            "target_date_pattern":"yyyy-MM-dd HH:mm:ss,SSS"
-          }
-
-        }
-
-      }
-
-    },
-    {
-      "filter":"grok",
-      "conditions":{
-        "fields":{
-          "type":[
-            "webhcat_server"
-          ]
-
-        }
-
-      },
-      "log4j_format":" %-5p | %d{DATE} | %c | %m%n",
-      "multiline_pattern":"^(%{SPACE}%{LOGLEVEL:level}%{CUSTOM_SEPARATOR}%{CUSTOM_DATESTAMP:logtime})",
-      "message_pattern":"(?m)^%{SPACE}%{LOGLEVEL:level}%{CUSTOM_SEPARATOR}%{CUSTOM_DATESTAMP:logtime}%{CUSTOM_SEPARATOR}%{JAVACLASS:file}%{CUSTOM_SEPARATOR}%{GREEDYDATA:log_message}",
-      "post_map_values":{
-        "logtime":{
-          "map_date":{
-            "target_date_pattern":"dd MMM yyyy HH:mm:ss,SSS"
-          }
-
-        },
-        "level":{
-           "map_fieldvalue":{
-             "pre_value":"WARNING",
-             "post_value":"WARN"
-            }
-        }
-
-      }
-
-    }
-
-  ]
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/559fc2e4/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/templates/input.config-infra.json.j2
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/templates/input.config-infra.json.j2 b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/templates/input.config-infra.json.j2
deleted file mode 100644
index 20fa49d..0000000
--- a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/templates/input.config-infra.json.j2
+++ /dev/null
@@ -1,56 +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.
- #}
-{
-  "input":[
-    {
-      "type":"infra_solr",
-      "rowtype":"service",
-      "path":"{{infra_solr_log_dir}}/solr.log"
-    }
-
-  ],
-  "filter":[
-    {
-      "filter":"grok",
-      "conditions":{
-        "fields":{
-          "type":[
-            "infra_solr"
-          ]
-
-        }
-
-      },
-      "log4j_format":"",
-      "multiline_pattern":"^(%{TIMESTAMP_ISO8601:logtime})",
-      "message_pattern":"(?m)^%{TIMESTAMP_ISO8601:logtime}%{SPACE}\\[%{DATA:thread_name}\\]%{SPACE}%{LOGLEVEL:level}%{SPACE}%{GREEDYDATA:log_message}",
-      "post_map_values":{
-        "logtime":{
-          "map_date":{
-            "target_date_pattern":"yyyy-MM-dd HH:mm:ss,SSS"
-          }
-
-        }
-
-      }
-
-    }
-
-  ]
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/559fc2e4/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/templates/input.config-kafka.json.j2
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/templates/input.config-kafka.json.j2 b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/templates/input.config-kafka.json.j2
deleted file mode 100644
index d05d4ad..0000000
--- a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/templates/input.config-kafka.json.j2
+++ /dev/null
@@ -1,105 +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.
- #}
-{
-  "input":[
-    {
-      "type":"kafka_controller",
-      "rowtype":"service",
-      "path":"{{kafka_log_dir}}/controller.log"
-    },
-    {
-      "type":"kafka_request",
-      "rowtype":"service",
-      "path":"{{kafka_log_dir}}/kafka-request.log"
-    },
-    {
-      "type":"kafka_logcleaner",
-      "rowtype":"service",
-      "path":"{{kafka_log_dir}}/log-cleaner.log"
-    },
-    {
-      "type":"kafka_server",
-      "rowtype":"service",
-      "path":"{{kafka_log_dir}}/server.log"
-    },
-    {
-      "type":"kafka_statechange",
-      "rowtype":"service",
-      "path":"{{kafka_log_dir}}/state-change.log"
-    }
-
-  ],
-  "filter":[
-    {
-      "filter":"grok",
-      "conditions":{
-        "fields":{
-          "type":[
-            "kafka_controller",
-            "kafka_request",
-            "kafka_logcleaner"
-          ]
-
-        }
-
-      },
-      "log4j_format":"[%d] %p %m (%c)%n",
-      "multiline_pattern":"^(\\[%{TIMESTAMP_ISO8601:logtime}\\])",
-      "message_pattern":"(?m)^\\[%{TIMESTAMP_ISO8601:logtime}\\]%{SPACE}%{LOGLEVEL:level}%{SPACE}\\[%{DATA:thread_name}\\]%{SPACE}%{GREEDYDATA:log_message}",
-      "post_map_values":{
-        "logtime":{
-          "map_date":{
-            "target_date_pattern":"yyyy-MM-dd HH:mm:ss,SSS"
-          }
-
-        }
-
-      }
-
-    },
-    {
-      "filter":"grok",
-      "comment":"Suppose to be same log4j pattern as other kafka processes, but some reason thread is not printed",
-      "conditions":{
-        "fields":{
-          "type":[
-            "kafka_server",
-            "kafka_statechange"
-          ]
-
-        }
-
-      },
-      "log4j_format":"[%d] %p %m (%c)%n",
-      "multiline_pattern":"^(\\[%{TIMESTAMP_ISO8601:logtime}\\])",
-      "message_pattern":"(?m)^\\[%{TIMESTAMP_ISO8601:logtime}\\]%{SPACE}%{LOGLEVEL:level}%{SPACE}%{GREEDYDATA:log_message}",
-      "post_map_values":{
-        "logtime":{
-          "map_date":{
-            "target_date_pattern":"yyyy-MM-dd HH:mm:ss,SSS"
-          }
-
-        }
-
-      }
-
-    }
-
-  ]
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/559fc2e4/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/templates/input.config-knox.json.j2
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/templates/input.config-knox.json.j2 b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/templates/input.config-knox.json.j2
deleted file mode 100644
index df98e25..0000000
--- a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/templates/input.config-knox.json.j2
+++ /dev/null
@@ -1,68 +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.
- #}
-{
-  "input":[
-    {
-      "type":"knox_gateway",
-      "rowtype":"service",
-      "path":"{{knox_log_dir}}/gateway.log"
-    },
-    {
-      "type":"knox_cli",
-      "rowtype":"service",
-      "path":"{{knox_log_dir}}/knoxcli.log"
-    },
-    {
-      "type":"knox_ldap",
-      "rowtype":"service",
-      "path":"{{knox_log_dir}}/ldap.log"
-    }
-
-  ],
-  "filter":[
-    {
-      "filter":"grok",
-      "conditions":{
-        "fields":{
-          "type":[
-            "knox_gateway",
-            "knox_cli",
-            "knox_ldap"
-          ]
-          
-        }
-
-      },
-      "log4j_format":"%d{ISO8601} %-5p %c{2} (%F:%M(%L)) - %m%n",
-      "multiline_pattern":"^(%{TIMESTAMP_ISO8601:logtime})",
-      "message_pattern":"(?m)^%{TIMESTAMP_ISO8601:logtime}%{SPACE}%{LOGLEVEL:level}%{SPACE}%{JAVACLASS:logger_name}%{SPACE}\\(%{JAVAFILE:file}:%{JAVAMETHOD:method}\\(%{INT:line_number}\\)\\)%{SPACE}-%{SPACE}%{GREEDYDATA:log_message}",
-      "post_map_values":{
-        "logtime":{
-          "map_date":{
-            "target_date_pattern":"yyyy-MM-dd HH:mm:ss,SSS"
-          }
-
-        }
-
-      }
-
-    }
-
-  ]
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/559fc2e4/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/templates/input.config-oozie.json.j2
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/templates/input.config-oozie.json.j2 b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/templates/input.config-oozie.json.j2
deleted file mode 100644
index ddb8198..0000000
--- a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/templates/input.config-oozie.json.j2
+++ /dev/null
@@ -1,56 +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.
- #}
-{
-  "input":[
-    {
-      "type":"oozie_app",
-      "rowtype":"service",
-      "path":"{{oozie_log_dir}}/oozie.log"
-    }
-
-  ],
-  "filter":[
-    {
-      "filter":"grok",
-      "conditions":{
-        "fields":{
-          "type":[
-            "oozie_app"
-          ]
-
-        }
-
-      },
-      "log4j_format":"%d{ISO8601} %5p %c{1}:%L - SERVER[${oozie.instance.id}] %m%n",
-      "multiline_pattern":"^(%{TIMESTAMP_ISO8601:logtime})",
-      "message_pattern":"(?m)^%{TIMESTAMP_ISO8601:logtime}%{SPACE}%{LOGLEVEL:level}%{SPACE}%{DATA:logger_name}:%{INT:line_number}%{SPACE}-%{SPACE}%{GREEDYDATA:log_message}",
-      "post_map_values":{
-        "logtime":{
-          "map_date":{
-            "target_date_pattern":"yyyy-MM-dd HH:mm:ss,SSS"
-          }
-
-        }
-
-      }
-
-    }
-
-  ]
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/559fc2e4/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/templates/input.config-ranger.json.j2
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/templates/input.config-ranger.json.j2 b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/templates/input.config-ranger.json.j2
deleted file mode 100644
index 7b12869..0000000
--- a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/templates/input.config-ranger.json.j2
+++ /dev/null
@@ -1,122 +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.
- #}
-{
-  "input":[
-    {
-      "type":"ranger_admin",
-      "rowtype":"service",
-      "path":"{{ranger_admin_log_dir}}/xa_portal.log"
-    },
-    {
-      "type":"ranger_dbpatch",
-      "is_enabled":"true",
-      "path":"{{ranger_admin_log_dir}}/ranger_db_patch.log"
-    },
-    {
-      "type":"ranger_kms",
-      "rowtype":"service",
-      "path":"{{ranger_kms_log_dir}}/kms.log"
-    },
-    {
-      "type":"ranger_usersync",
-      "rowtype":"service",
-      "path":"{{ranger_usersync_log_dir}}/usersync.log"
-    }
-
-  ],
-  "filter":[
-    {
-      "filter":"grok",
-      "conditions":{
-        "fields":{
-          "type":[
-            "ranger_admin",
-            "ranger_dbpatch"
-          ]
-
-        }
-
-      },
-      "log4j_format":"%d [%t] %-5p %C{6} (%F:%L) - %m%n",
-      "multiline_pattern":"^(%{TIMESTAMP_ISO8601:logtime})",
-      "message_pattern":"(?m)^%{TIMESTAMP_ISO8601:logtime}%{SPACE}\\[%{DATA:thread_name}\\]%{SPACE}%{LOGLEVEL:level}%{SPACE}%{JAVACLASS:logger_name}%{SPACE}\\(%{JAVAFILE:file}:%{INT:line_number}\\)%{SPACE}-%{SPACE}%{GREEDYDATA:log_message}",
-      "post_map_values":{
-        "logtime":{
-          "map_date":{
-            "target_date_pattern":"yyyy-MM-dd HH:mm:ss,SSS"
-          }
-
-        }
-
-      }
-
-    },
-    {
-      "filter":"grok",
-      "conditions":{
-        "fields":{
-          "type":[
-            "ranger_kms"
-          ]
-
-        }
-
-      },
-      "log4j_format":"%d{ISO8601} %-5p %c{1} - %m%n",
-      "multiline_pattern":"^(%{TIMESTAMP_ISO8601:logtime})",
-      "message_pattern":"(?m)^%{TIMESTAMP_ISO8601:logtime}%{SPACE}%{LOGLEVEL:level}%{SPACE}%{JAVACLASS:logger_name}%{SPACE}-%{SPACE}%{GREEDYDATA:log_message}",
-      "post_map_values":{
-        "logtime":{
-          "map_date":{
-            "target_date_pattern":"yyyy-MM-dd HH:mm:ss,SSS"
-          }
-
-        }
-
-      }
-
-    },
-    {
-      "filter":"grok",
-      "conditions":{
-        "fields":{
-          "type":[
-            "ranger_usersync"
-          ]
-          
-        }
-        
-      },
-      "log4j_format":"%d{dd MMM yyyy HH:mm:ss} %5p %c{1} [%t] - %m%n",
-      "multiline_pattern":"^(%{USER_SYNC_DATE:logtime})",
-      "message_pattern":"(?m)^%{USER_SYNC_DATE:logtime}%{SPACE}%{LOGLEVEL:level}%{SPACE}%{JAVACLASS:logger_name}%{SPACE}\\[%{DATA:thread_name}\\]%{SPACE}-%{SPACE}%{GREEDYDATA:log_message}",
-      "post_map_values":{
-        "logtime":{
-          "map_date":{
-            "target_date_pattern":"dd MMM yyyy HH:mm:ss"
-          }
-
-        }
-
-      }
-
-    }
-
-  ]
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/559fc2e4/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/templates/input.config-spark.json.j2
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/templates/input.config-spark.json.j2 b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/templates/input.config-spark.json.j2
deleted file mode 100644
index 4371276..0000000
--- a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/templates/input.config-spark.json.j2
+++ /dev/null
@@ -1,72 +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.
- #}
- {
-   "input":[
-
-     {
-       "type":"spark_jobhistory_server",
-       "rowtype":"service",
-       "path":"{{spark_log_dir}}/spark-*-org.apache.spark.deploy.history.HistoryServer*.out"
-     },
-     {
-       "type":"spark_thriftserver",
-       "rowtype":"service",
-       "path":"{{spark_log_dir}}/spark-*-org.apache.spark.sql.hive.thriftserver.HiveThriftServer2*.out"
-     },
-     {
-       "type":"livy_server",
-       "rowtype":"service",
-       "path":"{{livy_log_dir}}/livy-livy-server.out"
-     }
-   ],
-   "filter":[
-       {
-          "filter":"grok",
-          "conditions":{
-            "fields":{
-              "type":[
-                "spark_jobhistory_server",
-                "spark_thriftserver",
-                "livy_server"
-              ]
-
-            }
-          },
-          "log4j_format":"",
-          "multiline_pattern":"^(%{SPARK_DATESTAMP:logtime}%{SPACE}%{LOGLEVEL:level})",
-          "message_pattern":"(?m)^%{SPARK_DATESTAMP:logtime}%{SPACE}%{LOGLEVEL:level}%{SPACE}%{JAVAFILE:file}:%{SPACE}%{GREEDYDATA:log_message}",
-          "post_map_values":{
-            "logtime":{
-              "map_date":{
-                "target_date_pattern":"yy/MM/dd HH:mm:ss"
-              }
-
-            },
-            "level":{
-              "map_fieldvalue":{
-                "pre_value":"WARNING",
-                "post_value":"WARN"
-              }
-
-            }
-
-          }
-      }
-   ]
-
- }

http://git-wip-us.apache.org/repos/asf/ambari/blob/559fc2e4/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/templates/input.config-spark2.json.j2
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/templates/input.config-spark2.json.j2 b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/templates/input.config-spark2.json.j2
deleted file mode 100644
index 01aea36..0000000
--- a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/templates/input.config-spark2.json.j2
+++ /dev/null
@@ -1,66 +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.
- #}
- {
-   "input":[
-
-     {
-       "type":"spark2_jobhistory_server",
-       "rowtype":"service",
-       "path":"{{spark2_log_dir}}/spark-*-org.apache.spark.deploy.history.HistoryServer*.out"
-     },
-     {
-       "type":"spark2_thriftserver",
-       "rowtype":"service",
-       "path":"{{spark2_log_dir}}/spark-*-org.apache.spark.sql.hive.thriftserver.HiveThriftServer2*.out"
-     }
-   ],
-   "filter":[
-   {
-          "filter":"grok",
-          "conditions":{
-            "fields":{
-              "type":[
-                "spark2_jobhistory_server",
-                "spark2_thriftserver"
-              ]
-
-            }
-          },
-          "log4j_format":"",
-          "multiline_pattern":"^(%{SPARK_DATESTAMP:logtime}%{SPACE}%{LOGLEVEL:level})",
-          "message_pattern":"(?m)^%{SPARK_DATESTAMP:logtime}%{SPACE}%{LOGLEVEL:level}%{SPACE}%{JAVAFILE:file}:%{SPACE}%{GREEDYDATA:log_message}",
-          "post_map_values":{
-            "logtime":{
-              "map_date":{
-                "target_date_pattern":"yy/MM/dd HH:mm:ss"
-              }
-
-            },
-            "level":{
-              "map_fieldvalue":{
-                "pre_value":"WARNING",
-                "post_value":"WARN"
-              }
-
-            }
-
-          }
-      }
-   ]
-
- }

http://git-wip-us.apache.org/repos/asf/ambari/blob/559fc2e4/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/templates/input.config-storm.json.j2
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/templates/input.config-storm.json.j2 b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/templates/input.config-storm.json.j2
deleted file mode 100644
index 07a4c2e..0000000
--- a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/templates/input.config-storm.json.j2
+++ /dev/null
@@ -1,86 +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.
- #}
-{
-  "input":[
-    {
-      "type":"storm_drpc",
-      "rowtype":"service",
-      "path":"{{storm_log_dir}}/drpc.log"
-    },
-    {
-      "type":"storm_logviewer",
-      "rowtype":"service",
-      "path":"{{storm_log_dir}}/logviewer.log"
-    },
-    {
-      "type":"storm_nimbus",
-      "rowtype":"service",
-      "path":"{{storm_log_dir}}/nimbus.log"
-    },
-    {
-      "type":"storm_supervisor",
-      "rowtype":"service",
-      "path":"{{storm_log_dir}}/supervisor.log"
-    },
-    {
-      "type":"storm_ui",
-      "rowtype":"service",
-      "path":"{{storm_log_dir}}/ui.log"
-    },
-    {
-      "type":"storm_worker",
-      "rowtype":"service",
-      "path":"{{storm_log_dir}}/*worker*.log"
-    }
-
-  ],
-  "filter":[
-    {
-      "filter":"grok",
-      "conditions":{
-        "fields":{
-          "type":[
-            "storm_drpc",
-            "storm_logviewer",
-            "storm_nimbus",
-            "storm_supervisor",
-            "storm_ui",
-            "storm_worker"
-          ]
-
-        }
-
-      },
-      "log4j_format":"",
-      "multiline_pattern":"^(%{TIMESTAMP_ISO8601:logtime})",
-      "message_pattern":"(?m)^%{TIMESTAMP_ISO8601:logtime}%{SPACE}%{JAVACLASS:logger_name}%{SPACE}\\[%{LOGLEVEL:level}\\]%{SPACE}%{SPACE}%{GREEDYDATA:log_message}",
-      "post_map_values":{
-        "logtime":{
-          "map_date":{
-            "target_date_pattern":"yyyy-MM-dd HH:mm:ss.SSS"
-          }
-
-        }
-
-      }
-
-    }
-
-  ]
-
-}
\ No newline at end of file


[13/58] [abbrv] ambari git commit: AMBARI-18310. Refactor logsearch portal side code (oleewere)

Posted by ol...@apache.org.
http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/production/r.js
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/production/r.js b/ambari-logsearch/ambari-logsearch-portal/production/r.js
deleted file mode 100644
index 6e6ffd0..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/production/r.js
+++ /dev/null
@@ -1,32140 +0,0 @@
-/**
- * @license r.js 2.1.22 Copyright (c) 2010-2015, The Dojo Foundation All Rights Reserved.
- * Available via the MIT or new BSD license.
- * see: http://github.com/jrburke/requirejs for details
- */
-
-/*
- * This is a bootstrap script to allow running RequireJS in the command line
- * in either a Java/Rhino or Node environment. It is modified by the top-level
- * dist.js file to inject other files to completely enable this file. It is
- * the shell of the r.js file.
- */
-
-/*jslint evil: true, nomen: true, sloppy: true */
-/*global readFile: true, process: false, Packages: false, print: false,
-console: false, java: false, module: false, requirejsVars, navigator,
-document, importScripts, self, location, Components, FileUtils */
-
-var requirejs, require, define, xpcUtil;
-(function (console, args, readFileFunc) {
-    var fileName, env, fs, vm, path, exec, rhinoContext, dir, nodeRequire,
-        nodeDefine, exists, reqMain, loadedOptimizedLib, existsForNode, Cc, Ci,
-        version = '2.1.22',
-        jsSuffixRegExp = /\.js$/,
-        commandOption = '',
-        useLibLoaded = {},
-        //Used by jslib/rhino/args.js
-        rhinoArgs = args,
-        //Used by jslib/xpconnect/args.js
-        xpconnectArgs = args,
-        readFile = typeof readFileFunc !== 'undefined' ? readFileFunc : null;
-
-    function showHelp() {
-        console.log('See https://github.com/jrburke/r.js for usage.');
-    }
-
-    if ((typeof navigator !== 'undefined' && typeof document !== 'undefined') ||
-            (typeof importScripts !== 'undefined' && typeof self !== 'undefined')) {
-        env = 'browser';
-
-        readFile = function (path) {
-            return fs.readFileSync(path, 'utf8');
-        };
-
-        exec = function (string) {
-            return eval(string);
-        };
-
-        exists = function () {
-            console.log('x.js exists not applicable in browser env');
-            return false;
-        };
-
-    } else if (typeof process !== 'undefined' && process.versions && !!process.versions.node) {
-        env = 'node';
-
-        //Get the fs module via Node's require before it
-        //gets replaced. Used in require/node.js
-        fs = require('fs');
-        vm = require('vm');
-        path = require('path');
-        //In Node 0.7+ existsSync is on fs.
-        existsForNode = fs.existsSync || path.existsSync;
-
-        nodeRequire = require;
-        nodeDefine = define;
-        reqMain = require.main;
-
-        //Temporarily hide require and define to allow require.js to define
-        //them.
-        require = undefined;
-        define = undefined;
-
-        readFile = function (path) {
-            return fs.readFileSync(path, 'utf8');
-        };
-
-        exec = function (string, name) {
-            return vm.runInThisContext(this.requirejsVars.require.makeNodeWrapper(string),
-                                       name ? fs.realpathSync(name) : '');
-        };
-
-        exists = function (fileName) {
-            return existsForNode(fileName);
-        };
-
-
-        fileName = process.argv[2];
-
-        if (fileName && fileName.indexOf('-') === 0) {
-            commandOption = fileName.substring(1);
-            fileName = process.argv[3];
-        }
-    } else if (typeof Packages !== 'undefined') {
-        env = 'rhino';
-
-        fileName = args[0];
-
-        if (fileName && fileName.indexOf('-') === 0) {
-            commandOption = fileName.substring(1);
-            fileName = args[1];
-        }
-
-        //Exec/readFile differs between Rhino and Nashorn. Rhino has an
-        //importPackage where Nashorn does not, so branch on that. This is a
-        //coarser check -- detecting readFile existence might also be enough for
-        //this spot. However, sticking with importPackage to keep it the same
-        //as other Rhino/Nashorn detection branches.
-        if (typeof importPackage !== 'undefined') {
-            rhinoContext = Packages.org.mozilla.javascript.ContextFactory.getGlobal().enterContext();
-
-            exec = function (string, name) {
-                return rhinoContext.evaluateString(this, string, name, 0, null);
-            };
-        } else {
-            exec = function (string, name) {
-                load({ script: string, name: name});
-            };
-            readFile = readFully;
-        }
-
-        exists = function (fileName) {
-            return (new java.io.File(fileName)).exists();
-        };
-
-        //Define a console.log for easier logging. Don't
-        //get fancy though.
-        if (typeof console === 'undefined') {
-            console = {
-                log: function () {
-                    print.apply(undefined, arguments);
-                }
-            };
-        }
-    } else if (typeof Components !== 'undefined' && Components.classes && Components.interfaces) {
-        env = 'xpconnect';
-
-        Components.utils['import']('resource://gre/modules/FileUtils.jsm');
-        Cc = Components.classes;
-        Ci = Components.interfaces;
-
-        fileName = args[0];
-
-        if (fileName && fileName.indexOf('-') === 0) {
-            commandOption = fileName.substring(1);
-            fileName = args[1];
-        }
-
-        xpcUtil = {
-            isWindows: ('@mozilla.org/windows-registry-key;1' in Cc),
-            cwd: function () {
-                return FileUtils.getFile("CurWorkD", []).path;
-            },
-
-            //Remove . and .. from paths, normalize on front slashes
-            normalize: function (path) {
-                //There has to be an easier way to do this.
-                var i, part, ary,
-                    firstChar = path.charAt(0);
-
-                if (firstChar !== '/' &&
-                        firstChar !== '\\' &&
-                        path.indexOf(':') === -1) {
-                    //A relative path. Use the current working directory.
-                    path = xpcUtil.cwd() + '/' + path;
-                }
-
-                ary = path.replace(/\\/g, '/').split('/');
-
-                for (i = 0; i < ary.length; i += 1) {
-                    part = ary[i];
-                    if (part === '.') {
-                        ary.splice(i, 1);
-                        i -= 1;
-                    } else if (part === '..') {
-                        ary.splice(i - 1, 2);
-                        i -= 2;
-                    }
-                }
-                return ary.join('/');
-            },
-
-            xpfile: function (path) {
-                var fullPath;
-                try {
-                    fullPath = xpcUtil.normalize(path);
-                    if (xpcUtil.isWindows) {
-                        fullPath = fullPath.replace(/\//g, '\\');
-                    }
-                    return new FileUtils.File(fullPath);
-                } catch (e) {
-                    throw new Error((fullPath || path) + ' failed: ' + e);
-                }
-            },
-
-            readFile: function (/*String*/path, /*String?*/encoding) {
-                //A file read function that can deal with BOMs
-                encoding = encoding || "utf-8";
-
-                var inStream, convertStream,
-                    readData = {},
-                    fileObj = xpcUtil.xpfile(path);
-
-                //XPCOM, you so crazy
-                try {
-                    inStream = Cc['@mozilla.org/network/file-input-stream;1']
-                               .createInstance(Ci.nsIFileInputStream);
-                    inStream.init(fileObj, 1, 0, false);
-
-                    convertStream = Cc['@mozilla.org/intl/converter-input-stream;1']
-                                    .createInstance(Ci.nsIConverterInputStream);
-                    convertStream.init(inStream, encoding, inStream.available(),
-                    Ci.nsIConverterInputStream.DEFAULT_REPLACEMENT_CHARACTER);
-
-                    convertStream.readString(inStream.available(), readData);
-                    return readData.value;
-                } catch (e) {
-                    throw new Error((fileObj && fileObj.path || '') + ': ' + e);
-                } finally {
-                    if (convertStream) {
-                        convertStream.close();
-                    }
-                    if (inStream) {
-                        inStream.close();
-                    }
-                }
-            }
-        };
-
-        readFile = xpcUtil.readFile;
-
-        exec = function (string) {
-            return eval(string);
-        };
-
-        exists = function (fileName) {
-            return xpcUtil.xpfile(fileName).exists();
-        };
-
-        //Define a console.log for easier logging. Don't
-        //get fancy though.
-        if (typeof console === 'undefined') {
-            console = {
-                log: function () {
-                    print.apply(undefined, arguments);
-                }
-            };
-        }
-    }
-
-    /** vim: et:ts=4:sw=4:sts=4
- * @license RequireJS 2.1.22 Copyright (c) 2010-2015, The Dojo Foundation All Rights Reserved.
- * Available via the MIT or new BSD license.
- * see: http://github.com/jrburke/requirejs for details
- */
-//Not using strict: uneven strict support in browsers, #392, and causes
-//problems with requirejs.exec()/transpiler plugins that may not be strict.
-/*jslint regexp: true, nomen: true, sloppy: true */
-/*global window, navigator, document, importScripts, setTimeout, opera */
-
-
-(function (global) {
-    var req, s, head, baseElement, dataMain, src,
-        interactiveScript, currentlyAddingScript, mainScript, subPath,
-        version = '2.1.22',
-        commentRegExp = /(\/\*([\s\S]*?)\*\/|([^:]|^)\/\/(.*)$)/mg,
-        cjsRequireRegExp = /[^.]\s*require\s*\(\s*["']([^'"\s]+)["']\s*\)/g,
-        jsSuffixRegExp = /\.js$/,
-        currDirRegExp = /^\.\//,
-        op = Object.prototype,
-        ostring = op.toString,
-        hasOwn = op.hasOwnProperty,
-        ap = Array.prototype,
-        isBrowser = !!(typeof window !== 'undefined' && typeof navigator !== 'undefined' && window.document),
-        isWebWorker = !isBrowser && typeof importScripts !== 'undefined',
-        //PS3 indicates loaded and complete, but need to wait for complete
-        //specifically. Sequence is 'loading', 'loaded', execution,
-        // then 'complete'. The UA check is unfortunate, but not sure how
-        //to feature test w/o causing perf issues.
-        readyRegExp = isBrowser && navigator.platform === 'PLAYSTATION 3' ?
-                      /^complete$/ : /^(complete|loaded)$/,
-        defContextName = '_',
-        //Oh the tragedy, detecting opera. See the usage of isOpera for reason.
-        isOpera = typeof opera !== 'undefined' && opera.toString() === '[object Opera]',
-        contexts = {},
-        cfg = {},
-        globalDefQueue = [],
-        useInteractive = false;
-
-    function isFunction(it) {
-        return ostring.call(it) === '[object Function]';
-    }
-
-    function isArray(it) {
-        return ostring.call(it) === '[object Array]';
-    }
-
-    /**
-     * Helper function for iterating over an array. If the func returns
-     * a true value, it will break out of the loop.
-     */
-    function each(ary, func) {
-        if (ary) {
-            var i;
-            for (i = 0; i < ary.length; i += 1) {
-                if (ary[i] && func(ary[i], i, ary)) {
-                    break;
-                }
-            }
-        }
-    }
-
-    /**
-     * Helper function for iterating over an array backwards. If the func
-     * returns a true value, it will break out of the loop.
-     */
-    function eachReverse(ary, func) {
-        if (ary) {
-            var i;
-            for (i = ary.length - 1; i > -1; i -= 1) {
-                if (ary[i] && func(ary[i], i, ary)) {
-                    break;
-                }
-            }
-        }
-    }
-
-    function hasProp(obj, prop) {
-        return hasOwn.call(obj, prop);
-    }
-
-    function getOwn(obj, prop) {
-        return hasProp(obj, prop) && obj[prop];
-    }
-
-    /**
-     * Cycles over properties in an object and calls a function for each
-     * property value. If the function returns a truthy value, then the
-     * iteration is stopped.
-     */
-    function eachProp(obj, func) {
-        var prop;
-        for (prop in obj) {
-            if (hasProp(obj, prop)) {
-                if (func(obj[prop], prop)) {
-                    break;
-                }
-            }
-        }
-    }
-
-    /**
-     * Simple function to mix in properties from source into target,
-     * but only if target does not already have a property of the same name.
-     */
-    function mixin(target, source, force, deepStringMixin) {
-        if (source) {
-            eachProp(source, function (value, prop) {
-                if (force || !hasProp(target, prop)) {
-                    if (deepStringMixin && typeof value === 'object' && value &&
-                        !isArray(value) && !isFunction(value) &&
-                        !(value instanceof RegExp)) {
-
-                        if (!target[prop]) {
-                            target[prop] = {};
-                        }
-                        mixin(target[prop], value, force, deepStringMixin);
-                    } else {
-                        target[prop] = value;
-                    }
-                }
-            });
-        }
-        return target;
-    }
-
-    //Similar to Function.prototype.bind, but the 'this' object is specified
-    //first, since it is easier to read/figure out what 'this' will be.
-    function bind(obj, fn) {
-        return function () {
-            return fn.apply(obj, arguments);
-        };
-    }
-
-    function scripts() {
-        return document.getElementsByTagName('script');
-    }
-
-    function defaultOnError(err) {
-        throw err;
-    }
-
-    //Allow getting a global that is expressed in
-    //dot notation, like 'a.b.c'.
-    function getGlobal(value) {
-        if (!value) {
-            return value;
-        }
-        var g = global;
-        each(value.split('.'), function (part) {
-            g = g[part];
-        });
-        return g;
-    }
-
-    /**
-     * Constructs an error with a pointer to an URL with more information.
-     * @param {String} id the error ID that maps to an ID on a web page.
-     * @param {String} message human readable error.
-     * @param {Error} [err] the original error, if there is one.
-     *
-     * @returns {Error}
-     */
-    function makeError(id, msg, err, requireModules) {
-        var e = new Error(msg + '\nhttp://requirejs.org/docs/errors.html#' + id);
-        e.requireType = id;
-        e.requireModules = requireModules;
-        if (err) {
-            e.originalError = err;
-        }
-        return e;
-    }
-
-    if (typeof define !== 'undefined') {
-        //If a define is already in play via another AMD loader,
-        //do not overwrite.
-        return;
-    }
-
-    if (typeof requirejs !== 'undefined') {
-        if (isFunction(requirejs)) {
-            //Do not overwrite an existing requirejs instance.
-            return;
-        }
-        cfg = requirejs;
-        requirejs = undefined;
-    }
-
-    //Allow for a require config object
-    if (typeof require !== 'undefined' && !isFunction(require)) {
-        //assume it is a config object.
-        cfg = require;
-        require = undefined;
-    }
-
-    function newContext(contextName) {
-        var inCheckLoaded, Module, context, handlers,
-            checkLoadedTimeoutId,
-            config = {
-                //Defaults. Do not set a default for map
-                //config to speed up normalize(), which
-                //will run faster if there is no default.
-                waitSeconds: 7,
-                baseUrl: './',
-                paths: {},
-                bundles: {},
-                pkgs: {},
-                shim: {},
-                config: {}
-            },
-            registry = {},
-            //registry of just enabled modules, to speed
-            //cycle breaking code when lots of modules
-            //are registered, but not activated.
-            enabledRegistry = {},
-            undefEvents = {},
-            defQueue = [],
-            defined = {},
-            urlFetched = {},
-            bundlesMap = {},
-            requireCounter = 1,
-            unnormalizedCounter = 1;
-
-        /**
-         * Trims the . and .. from an array of path segments.
-         * It will keep a leading path segment if a .. will become
-         * the first path segment, to help with module name lookups,
-         * which act like paths, but can be remapped. But the end result,
-         * all paths that use this function should look normalized.
-         * NOTE: this method MODIFIES the input array.
-         * @param {Array} ary the array of path segments.
-         */
-        function trimDots(ary) {
-            var i, part;
-            for (i = 0; i < ary.length; i++) {
-                part = ary[i];
-                if (part === '.') {
-                    ary.splice(i, 1);
-                    i -= 1;
-                } else if (part === '..') {
-                    // If at the start, or previous value is still ..,
-                    // keep them so that when converted to a path it may
-                    // still work when converted to a path, even though
-                    // as an ID it is less than ideal. In larger point
-                    // releases, may be better to just kick out an error.
-                    if (i === 0 || (i === 1 && ary[2] === '..') || ary[i - 1] === '..') {
-                        continue;
-                    } else if (i > 0) {
-                        ary.splice(i - 1, 2);
-                        i -= 2;
-                    }
-                }
-            }
-        }
-
-        /**
-         * Given a relative module name, like ./something, normalize it to
-         * a real name that can be mapped to a path.
-         * @param {String} name the relative name
-         * @param {String} baseName a real name that the name arg is relative
-         * to.
-         * @param {Boolean} applyMap apply the map config to the value. Should
-         * only be done if this normalization is for a dependency ID.
-         * @returns {String} normalized name
-         */
-        function normalize(name, baseName, applyMap) {
-            var pkgMain, mapValue, nameParts, i, j, nameSegment, lastIndex,
-                foundMap, foundI, foundStarMap, starI, normalizedBaseParts,
-                baseParts = (baseName && baseName.split('/')),
-                map = config.map,
-                starMap = map && map['*'];
-
-            //Adjust any relative paths.
-            if (name) {
-                name = name.split('/');
-                lastIndex = name.length - 1;
-
-                // If wanting node ID compatibility, strip .js from end
-                // of IDs. Have to do this here, and not in nameToUrl
-                // because node allows either .js or non .js to map
-                // to same file.
-                if (config.nodeIdCompat && jsSuffixRegExp.test(name[lastIndex])) {
-                    name[lastIndex] = name[lastIndex].replace(jsSuffixRegExp, '');
-                }
-
-                // Starts with a '.' so need the baseName
-                if (name[0].charAt(0) === '.' && baseParts) {
-                    //Convert baseName to array, and lop off the last part,
-                    //so that . matches that 'directory' and not name of the baseName's
-                    //module. For instance, baseName of 'one/two/three', maps to
-                    //'one/two/three.js', but we want the directory, 'one/two' for
-                    //this normalization.
-                    normalizedBaseParts = baseParts.slice(0, baseParts.length - 1);
-                    name = normalizedBaseParts.concat(name);
-                }
-
-                trimDots(name);
-                name = name.join('/');
-            }
-
-            //Apply map config if available.
-            if (applyMap && map && (baseParts || starMap)) {
-                nameParts = name.split('/');
-
-                outerLoop: for (i = nameParts.length; i > 0; i -= 1) {
-                    nameSegment = nameParts.slice(0, i).join('/');
-
-                    if (baseParts) {
-                        //Find the longest baseName segment match in the config.
-                        //So, do joins on the biggest to smallest lengths of baseParts.
-                        for (j = baseParts.length; j > 0; j -= 1) {
-                            mapValue = getOwn(map, baseParts.slice(0, j).join('/'));
-
-                            //baseName segment has config, find if it has one for
-                            //this name.
-                            if (mapValue) {
-                                mapValue = getOwn(mapValue, nameSegment);
-                                if (mapValue) {
-                                    //Match, update name to the new value.
-                                    foundMap = mapValue;
-                                    foundI = i;
-                                    break outerLoop;
-                                }
-                            }
-                        }
-                    }
-
-                    //Check for a star map match, but just hold on to it,
-                    //if there is a shorter segment match later in a matching
-                    //config, then favor over this star map.
-                    if (!foundStarMap && starMap && getOwn(starMap, nameSegment)) {
-                        foundStarMap = getOwn(starMap, nameSegment);
-                        starI = i;
-                    }
-                }
-
-                if (!foundMap && foundStarMap) {
-                    foundMap = foundStarMap;
-                    foundI = starI;
-                }
-
-                if (foundMap) {
-                    nameParts.splice(0, foundI, foundMap);
-                    name = nameParts.join('/');
-                }
-            }
-
-            // If the name points to a package's name, use
-            // the package main instead.
-            pkgMain = getOwn(config.pkgs, name);
-
-            return pkgMain ? pkgMain : name;
-        }
-
-        function removeScript(name) {
-            if (isBrowser) {
-                each(scripts(), function (scriptNode) {
-                    if (scriptNode.getAttribute('data-requiremodule') === name &&
-                            scriptNode.getAttribute('data-requirecontext') === context.contextName) {
-                        scriptNode.parentNode.removeChild(scriptNode);
-                        return true;
-                    }
-                });
-            }
-        }
-
-        function hasPathFallback(id) {
-            var pathConfig = getOwn(config.paths, id);
-            if (pathConfig && isArray(pathConfig) && pathConfig.length > 1) {
-                //Pop off the first array value, since it failed, and
-                //retry
-                pathConfig.shift();
-                context.require.undef(id);
-
-                //Custom require that does not do map translation, since
-                //ID is "absolute", already mapped/resolved.
-                context.makeRequire(null, {
-                    skipMap: true
-                })([id]);
-
-                return true;
-            }
-        }
-
-        //Turns a plugin!resource to [plugin, resource]
-        //with the plugin being undefined if the name
-        //did not have a plugin prefix.
-        function splitPrefix(name) {
-            var prefix,
-                index = name ? name.indexOf('!') : -1;
-            if (index > -1) {
-                prefix = name.substring(0, index);
-                name = name.substring(index + 1, name.length);
-            }
-            return [prefix, name];
-        }
-
-        /**
-         * Creates a module mapping that includes plugin prefix, module
-         * name, and path. If parentModuleMap is provided it will
-         * also normalize the name via require.normalize()
-         *
-         * @param {String} name the module name
-         * @param {String} [parentModuleMap] parent module map
-         * for the module name, used to resolve relative names.
-         * @param {Boolean} isNormalized: is the ID already normalized.
-         * This is true if this call is done for a define() module ID.
-         * @param {Boolean} applyMap: apply the map config to the ID.
-         * Should only be true if this map is for a dependency.
-         *
-         * @returns {Object}
-         */
-        function makeModuleMap(name, parentModuleMap, isNormalized, applyMap) {
-            var url, pluginModule, suffix, nameParts,
-                prefix = null,
-                parentName = parentModuleMap ? parentModuleMap.name : null,
-                originalName = name,
-                isDefine = true,
-                normalizedName = '';
-
-            //If no name, then it means it is a require call, generate an
-            //internal name.
-            if (!name) {
-                isDefine = false;
-                name = '_@r' + (requireCounter += 1);
-            }
-
-            nameParts = splitPrefix(name);
-            prefix = nameParts[0];
-            name = nameParts[1];
-
-            if (prefix) {
-                prefix = normalize(prefix, parentName, applyMap);
-                pluginModule = getOwn(defined, prefix);
-            }
-
-            //Account for relative paths if there is a base name.
-            if (name) {
-                if (prefix) {
-                    if (pluginModule && pluginModule.normalize) {
-                        //Plugin is loaded, use its normalize method.
-                        normalizedName = pluginModule.normalize(name, function (name) {
-                            return normalize(name, parentName, applyMap);
-                        });
-                    } else {
-                        // If nested plugin references, then do not try to
-                        // normalize, as it will not normalize correctly. This
-                        // places a restriction on resourceIds, and the longer
-                        // term solution is not to normalize until plugins are
-                        // loaded and all normalizations to allow for async
-                        // loading of a loader plugin. But for now, fixes the
-                        // common uses. Details in #1131
-                        normalizedName = name.indexOf('!') === -1 ?
-                                         normalize(name, parentName, applyMap) :
-                                         name;
-                    }
-                } else {
-                    //A regular module.
-                    normalizedName = normalize(name, parentName, applyMap);
-
-                    //Normalized name may be a plugin ID due to map config
-                    //application in normalize. The map config values must
-                    //already be normalized, so do not need to redo that part.
-                    nameParts = splitPrefix(normalizedName);
-                    prefix = nameParts[0];
-                    normalizedName = nameParts[1];
-                    isNormalized = true;
-
-                    url = context.nameToUrl(normalizedName);
-                }
-            }
-
-            //If the id is a plugin id that cannot be determined if it needs
-            //normalization, stamp it with a unique ID so two matching relative
-            //ids that may conflict can be separate.
-            suffix = prefix && !pluginModule && !isNormalized ?
-                     '_unnormalized' + (unnormalizedCounter += 1) :
-                     '';
-
-            return {
-                prefix: prefix,
-                name: normalizedName,
-                parentMap: parentModuleMap,
-                unnormalized: !!suffix,
-                url: url,
-                originalName: originalName,
-                isDefine: isDefine,
-                id: (prefix ?
-                        prefix + '!' + normalizedName :
-                        normalizedName) + suffix
-            };
-        }
-
-        function getModule(depMap) {
-            var id = depMap.id,
-                mod = getOwn(registry, id);
-
-            if (!mod) {
-                mod = registry[id] = new context.Module(depMap);
-            }
-
-            return mod;
-        }
-
-        function on(depMap, name, fn) {
-            var id = depMap.id,
-                mod = getOwn(registry, id);
-
-            if (hasProp(defined, id) &&
-                    (!mod || mod.defineEmitComplete)) {
-                if (name === 'defined') {
-                    fn(defined[id]);
-                }
-            } else {
-                mod = getModule(depMap);
-                if (mod.error && name === 'error') {
-                    fn(mod.error);
-                } else {
-                    mod.on(name, fn);
-                }
-            }
-        }
-
-        function onError(err, errback) {
-            var ids = err.requireModules,
-                notified = false;
-
-            if (errback) {
-                errback(err);
-            } else {
-                each(ids, function (id) {
-                    var mod = getOwn(registry, id);
-                    if (mod) {
-                        //Set error on module, so it skips timeout checks.
-                        mod.error = err;
-                        if (mod.events.error) {
-                            notified = true;
-                            mod.emit('error', err);
-                        }
-                    }
-                });
-
-                if (!notified) {
-                    req.onError(err);
-                }
-            }
-        }
-
-        /**
-         * Internal method to transfer globalQueue items to this context's
-         * defQueue.
-         */
-        function takeGlobalQueue() {
-            //Push all the globalDefQueue items into the context's defQueue
-            if (globalDefQueue.length) {
-                each(globalDefQueue, function(queueItem) {
-                    var id = queueItem[0];
-                    if (typeof id === 'string') {
-                        context.defQueueMap[id] = true;
-                    }
-                    defQueue.push(queueItem);
-                });
-                globalDefQueue = [];
-            }
-        }
-
-        handlers = {
-            'require': function (mod) {
-                if (mod.require) {
-                    return mod.require;
-                } else {
-                    return (mod.require = context.makeRequire(mod.map));
-                }
-            },
-            'exports': function (mod) {
-                mod.usingExports = true;
-                if (mod.map.isDefine) {
-                    if (mod.exports) {
-                        return (defined[mod.map.id] = mod.exports);
-                    } else {
-                        return (mod.exports = defined[mod.map.id] = {});
-                    }
-                }
-            },
-            'module': function (mod) {
-                if (mod.module) {
-                    return mod.module;
-                } else {
-                    return (mod.module = {
-                        id: mod.map.id,
-                        uri: mod.map.url,
-                        config: function () {
-                            return getOwn(config.config, mod.map.id) || {};
-                        },
-                        exports: mod.exports || (mod.exports = {})
-                    });
-                }
-            }
-        };
-
-        function cleanRegistry(id) {
-            //Clean up machinery used for waiting modules.
-            delete registry[id];
-            delete enabledRegistry[id];
-        }
-
-        function breakCycle(mod, traced, processed) {
-            var id = mod.map.id;
-
-            if (mod.error) {
-                mod.emit('error', mod.error);
-            } else {
-                traced[id] = true;
-                each(mod.depMaps, function (depMap, i) {
-                    var depId = depMap.id,
-                        dep = getOwn(registry, depId);
-
-                    //Only force things that have not completed
-                    //being defined, so still in the registry,
-                    //and only if it has not been matched up
-                    //in the module already.
-                    if (dep && !mod.depMatched[i] && !processed[depId]) {
-                        if (getOwn(traced, depId)) {
-                            mod.defineDep(i, defined[depId]);
-                            mod.check(); //pass false?
-                        } else {
-                            breakCycle(dep, traced, processed);
-                        }
-                    }
-                });
-                processed[id] = true;
-            }
-        }
-
-        function checkLoaded() {
-            var err, usingPathFallback,
-                waitInterval = config.waitSeconds * 1000,
-                //It is possible to disable the wait interval by using waitSeconds of 0.
-                expired = waitInterval && (context.startTime + waitInterval) < new Date().getTime(),
-                noLoads = [],
-                reqCalls = [],
-                stillLoading = false,
-                needCycleCheck = true;
-
-            //Do not bother if this call was a result of a cycle break.
-            if (inCheckLoaded) {
-                return;
-            }
-
-            inCheckLoaded = true;
-
-            //Figure out the state of all the modules.
-            eachProp(enabledRegistry, function (mod) {
-                var map = mod.map,
-                    modId = map.id;
-
-                //Skip things that are not enabled or in error state.
-                if (!mod.enabled) {
-                    return;
-                }
-
-                if (!map.isDefine) {
-                    reqCalls.push(mod);
-                }
-
-                if (!mod.error) {
-                    //If the module should be executed, and it has not
-                    //been inited and time is up, remember it.
-                    if (!mod.inited && expired) {
-                        if (hasPathFallback(modId)) {
-                            usingPathFallback = true;
-                            stillLoading = true;
-                        } else {
-                            noLoads.push(modId);
-                            removeScript(modId);
-                        }
-                    } else if (!mod.inited && mod.fetched && map.isDefine) {
-                        stillLoading = true;
-                        if (!map.prefix) {
-                            //No reason to keep looking for unfinished
-                            //loading. If the only stillLoading is a
-                            //plugin resource though, keep going,
-                            //because it may be that a plugin resource
-                            //is waiting on a non-plugin cycle.
-                            return (needCycleCheck = false);
-                        }
-                    }
-                }
-            });
-
-            if (expired && noLoads.length) {
-                //If wait time expired, throw error of unloaded modules.
-                err = makeError('timeout', 'Load timeout for modules: ' + noLoads, null, noLoads);
-                err.contextName = context.contextName;
-                return onError(err);
-            }
-
-            //Not expired, check for a cycle.
-            if (needCycleCheck) {
-                each(reqCalls, function (mod) {
-                    breakCycle(mod, {}, {});
-                });
-            }
-
-            //If still waiting on loads, and the waiting load is something
-            //other than a plugin resource, or there are still outstanding
-            //scripts, then just try back later.
-            if ((!expired || usingPathFallback) && stillLoading) {
-                //Something is still waiting to load. Wait for it, but only
-                //if a timeout is not already in effect.
-                if ((isBrowser || isWebWorker) && !checkLoadedTimeoutId) {
-                    checkLoadedTimeoutId = setTimeout(function () {
-                        checkLoadedTimeoutId = 0;
-                        checkLoaded();
-                    }, 50);
-                }
-            }
-
-            inCheckLoaded = false;
-        }
-
-        Module = function (map) {
-            this.events = getOwn(undefEvents, map.id) || {};
-            this.map = map;
-            this.shim = getOwn(config.shim, map.id);
-            this.depExports = [];
-            this.depMaps = [];
-            this.depMatched = [];
-            this.pluginMaps = {};
-            this.depCount = 0;
-
-            /* this.exports this.factory
-               this.depMaps = [],
-               this.enabled, this.fetched
-            */
-        };
-
-        Module.prototype = {
-            init: function (depMaps, factory, errback, options) {
-                options = options || {};
-
-                //Do not do more inits if already done. Can happen if there
-                //are multiple define calls for the same module. That is not
-                //a normal, common case, but it is also not unexpected.
-                if (this.inited) {
-                    return;
-                }
-
-                this.factory = factory;
-
-                if (errback) {
-                    //Register for errors on this module.
-                    this.on('error', errback);
-                } else if (this.events.error) {
-                    //If no errback already, but there are error listeners
-                    //on this module, set up an errback to pass to the deps.
-                    errback = bind(this, function (err) {
-                        this.emit('error', err);
-                    });
-                }
-
-                //Do a copy of the dependency array, so that
-                //source inputs are not modified. For example
-                //"shim" deps are passed in here directly, and
-                //doing a direct modification of the depMaps array
-                //would affect that config.
-                this.depMaps = depMaps && depMaps.slice(0);
-
-                this.errback = errback;
-
-                //Indicate this module has be initialized
-                this.inited = true;
-
-                this.ignore = options.ignore;
-
-                //Could have option to init this module in enabled mode,
-                //or could have been previously marked as enabled. However,
-                //the dependencies are not known until init is called. So
-                //if enabled previously, now trigger dependencies as enabled.
-                if (options.enabled || this.enabled) {
-                    //Enable this module and dependencies.
-                    //Will call this.check()
-                    this.enable();
-                } else {
-                    this.check();
-                }
-            },
-
-            defineDep: function (i, depExports) {
-                //Because of cycles, defined callback for a given
-                //export can be called more than once.
-                if (!this.depMatched[i]) {
-                    this.depMatched[i] = true;
-                    this.depCount -= 1;
-                    this.depExports[i] = depExports;
-                }
-            },
-
-            fetch: function () {
-                if (this.fetched) {
-                    return;
-                }
-                this.fetched = true;
-
-                context.startTime = (new Date()).getTime();
-
-                var map = this.map;
-
-                //If the manager is for a plugin managed resource,
-                //ask the plugin to load it now.
-                if (this.shim) {
-                    context.makeRequire(this.map, {
-                        enableBuildCallback: true
-                    })(this.shim.deps || [], bind(this, function () {
-                        return map.prefix ? this.callPlugin() : this.load();
-                    }));
-                } else {
-                    //Regular dependency.
-                    return map.prefix ? this.callPlugin() : this.load();
-                }
-            },
-
-            load: function () {
-                var url = this.map.url;
-
-                //Regular dependency.
-                if (!urlFetched[url]) {
-                    urlFetched[url] = true;
-                    context.load(this.map.id, url);
-                }
-            },
-
-            /**
-             * Checks if the module is ready to define itself, and if so,
-             * define it.
-             */
-            check: function () {
-                if (!this.enabled || this.enabling) {
-                    return;
-                }
-
-                var err, cjsModule,
-                    id = this.map.id,
-                    depExports = this.depExports,
-                    exports = this.exports,
-                    factory = this.factory;
-
-                if (!this.inited) {
-                    // Only fetch if not already in the defQueue.
-                    if (!hasProp(context.defQueueMap, id)) {
-                        this.fetch();
-                    }
-                } else if (this.error) {
-                    this.emit('error', this.error);
-                } else if (!this.defining) {
-                    //The factory could trigger another require call
-                    //that would result in checking this module to
-                    //define itself again. If already in the process
-                    //of doing that, skip this work.
-                    this.defining = true;
-
-                    if (this.depCount < 1 && !this.defined) {
-                        if (isFunction(factory)) {
-                            try {
-                                exports = context.execCb(id, factory, depExports, exports);
-                            } catch (e) {
-                                err = e;
-                            }
-
-                            // Favor return value over exports. If node/cjs in play,
-                            // then will not have a return value anyway. Favor
-                            // module.exports assignment over exports object.
-                            if (this.map.isDefine && exports === undefined) {
-                                cjsModule = this.module;
-                                if (cjsModule) {
-                                    exports = cjsModule.exports;
-                                } else if (this.usingExports) {
-                                    //exports already set the defined value.
-                                    exports = this.exports;
-                                }
-                            }
-
-                            if (err) {
-                                // If there is an error listener, favor passing
-                                // to that instead of throwing an error. However,
-                                // only do it for define()'d  modules. require
-                                // errbacks should not be called for failures in
-                                // their callbacks (#699). However if a global
-                                // onError is set, use that.
-                                if ((this.events.error && this.map.isDefine) ||
-                                    req.onError !== defaultOnError) {
-                                    err.requireMap = this.map;
-                                    err.requireModules = this.map.isDefine ? [this.map.id] : null;
-                                    err.requireType = this.map.isDefine ? 'define' : 'require';
-                                    return onError((this.error = err));
-                                } else if (typeof console !== 'undefined' &&
-                                           console.error) {
-                                    // Log the error for debugging. If promises could be
-                                    // used, this would be different, but making do.
-                                    console.error(err);
-                                } else {
-                                    // Do not want to completely lose the error. While this
-                                    // will mess up processing and lead to similar results
-                                    // as bug 1440, it at least surfaces the error.
-                                    req.onError(err);
-                                }
-                            }
-                        } else {
-                            //Just a literal value
-                            exports = factory;
-                        }
-
-                        this.exports = exports;
-
-                        if (this.map.isDefine && !this.ignore) {
-                            defined[id] = exports;
-
-                            if (req.onResourceLoad) {
-                                var resLoadMaps = [];
-                                each(this.depMaps, function (depMap) {
-                                    resLoadMaps.push(depMap.normalizedMap || depMap);
-                                });
-                                req.onResourceLoad(context, this.map, resLoadMaps);
-                            }
-                        }
-
-                        //Clean up
-                        cleanRegistry(id);
-
-                        this.defined = true;
-                    }
-
-                    //Finished the define stage. Allow calling check again
-                    //to allow define notifications below in the case of a
-                    //cycle.
-                    this.defining = false;
-
-                    if (this.defined && !this.defineEmitted) {
-                        this.defineEmitted = true;
-                        this.emit('defined', this.exports);
-                        this.defineEmitComplete = true;
-                    }
-
-                }
-            },
-
-            callPlugin: function () {
-                var map = this.map,
-                    id = map.id,
-                    //Map already normalized the prefix.
-                    pluginMap = makeModuleMap(map.prefix);
-
-                //Mark this as a dependency for this plugin, so it
-                //can be traced for cycles.
-                this.depMaps.push(pluginMap);
-
-                on(pluginMap, 'defined', bind(this, function (plugin) {
-                    var load, normalizedMap, normalizedMod,
-                        bundleId = getOwn(bundlesMap, this.map.id),
-                        name = this.map.name,
-                        parentName = this.map.parentMap ? this.map.parentMap.name : null,
-                        localRequire = context.makeRequire(map.parentMap, {
-                            enableBuildCallback: true
-                        });
-
-                    //If current map is not normalized, wait for that
-                    //normalized name to load instead of continuing.
-                    if (this.map.unnormalized) {
-                        //Normalize the ID if the plugin allows it.
-                        if (plugin.normalize) {
-                            name = plugin.normalize(name, function (name) {
-                                return normalize(name, parentName, true);
-                            }) || '';
-                        }
-
-                        //prefix and name should already be normalized, no need
-                        //for applying map config again either.
-                        normalizedMap = makeModuleMap(map.prefix + '!' + name,
-                                                      this.map.parentMap);
-                        on(normalizedMap,
-                            'defined', bind(this, function (value) {
-                                this.map.normalizedMap = normalizedMap;
-                                this.init([], function () { return value; }, null, {
-                                    enabled: true,
-                                    ignore: true
-                                });
-                            }));
-
-                        normalizedMod = getOwn(registry, normalizedMap.id);
-                        if (normalizedMod) {
-                            //Mark this as a dependency for this plugin, so it
-                            //can be traced for cycles.
-                            this.depMaps.push(normalizedMap);
-
-                            if (this.events.error) {
-                                normalizedMod.on('error', bind(this, function (err) {
-                                    this.emit('error', err);
-                                }));
-                            }
-                            normalizedMod.enable();
-                        }
-
-                        return;
-                    }
-
-                    //If a paths config, then just load that file instead to
-                    //resolve the plugin, as it is built into that paths layer.
-                    if (bundleId) {
-                        this.map.url = context.nameToUrl(bundleId);
-                        this.load();
-                        return;
-                    }
-
-                    load = bind(this, function (value) {
-                        this.init([], function () { return value; }, null, {
-                            enabled: true
-                        });
-                    });
-
-                    load.error = bind(this, function (err) {
-                        this.inited = true;
-                        this.error = err;
-                        err.requireModules = [id];
-
-                        //Remove temp unnormalized modules for this module,
-                        //since they will never be resolved otherwise now.
-                        eachProp(registry, function (mod) {
-                            if (mod.map.id.indexOf(id + '_unnormalized') === 0) {
-                                cleanRegistry(mod.map.id);
-                            }
-                        });
-
-                        onError(err);
-                    });
-
-                    //Allow plugins to load other code without having to know the
-                    //context or how to 'complete' the load.
-                    load.fromText = bind(this, function (text, textAlt) {
-                        /*jslint evil: true */
-                        var moduleName = map.name,
-                            moduleMap = makeModuleMap(moduleName),
-                            hasInteractive = useInteractive;
-
-                        //As of 2.1.0, support just passing the text, to reinforce
-                        //fromText only being called once per resource. Still
-                        //support old style of passing moduleName but discard
-                        //that moduleName in favor of the internal ref.
-                        if (textAlt) {
-                            text = textAlt;
-                        }
-
-                        //Turn off interactive script matching for IE for any define
-                        //calls in the text, then turn it back on at the end.
-                        if (hasInteractive) {
-                            useInteractive = false;
-                        }
-
-                        //Prime the system by creating a module instance for
-                        //it.
-                        getModule(moduleMap);
-
-                        //Transfer any config to this other module.
-                        if (hasProp(config.config, id)) {
-                            config.config[moduleName] = config.config[id];
-                        }
-
-                        try {
-                            req.exec(text);
-                        } catch (e) {
-                            return onError(makeError('fromtexteval',
-                                             'fromText eval for ' + id +
-                                            ' failed: ' + e,
-                                             e,
-                                             [id]));
-                        }
-
-                        if (hasInteractive) {
-                            useInteractive = true;
-                        }
-
-                        //Mark this as a dependency for the plugin
-                        //resource
-                        this.depMaps.push(moduleMap);
-
-                        //Support anonymous modules.
-                        context.completeLoad(moduleName);
-
-                        //Bind the value of that module to the value for this
-                        //resource ID.
-                        localRequire([moduleName], load);
-                    });
-
-                    //Use parentName here since the plugin's name is not reliable,
-                    //could be some weird string with no path that actually wants to
-                    //reference the parentName's path.
-                    plugin.load(map.name, localRequire, load, config);
-                }));
-
-                context.enable(pluginMap, this);
-                this.pluginMaps[pluginMap.id] = pluginMap;
-            },
-
-            enable: function () {
-                enabledRegistry[this.map.id] = this;
-                this.enabled = true;
-
-                //Set flag mentioning that the module is enabling,
-                //so that immediate calls to the defined callbacks
-                //for dependencies do not trigger inadvertent load
-                //with the depCount still being zero.
-                this.enabling = true;
-
-                //Enable each dependency
-                each(this.depMaps, bind(this, function (depMap, i) {
-                    var id, mod, handler;
-
-                    if (typeof depMap === 'string') {
-                        //Dependency needs to be converted to a depMap
-                        //and wired up to this module.
-                        depMap = makeModuleMap(depMap,
-                                               (this.map.isDefine ? this.map : this.map.parentMap),
-                                               false,
-                                               !this.skipMap);
-                        this.depMaps[i] = depMap;
-
-                        handler = getOwn(handlers, depMap.id);
-
-                        if (handler) {
-                            this.depExports[i] = handler(this);
-                            return;
-                        }
-
-                        this.depCount += 1;
-
-                        on(depMap, 'defined', bind(this, function (depExports) {
-                            if (this.undefed) {
-                                return;
-                            }
-                            this.defineDep(i, depExports);
-                            this.check();
-                        }));
-
-                        if (this.errback) {
-                            on(depMap, 'error', bind(this, this.errback));
-                        } else if (this.events.error) {
-                            // No direct errback on this module, but something
-                            // else is listening for errors, so be sure to
-                            // propagate the error correctly.
-                            on(depMap, 'error', bind(this, function(err) {
-                                this.emit('error', err);
-                            }));
-                        }
-                    }
-
-                    id = depMap.id;
-                    mod = registry[id];
-
-                    //Skip special modules like 'require', 'exports', 'module'
-                    //Also, don't call enable if it is already enabled,
-                    //important in circular dependency cases.
-                    if (!hasProp(handlers, id) && mod && !mod.enabled) {
-                        context.enable(depMap, this);
-                    }
-                }));
-
-                //Enable each plugin that is used in
-                //a dependency
-                eachProp(this.pluginMaps, bind(this, function (pluginMap) {
-                    var mod = getOwn(registry, pluginMap.id);
-                    if (mod && !mod.enabled) {
-                        context.enable(pluginMap, this);
-                    }
-                }));
-
-                this.enabling = false;
-
-                this.check();
-            },
-
-            on: function (name, cb) {
-                var cbs = this.events[name];
-                if (!cbs) {
-                    cbs = this.events[name] = [];
-                }
-                cbs.push(cb);
-            },
-
-            emit: function (name, evt) {
-                each(this.events[name], function (cb) {
-                    cb(evt);
-                });
-                if (name === 'error') {
-                    //Now that the error handler was triggered, remove
-                    //the listeners, since this broken Module instance
-                    //can stay around for a while in the registry.
-                    delete this.events[name];
-                }
-            }
-        };
-
-        function callGetModule(args) {
-            //Skip modules already defined.
-            if (!hasProp(defined, args[0])) {
-                getModule(makeModuleMap(args[0], null, true)).init(args[1], args[2]);
-            }
-        }
-
-        function removeListener(node, func, name, ieName) {
-            //Favor detachEvent because of IE9
-            //issue, see attachEvent/addEventListener comment elsewhere
-            //in this file.
-            if (node.detachEvent && !isOpera) {
-                //Probably IE. If not it will throw an error, which will be
-                //useful to know.
-                if (ieName) {
-                    node.detachEvent(ieName, func);
-                }
-            } else {
-                node.removeEventListener(name, func, false);
-            }
-        }
-
-        /**
-         * Given an event from a script node, get the requirejs info from it,
-         * and then removes the event listeners on the node.
-         * @param {Event} evt
-         * @returns {Object}
-         */
-        function getScriptData(evt) {
-            //Using currentTarget instead of target for Firefox 2.0's sake. Not
-            //all old browsers will be supported, but this one was easy enough
-            //to support and still makes sense.
-            var node = evt.currentTarget || evt.srcElement;
-
-            //Remove the listeners once here.
-            removeListener(node, context.onScriptLoad, 'load', 'onreadystatechange');
-            removeListener(node, context.onScriptError, 'error');
-
-            return {
-                node: node,
-                id: node && node.getAttribute('data-requiremodule')
-            };
-        }
-
-        function intakeDefines() {
-            var args;
-
-            //Any defined modules in the global queue, intake them now.
-            takeGlobalQueue();
-
-            //Make sure any remaining defQueue items get properly processed.
-            while (defQueue.length) {
-                args = defQueue.shift();
-                if (args[0] === null) {
-                    return onError(makeError('mismatch', 'Mismatched anonymous define() module: ' +
-                        args[args.length - 1]));
-                } else {
-                    //args are id, deps, factory. Should be normalized by the
-                    //define() function.
-                    callGetModule(args);
-                }
-            }
-            context.defQueueMap = {};
-        }
-
-        context = {
-            config: config,
-            contextName: contextName,
-            registry: registry,
-            defined: defined,
-            urlFetched: urlFetched,
-            defQueue: defQueue,
-            defQueueMap: {},
-            Module: Module,
-            makeModuleMap: makeModuleMap,
-            nextTick: req.nextTick,
-            onError: onError,
-
-            /**
-             * Set a configuration for the context.
-             * @param {Object} cfg config object to integrate.
-             */
-            configure: function (cfg) {
-                //Make sure the baseUrl ends in a slash.
-                if (cfg.baseUrl) {
-                    if (cfg.baseUrl.charAt(cfg.baseUrl.length - 1) !== '/') {
-                        cfg.baseUrl += '/';
-                    }
-                }
-
-                //Save off the paths since they require special processing,
-                //they are additive.
-                var shim = config.shim,
-                    objs = {
-                        paths: true,
-                        bundles: true,
-                        config: true,
-                        map: true
-                    };
-
-                eachProp(cfg, function (value, prop) {
-                    if (objs[prop]) {
-                        if (!config[prop]) {
-                            config[prop] = {};
-                        }
-                        mixin(config[prop], value, true, true);
-                    } else {
-                        config[prop] = value;
-                    }
-                });
-
-                //Reverse map the bundles
-                if (cfg.bundles) {
-                    eachProp(cfg.bundles, function (value, prop) {
-                        each(value, function (v) {
-                            if (v !== prop) {
-                                bundlesMap[v] = prop;
-                            }
-                        });
-                    });
-                }
-
-                //Merge shim
-                if (cfg.shim) {
-                    eachProp(cfg.shim, function (value, id) {
-                        //Normalize the structure
-                        if (isArray(value)) {
-                            value = {
-                                deps: value
-                            };
-                        }
-                        if ((value.exports || value.init) && !value.exportsFn) {
-                            value.exportsFn = context.makeShimExports(value);
-                        }
-                        shim[id] = value;
-                    });
-                    config.shim = shim;
-                }
-
-                //Adjust packages if necessary.
-                if (cfg.packages) {
-                    each(cfg.packages, function (pkgObj) {
-                        var location, name;
-
-                        pkgObj = typeof pkgObj === 'string' ? {name: pkgObj} : pkgObj;
-
-                        name = pkgObj.name;
-                        location = pkgObj.location;
-                        if (location) {
-                            config.paths[name] = pkgObj.location;
-                        }
-
-                        //Save pointer to main module ID for pkg name.
-                        //Remove leading dot in main, so main paths are normalized,
-                        //and remove any trailing .js, since different package
-                        //envs have different conventions: some use a module name,
-                        //some use a file name.
-                        config.pkgs[name] = pkgObj.name + '/' + (pkgObj.main || 'main')
-                                     .replace(currDirRegExp, '')
-                                     .replace(jsSuffixRegExp, '');
-                    });
-                }
-
-                //If there are any "waiting to execute" modules in the registry,
-                //update the maps for them, since their info, like URLs to load,
-                //may have changed.
-                eachProp(registry, function (mod, id) {
-                    //If module already has init called, since it is too
-                    //late to modify them, and ignore unnormalized ones
-                    //since they are transient.
-                    if (!mod.inited && !mod.map.unnormalized) {
-                        mod.map = makeModuleMap(id, null, true);
-                    }
-                });
-
-                //If a deps array or a config callback is specified, then call
-                //require with those args. This is useful when require is defined as a
-                //config object before require.js is loaded.
-                if (cfg.deps || cfg.callback) {
-                    context.require(cfg.deps || [], cfg.callback);
-                }
-            },
-
-            makeShimExports: function (value) {
-                function fn() {
-                    var ret;
-                    if (value.init) {
-                        ret = value.init.apply(global, arguments);
-                    }
-                    return ret || (value.exports && getGlobal(value.exports));
-                }
-                return fn;
-            },
-
-            makeRequire: function (relMap, options) {
-                options = options || {};
-
-                function localRequire(deps, callback, errback) {
-                    var id, map, requireMod;
-
-                    if (options.enableBuildCallback && callback && isFunction(callback)) {
-                        callback.__requireJsBuild = true;
-                    }
-
-                    if (typeof deps === 'string') {
-                        if (isFunction(callback)) {
-                            //Invalid call
-                            return onError(makeError('requireargs', 'Invalid require call'), errback);
-                        }
-
-                        //If require|exports|module are requested, get the
-                        //value for them from the special handlers. Caveat:
-                        //this only works while module is being defined.
-                        if (relMap && hasProp(handlers, deps)) {
-                            return handlers[deps](registry[relMap.id]);
-                        }
-
-                        //Synchronous access to one module. If require.get is
-                        //available (as in the Node adapter), prefer that.
-                        if (req.get) {
-                            return req.get(context, deps, relMap, localRequire);
-                        }
-
-                        //Normalize module name, if it contains . or ..
-                        map = makeModuleMap(deps, relMap, false, true);
-                        id = map.id;
-
-                        if (!hasProp(defined, id)) {
-                            return onError(makeError('notloaded', 'Module name "' +
-                                        id +
-                                        '" has not been loaded yet for context: ' +
-                                        contextName +
-                                        (relMap ? '' : '. Use require([])')));
-                        }
-                        return defined[id];
-                    }
-
-                    //Grab defines waiting in the global queue.
-                    intakeDefines();
-
-                    //Mark all the dependencies as needing to be loaded.
-                    context.nextTick(function () {
-                        //Some defines could have been added since the
-                        //require call, collect them.
-                        intakeDefines();
-
-                        requireMod = getModule(makeModuleMap(null, relMap));
-
-                        //Store if map config should be applied to this require
-                        //call for dependencies.
-                        requireMod.skipMap = options.skipMap;
-
-                        requireMod.init(deps, callback, errback, {
-                            enabled: true
-                        });
-
-                        checkLoaded();
-                    });
-
-                    return localRequire;
-                }
-
-                mixin(localRequire, {
-                    isBrowser: isBrowser,
-
-                    /**
-                     * Converts a module name + .extension into an URL path.
-                     * *Requires* the use of a module name. It does not support using
-                     * plain URLs like nameToUrl.
-                     */
-                    toUrl: function (moduleNamePlusExt) {
-                        var ext,
-                            index = moduleNamePlusExt.lastIndexOf('.'),
-                            segment = moduleNamePlusExt.split('/')[0],
-                            isRelative = segment === '.' || segment === '..';
-
-                        //Have a file extension alias, and it is not the
-                        //dots from a relative path.
-                        if (index !== -1 && (!isRelative || index > 1)) {
-                            ext = moduleNamePlusExt.substring(index, moduleNamePlusExt.length);
-                            moduleNamePlusExt = moduleNamePlusExt.substring(0, index);
-                        }
-
-                        return context.nameToUrl(normalize(moduleNamePlusExt,
-                                                relMap && relMap.id, true), ext,  true);
-                    },
-
-                    defined: function (id) {
-                        return hasProp(defined, makeModuleMap(id, relMap, false, true).id);
-                    },
-
-                    specified: function (id) {
-                        id = makeModuleMap(id, relMap, false, true).id;
-                        return hasProp(defined, id) || hasProp(registry, id);
-                    }
-                });
-
-                //Only allow undef on top level require calls
-                if (!relMap) {
-                    localRequire.undef = function (id) {
-                        //Bind any waiting define() calls to this context,
-                        //fix for #408
-                        takeGlobalQueue();
-
-                        var map = makeModuleMap(id, relMap, true),
-                            mod = getOwn(registry, id);
-
-                        mod.undefed = true;
-                        removeScript(id);
-
-                        delete defined[id];
-                        delete urlFetched[map.url];
-                        delete undefEvents[id];
-
-                        //Clean queued defines too. Go backwards
-                        //in array so that the splices do not
-                        //mess up the iteration.
-                        eachReverse(defQueue, function(args, i) {
-                            if (args[0] === id) {
-                                defQueue.splice(i, 1);
-                            }
-                        });
-                        delete context.defQueueMap[id];
-
-                        if (mod) {
-                            //Hold on to listeners in case the
-                            //module will be attempted to be reloaded
-                            //using a different config.
-                            if (mod.events.defined) {
-                                undefEvents[id] = mod.events;
-                            }
-
-                            cleanRegistry(id);
-                        }
-                    };
-                }
-
-                return localRequire;
-            },
-
-            /**
-             * Called to enable a module if it is still in the registry
-             * awaiting enablement. A second arg, parent, the parent module,
-             * is passed in for context, when this method is overridden by
-             * the optimizer. Not shown here to keep code compact.
-             */
-            enable: function (depMap) {
-                var mod = getOwn(registry, depMap.id);
-                if (mod) {
-                    getModule(depMap).enable();
-                }
-            },
-
-            /**
-             * Internal method used by environment adapters to complete a load event.
-             * A load event could be a script load or just a load pass from a synchronous
-             * load call.
-             * @param {String} moduleName the name of the module to potentially complete.
-             */
-            completeLoad: function (moduleName) {
-                var found, args, mod,
-                    shim = getOwn(config.shim, moduleName) || {},
-                    shExports = shim.exports;
-
-                takeGlobalQueue();
-
-                while (defQueue.length) {
-                    args = defQueue.shift();
-                    if (args[0] === null) {
-                        args[0] = moduleName;
-                        //If already found an anonymous module and bound it
-                        //to this name, then this is some other anon module
-                        //waiting for its completeLoad to fire.
-                        if (found) {
-                            break;
-                        }
-                        found = true;
-                    } else if (args[0] === moduleName) {
-                        //Found matching define call for this script!
-                        found = true;
-                    }
-
-                    callGetModule(args);
-                }
-                context.defQueueMap = {};
-
-                //Do this after the cycle of callGetModule in case the result
-                //of those calls/init calls changes the registry.
-                mod = getOwn(registry, moduleName);
-
-                if (!found && !hasProp(defined, moduleName) && mod && !mod.inited) {
-                    if (config.enforceDefine && (!shExports || !getGlobal(shExports))) {
-                        if (hasPathFallback(moduleName)) {
-                            return;
-                        } else {
-                            return onError(makeError('nodefine',
-                                             'No define call for ' + moduleName,
-                                             null,
-                                             [moduleName]));
-                        }
-                    } else {
-                        //A script that does not call define(), so just simulate
-                        //the call for it.
-                        callGetModule([moduleName, (shim.deps || []), shim.exportsFn]);
-                    }
-                }
-
-                checkLoaded();
-            },
-
-            /**
-             * Converts a module name to a file path. Supports cases where
-             * moduleName may actually be just an URL.
-             * Note that it **does not** call normalize on the moduleName,
-             * it is assumed to have already been normalized. This is an
-             * internal API, not a public one. Use toUrl for the public API.
-             */
-            nameToUrl: function (moduleName, ext, skipExt) {
-                var paths, syms, i, parentModule, url,
-                    parentPath, bundleId,
-                    pkgMain = getOwn(config.pkgs, moduleName);
-
-                if (pkgMain) {
-                    moduleName = pkgMain;
-                }
-
-                bundleId = getOwn(bundlesMap, moduleName);
-
-                if (bundleId) {
-                    return context.nameToUrl(bundleId, ext, skipExt);
-                }
-
-                //If a colon is in the URL, it indicates a protocol is used and it is just
-                //an URL to a file, or if it starts with a slash, contains a query arg (i.e. ?)
-                //or ends with .js, then assume the user meant to use an url and not a module id.
-                //The slash is important for protocol-less URLs as well as full paths.
-                if (req.jsExtRegExp.test(moduleName)) {
-                    //Just a plain path, not module name lookup, so just return it.
-                    //Add extension if it is included. This is a bit wonky, only non-.js things pass
-                    //an extension, this method probably needs to be reworked.
-                    url = moduleName + (ext || '');
-                } else {
-                    //A module that needs to be converted to a path.
-                    paths = config.paths;
-
-                    syms = moduleName.split('/');
-                    //For each module name segment, see if there is a path
-                    //registered for it. Start with most specific name
-                    //and work up from it.
-                    for (i = syms.length; i > 0; i -= 1) {
-                        parentModule = syms.slice(0, i).join('/');
-
-                        parentPath = getOwn(paths, parentModule);
-                        if (parentPath) {
-                            //If an array, it means there are a few choices,
-                            //Choose the one that is desired
-                            if (isArray(parentPath)) {
-                                parentPath = parentPath[0];
-                            }
-                            syms.splice(0, i, parentPath);
-                            break;
-                        }
-                    }
-
-                    //Join the path parts together, then figure out if baseUrl is needed.
-                    url = syms.join('/');
-                    url += (ext || (/^data\:|\?/.test(url) || skipExt ? '' : '.js'));
-                    url = (url.charAt(0) === '/' || url.match(/^[\w\+\.\-]+:/) ? '' : config.baseUrl) + url;
-                }
-
-                return config.urlArgs ? url +
-                                        ((url.indexOf('?') === -1 ? '?' : '&') +
-                                         config.urlArgs) : url;
-            },
-
-            //Delegates to req.load. Broken out as a separate function to
-            //allow overriding in the optimizer.
-            load: function (id, url) {
-                req.load(context, id, url);
-            },
-
-            /**
-             * Executes a module callback function. Broken out as a separate function
-             * solely to allow the build system to sequence the files in the built
-             * layer in the right sequence.
-             *
-             * @private
-             */
-            execCb: function (name, callback, args, exports) {
-                return callback.apply(exports, args);
-            },
-
-            /**
-             * callback for script loads, used to check status of loading.
-             *
-             * @param {Event} evt the event from the browser for the script
-             * that was loaded.
-             */
-            onScriptLoad: function (evt) {
-                //Using currentTarget instead of target for Firefox 2.0's sake. Not
-                //all old browsers will be supported, but this one was easy enough
-                //to support and still makes sense.
-                if (evt.type === 'load' ||
-                        (readyRegExp.test((evt.currentTarget || evt.srcElement).readyState))) {
-                    //Reset interactive script so a script node is not held onto for
-                    //to long.
-                    interactiveScript = null;
-
-                    //Pull out the name of the module and the context.
-                    var data = getScriptData(evt);
-                    context.completeLoad(data.id);
-                }
-            },
-
-            /**
-             * Callback for script errors.
-             */
-            onScriptError: function (evt) {
-                var data = getScriptData(evt);
-                if (!hasPathFallback(data.id)) {
-                    var parents = [];
-                    eachProp(registry, function(value, key) {
-                        if (key.indexOf('_@r') !== 0) {
-                            each(value.depMaps, function(depMap) {
-                                if (depMap.id === data.id) {
-                                    parents.push(key);
-                                }
-                                return true;
-                            });
-                        }
-                    });
-                    return onError(makeError('scripterror', 'Script error for "' + data.id +
-                                             (parents.length ?
-                                             '", needed by: ' + parents.join(', ') :
-                                             '"'), evt, [data.id]));
-                }
-            }
-        };
-
-        context.require = context.makeRequire();
-        return context;
-    }
-
-    /**
-     * Main entry point.
-     *
-     * If the only argument to require is a string, then the module that
-     * is represented by that string is fetched for the appropriate context.
-     *
-     * If the first argument is an array, then it will be treated as an array
-     * of dependency string names to fetch. An optional function callback can
-     * be specified to execute when all of those dependencies are available.
-     *
-     * Make a local req variable to help Caja compliance (it assumes things
-     * on a require that are not standardized), and to give a short
-     * name for minification/local scope use.
-     */
-    req = requirejs = function (deps, callback, errback, optional) {
-
-        //Find the right context, use default
-        var context, config,
-            contextName = defContextName;
-
-        // Determine if have config object in the call.
-        if (!isArray(deps) && typeof deps !== 'string') {
-            // deps is a config object
-            config = deps;
-            if (isArray(callback)) {
-                // Adjust args if there are dependencies
-                deps = callback;
-                callback = errback;
-                errback = optional;
-            } else {
-                deps = [];
-            }
-        }
-
-        if (config && config.context) {
-            contextName = config.context;
-        }
-
-        context = getOwn(contexts, contextName);
-        if (!context) {
-            context = contexts[contextName] = req.s.newContext(contextName);
-        }
-
-        if (config) {
-            context.configure(config);
-        }
-
-        return context.require(deps, callback, errback);
-    };
-
-    /**
-     * Support require.config() to make it easier to cooperate with other
-     * AMD loaders on globally agreed names.
-     */
-    req.config = function (config) {
-        return req(config);
-    };
-
-    /**
-     * Execute something after the current tick
-     * of the event loop. Override for other envs
-     * that have a better solution than setTimeout.
-     * @param  {Function} fn function to execute later.
-     */
-    req.nextTick = typeof setTimeout !== 'undefined' ? function (fn) {
-        setTimeout(fn, 4);
-    } : function (fn) { fn(); };
-
-    /**
-     * Export require as a global, but only if it does not already exist.
-     */
-    if (!require) {
-        require = req;
-    }
-
-    req.version = version;
-
-    //Used to filter out dependencies that are already paths.
-    req.jsExtRegExp = /^\/|:|\?|\.js$/;
-    req.isBrowser = isBrowser;
-    s = req.s = {
-        contexts: contexts,
-        newContext: newContext
-    };
-
-    //Create default context.
-    req({});
-
-    //Exports some context-sensitive methods on global require.
-    each([
-        'toUrl',
-        'undef',
-        'defined',
-        'specified'
-    ], function (prop) {
-        //Reference from contexts instead of early binding to default context,
-        //so that during builds, the latest instance of the default context
-        //with its config gets used.
-        req[prop] = function () {
-            var ctx = contexts[defContextName];
-            return ctx.require[prop].apply(ctx, arguments);
-        };
-    });
-
-    if (isBrowser) {
-        head = s.head = document.getElementsByTagName('head')[0];
-        //If BASE tag is in play, using appendChild is a problem for IE6.
-        //When that browser dies, this can be removed. Details in this jQuery bug:
-        //http://dev.jquery.com/ticket/2709
-        baseElement = document.getElementsByTagName('base')[0];
-        if (baseElement) {
-            head = s.head = baseElement.parentNode;
-        }
-    }
-
-    /**
-     * Any errors that require explicitly generates will be passed to this
-     * function. Intercept/override it if you want custom error handling.
-     * @param {Error} err the error object.
-     */
-    req.onError = defaultOnError;
-
-    /**
-     * Creates the node for the load command. Only used in browser envs.
-     */
-    req.createNode = function (config, moduleName, url) {
-        var node = config.xhtml ?
-                document.createElementNS('http://www.w3.org/1999/xhtml', 'html:script') :
-                document.createElement('script');
-        node.type = config.scriptType || 'text/javascript';
-        node.charset = 'utf-8';
-        node.async = true;
-        return node;
-    };
-
-    /**
-     * Does the request to load a module for the browser case.
-     * Make this a separate function to allow other environments
-     * to override it.
-     *
-     * @param {Object} context the require context to find state.
-     * @param {String} moduleName the name of the module.
-     * @param {Object} url the URL to the module.
-     */
-    req.load = function (context, moduleName, url) {
-        var config = (context && context.config) || {},
-            node;
-        if (isBrowser) {
-            //In the browser so use a script tag
-            node = req.createNode(config, moduleName, url);
-            if (config.onNodeCreated) {
-                config.onNodeCreated(node, config, moduleName, url);
-            }
-
-            node.setAttribute('data-requirecontext', context.contextName);
-            node.setAttribute('data-requiremodule', moduleName);
-
-            //Set up load listener. Test attachEvent first because IE9 has
-            //a subtle issue in its addEventListener and script onload firings
-            //that do not match the behavior of all other browsers with
-            //addEventListener support, which fire the onload event for a
-            //script right after the script execution. See:
-            //https://connect.microsoft.com/IE/feedback/details/648057/script-onload-event-is-not-fired-immediately-after-script-execution
-            //UNFORTUNATELY Opera implements attachEvent but does not follow the script
-            //script execution mode.
-            if (node.attachEvent &&
-                    //Check if node.attachEvent is artificially added by custom script or
-                    //natively supported by browser
-                    //read https://github.com/jrburke/requirejs/issues/187
-                    //if we can NOT find [native code] then it must NOT natively supported.
-                    //in IE8, node.attachEvent does not have toString()
-                    //Note the test for "[native code" with no closing brace, see:
-                    //https://github.com/jrburke/requirejs/issues/273
-                    !(node.attachEvent.toString && node.attachEvent.toString().indexOf('[native code') < 0) &&
-                    !isOpera) {
-                //Probably IE. IE (at least 6-8) do not fire
-                //script onload right after executing the script, so
-                //we cannot tie the anonymous define call to a name.
-                //However, IE reports the script as being in 'interactive'
-                //readyState at the time of the define call.
-                useInteractive = true;
-
-                node.attachEvent('onreadystatechange', context.onScriptLoad);
-                //It would be great to add an error handler here to catch
-                //404s in IE9+. However, onreadystatechange will fire before
-                //the error handler, so that does not help. If addEventListener
-                //is used, then IE will fire error before load, but we cannot
-                //use that pathway given the connect.microsoft.com issue
-                //mentioned above

<TRUNCATED>

[28/58] [abbrv] ambari git commit: AMBARI-18076. Exclude Jbehave story files from rat check (oleewere)

Posted by ol...@apache.org.
AMBARI-18076. Exclude Jbehave story files from rat check (oleewere)


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

Branch: refs/heads/branch-2.5
Commit: 51946d9d41a4bda2a9d0c1e8a2740a51a459cd41
Parents: 1b07a6d
Author: oleewere <ol...@gmail.com>
Authored: Thu Aug 25 15:37:49 2016 +0200
Committer: oleewere <ol...@gmail.com>
Committed: Sat Nov 5 14:46:44 2016 +0100

----------------------------------------------------------------------
 ambari-logsearch/ambari-logsearch-it/pom.xml | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/51946d9d/ambari-logsearch/ambari-logsearch-it/pom.xml
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-it/pom.xml b/ambari-logsearch/ambari-logsearch-it/pom.xml
index d918c8a..f9a62cd 100644
--- a/ambari-logsearch/ambari-logsearch-it/pom.xml
+++ b/ambari-logsearch/ambari-logsearch-it/pom.xml
@@ -125,6 +125,27 @@
           </execution>
         </executions>
       </plugin>
+      <plugin>
+        <groupId>org.apache.rat</groupId>
+        <artifactId>apache-rat-plugin</artifactId>
+        <configuration>
+          <excludes>
+            <exclude>README.md</exclude>
+            <exclude>**/*.json</exclude>
+            <exclude>**/*.log</exclude>
+            <exclude>**/*.txt</exclude>
+            <exclude>**/*.story</exclude>
+          </excludes>
+        </configuration>
+        <executions>
+          <execution>
+            <phase>test</phase>
+            <goals>
+              <goal>check</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
     </plugins>
   </build>
 


[50/58] [abbrv] ambari git commit: AMBARI-18298. Add ability to add custom grok filters and custom grok patterns with Ambari (Miklos Gergely via oleewere)

Posted by ol...@apache.org.
AMBARI-18298. Add ability to add custom grok filters and custom grok patterns with Ambari (Miklos Gergely via oleewere)

Change-Id: I03852666f85185be80787824422c74eb0e437757


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

Branch: refs/heads/branch-2.5
Commit: c9d3b597fc120a9e5ce7396dbf38228f48019b44
Parents: 98d6317
Author: Miklos Gergely <mg...@hortonworks.com>
Authored: Fri Oct 7 01:15:29 2016 +0200
Committer: oleewere <ol...@gmail.com>
Committed: Sat Nov 5 14:46:46 2016 +0100

----------------------------------------------------------------------
 .../0.5.0/configuration/logfeeder-grok.xml      |  49 ++++++
 .../0.5.0/configuration/logfeeder-log4j.xml     |   1 -
 .../LOGSEARCH/0.5.0/metainfo.xml                |   1 +
 .../LOGSEARCH/0.5.0/package/scripts/params.py   |  11 ++
 .../0.5.0/package/scripts/setup_logfeeder.py    |   3 +-
 .../0.5.0/package/templates/grok-patterns.j2    | 148 -------------------
 .../logfeeder-default_grok_patterns.j2          | 148 +++++++++++++++++++
 .../stacks/2.4/LOGSEARCH/test_logfeeder.py      |   2 +-
 .../test/python/stacks/2.4/configs/default.json |   4 +
 ambari-web/app/data/HDP2/site_properties.js     |  15 ++
 10 files changed, 231 insertions(+), 151 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/c9d3b597/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/configuration/logfeeder-grok.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/configuration/logfeeder-grok.xml b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/configuration/logfeeder-grok.xml
new file mode 100644
index 0000000..e280bb9
--- /dev/null
+++ b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/configuration/logfeeder-grok.xml
@@ -0,0 +1,49 @@
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
+<!--
+/**
+ * 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.
+ */
+-->
+<!-- This is a special config file for properties used to monitor status of the service -->
+<configuration supports_adding_forbidden="true">
+  <property>
+    <name>default_grok_patterns</name>
+    <display-name>Default Grok Patterns</display-name>
+    <description>This is the jinja template for default grok patterns</description>
+    <value/>
+    <property-type>VALUE_FROM_PROPERTY_FILE</property-type>
+    <value-attributes>
+      <read-only>true</read-only>
+      <property-file-name>logfeeder-default_grok_patterns.j2</property-file-name>
+      <property-file-type>text</property-file-type>
+    </value-attributes>
+    <on-ambari-upgrade add="true"/>
+  </property>
+  <property>
+    <name>custom_grok_patterns</name>
+    <display-name>Custom Grok Patterns</display-name>
+    <description>This is the jinja template for custom grok patterns</description>
+    <value/>
+    <property-type>TEXT</property-type>
+    <value-attributes>
+      <type>multiLine</type>
+      <empty-value-valid>true</empty-value-valid>
+    </value-attributes>
+    <on-ambari-upgrade add="true"/>
+  </property>
+</configuration>

http://git-wip-us.apache.org/repos/asf/ambari/blob/c9d3b597/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/configuration/logfeeder-log4j.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/configuration/logfeeder-log4j.xml b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/configuration/logfeeder-log4j.xml
index 81e17d8..6a17e05 100644
--- a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/configuration/logfeeder-log4j.xml
+++ b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/configuration/logfeeder-log4j.xml
@@ -21,7 +21,6 @@
 -->
 <!-- This is a special config file for properties used to monitor status of the service -->
 <configuration supports_adding_forbidden="true">
-  <!-- solrconfig.xml -->
   <property>
     <name>content</name>
     <display-name>logfeeder-log4j template</display-name>

http://git-wip-us.apache.org/repos/asf/ambari/blob/c9d3b597/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/metainfo.xml b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/metainfo.xml
index e0280b4..6d1cf38 100644
--- a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/metainfo.xml
+++ b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/metainfo.xml
@@ -109,6 +109,7 @@
             <config-type>infra-solr-env</config-type>
             <config-type>logfeeder-properties</config-type>
             <config-type>logfeeder-env</config-type>
+            <config-type>logfeeder-grok</config-type>
             <config-type>logfeeder-log4j</config-type>
           </configuration-dependencies>
         </component>

http://git-wip-us.apache.org/repos/asf/ambari/blob/c9d3b597/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/params.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/params.py b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/params.py
index 63bc21f..e55653f 100644
--- a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/params.py
+++ b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/params.py
@@ -273,6 +273,17 @@ logfeeder_config_file_names = \
 
 default_config_files = ','.join(logfeeder_config_file_names)
 
+logfeeder_grok_patterns = config['configurations']['logfeeder-grok']['default_grok_patterns']
+if config['configurations']['logfeeder-grok']['custom_grok_patterns'].strip():
+  logfeeder_grok_patterns = \
+    logfeeder_grok_patterns + '\n' + \
+    '\n' + \
+    '########################\n' +\
+    '# Custom Grok Patterns #\n' +\
+    '########################\n' +\
+    '\n' + \
+    config['configurations']['logfeeder-grok']['custom_grok_patterns']
+
 logfeeder_properties = dict(config['configurations']['logfeeder-properties'])
 
 logfeeder_properties['logfeeder.metrics.collector.hosts'] = format(logfeeder_properties['logfeeder.metrics.collector.hosts'])

http://git-wip-us.apache.org/repos/asf/ambari/blob/c9d3b597/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/setup_logfeeder.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/setup_logfeeder.py b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/setup_logfeeder.py
index 688a9b0..ad16958 100644
--- a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/setup_logfeeder.py
+++ b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/setup_logfeeder.py
@@ -57,7 +57,7 @@ def setup_logfeeder():
        )
 
   File(format("{logsearch_logfeeder_conf}/grok-patterns"),
-       content=Template("grok-patterns.j2"),
+       content=InlineTemplate(params.logfeeder_grok_patterns),
        encoding="utf-8"
        )
 
@@ -65,6 +65,7 @@ def setup_logfeeder():
     File(format("{logsearch_logfeeder_conf}/" + file_name),
          content=Template(file_name + ".j2")
          )
+
   if params.security_enabled:
     File(format("{logfeeder_jaas_file}"),
          content=Template("logfeeder_jaas.conf.j2")

http://git-wip-us.apache.org/repos/asf/ambari/blob/c9d3b597/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/templates/grok-patterns.j2
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/templates/grok-patterns.j2 b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/templates/grok-patterns.j2
deleted file mode 100644
index 49aa357..0000000
--- a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/templates/grok-patterns.j2
+++ /dev/null
@@ -1,148 +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.
-
-#Updated JAVACLASS to be same as JAVAFILE. Because if class doesn't have package, then it doesn't work.
-JAVACLASS (?:[A-Za-z$0-9_. -]+)
-#JAVACLASS (?:[a-zA-Z$_][a-zA-Z$_0-9]*\.)*[a-zA-Z$_][a-zA-Z$_0-9]*
-#JAVACLASS (?:[a-zA-Z0-9-]+\.)+[A-Za-z0-9$]+
-
-#Space is an allowed character to match special cases like 'Native Method' or 'Unknown Source'
-JAVAFILE (?:[A-Za-z0-9_. -]+)
-#Allow special <init> or <clinit> method
-JAVAMETHOD (?:(<init>)|(<clinit>)|[a-zA-Z$_][a-zA-Z$_0-9]*)
-#Line number is optional in special cases 'Native method' or 'Unknown source'
-JAVASTACKTRACEPART %{SPACE}at %{JAVACLASS:class}\.%{JAVAMETHOD:method}\(%{JAVAFILE:file}(?::%{NUMBER:line})?\)
-# Java Logs
-JAVATHREAD (?:[A-Z]{2}-Processor[\d]+)
-
-JAVASTACKTRACEPART at %{JAVACLASS:class}\.%{WORD:method}\(%{JAVAFILE:file}:%{NUMBER:line}\)
-JAVALOGMESSAGE (.*)
-# MMM dd, yyyy HH:mm:ss eg: Jan 9, 2014 7:13:13 AM
-CATALINA_DATESTAMP %{MONTH} %{MONTHDAY}, 20%{YEAR} %{HOUR}:?%{MINUTE}(?::?%{SECOND}) (?:AM|PM)
-# yyyy-MM-dd HH:mm:ss,SSS ZZZ eg: 2014-01-09 17:32:25,527 -0800
-TOMCAT_DATESTAMP 20%{YEAR}-%{MONTHNUM}-%{MONTHDAY} %{HOUR}:?%{MINUTE}(?::?%{SECOND}) %{ISO8601_TIMEZONE}
-CATALINALOG %{CATALINA_DATESTAMP:timestamp} %{JAVACLASS:class} %{JAVALOGMESSAGE:logmessage}
-# 2014-01-09 20:03:28,269 -0800 | ERROR | com.example.service.ExampleService - something compeletely unexpected happened...
-TOMCATLOG %{TOMCAT_DATESTAMP:timestamp} \| %{LOGLEVEL:level} \| %{JAVACLASS:class} - %{JAVALOGMESSAGE:logmessage}
-
-USERNAME [a-zA-Z0-9._-]+
-USER %{USERNAME}
-EMAILLOCALPART [a-zA-Z][a-zA-Z0-9_.+-=:]+
-EMAILADDRESS %{EMAILLOCALPART}@%{HOSTNAME}
-HTTPDUSER %{EMAILADDRESS}|%{USER}
-INT (?:[+-]?(?:[0-9]+))
-BASE10NUM (?<![0-9.+-])(?>[+-]?(?:(?:[0-9]+(?:\.[0-9]+)?)|(?:\.[0-9]+)))
-NUMBER (?:%{BASE10NUM})
-BASE16NUM (?<![0-9A-Fa-f])(?:[+-]?(?:0x)?(?:[0-9A-Fa-f]+))
-BASE16FLOAT \b(?<![0-9A-Fa-f.])(?:[+-]?(?:0x)?(?:(?:[0-9A-Fa-f]+(?:\.[0-9A-Fa-f]*)?)|(?:\.[0-9A-Fa-f]+)))\b
-
-POSINT \b(?:[1-9][0-9]*)\b
-NONNEGINT \b(?:[0-9]+)\b
-WORD \b\w+\b
-NOTSPACE \S+
-SPACE \s*
-DATA .*?
-GREEDYDATA .*
-QUOTEDSTRING (?>(?<!\\)(?>"(?>\\.|[^\\"]+)+"|""|(?>'(?>\\.|[^\\']+)+')|''|(?>`(?>\\.|[^\\`]+)+`)|``))
-UUID [A-Fa-f0-9]{8}-(?:[A-Fa-f0-9]{4}-){3}[A-Fa-f0-9]{12}
-
-# Networking
-MAC (?:%{CISCOMAC}|%{WINDOWSMAC}|%{COMMONMAC})
-CISCOMAC (?:(?:[A-Fa-f0-9]{4}\.){2}[A-Fa-f0-9]{4})
-WINDOWSMAC (?:(?:[A-Fa-f0-9]{2}-){5}[A-Fa-f0-9]{2})
-COMMONMAC (?:(?:[A-Fa-f0-9]{2}:){5}[A-Fa-f0-9]{2})
-IPV6 ((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5
 ]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?
-IPV4 (?<![0-9])(?:(?:[0-1]?[0-9]{1,2}|2[0-4][0-9]|25[0-5])[.](?:[0-1]?[0-9]{1,2}|2[0-4][0-9]|25[0-5])[.](?:[0-1]?[0-9]{1,2}|2[0-4][0-9]|25[0-5])[.](?:[0-1]?[0-9]{1,2}|2[0-4][0-9]|25[0-5]))(?![0-9])
-IP (?:%{IPV6}|%{IPV4})
-HOSTNAME \b(?:[0-9A-Za-z][0-9A-Za-z-]{0,62})(?:\.(?:[0-9A-Za-z][0-9A-Za-z-]{0,62}))*(\.?|\b)
-IPORHOST (?:%{IP}|%{HOSTNAME})
-HOSTPORT %{IPORHOST}:%{POSINT}
-
-# paths
-PATH (?:%{UNIXPATH}|%{WINPATH})
-UNIXPATH (/([\w_%!$@:.,~-]+|\\.)*)+
-TTY (?:/dev/(pts|tty([pq])?)(\w+)?/?(?:[0-9]+))
-WINPATH (?>[A-Za-z]+:|\\)(?:\\[^\\?*]*)+
-URIPROTO [A-Za-z]+(\+[A-Za-z+]+)?
-URIHOST %{IPORHOST}(?::%{POSINT:port})?
-# uripath comes loosely from RFC1738, but mostly from what Firefox
-# doesn't turn into %XX
-URIPATH (?:/[A-Za-z0-9$.+!*'(){},~:;=@#%_\-]*)+
-#URIPARAM \?(?:[A-Za-z0-9]+(?:=(?:[^&]*))?(?:&(?:[A-Za-z0-9]+(?:=(?:[^&]*))?)?)*)?
-URIPARAM \?[A-Za-z0-9$.+!*'|(){},~@#%&/=:;_?\-\[\]<>]*
-URIPATHPARAM %{URIPATH}(?:%{URIPARAM})?
-URI %{URIPROTO}://(?:%{USER}(?::[^@]*)?@)?(?:%{URIHOST})?(?:%{URIPATHPARAM})?
-
-# Months: January, Feb, 3, 03, 12, December
-MONTH \b(?:Jan(?:uary|uar)?|Feb(?:ruary|ruar)?|M(?:a|�)?r(?:ch|z)?|Apr(?:il)?|Ma(?:y|i)?|Jun(?:e|i)?|Jul(?:y)?|Aug(?:ust)?|Sep(?:tember)?|O(?:c|k)?t(?:ober)?|Nov(?:ember)?|De(?:c|z)(?:ember)?)\b
-MONTHNUM (?:0?[1-9]|1[0-2])
-MONTHNUM2 (?:0[1-9]|1[0-2])
-MONTHDAY (?:(?:0[1-9])|(?:[12][0-9])|(?:3[01])|[1-9])
-
-# Days: Monday, Tue, Thu, etc...
-DAY (?:Mon(?:day)?|Tue(?:sday)?|Wed(?:nesday)?|Thu(?:rsday)?|Fri(?:day)?|Sat(?:urday)?|Sun(?:day)?)
-
-# Years?
-YEAR (?>\d\d){1,2}
-HOUR (?:2[0123]|[01]?[0-9])
-MINUTE (?:[0-5][0-9])
-# '60' is a leap second in most time standards and thus is valid.
-SECOND (?:(?:[0-5]?[0-9]|60)(?:[:.,][0-9]+)?)
-TIME (?!<[0-9])%{HOUR}:%{MINUTE}(?::%{SECOND})(?![0-9])
-# datestamp is YYYY/MM/DD-HH:MM:SS.UUUU (or something like it)
-DATE_US %{MONTHNUM}[/-]%{MONTHDAY}[/-]%{YEAR}
-DATE_EU %{MONTHDAY}[./-]%{MONTHNUM}[./-]%{YEAR}
-DATE_EU2 %{YEAR}[./-]%{MONTHNUM}[./-]%{MONTHDAY}
-ISO8601_TIMEZONE (?:Z|[+-]%{HOUR}(?::?%{MINUTE}))
-ISO8601_SECOND (?:%{SECOND}|60)
-TIMESTAMP_ISO8601 %{YEAR}-%{MONTHNUM}-%{MONTHDAY}[T ]%{HOUR}:?%{MINUTE}(?::?%{SECOND})?%{ISO8601_TIMEZONE}?
-DATE %{DATE_US}|%{DATE_EU}|%{DATE_EU2}
-DATESTAMP %{DATE}[- ]%{TIME}
-TZ (?:[PMCE][SD]T|UTC)
-DATESTAMP_RFC822 %{DAY} %{MONTH} %{MONTHDAY} %{YEAR} %{TIME} %{TZ}
-DATESTAMP_RFC2822 %{DAY}, %{MONTHDAY} %{MONTH} %{YEAR} %{TIME} %{ISO8601_TIMEZONE}
-DATESTAMP_OTHER %{DAY} %{MONTH} %{MONTHDAY} %{TIME} %{TZ} %{YEAR}
-DATESTAMP_EVENTLOG %{YEAR}%{MONTHNUM2}%{MONTHDAY}%{HOUR}%{MINUTE}%{SECOND}
-HTTPDERROR_DATE %{DAY} %{MONTH} %{MONTHDAY} %{TIME} %{YEAR}
-
-# Syslog Dates: Month Day HH:MM:SS
-SYSLOGTIMESTAMP %{MONTH} +%{MONTHDAY} %{TIME}
-PROG [\x21-\x5a\x5c\x5e-\x7e]+
-SYSLOGPROG %{PROG:program}(?:\[%{POSINT:pid}\])?
-SYSLOGHOST %{IPORHOST}
-SYSLOGFACILITY <%{NONNEGINT:facility}.%{NONNEGINT:priority}>
-HTTPDATE %{MONTHDAY}/%{MONTH}/%{YEAR}:%{TIME} %{INT}
-
-# Shortcuts
-QS %{QUOTEDSTRING}
-
-# Log formats
-SYSLOGBASE %{SYSLOGTIMESTAMP:timestamp} (?:%{SYSLOGFACILITY} )?%{SYSLOGHOST:logsource} %{SYSLOGPROG}:
-COMMONAPACHELOG %{IPORHOST:clientip} %{HTTPDUSER:ident} %{USER:auth} \[%{HTTPDATE:timestamp}\] "(?:%{WORD:verb} %{NOTSPACE:request}(?: HTTP/%{NUMBER:httpversion})?|%{DATA:rawrequest})" %{NUMBER:response} (?:%{NUMBER:bytes}|-)
-COMBINEDAPACHELOG %{COMMONAPACHELOG} %{QS:referrer} %{QS:agent}
-HTTPD20_ERRORLOG \[%{HTTPDERROR_DATE:timestamp}\] \[%{LOGLEVEL:loglevel}\] (?:\[client %{IPORHOST:clientip}\] ){0,1}%{GREEDYDATA:errormsg}
-HTTPD24_ERRORLOG \[%{HTTPDERROR_DATE:timestamp}\] \[%{WORD:module}:%{LOGLEVEL:loglevel}\] \[pid %{POSINT:pid}:tid %{NUMBER:tid}\]( \(%{POSINT:proxy_errorcode}\)%{DATA:proxy_errormessage}:)?( \[client %{IPORHOST:client}:%{POSINT:clientport}\])? %{DATA:errorcode}: %{GREEDYDATA:message}
-HTTPD_ERRORLOG %{HTTPD20_ERRORLOG}|%{HTTPD24_ERRORLOG}
-
-
-# Log Levels
-LOGLEVEL ([Aa]lert|ALERT|[Tt]race|TRACE|[Dd]ebug|DEBUG|[Nn]otice|NOTICE|[Ii]nfo|INFO|[Ww]arn?(?:ing)?|WARN?(?:ING)?|[Ee]rr?(?:or)?|ERR?(?:OR)?|[Cc]rit?(?:ical)?|CRIT?(?:ICAL)?|[Ff]atal|FATAL|[Ss]evere|SEVERE|EMERG(?:ENCY)?|[Ee]merg(?:ency)?)
-
-
-# Custom
-USER_SYNC_DATE %{MONTHDAY} %{MONTH} %{YEAR} %{TIME}
-SPARK_DATESTAMP %{YEAR}[/-]%{MONTHNUM2}[/-]%{MONTHDAY} %{TIME}
-CUSTOM_DATESTAMP %{MONTHDAY} %{MONTH} %{YEAR} %{TIME}
-CUSTOM_SEPARATOR %{SPACE}\|%{SPACE}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/c9d3b597/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/properties/logfeeder-default_grok_patterns.j2
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/properties/logfeeder-default_grok_patterns.j2 b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/properties/logfeeder-default_grok_patterns.j2
new file mode 100644
index 0000000..762c2ec
--- /dev/null
+++ b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/properties/logfeeder-default_grok_patterns.j2
@@ -0,0 +1,148 @@
+# 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.
+
+#Updated JAVACLASS to be same as JAVAFILE. Because if class doesn't have package, then it doesn't work.
+JAVACLASS (?:[A-Za-z$0-9_. -]+)
+#JAVACLASS (?:[a-zA-Z$_][a-zA-Z$_0-9]*\.)*[a-zA-Z$_][a-zA-Z$_0-9]*
+#JAVACLASS (?:[a-zA-Z0-9-]+\.)+[A-Za-z0-9$]+
+
+#Space is an allowed character to match special cases like 'Native Method' or 'Unknown Source'
+JAVAFILE (?:[A-Za-z0-9_. -]+)
+#Allow special <init> or <clinit> method
+JAVAMETHOD (?:(<init>)|(<clinit>)|[a-zA-Z$_][a-zA-Z$_0-9]*)
+#Line number is optional in special cases 'Native method' or 'Unknown source'
+JAVASTACKTRACEPART %{SPACE}at %{JAVACLASS:class}\.%{JAVAMETHOD:method}\(%{JAVAFILE:file}(?::%{NUMBER:line})?\)
+# Java Logs
+JAVATHREAD (?:[A-Z]{2}-Processor[\d]+)
+
+JAVASTACKTRACEPART at %{JAVACLASS:class}\.%{WORD:method}\(%{JAVAFILE:file}:%{NUMBER:line}\)
+JAVALOGMESSAGE (.*)
+# MMM dd, yyyy HH:mm:ss eg: Jan 9, 2014 7:13:13 AM
+CATALINA_DATESTAMP %{MONTH} %{MONTHDAY}, 20%{YEAR} %{HOUR}:?%{MINUTE}(?::?%{SECOND}) (?:AM|PM)
+# yyyy-MM-dd HH:mm:ss,SSS ZZZ eg: 2014-01-09 17:32:25,527 -0800
+TOMCAT_DATESTAMP 20%{YEAR}-%{MONTHNUM}-%{MONTHDAY} %{HOUR}:?%{MINUTE}(?::?%{SECOND}) %{ISO8601_TIMEZONE}
+CATALINALOG %{CATALINA_DATESTAMP:timestamp} %{JAVACLASS:class} %{JAVALOGMESSAGE:logmessage}
+# 2014-01-09 20:03:28,269 -0800 | ERROR | com.example.service.ExampleService - something compeletely unexpected happened...
+TOMCATLOG %{TOMCAT_DATESTAMP:timestamp} \| %{LOGLEVEL:level} \| %{JAVACLASS:class} - %{JAVALOGMESSAGE:logmessage}
+
+USERNAME [a-zA-Z0-9._-]+
+USER %{USERNAME}
+EMAILLOCALPART [a-zA-Z][a-zA-Z0-9_.+-=:]+
+EMAILADDRESS %{EMAILLOCALPART}@%{HOSTNAME}
+HTTPDUSER %{EMAILADDRESS}|%{USER}
+INT (?:[+-]?(?:[0-9]+))
+BASE10NUM (?<![0-9.+-])(?>[+-]?(?:(?:[0-9]+(?:\.[0-9]+)?)|(?:\.[0-9]+)))
+NUMBER (?:%{BASE10NUM})
+BASE16NUM (?<![0-9A-Fa-f])(?:[+-]?(?:0x)?(?:[0-9A-Fa-f]+))
+BASE16FLOAT \b(?<![0-9A-Fa-f.])(?:[+-]?(?:0x)?(?:(?:[0-9A-Fa-f]+(?:\.[0-9A-Fa-f]*)?)|(?:\.[0-9A-Fa-f]+)))\b
+
+POSINT \b(?:[1-9][0-9]*)\b
+NONNEGINT \b(?:[0-9]+)\b
+WORD \b\w+\b
+NOTSPACE \S+
+SPACE \s*
+DATA .*?
+GREEDYDATA .*
+QUOTEDSTRING (?>(?<!\\)(?>"(?>\\.|[^\\"]+)+"|""|(?>'(?>\\.|[^\\']+)+')|''|(?>`(?>\\.|[^\\`]+)+`)|``))
+UUID [A-Fa-f0-9]{8}-(?:[A-Fa-f0-9]{4}-){3}[A-Fa-f0-9]{12}
+
+# Networking
+MAC (?:%{CISCOMAC}|%{WINDOWSMAC}|%{COMMONMAC})
+CISCOMAC (?:(?:[A-Fa-f0-9]{4}\.){2}[A-Fa-f0-9]{4})
+WINDOWSMAC (?:(?:[A-Fa-f0-9]{2}-){5}[A-Fa-f0-9]{2})
+COMMONMAC (?:(?:[A-Fa-f0-9]{2}:){5}[A-Fa-f0-9]{2})
+IPV6 ((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5
 ]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?
+IPV4 (?<![0-9])(?:(?:[0-1]?[0-9]{1,2}|2[0-4][0-9]|25[0-5])[.](?:[0-1]?[0-9]{1,2}|2[0-4][0-9]|25[0-5])[.](?:[0-1]?[0-9]{1,2}|2[0-4][0-9]|25[0-5])[.](?:[0-1]?[0-9]{1,2}|2[0-4][0-9]|25[0-5]))(?![0-9])
+IP (?:%{IPV6}|%{IPV4})
+HOSTNAME \b(?:[0-9A-Za-z][0-9A-Za-z-]{0,62})(?:\.(?:[0-9A-Za-z][0-9A-Za-z-]{0,62}))*(\.?|\b)
+IPORHOST (?:%{IP}|%{HOSTNAME})
+HOSTPORT %{IPORHOST}:%{POSINT}
+
+# paths
+PATH (?:%{UNIXPATH}|%{WINPATH})
+UNIXPATH (/([\w_%!$@:.,~-]+|\\.)*)+
+TTY (?:/dev/(pts|tty([pq])?)(\w+)?/?(?:[0-9]+))
+WINPATH (?>[A-Za-z]+:|\\)(?:\\[^\\?*]*)+
+URIPROTO [A-Za-z]+(\+[A-Za-z+]+)?
+URIHOST %{IPORHOST}(?::%{POSINT:port})?
+# uripath comes loosely from RFC1738, but mostly from what Firefox
+# doesn't turn into %XX
+URIPATH (?:/[A-Za-z0-9$.+!*'(){},~:;=@#%_\-]*)+
+#URIPARAM \?(?:[A-Za-z0-9]+(?:=(?:[^&]*))?(?:&(?:[A-Za-z0-9]+(?:=(?:[^&]*))?)?)*)?
+URIPARAM \?[A-Za-z0-9$.+!*'|(){},~@#%&/=:;_?\-\[\]<>]*
+URIPATHPARAM %{URIPATH}(?:%{URIPARAM})?
+URI %{URIPROTO}://(?:%{USER}(?::[^@]*)?@)?(?:%{URIHOST})?(?:%{URIPATHPARAM})?
+
+# Months: January, Feb, 3, 03, 12, December
+MONTH \b(?:Jan(?:uary|uar)?|Feb(?:ruary|ruar)?|M(?:a|�)?r(?:ch|z)?|Apr(?:il)?|Ma(?:y|i)?|Jun(?:e|i)?|Jul(?:y)?|Aug(?:ust)?|Sep(?:tember)?|O(?:c|k)?t(?:ober)?|Nov(?:ember)?|De(?:c|z)(?:ember)?)\b
+MONTHNUM (?:0?[1-9]|1[0-2])
+MONTHNUM2 (?:0[1-9]|1[0-2])
+MONTHDAY (?:(?:0[1-9])|(?:[12][0-9])|(?:3[01])|[1-9])
+
+# Days: Monday, Tue, Thu, etc...
+DAY (?:Mon(?:day)?|Tue(?:sday)?|Wed(?:nesday)?|Thu(?:rsday)?|Fri(?:day)?|Sat(?:urday)?|Sun(?:day)?)
+
+# Years?
+YEAR (?>\d\d){1,2}
+HOUR (?:2[0123]|[01]?[0-9])
+MINUTE (?:[0-5][0-9])
+# '60' is a leap second in most time standards and thus is valid.
+SECOND (?:(?:[0-5]?[0-9]|60)(?:[:.,][0-9]+)?)
+TIME (?!<[0-9])%{HOUR}:%{MINUTE}(?::%{SECOND})(?![0-9])
+# datestamp is YYYY/MM/DD-HH:MM:SS.UUUU (or something like it)
+DATE_US %{MONTHNUM}[/-]%{MONTHDAY}[/-]%{YEAR}
+DATE_EU %{MONTHDAY}[./-]%{MONTHNUM}[./-]%{YEAR}
+DATE_EU2 %{YEAR}[./-]%{MONTHNUM}[./-]%{MONTHDAY}
+ISO8601_TIMEZONE (?:Z|[+-]%{HOUR}(?::?%{MINUTE}))
+ISO8601_SECOND (?:%{SECOND}|60)
+TIMESTAMP_ISO8601 %{YEAR}-%{MONTHNUM}-%{MONTHDAY}[T ]%{HOUR}:?%{MINUTE}(?::?%{SECOND})?%{ISO8601_TIMEZONE}?
+DATE %{DATE_US}|%{DATE_EU}|%{DATE_EU2}
+DATESTAMP %{DATE}[- ]%{TIME}
+TZ (?:[PMCE][SD]T|UTC)
+DATESTAMP_RFC822 %{DAY} %{MONTH} %{MONTHDAY} %{YEAR} %{TIME} %{TZ}
+DATESTAMP_RFC2822 %{DAY}, %{MONTHDAY} %{MONTH} %{YEAR} %{TIME} %{ISO8601_TIMEZONE}
+DATESTAMP_OTHER %{DAY} %{MONTH} %{MONTHDAY} %{TIME} %{TZ} %{YEAR}
+DATESTAMP_EVENTLOG %{YEAR}%{MONTHNUM2}%{MONTHDAY}%{HOUR}%{MINUTE}%{SECOND}
+HTTPDERROR_DATE %{DAY} %{MONTH} %{MONTHDAY} %{TIME} %{YEAR}
+
+# Syslog Dates: Month Day HH:MM:SS
+SYSLOGTIMESTAMP %{MONTH} +%{MONTHDAY} %{TIME}
+PROG [\x21-\x5a\x5c\x5e-\x7e]+
+SYSLOGPROG %{PROG:program}(?:\[%{POSINT:pid}\])?
+SYSLOGHOST %{IPORHOST}
+SYSLOGFACILITY <%{NONNEGINT:facility}.%{NONNEGINT:priority}>
+HTTPDATE %{MONTHDAY}/%{MONTH}/%{YEAR}:%{TIME} %{INT}
+
+# Shortcuts
+QS %{QUOTEDSTRING}
+
+# Log formats
+SYSLOGBASE %{SYSLOGTIMESTAMP:timestamp} (?:%{SYSLOGFACILITY} )?%{SYSLOGHOST:logsource} %{SYSLOGPROG}:
+COMMONAPACHELOG %{IPORHOST:clientip} %{HTTPDUSER:ident} %{USER:auth} \[%{HTTPDATE:timestamp}\] "(?:%{WORD:verb} %{NOTSPACE:request}(?: HTTP/%{NUMBER:httpversion})?|%{DATA:rawrequest})" %{NUMBER:response} (?:%{NUMBER:bytes}|-)
+COMBINEDAPACHELOG %{COMMONAPACHELOG} %{QS:referrer} %{QS:agent}
+HTTPD20_ERRORLOG \[%{HTTPDERROR_DATE:timestamp}\] \[%{LOGLEVEL:loglevel}\] (?:\[client %{IPORHOST:clientip}\] ){0,1}%{GREEDYDATA:errormsg}
+HTTPD24_ERRORLOG \[%{HTTPDERROR_DATE:timestamp}\] \[%{WORD:module}:%{LOGLEVEL:loglevel}\] \[pid %{POSINT:pid}:tid %{NUMBER:tid}\]( \(%{POSINT:proxy_errorcode}\)%{DATA:proxy_errormessage}:)?( \[client %{IPORHOST:client}:%{POSINT:clientport}\])? %{DATA:errorcode}: %{GREEDYDATA:message}
+HTTPD_ERRORLOG %{HTTPD20_ERRORLOG}|%{HTTPD24_ERRORLOG}
+
+
+# Log Levels
+LOGLEVEL ([Aa]lert|ALERT|[Tt]race|TRACE|[Dd]ebug|DEBUG|[Nn]otice|NOTICE|[Ii]nfo|INFO|[Ww]arn?(?:ing)?|WARN?(?:ING)?|[Ee]rr?(?:or)?|ERR?(?:OR)?|[Cc]rit?(?:ical)?|CRIT?(?:ICAL)?|[Ff]atal|FATAL|[Ss]evere|SEVERE|EMERG(?:ENCY)?|[Ee]merg(?:ency)?)
+
+
+# Log specific patterns
+USER_SYNC_DATE %{MONTHDAY} %{MONTH} %{YEAR} %{TIME}
+SPARK_DATESTAMP %{YEAR}[/-]%{MONTHNUM2}[/-]%{MONTHDAY} %{TIME}
+CUSTOM_DATESTAMP %{MONTHDAY} %{MONTH} %{YEAR} %{TIME}
+CUSTOM_SEPARATOR %{SPACE}\|%{SPACE}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/c9d3b597/ambari-server/src/test/python/stacks/2.4/LOGSEARCH/test_logfeeder.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.4/LOGSEARCH/test_logfeeder.py b/ambari-server/src/test/python/stacks/2.4/LOGSEARCH/test_logfeeder.py
index 7f9acba..ba070fe 100644
--- a/ambari-server/src/test/python/stacks/2.4/LOGSEARCH/test_logfeeder.py
+++ b/ambari-server/src/test/python/stacks/2.4/LOGSEARCH/test_logfeeder.py
@@ -76,7 +76,7 @@ class TestLogFeeder(RMFTestCase):
                               content=InlineTemplate(self.getConfig()['configurations']['logfeeder-log4j']['content'])
                               )
     self.assertResourceCalled('File', '/etc/ambari-logsearch-logfeeder/conf/grok-patterns',
-                              content=Template('grok-patterns.j2'),
+                              content=InlineTemplate('GP'),
                               encoding='utf-8'
                               )
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/c9d3b597/ambari-server/src/test/python/stacks/2.4/configs/default.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.4/configs/default.json b/ambari-server/src/test/python/stacks/2.4/configs/default.json
index 1ebbda9..a2c4791 100644
--- a/ambari-server/src/test/python/stacks/2.4/configs/default.json
+++ b/ambari-server/src/test/python/stacks/2.4/configs/default.json
@@ -308,6 +308,10 @@
         "logfeeder_max_mem": "512m",
         "content": "# Licensed to the Apache Software Foundation (ASF) under one or more\n# contributor license agreements.  See the NOTICE file distributed with\n# this work for additional information regarding copyright ownership.\n# The ASF licenses this file to You under the Apache License, Version 2.0\n# (the \"License\"); you may not use this file except in compliance with\n# the License.  You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nlogsearch.solr.metrics.collector.hosts=http://{{metrics_collector_hosts}}:{{metrics_collector_port}}/ws/v1/timeline/metrics\n{% if logsearch_solr_ssl_enabled %}\nexport LOGFEED
 ER_SSL=\"true\"\nexport LOGFEEDER_KEYSTORE_LOCATION={{logfeeder_keystore_location}}\nexport LOGFEEDER_KEYSTORE_PASSWORD={{logfeeder_keystore_password}}\nexport LOGFEEDER_KEYSTORE_TYPE={{logfeeder_keystore_type}}\nexport LOGFEEDER_TRUSTSTORE_LOCATION={{logfeeder_truststore_location}}\nexport LOGFEEDER_TRUSTSTORE_PASSWORD={{logfeeder_truststore_password}}\nexport LOGFEEDER_TRUSTSTORE_TYPE={{logfeeder_truststore_type}}\n{% endif %}"
       },
+      "logfeeder-grok": {
+        "default_grok_patterns": "GP",
+        "custom_grok_patterns": ""
+      },
       "logfeeder-log4j": {
         "content": "&lt;?xml version=\"1.0\" encoding=\"UTF-8\" ?&gt;\n&lt;!--\n  Licensed to the Apache Software Foundation (ASF) under one or more\n  contributor license agreements.  See the NOTICE file distributed with\n  this work for additional information regarding copyright ownership.\n  The ASF licenses this file to You under the Apache License, Version 2.0\n  (the \"License\"); you may not use this file except in compliance with\n  the License.  You may obtain a copy of the License at\n\n      http://www.apache.org/licenses/LICENSE-2.0\n\n  Unless required by applicable law or agreed to in writing, software\n  distributed under the License is distributed on an \"AS IS\" BASIS,\n  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  See the License for the specific language governing permissions and\n  limitations under the License.\n--&gt;\n&lt;!DOCTYPE log4j:configuration SYSTEM \"log4j.dtd\"&gt;\n&lt;log4j:configuration xmlns:log4j=\"http://jakarta.
 apache.org/log4j/\"&gt;\n  &lt;appender name=\"console\" class=\"org.apache.log4j.ConsoleAppender\"&gt;\n    &lt;param name=\"Target\" value=\"System.out\" /&gt;\n    &lt;layout class=\"org.apache.log4j.PatternLayout\"&gt;\n      &lt;param name=\"ConversionPattern\" value=\"%d [%t] %-5p %C{6} (%F:%L) - %m%n\" /&gt;\n    &lt;/layout&gt;\n  &lt;/appender&gt;\n\n  &lt;appender name=\"rolling_file\" class=\"org.apache.log4j.RollingFileAppender\"&gt; \n    &lt;param name=\"file\" value=\"{{logfeeder_log_dir}}/logfeeder.log\" /&gt;\n    &lt;param name=\"append\" value=\"true\" /&gt; \n    &lt;param name=\"maxFileSize\" value=\"10MB\" /&gt; \n    &lt;param name=\"maxBackupIndex\" value=\"10\" /&gt; \n    &lt;layout class=\"org.apache.log4j.PatternLayout\"&gt; \n      &lt;param name=\"ConversionPattern\" value=\"%d [%t] %-5p %C{6} (%F:%L) - %m%n\"/&gt; \n    &lt;/layout&gt; \n  &lt;/appender&gt; \n\n  &lt;category name=\"org.apache.ambari.logfeeder\" additivity=\"false\"&gt;\n    &lt;priori
 ty value=\"info\" /&gt;\n    &lt;appender-ref ref=\"rolling_file\" /&gt;\n  &lt;/category&gt;\n\n  &lt;root&gt;\n    &lt;priority value=\"warn\" /&gt;\n    &lt;appender-ref ref=\"rolling_file\" /&gt;\n  &lt;/root&gt;\n&lt;/log4j:configuration&gt;"
       },

http://git-wip-us.apache.org/repos/asf/ambari/blob/c9d3b597/ambari-web/app/data/HDP2/site_properties.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/data/HDP2/site_properties.js b/ambari-web/app/data/HDP2/site_properties.js
index fac40c4..5be3b5a 100644
--- a/ambari-web/app/data/HDP2/site_properties.js
+++ b/ambari-web/app/data/HDP2/site_properties.js
@@ -1962,6 +1962,21 @@ var hdp2properties = [
     "category": "Advanced logfeeder-env",
     "index": 14
   },
+  /*logfeeder-grok*/
+  {
+    "name": "default_grok_patterns",
+    "serviceName": "LOGSEARCH",
+    "filename": "logfeeder-grok.xml",
+    "category": "Advanced logfeeder-grok",
+    "index": 1
+  },
+  {
+    "name": "custom_grok_patterns",
+    "serviceName": "LOGSEARCH",
+    "filename": "logfeeder-grok.xml",
+    "category": "Advanced logfeeder-grok",
+    "index": 2
+  },
   /*logfeeder-log4j*/
   {
     "name": "content",


[06/58] [abbrv] ambari git commit: AMBARI-18310. Refactor logsearch portal side code (oleewere)

Posted by ol...@apache.org.
http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/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
new file mode 100644
index 0000000..ba4f4a8
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/BaseServiceLogRequest.java
@@ -0,0 +1,186 @@
+/*
+ * 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 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;
+
+public class BaseServiceLogRequest extends BaseLogRequest
+  implements ServiceLogParamDefinition, BundleIdParamDefinition, DateRangeParamDefinition {
+
+  @QueryParam(LogSearchConstants.REQUEST_PARAM_LEVEL)
+  private String level;
+
+  @QueryParam(LogSearchConstants.REQUEST_PARAM_ADVANCED_SEARCH)
+  private String advancedSearch;
+
+  @QueryParam(LogSearchConstants.REQUEST_PARAM_TREE_PARAMS)
+  private String treeParams;
+
+  @QueryParam(LogSearchConstants.REQUEST_PARAM_E_MESSAGE)
+  private String eMessage;
+
+  @QueryParam(LogSearchConstants.REQUEST_PARAM_G_MUST_NOT)
+  private String gMustNot;
+
+  @QueryParam(LogSearchConstants.REQUEST_PARAM_HOST_NAME)
+  private String hostName;
+
+  @QueryParam(LogSearchConstants.REQUEST_PARAM_COMPONENT_NAME)
+  private String componentName;
+
+  @QueryParam(LogSearchConstants.REQUEST_PARAM_FILE_NAME)
+  private String fileName;
+
+  @QueryParam(LogSearchConstants.REQUEST_PARAM_BUNDLE_ID)
+  private String bundleId;
+
+  @QueryParam(LogSearchConstants.REQUEST_PARAM_FROM)
+  private String from;
+
+  @QueryParam(LogSearchConstants.REQUEST_PARAM_TO)
+  private String to;
+
+  @QueryParam(LogSearchConstants.REQUEST_PARAM_DATE_RANGE_LABEL)
+  private String dateRangeLabel;
+
+  @Override
+  public String getLevel() {
+    return level;
+  }
+
+  @Override
+  public void setLevel(String level) {
+    this.level = level;
+  }
+
+  @Override
+  public String getAdvancedSearch() {
+    return advancedSearch;
+  }
+
+  @Override
+  public void setAdvancedSearch(String advancedSearch) {
+    this.advancedSearch = advancedSearch;
+  }
+
+  @Override
+  public String getTreeParams() {
+    return treeParams;
+  }
+
+  @Override
+  public void setTreeParams(String treeParams) {
+    this.treeParams = treeParams;
+  }
+
+  @Override
+  public String geteMessage() {
+    return eMessage;
+  }
+
+  @Override
+  public void seteMessage(String eMessage) {
+    this.eMessage = eMessage;
+  }
+
+  @Override
+  public String getgMustNot() {
+    return gMustNot;
+  }
+
+  @Override
+  public void setgMustNot(String gMustNot) {
+    this.gMustNot = gMustNot;
+  }
+
+  @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;
+  }
+
+  @Override
+  public String getFileName() {
+    return fileName;
+  }
+
+  @Override
+  public void setFileName(String fileName) {
+    this.fileName = fileName;
+  }
+
+  @Override
+  public String getBundleId() {
+    return bundleId;
+  }
+
+  @Override
+  public void setBundleId(String bundleId) {
+    this.bundleId = bundleId;
+  }
+
+  @Override
+  public String getFrom() {
+    return from;
+  }
+
+  @Override
+  public void setFrom(String from) {
+    this.from = from;
+  }
+
+  @Override
+  public String getTo() {
+    return to;
+  }
+
+  @Override
+  public void setTo(String to) {
+    this.to = to;
+  }
+
+  @Override
+  public String getDateRangeLabel() {
+    return dateRangeLabel;
+  }
+
+  @Override
+  public void setDateRangeLabel(String dateRangeLabel) {
+    this.dateRangeLabel = dateRangeLabel;
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/CommonSearchRequest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/CommonSearchRequest.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/CommonSearchRequest.java
new file mode 100644
index 0000000..7001cf3
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/CommonSearchRequest.java
@@ -0,0 +1,119 @@
+/*
+ * 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 org.apache.ambari.logsearch.common.LogSearchConstants;
+import org.apache.ambari.logsearch.model.request.CommonSearchParamDefinition;
+import org.apache.ambari.logsearch.model.request.SearchRequest;
+
+import javax.ws.rs.QueryParam;
+
+public class CommonSearchRequest implements SearchRequest, CommonSearchParamDefinition {
+
+  @QueryParam(LogSearchConstants.REQUEST_PARAM_START_INDEX)
+  private String startIndex;
+
+  @QueryParam(LogSearchConstants.REQUEST_PARAM_PAGE)
+  private String page;
+
+  @QueryParam(LogSearchConstants.REQUEST_PARAM_PAGE_SIZE)
+  private String pageSize;
+
+  @QueryParam(LogSearchConstants.REQUEST_PARAM_SORT_BY)
+  private String sortBy;
+
+  @QueryParam(LogSearchConstants.REQUEST_PARAM_SORT_TYPE)
+  private String sortType;
+
+  @QueryParam(LogSearchConstants.REQUEST_PARAM_START_TIME)
+  private String startTime;
+
+  @QueryParam(LogSearchConstants.REQUEST_PARAM_END_TIME)
+  private String endTime;
+
+  @Override
+  public String getStartIndex() {
+    return startIndex;
+  }
+
+  @Override
+  public void setStartIndex(String startIndex) {
+    this.startIndex = startIndex;
+  }
+
+  @Override
+  public String getPage() {
+    return page;
+  }
+
+  @Override
+  public void setPage(String page) {
+    this.page = page;
+  }
+
+  @Override
+  public String getPageSize() {
+    return pageSize;
+  }
+
+  @Override
+  public void setPageSize(String pageSize) {
+    this.pageSize = pageSize;
+  }
+
+  @Override
+  public String getSortBy() {
+    return sortBy;
+  }
+
+  @Override
+  public void setSortBy(String sortBy) {
+    this.sortBy = sortBy;
+  }
+
+  @Override
+  public String getSortType() {
+    return sortType;
+  }
+
+  @Override
+  public void setSortType(String sortType) {
+    this.sortType = sortType;
+  }
+
+  @Override
+  public String getStartTime() {
+    return startTime;
+  }
+
+  @Override
+  public void setStartTime(String startTime) {
+    this.startTime = startTime;
+  }
+
+  @Override
+  public String getEndTime() {
+    return endTime;
+  }
+
+  @Override
+  public void setEndTime(String endTime) {
+    this.endTime = endTime;
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/FieldAuditBarGraphRequest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/FieldAuditBarGraphRequest.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/FieldAuditBarGraphRequest.java
new file mode 100644
index 0000000..aa08aaf
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/FieldAuditBarGraphRequest.java
@@ -0,0 +1,40 @@
+/*
+ * 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 org.apache.ambari.logsearch.common.LogSearchConstants;
+import org.apache.ambari.logsearch.model.request.FieldParamDefinition;
+
+import javax.ws.rs.QueryParam;
+
+public class FieldAuditBarGraphRequest extends AuditBarGraphRequest implements FieldParamDefinition {
+
+  @QueryParam(LogSearchConstants.REQUEST_PARAM_FIELD)
+  private String field;
+
+  @Override
+  public String getField() {
+    return field;
+  }
+
+  @Override
+  public void setField(String field) {
+    this.field = field;
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/FieldAuditLogRequest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/FieldAuditLogRequest.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/FieldAuditLogRequest.java
new file mode 100644
index 0000000..67502fa
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/FieldAuditLogRequest.java
@@ -0,0 +1,41 @@
+/*
+ * 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 io.swagger.annotations.ApiParam;
+import org.apache.ambari.logsearch.common.LogSearchConstants;
+import org.apache.ambari.logsearch.model.request.FieldParamDefinition;
+
+import javax.ws.rs.QueryParam;
+
+public class FieldAuditLogRequest extends BaseAuditLogRequest implements FieldParamDefinition {
+
+  @QueryParam(LogSearchConstants.REQUEST_PARAM_FIELD)
+  private String field;
+
+  @Override
+  public String getField() {
+    return field;
+  }
+
+  @Override
+  public void setField(String field) {
+    this.field = field;
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/LogFileRequest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/LogFileRequest.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/LogFileRequest.java
new file mode 100644
index 0000000..78c5b33
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/LogFileRequest.java
@@ -0,0 +1,67 @@
+/*
+ * 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 org.apache.ambari.logsearch.common.LogSearchConstants;
+import org.apache.ambari.logsearch.model.request.LogFileParamDefinition;
+import org.apache.ambari.logsearch.model.request.SearchRequest;
+
+import javax.ws.rs.QueryParam;
+
+public class LogFileRequest implements SearchRequest, LogFileParamDefinition {
+
+  @QueryParam(LogSearchConstants.REQUEST_PARAM_COMPONENT)
+  private String component;
+
+  @QueryParam(LogSearchConstants.REQUEST_PARAM_HOST)
+  private String host;
+
+  @QueryParam(LogSearchConstants.REQUEST_PARAM_LOG_TYPE)
+  private String logType;
+
+  @Override
+  public String getComponent() {
+    return component;
+  }
+
+  @Override
+  public void setComponent(String component) {
+    this.component = component;
+  }
+
+  @Override
+  public String getHost() {
+    return host;
+  }
+
+  @Override
+  public void setHost(String host) {
+    this.host = host;
+  }
+
+  @Override
+  public String getLogType() {
+    return logType;
+  }
+
+  @Override
+  public void setLogType(String logType) {
+    this.logType = logType;
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/LogFileTailRequest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/LogFileTailRequest.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/LogFileTailRequest.java
new file mode 100644
index 0000000..d5b91ab
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/LogFileTailRequest.java
@@ -0,0 +1,40 @@
+/*
+ * 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 org.apache.ambari.logsearch.common.LogSearchConstants;
+import org.apache.ambari.logsearch.model.request.LogFileTailParamDefinition;
+
+import javax.ws.rs.QueryParam;
+
+public class LogFileTailRequest extends LogFileRequest implements LogFileTailParamDefinition {
+
+  @QueryParam(LogSearchConstants.REQUEST_PARAM_TAIL_SIZE)
+  private String tailSize;
+
+  @Override
+  public String getTailSize() {
+    return tailSize;
+  }
+
+  @Override
+  public void setTailSize(String tailSize) {
+    this.tailSize = tailSize;
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/QueryRequest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/QueryRequest.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/QueryRequest.java
new file mode 100644
index 0000000..0ce788c
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/QueryRequest.java
@@ -0,0 +1,40 @@
+/*
+ * 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 org.apache.ambari.logsearch.common.LogSearchConstants;
+import org.apache.ambari.logsearch.model.request.QueryParamDefinition;
+
+import javax.ws.rs.QueryParam;
+
+public class QueryRequest extends CommonSearchRequest implements QueryParamDefinition {
+
+  @QueryParam(LogSearchConstants.REQUEST_PARAM_QUERY)
+  private String query;
+
+  @Override
+  public String getQuery() {
+    return query;
+  }
+
+  @Override
+  public void setQuery(String query) {
+    this.query = query;
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/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
new file mode 100644
index 0000000..a6aadbb
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/ServiceAnyGraphRequest.java
@@ -0,0 +1,109 @@
+/*
+ * 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 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;
+
+public class ServiceAnyGraphRequest extends ServiceLogRequest
+  implements AnyGraphParamDefinition, DateRangeParamDefinition, UnitParamDefinition {
+
+  @QueryParam(LogSearchConstants.REQUEST_PARAM_XAXIS)
+  private String xAxis;
+
+  @QueryParam(LogSearchConstants.REQUEST_PARAM_YAXIS)
+  private String yAxis;
+
+  @QueryParam(LogSearchConstants.REQUEST_PARAM_STACK_BY)
+  private String stackBy;
+
+  @QueryParam(LogSearchConstants.REQUEST_PARAM_UNIT)
+  private String unit;
+
+  @QueryParam(LogSearchConstants.REQUEST_PARAM_FROM)
+  private String from;
+
+  @QueryParam(LogSearchConstants.REQUEST_PARAM_TO)
+  private String to;
+
+  @Override
+  public String getxAxis() {
+    return xAxis;
+  }
+
+  @Override
+  public void setxAxis(String xAxis) {
+    this.xAxis = xAxis;
+  }
+
+  @Override
+  public String getyAxis() {
+    return yAxis;
+  }
+
+  @Override
+  public void setyAxis(String yAxis) {
+    this.yAxis = yAxis;
+  }
+
+  @Override
+  public String getStackBy() {
+    return stackBy;
+  }
+
+  @Override
+  public void setStackBy(String stackBy) {
+    this.stackBy = stackBy;
+  }
+
+  @Override
+  public String getUnit() {
+    return unit;
+  }
+
+  @Override
+  public void setUnit(String unit) {
+    this.unit = unit;
+  }
+
+  @Override
+  public String getFrom() {
+    return from;
+  }
+
+  @Override
+  public void setFrom(String from) {
+    this.from = from;
+  }
+
+  @Override
+  public String getTo() {
+    return to;
+  }
+
+  @Override
+  public void setTo(String to) {
+    this.to = to;
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/ServiceExtremeDatesRequest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/ServiceExtremeDatesRequest.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/ServiceExtremeDatesRequest.java
new file mode 100644
index 0000000..8207c5d
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/ServiceExtremeDatesRequest.java
@@ -0,0 +1,41 @@
+/*
+ * 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 io.swagger.annotations.ApiParam;
+import org.apache.ambari.logsearch.common.LogSearchConstants;
+import org.apache.ambari.logsearch.model.request.BundleIdParamDefinition;
+
+import javax.ws.rs.QueryParam;
+
+public class ServiceExtremeDatesRequest extends CommonSearchRequest implements BundleIdParamDefinition {
+
+  @QueryParam(LogSearchConstants.REQUEST_PARAM_BUNDLE_ID)
+  private String bundleId;
+
+  @Override
+  public String getBundleId() {
+    return bundleId;
+  }
+
+  @Override
+  public void setBundleId(String bundleId) {
+    this.bundleId = bundleId;
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/ServiceGraphRequest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/ServiceGraphRequest.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/ServiceGraphRequest.java
new file mode 100644
index 0000000..1618aa1
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/ServiceGraphRequest.java
@@ -0,0 +1,40 @@
+/*
+ * 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 org.apache.ambari.logsearch.common.LogSearchConstants;
+import org.apache.ambari.logsearch.model.request.UnitParamDefinition;
+
+import javax.ws.rs.QueryParam;
+
+public class ServiceGraphRequest extends ServiceLogFileRequest implements UnitParamDefinition {
+
+  @QueryParam(LogSearchConstants.REQUEST_PARAM_UNIT)
+  private String unit;
+
+  @Override
+  public String getUnit() {
+    return unit;
+  }
+
+  @Override
+  public void setUnit(String unit) {
+    this.unit = unit;
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/ServiceLogExportRequest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/ServiceLogExportRequest.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/ServiceLogExportRequest.java
new file mode 100644
index 0000000..6ae0dc9
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/ServiceLogExportRequest.java
@@ -0,0 +1,54 @@
+/*
+ * 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 org.apache.ambari.logsearch.common.LogSearchConstants;
+import org.apache.ambari.logsearch.model.request.FormatParamDefinition;
+import org.apache.ambari.logsearch.model.request.UtcOffsetParamDefinition;
+
+import javax.ws.rs.QueryParam;
+
+public class ServiceLogExportRequest extends ServiceLogFileRequest implements FormatParamDefinition, UtcOffsetParamDefinition {
+
+  @QueryParam(LogSearchConstants.REQUEST_PARAM_FORMAT)
+  private String format;
+
+  @QueryParam(LogSearchConstants.REQUEST_PARAM_UTC_OFFSET)
+  private String utcOffset;
+
+  @Override
+  public String getFormat() {
+    return format;
+  }
+
+  @Override
+  public void setFormat(String format) {
+    this.format = format;
+  }
+
+  @Override
+  public String getUtcOffset() {
+    return utcOffset;
+  }
+
+  @Override
+  public void setUtcOffset(String utcOffset) {
+    this.utcOffset = utcOffset;
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/ServiceLogFileRequest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/ServiceLogFileRequest.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/ServiceLogFileRequest.java
new file mode 100644
index 0000000..6c7078a
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/ServiceLogFileRequest.java
@@ -0,0 +1,54 @@
+/*
+ * 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 io.swagger.annotations.ApiParam;
+import org.apache.ambari.logsearch.common.LogSearchConstants;
+import org.apache.ambari.logsearch.model.request.ServiceLogFileParamDefinition;
+
+import javax.ws.rs.QueryParam;
+
+public class ServiceLogFileRequest extends BaseServiceLogRequest implements ServiceLogFileParamDefinition {
+
+  @QueryParam(LogSearchConstants.REQUEST_PARAM_HOST_LOG_FILE)
+  private String hostLogFile;
+
+  @QueryParam(LogSearchConstants.REQUEST_PARAM_COMPONENT_LOG_FILE)
+  private String componentLogFile;
+
+  @Override
+  public String getHostLogFile() {
+    return hostLogFile;
+  }
+
+  @Override
+  public void setHostLogFile(String hostLogFile) {
+    this.hostLogFile = hostLogFile;
+  }
+
+  @Override
+  public String getComponentLogFile() {
+    return componentLogFile;
+  }
+
+  @Override
+  public void setComponentLogFile(String componentLogFile) {
+    this.componentLogFile = componentLogFile;
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/ServiceLogRequest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/ServiceLogRequest.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/ServiceLogRequest.java
new file mode 100644
index 0000000..9a46de3
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/ServiceLogRequest.java
@@ -0,0 +1,93 @@
+/*
+ * 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 org.apache.ambari.logsearch.common.LogSearchConstants;
+import org.apache.ambari.logsearch.model.request.LastPageParamDefinition;
+import org.apache.ambari.logsearch.model.request.ServiceLogSearchParamDefinition;
+
+import javax.ws.rs.QueryParam;
+
+public class ServiceLogRequest extends ServiceLogFileRequest implements ServiceLogSearchParamDefinition, LastPageParamDefinition {
+
+  @QueryParam(LogSearchConstants.REQUEST_PARAM_KEYWORD)
+  private String keyWord;
+
+  @QueryParam(LogSearchConstants.REQUEST_PARAM_SOURCE_LOG_ID)
+  private String sourceLogId;
+
+  @QueryParam(LogSearchConstants.REQUEST_PARAM_KEYWORD_TYPE)
+  private String keywordType;
+
+  @QueryParam(LogSearchConstants.REQUEST_PARAM_TOKEN)
+  private String token;
+
+  @QueryParam(LogSearchConstants.REQUEST_PARAM_LAST_PAGE)
+  private boolean isLastPage;
+
+  @Override
+  public String getKeyWord() {
+    return keyWord;
+  }
+
+  @Override
+  public void setKeyWord(String keyWord) {
+    this.keyWord = keyWord;
+  }
+
+  @Override
+  public String getSourceLogId() {
+    return sourceLogId;
+  }
+
+  @Override
+  public void setSourceLogId(String sourceLogId) {
+    this.sourceLogId = sourceLogId;
+  }
+
+  @Override
+  public String getKeywordType() {
+    return keywordType;
+  }
+
+  @Override
+  public void setKeywordType(String keywordType) {
+    this.keywordType = keywordType;
+  }
+
+  @Override
+  public String getToken() {
+    return token;
+  }
+
+  @Override
+  public void setToken(String token) {
+    this.token = token;
+  }
+
+  @Override
+  public boolean isLastPage() {
+    return isLastPage;
+  }
+
+  @Override
+  public void setLastPage(boolean lastPage) {
+    isLastPage = lastPage;
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/ServiceLogTruncatedRequest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/ServiceLogTruncatedRequest.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/ServiceLogTruncatedRequest.java
new file mode 100644
index 0000000..516c328
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/ServiceLogTruncatedRequest.java
@@ -0,0 +1,66 @@
+/*
+ * 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 org.apache.ambari.logsearch.common.LogSearchConstants;
+import org.apache.ambari.logsearch.model.request.LogTruncatedParamDefinition;
+
+import javax.ws.rs.QueryParam;
+
+public class ServiceLogTruncatedRequest extends ServiceLogFileRequest implements LogTruncatedParamDefinition {
+
+  @QueryParam(LogSearchConstants.REQUEST_PARAM_ID)
+  private String id;
+
+  @QueryParam(LogSearchConstants.REQUEST_PARAM_SCROLL_TYPE)
+  private String scrollType;
+
+  @QueryParam(LogSearchConstants.REQUEST_PARAM_NUMBER_ROWS)
+  private String numberRows;
+
+  @Override
+  public String getId() {
+    return id;
+  }
+
+  @Override
+  public void setId(String id) {
+    this.id = id;
+  }
+
+  @Override
+  public String getScrollType() {
+    return scrollType;
+  }
+
+  @Override
+  public void setScrollType(String scrollType) {
+    this.scrollType = scrollType;
+  }
+
+  @Override
+  public String getNumberRows() {
+    return numberRows;
+  }
+
+  @Override
+  public void setNumberRows(String numberRows) {
+    this.numberRows = numberRows;
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/SimpleQueryRequest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/SimpleQueryRequest.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/SimpleQueryRequest.java
new file mode 100644
index 0000000..eec4379
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/SimpleQueryRequest.java
@@ -0,0 +1,42 @@
+/*
+ * 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 org.apache.ambari.logsearch.common.LogSearchConstants;
+import org.apache.ambari.logsearch.model.request.QueryParamDefinition;
+import org.apache.ambari.logsearch.model.request.SearchRequest;
+
+import javax.ws.rs.QueryParam;
+
+
+public class SimpleQueryRequest implements SearchRequest, QueryParamDefinition {
+
+  @QueryParam(LogSearchConstants.REQUEST_PARAM_QUERY)
+  private String query;
+
+  @Override
+  public String getQuery() {
+    return query;
+  }
+
+  @Override
+  public void setQuery(String query) {
+    this.query = query;
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/UserConfigRequest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/UserConfigRequest.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/UserConfigRequest.java
new file mode 100644
index 0000000..c99ea75
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/UserConfigRequest.java
@@ -0,0 +1,66 @@
+/*
+ * 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 org.apache.ambari.logsearch.common.LogSearchConstants;
+import org.apache.ambari.logsearch.model.request.UserConfigParamDefinition;
+
+import javax.ws.rs.QueryParam;
+
+public class UserConfigRequest extends CommonSearchRequest implements UserConfigParamDefinition {
+
+  @QueryParam(LogSearchConstants.REQUEST_PARAM_USER_ID)
+  private String userId;
+
+  @QueryParam(LogSearchConstants.REQUEST_PARAM_FILE_NAME)
+  private String filterName;
+
+  @QueryParam(LogSearchConstants.REQUEST_PARAM_ROW_TYPE)
+  private String rowType;
+
+  @Override
+  public String getUserId() {
+    return userId;
+  }
+
+  @Override
+  public void setUserId(String userId) {
+    this.userId = userId;
+  }
+
+  @Override
+  public String getFilterName() {
+    return filterName;
+  }
+
+  @Override
+  public void setFilterName(String filterName) {
+    this.filterName = filterName;
+  }
+
+  @Override
+  public String getRowType() {
+    return rowType;
+  }
+
+  @Override
+  public void setRowType(String rowType) {
+    this.rowType = rowType;
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/UserExportRequest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/UserExportRequest.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/UserExportRequest.java
new file mode 100644
index 0000000..1583f94
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/UserExportRequest.java
@@ -0,0 +1,40 @@
+/*
+ * 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 org.apache.ambari.logsearch.common.LogSearchConstants;
+import org.apache.ambari.logsearch.model.request.FormatParamDefinition;
+
+import javax.ws.rs.QueryParam;
+
+public class UserExportRequest extends FieldAuditLogRequest implements FormatParamDefinition {
+
+  @QueryParam(LogSearchConstants.REQUEST_PARAM_FORMAT)
+  private String format;
+
+  @Override
+  public String getFormat() {
+    return format;
+  }
+
+  @Override
+  public void setFormat(String format) {
+    this.format = format;
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/AuditLogData.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/AuditLogData.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/AuditLogData.java
new file mode 100644
index 0000000..6df56a1
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/AuditLogData.java
@@ -0,0 +1,149 @@
+/*
+ * 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 com.fasterxml.jackson.annotation.JsonProperty;
+
+import java.util.Date;
+import java.util.List;
+
+@JsonIgnoreProperties(ignoreUnknown = true)
+public interface AuditLogData extends CommonLogData {
+
+  @JsonProperty("logType")
+  String getLogType();
+
+  void setLogType(String logType);
+
+  @JsonProperty("policy")
+  String getPolicy();
+
+  void setPolicy(String policy);
+
+  @JsonProperty("access")
+  String getAccess();
+
+  void setAccess(String access);
+
+  @JsonProperty("action")
+  String getAction();
+
+  void setAction(String action);
+
+  @JsonProperty("agent")
+  String getAgent();
+
+  void setAgent(String agent);
+
+  @JsonProperty("agentHost")
+  String getAgentHost();
+
+  void setAgentHost(String agentHost);
+
+  @JsonProperty("cliIP")
+  String getClientIp();
+
+  void setClientIp(String clientIp);
+
+  @JsonProperty("cliType")
+  String getClientType();
+
+  public void setClientType(String clientType);
+
+  @JsonProperty("reqContext")
+  String getRequestContext();
+
+  void setRequestContext(String requestContext);
+
+  @JsonProperty("enforcer")
+  String getEnforcer();
+
+  void setEnforcer(String enforcer);
+
+  @JsonProperty("evtTime")
+  Date getEventTime();
+
+  void setEventTime(Date eventTime);
+
+  @JsonProperty("reason")
+  String getReason();
+
+  void setReason(String reason);
+
+  @JsonProperty("proxyUsers")
+  List<String> getProxyUsers();
+
+  void setProxyUsers(List<String> proxyUsers);
+
+  @JsonProperty("repo")
+  String getRepo();
+
+  void setRepo(String repo);
+
+  @JsonProperty("repoType")
+  String getRepoType();
+
+  void setRepoType(String repoType);
+
+  @JsonProperty("reqData")
+  String getRequestData();
+
+  void setRequestData(String requestData);
+
+  @JsonProperty("reqUser")
+  String getRequestUser();
+
+  void setRequestUser(String requestUser);
+
+  @JsonProperty("resType")
+  String getResponseType();
+
+  void setResponseType(String requestType);
+
+  @JsonProperty("resource")
+  String getResource();
+
+  void setResource(String resource);
+
+  @JsonProperty("result")
+  Integer getResult();
+
+  void setResult(Integer result);
+
+  @JsonProperty("sess")
+  String getSession();
+
+  void setSession(String session);
+
+  @JsonProperty("tags")
+  List<String> getTags();
+
+  void setTags(List<String> tags);
+
+  @JsonProperty("tags_str")
+  String getTagsStr();
+
+  void setTagsStr(String tagsStr);
+
+  @JsonProperty("text")
+  String getText();
+
+  void setText(String text);
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/AuditLogResponse.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/AuditLogResponse.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/AuditLogResponse.java
new file mode 100644
index 0000000..a886a96
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/AuditLogResponse.java
@@ -0,0 +1,48 @@
+/*
+ * 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.List;
+
+@ApiModel
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class AuditLogResponse extends LogSearchResponse<AuditLogData> {
+
+  @ApiModelProperty
+  private List<AuditLogData> logList;
+
+  @Override
+  public List<AuditLogData> getLogList() {
+    return logList;
+  }
+
+  @Override
+  public void setLogList(List<AuditLogData> logList) {
+    this.logList = logList;
+  }
+
+  @Override
+  public int getListSize() {
+    return logList == null ? 0 : logList.size();
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/BarGraphData.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/BarGraphData.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/BarGraphData.java
new file mode 100644
index 0000000..3f2bd6f
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/BarGraphData.java
@@ -0,0 +1,53 @@
+/*
+ * 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.io.Serializable;
+import java.util.ArrayList;
+import java.util.Collection;
+
+@ApiModel
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class BarGraphData implements Serializable {
+
+  @ApiModelProperty
+  private Collection<NameValueData> dataCount = new ArrayList<>();
+  @ApiModelProperty
+  private String name;
+
+  public String getName() {
+    return name;
+  }
+
+  public void setName(String name) {
+    this.name = name;
+  }
+
+  public Collection<NameValueData> getDataCount() {
+    return dataCount;
+  }
+
+  public void setDataCount(Collection<NameValueData> dateValueCounts) {
+    this.dataCount = dateValueCounts;
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/BarGraphDataListResponse.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/BarGraphDataListResponse.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/BarGraphDataListResponse.java
new file mode 100644
index 0000000..4d5d166
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/BarGraphDataListResponse.java
@@ -0,0 +1,42 @@
+/*
+ * 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.ArrayList;
+import java.util.Collection;
+
+@ApiModel
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class BarGraphDataListResponse {
+
+  @ApiModelProperty
+  protected Collection<BarGraphData> graphData = new ArrayList<>();
+
+  public Collection<BarGraphData> getGraphData() {
+    return graphData;
+  }
+
+  public void setGraphData(Collection<BarGraphData> graphData) {
+    this.graphData = graphData;
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/CommonLogData.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/CommonLogData.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/CommonLogData.java
new file mode 100644
index 0000000..e2bba3f
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/CommonLogData.java
@@ -0,0 +1,113 @@
+/*
+ * 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 com.fasterxml.jackson.annotation.JsonProperty;
+
+import java.util.Date;
+
+@JsonIgnoreProperties(ignoreUnknown = true)
+public interface CommonLogData extends LogData {
+
+  @JsonProperty("id")
+  String getId();
+
+  void setId(String id);
+
+  @JsonProperty("case_id")
+  String getCaseId();
+
+  void setCaseId(String caseId);
+
+  @JsonProperty("log_message")
+  String getLogMessage();
+
+  void setLogMessage(String logMessage);
+
+  @JsonProperty("bundle_id")
+  String getBundleId();
+
+  void setBundleId(String bundleId);
+
+  @JsonProperty("logfile_line_number")
+  Integer getLogFileLineNumber();
+
+  void setLogFileLineNumber(Integer logFileLineNumber);
+
+  @JsonProperty("file")
+  String getFile();
+
+  void setFile(String file);
+
+  @JsonProperty("type")
+  String getType();
+
+  void setType(String type);
+
+  @JsonProperty("seq_num")
+  Long getSeqNum();
+
+  void setSeqNum(Long seqNum);
+
+  @JsonProperty("message_md5")
+  String getMessageMd5();
+
+  void setMessageMd5(String messageMd5);
+
+  @JsonProperty("cluster")
+  String getCluster();
+
+  void setCluster(String cluster);
+
+  @JsonProperty("event_count")
+  Long getEventCount();
+
+  void setEventCount(Long eventCount);
+
+  @JsonProperty("event_md5")
+  public String getEventMd5();
+
+  public void setEventMd5(String eventMd5);
+
+  @JsonProperty("event_dur_ms")
+  public Long getEventDurationMs();
+
+  public void setEventDurationMs(Long eventDurationMs);
+
+  @JsonProperty("_ttl_")
+  String getTtl();
+
+  void setTtl(String ttl);
+
+  @JsonProperty("_expire_at_")
+  Date getExpire();
+
+  void setExpire(Date expire);
+
+  @JsonProperty("_version_")
+  Long getVersion();
+
+  void setVersion(Long version);
+
+  @JsonProperty("_router_field_")
+  Integer getRouterField();
+
+  void setRouterField(Integer routerField);
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/ComponentTypeLogData.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/ComponentTypeLogData.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/ComponentTypeLogData.java
new file mode 100644
index 0000000..6c15f9c
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/ComponentTypeLogData.java
@@ -0,0 +1,32 @@
+/*
+ * 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 com.fasterxml.jackson.annotation.JsonProperty;
+
+@JsonIgnoreProperties(ignoreUnknown = true)
+public interface ComponentTypeLogData extends LogData {
+
+  @JsonProperty("type")
+  String getType();
+
+  void setType(String type);
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/CountData.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/CountData.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/CountData.java
new file mode 100644
index 0000000..fabaad2
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/CountData.java
@@ -0,0 +1,50 @@
+/*
+ * 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;
+
+@ApiModel
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class CountData {
+
+  @ApiModelProperty
+  private String name;
+
+  @ApiModelProperty
+  private Long count;
+
+  public String getName() {
+    return name;
+  }
+
+  public void setName(String name) {
+    this.name = name;
+  }
+
+  public Long getCount() {
+    return count;
+  }
+
+  public void setCount(Long count) {
+    this.count = count;
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/CountDataListResponse.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/CountDataListResponse.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/CountDataListResponse.java
new file mode 100644
index 0000000..2543dcc
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/CountDataListResponse.java
@@ -0,0 +1,48 @@
+/*
+ * 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.List;
+
+@ApiModel
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class CountDataListResponse extends SearchResponse {
+
+  @ApiModelProperty
+  private List<CountData> vCounts;
+
+  public List<CountData> getvCounts() {
+    return vCounts;
+  }
+
+  public void setvCounts(List<CountData> vCounts) {
+    this.vCounts = vCounts;
+  }
+
+  @Override
+  public int getListSize() {
+    if (vCounts != null)
+      return vCounts.size();
+    return 0;
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/GraphData.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/GraphData.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/GraphData.java
new file mode 100644
index 0000000..e39ec95
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/GraphData.java
@@ -0,0 +1,64 @@
+/*
+ * 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.io.Serializable;
+import java.util.List;
+
+@ApiModel
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class GraphData implements Serializable {
+
+  @ApiModelProperty
+  private String name;
+
+  @ApiModelProperty
+  private Long count;
+
+  @ApiModelProperty
+  private List<GraphData> dataList;
+
+  public String getName() {
+    return name;
+  }
+
+  public void setName(String name) {
+    this.name = name;
+  }
+
+  public Long getCount() {
+    return count;
+  }
+
+  public void setCount(Long count) {
+    this.count = count;
+  }
+
+  public List<GraphData> getDataList() {
+    return dataList;
+  }
+
+  public void setDataList(List<GraphData> dataList) {
+    this.dataList = dataList;
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/GraphDataListResponse.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/GraphDataListResponse.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/GraphDataListResponse.java
new file mode 100644
index 0000000..4357c28
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/GraphDataListResponse.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 io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+import java.util.List;
+
+@ApiModel
+public class GraphDataListResponse {
+
+  @ApiModelProperty
+  protected List<GraphData> graphData;
+
+  public List<GraphData> getGraphData() {
+    return graphData;
+  }
+
+  public void setGraphData(List<GraphData> graphData) {
+    this.graphData = graphData;
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/GroupListResponse.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/GroupListResponse.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/GroupListResponse.java
new file mode 100644
index 0000000..92c51f2
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/GroupListResponse.java
@@ -0,0 +1,48 @@
+/*
+ * 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 io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+import java.util.ArrayList;
+import java.util.List;
+
+@ApiModel
+public class GroupListResponse extends SearchResponse {
+
+  @ApiModelProperty
+  private List<LogData> groupList = new ArrayList<>();
+
+  public List<LogData> getGroupList() {
+    return groupList;
+  }
+
+  public void setGroupList(List<LogData> groupList) {
+    this.groupList = groupList;
+  }
+
+  @Override
+  public int getListSize() {
+    if (groupList != null){
+      return groupList.size();
+    }
+    return 0;
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/HostLogData.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/HostLogData.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/HostLogData.java
new file mode 100644
index 0000000..8cab1ab
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/HostLogData.java
@@ -0,0 +1,30 @@
+/*
+ * 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 com.fasterxml.jackson.annotation.JsonProperty;
+
+@JsonIgnoreProperties(ignoreUnknown = true)
+public interface HostLogData extends LogData {
+  @JsonProperty("host")
+  String getHost();
+
+  void setHost(String host);
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/LogData.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/LogData.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/LogData.java
new file mode 100644
index 0000000..ec6c34c
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/LogData.java
@@ -0,0 +1,25 @@
+/*
+ * 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 org.apache.ambari.logsearch.common.Marker;
+
+@Marker
+public interface LogData {
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/LogFileData.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/LogFileData.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/LogFileData.java
new file mode 100644
index 0000000..5a67606
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/LogFileData.java
@@ -0,0 +1,48 @@
+/*
+ * 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 io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+@ApiModel
+public class LogFileData {
+
+  @ApiModelProperty
+  private String name;
+
+  @ApiModelProperty
+  private String path;
+
+  public String getName() {
+    return name;
+  }
+
+  public void setName(String name) {
+    this.name = name;
+  }
+
+  public String getPath() {
+    return path;
+  }
+
+  public void setPath(String path) {
+    this.path = path;
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/LogFileDataListResponse.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/LogFileDataListResponse.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/LogFileDataListResponse.java
new file mode 100644
index 0000000..57614c3
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/LogFileDataListResponse.java
@@ -0,0 +1,48 @@
+/*
+ * 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 io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+import java.util.ArrayList;
+import java.util.List;
+
+@ApiModel
+public class LogFileDataListResponse extends SearchResponse {
+
+  @ApiModelProperty
+  private List<LogFileData> logFiles = new ArrayList<LogFileData>();
+
+  @Override
+  public int getListSize() {
+    if (logFiles == null) {
+      return 0;
+    }
+    return logFiles.size();
+  }
+
+  public List<LogFileData> getLogFiles() {
+    return logFiles;
+  }
+
+  public void setLogFiles(List<LogFileData> logFiles) {
+    this.logFiles = logFiles;
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/LogListResponse.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/LogListResponse.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/LogListResponse.java
new file mode 100644
index 0000000..c075fe2
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/LogListResponse.java
@@ -0,0 +1,27 @@
+/*
+ * 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 java.util.List;
+
+public interface LogListResponse<T extends LogData> {
+  List<T> getLogList();
+
+  void setLogList(List<T> logList);
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/LogSearchResponse.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/LogSearchResponse.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/LogSearchResponse.java
new file mode 100644
index 0000000..a63415b
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/LogSearchResponse.java
@@ -0,0 +1,22 @@
+/*
+ * 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;
+
+abstract public class LogSearchResponse<T extends LogData> extends SearchResponse implements LogListResponse<T> {
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/NameValueData.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/NameValueData.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/NameValueData.java
new file mode 100644
index 0000000..3f320e7
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/NameValueData.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.model.response;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+@ApiModel
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class NameValueData {
+
+  @ApiModelProperty
+  private String name;
+  @ApiModelProperty
+  private String value;
+
+  public String getName() {
+    return name;
+  }
+
+  public void setName(String name) {
+    this.name = name;
+  }
+
+  public String getValue() {
+    return value;
+  }
+
+  public void setValue(String value) {
+    if (value.contains(".") && (value.contains("e") || value.contains("E"))) {
+      this.value = getExponentialValueReplaced(value);
+    } else {
+      this.value = value;
+    }
+  }
+
+  private String getExponentialValueReplaced(String value) {
+    try{
+      Double number = Double.parseDouble(value);
+      return String.format("%.0f", number);
+    } catch(Exception e){
+      return value;
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/NameValueDataListResponse.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/NameValueDataListResponse.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/NameValueDataListResponse.java
new file mode 100644
index 0000000..4cb983f
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/NameValueDataListResponse.java
@@ -0,0 +1,49 @@
+/*
+ * 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.ArrayList;
+import java.util.List;
+
+@ApiModel
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class NameValueDataListResponse extends SearchResponse {
+  @ApiModelProperty
+  protected List<NameValueData> vNameValues = new ArrayList<>();
+
+  public List<NameValueData> getvNameValues() {
+    return vNameValues;
+  }
+
+  public void setvNameValues(List<NameValueData> vNameValues) {
+    this.vNameValues = vNameValues;
+  }
+
+  @Override
+  public int getListSize() {
+    if (vNameValues != null) {
+      return vNameValues.size();
+    }
+    return 0;
+  }
+}


[07/58] [abbrv] ambari git commit: AMBARI-18310. Refactor logsearch portal side code (oleewere)

Posted by ol...@apache.org.
http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/manager/UserConfigManager.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/manager/UserConfigManager.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/manager/UserConfigManager.java
new file mode 100644
index 0000000..7430770
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/manager/UserConfigManager.java
@@ -0,0 +1,276 @@
+/*
+ * 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.manager;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import org.apache.ambari.logsearch.common.LogSearchConstants;
+import org.apache.ambari.logsearch.common.MessageEnums;
+import org.apache.ambari.logsearch.dao.UserConfigSolrDao;
+import org.apache.ambari.logsearch.query.QueryGeneration;
+import org.apache.ambari.logsearch.util.JSONUtil;
+import org.apache.ambari.logsearch.util.RESTErrorUtil;
+import org.apache.ambari.logsearch.util.SolrUtil;
+import org.apache.ambari.logsearch.view.VLogfeederFilterWrapper;
+import org.apache.ambari.logsearch.view.VUserConfig;
+import org.apache.ambari.logsearch.view.VUserConfigList;
+import org.apache.ambari.logsearch.query.model.SearchCriteria;
+import org.apache.commons.lang.StringUtils;
+import org.apache.log4j.Logger;
+import org.apache.solr.client.solrj.SolrQuery;
+import org.apache.solr.client.solrj.SolrServerException;
+import org.apache.solr.client.solrj.response.FacetField.Count;
+import org.apache.solr.client.solrj.response.QueryResponse;
+import org.apache.solr.common.SolrDocument;
+import org.apache.solr.common.SolrDocumentList;
+import org.apache.solr.common.SolrException;
+import org.apache.solr.common.SolrInputDocument;
+import org.springframework.stereotype.Component;
+
+import javax.inject.Inject;
+
+@Component
+public class UserConfigManager extends JsonManagerBase {
+
+  private static final Logger logger = Logger.getLogger(UserConfigManager.class);
+
+  @Inject
+  private UserConfigSolrDao userConfigSolrDao;
+  @Inject
+  private QueryGeneration queryGenerator;
+
+  public String saveUserConfig(VUserConfig vHistory) {
+
+    SolrInputDocument solrInputDoc = new SolrInputDocument();
+    if (!isValid(vHistory)) {
+      throw RESTErrorUtil.createRESTException("No FilterName Specified", MessageEnums.INVALID_INPUT_DATA);
+    }
+
+    if (isNotUnique(vHistory) && !vHistory.isOverwrite()) {
+      throw RESTErrorUtil.createRESTException( "Name '" + vHistory.getFiltername() + "' already exists", MessageEnums.INVALID_INPUT_DATA);
+    }
+    String loggedInUserName = vHistory.getUserName();
+    String filterName = vHistory.getFiltername();
+
+    solrInputDoc.addField(LogSearchConstants.ID, vHistory.getId());
+    solrInputDoc.addField(LogSearchConstants.USER_NAME, loggedInUserName);
+    solrInputDoc.addField(LogSearchConstants.VALUES, vHistory.getValues());
+    solrInputDoc.addField(LogSearchConstants.FILTER_NAME, filterName);
+    solrInputDoc.addField(LogSearchConstants.ROW_TYPE, vHistory.getRowType());
+    List<String> shareNameList = vHistory.getShareNameList();
+    if (shareNameList != null && !shareNameList.isEmpty()) {
+      solrInputDoc.addField(LogSearchConstants.SHARE_NAME_LIST, shareNameList);
+    }
+    // Check whether the Filter Name exists in solr
+    SolrQuery solrQuery = new SolrQuery();
+    SolrUtil.setMainQuery(solrQuery, null);
+    queryGenerator.setSingleIncludeFilter(solrQuery, LogSearchConstants.FILTER_NAME, SolrUtil.makeSearcableString(filterName));
+    queryGenerator.setSingleIncludeFilter(solrQuery, LogSearchConstants.USER_NAME, loggedInUserName);
+    try {
+      QueryResponse queryResponse = userConfigSolrDao.process(solrQuery);
+      if (queryResponse != null) {
+        SolrDocumentList documentList = queryResponse.getResults();
+        if (documentList != null && !documentList.isEmpty() && !vHistory.isOverwrite()) {
+          logger.error("Filtername is already present");
+          throw RESTErrorUtil.createRESTException("Filtername is already present", MessageEnums.INVALID_INPUT_DATA);
+        }
+      }
+    } catch (SolrException | SolrServerException | IOException e) {
+      logger.error("Error in checking same filtername config", e);
+      throw RESTErrorUtil.createRESTException(MessageEnums.SOLR_ERROR.getMessage().getMessage(), MessageEnums.ERROR_SYSTEM);
+    }
+
+    try {
+      userConfigSolrDao.addDocs(solrInputDoc);
+      return convertObjToString(solrInputDoc);
+    } catch (SolrException | SolrServerException | IOException e) {
+      logger.error("Error saving user config. solrDoc=" + solrInputDoc, e);
+      throw RESTErrorUtil.createRESTException(MessageEnums.SOLR_ERROR.getMessage().getMessage(), MessageEnums.ERROR_SYSTEM);
+    }
+  }
+
+  private boolean isNotUnique(VUserConfig vHistory) {
+    String filterName = vHistory.getFiltername();
+    String rowType = vHistory.getRowType();
+
+    if (filterName != null && rowType != null) {
+      SolrQuery solrQuery = new SolrQuery();
+      filterName = SolrUtil.makeSearcableString(filterName);
+      solrQuery.setQuery(LogSearchConstants.COMPOSITE_KEY + ":" + filterName + "-" + rowType);
+      SolrUtil.setRowCount(solrQuery, 0);
+      try {
+        Long numFound = userConfigSolrDao.process(solrQuery).getResults().getNumFound();
+        if (numFound > 0) {
+          return true;
+        }
+      } catch (SolrException | SolrServerException | IOException e) {
+        logger.error("Error while checking if userConfig is unique.", e);
+      }
+    }
+    return false;
+  }
+
+  private boolean isValid(VUserConfig vHistory) {
+    return !StringUtils.isBlank(vHistory.getFiltername())
+        && !StringUtils.isBlank(vHistory.getRowType())
+        && !StringUtils.isBlank(vHistory.getUserName())
+        && !StringUtils.isBlank(vHistory.getValues());
+  }
+
+  public void deleteUserConfig(String id) {
+    try {
+      userConfigSolrDao.deleteUserConfig(id);
+    } catch (SolrException | SolrServerException | IOException e) {
+      throw RESTErrorUtil.createRESTException(MessageEnums.SOLR_ERROR.getMessage().getMessage(), MessageEnums.ERROR_SYSTEM);
+    }
+  }
+
+  @SuppressWarnings("unchecked")
+  public String getUserConfig(SearchCriteria searchCriteria) {
+
+    SolrDocumentList solrList = new SolrDocumentList();
+    VUserConfigList userConfigList = new VUserConfigList();
+
+    String rowType = (String) searchCriteria.getParamValue(LogSearchConstants.ROW_TYPE);
+    if (StringUtils.isBlank(rowType)) {
+      throw RESTErrorUtil.createRESTException("row type was not specified", MessageEnums.INVALID_INPUT_DATA);
+    }
+
+    String userName = (String) searchCriteria.getParamValue(LogSearchConstants.USER_NAME);
+    if (StringUtils.isBlank(userName)) {
+      throw RESTErrorUtil.createRESTException("user name was not specified", MessageEnums.INVALID_INPUT_DATA);
+    }
+    String filterName = (String) searchCriteria.getParamValue(LogSearchConstants.FILTER_NAME);
+    filterName = StringUtils.isBlank(filterName) ? "*" : "*" + filterName + "*";
+
+    try {
+
+      SolrQuery userConfigQuery = new SolrQuery();
+      SolrUtil.setMainQuery(userConfigQuery, null);
+      queryGenerator.setPagination(userConfigQuery, searchCriteria);
+      queryGenerator.setSingleIncludeFilter(userConfigQuery, LogSearchConstants.ROW_TYPE, rowType);
+      queryGenerator.setSingleORFilter(userConfigQuery, LogSearchConstants.USER_NAME, userName, LogSearchConstants.SHARE_NAME_LIST, userName);
+      queryGenerator.setSingleIncludeFilter(userConfigQuery, LogSearchConstants.FILTER_NAME, SolrUtil.makeSearcableString(filterName));
+
+      if (StringUtils.isBlank(searchCriteria.getSortBy())) {
+        searchCriteria.setSortBy(LogSearchConstants.FILTER_NAME);
+      }
+      if (StringUtils.isBlank(searchCriteria.getSortType())) {
+        searchCriteria.setSortType("" + SolrQuery.ORDER.asc);
+      }
+
+      queryGenerator.setSingleSortOrder(userConfigQuery, searchCriteria);
+      solrList = userConfigSolrDao.process(userConfigQuery).getResults();
+
+      Collection<VUserConfig> configList = new ArrayList<VUserConfig>();
+
+      for (SolrDocument solrDoc : solrList) {
+        VUserConfig userConfig = new VUserConfig();
+        userConfig.setFiltername("" + solrDoc.get(LogSearchConstants.FILTER_NAME));
+        userConfig.setId("" + solrDoc.get(LogSearchConstants.ID));
+        userConfig.setValues("" + solrDoc.get(LogSearchConstants.VALUES));
+        userConfig.setRowType("" + solrDoc.get(LogSearchConstants.ROW_TYPE));
+        try {
+          List<String> shareNameList = (List<String>) solrDoc.get(LogSearchConstants.SHARE_NAME_LIST);
+          userConfig.setShareNameList(shareNameList);
+        } catch (Exception e) {
+          // do nothing
+        }
+
+        userConfig.setUserName("" + solrDoc.get(LogSearchConstants.USER_NAME));
+
+        configList.add(userConfig);
+      }
+
+      userConfigList.setName("historyList");
+      userConfigList.setUserConfigList(configList);
+
+      userConfigList.setStartIndex(searchCriteria.getStartIndex());
+      userConfigList.setPageSize((int) searchCriteria.getMaxRows());
+
+      userConfigList.setTotalCount((long) solrList.getNumFound());
+    } catch (SolrException | SolrServerException | IOException e) {
+      // do nothing
+      logger.error(e);
+      throw RESTErrorUtil.createRESTException(MessageEnums.SOLR_ERROR.getMessage().getMessage(), MessageEnums.ERROR_SYSTEM);
+    }
+
+    return convertObjToString(userConfigList);
+
+  }
+
+  public String updateUserConfig(VUserConfig vuserConfig) {
+    return saveUserConfig(vuserConfig);
+  }
+
+  // ////////////////////////////LEVEL FILTER/////////////////////////////////////
+
+  public String getUserFilter() {
+    VLogfeederFilterWrapper userFilter;
+    try {
+      userFilter = userConfigSolrDao.getUserFilter();
+    } catch (SolrServerException | IOException e) {
+      logger.error(e);
+      throw RESTErrorUtil.createRESTException(MessageEnums.SOLR_ERROR.getMessage().getMessage(), MessageEnums.ERROR_SYSTEM);
+    }
+    return convertObjToString(userFilter);
+  }
+
+  public String saveUserFiter(String json) {
+    if (!StringUtils.isBlank(json)) {
+      VLogfeederFilterWrapper logfeederFilterWrapper = (VLogfeederFilterWrapper) JSONUtil.jsonToObj(json, VLogfeederFilterWrapper.class);
+      try {
+        if (logfeederFilterWrapper == null) {
+          logger.error(json + " is a invalid json");
+        }
+        userConfigSolrDao.saveUserFilter(logfeederFilterWrapper);
+      } catch (SolrException | SolrServerException | IOException e) {
+        logger.error("user config not able to save", e);
+        throw RESTErrorUtil.createRESTException(MessageEnums.SOLR_ERROR.getMessage().getMessage(), MessageEnums.ERROR_SYSTEM);
+      }
+    }
+    return getUserFilter();
+  }
+
+  public String getAllUserName() {
+    List<String> userList = new ArrayList<String>();
+    try {
+      SolrQuery userListQuery = new SolrQuery();
+      SolrUtil.setMainQuery(userListQuery, null);
+      SolrUtil.setFacetField(userListQuery, LogSearchConstants.USER_NAME);
+      QueryResponse queryResponse = userConfigSolrDao.process(userListQuery);
+      if (queryResponse == null) {
+        return convertObjToString(userList);
+      }
+      List<Count> counList = queryResponse.getFacetField(LogSearchConstants.USER_NAME).getValues();
+      for (Count cnt : counList) {
+        String userName = cnt.getName();
+        userList.add(userName);
+      }
+    } catch (SolrException | SolrServerException | IOException e) {
+      logger.warn("Error getting all users.", e);
+      throw RESTErrorUtil.createRESTException(MessageEnums.SOLR_ERROR.getMessage().getMessage(), MessageEnums.ERROR_SYSTEM);
+    }
+    return convertObjToString(userList);
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/manager/UserConfigMgr.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/manager/UserConfigMgr.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/manager/UserConfigMgr.java
deleted file mode 100644
index 59c1bbd..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/manager/UserConfigMgr.java
+++ /dev/null
@@ -1,276 +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.manager;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
-import org.apache.ambari.logsearch.common.LogSearchConstants;
-import org.apache.ambari.logsearch.common.MessageEnums;
-import org.apache.ambari.logsearch.common.SearchCriteria;
-import org.apache.ambari.logsearch.dao.UserConfigSolrDao;
-import org.apache.ambari.logsearch.query.QueryGeneration;
-import org.apache.ambari.logsearch.util.JSONUtil;
-import org.apache.ambari.logsearch.util.RESTErrorUtil;
-import org.apache.ambari.logsearch.util.SolrUtil;
-import org.apache.ambari.logsearch.view.VLogfeederFilterWrapper;
-import org.apache.ambari.logsearch.view.VUserConfig;
-import org.apache.ambari.logsearch.view.VUserConfigList;
-import org.apache.commons.lang.StringUtils;
-import org.apache.log4j.Logger;
-import org.apache.solr.client.solrj.SolrQuery;
-import org.apache.solr.client.solrj.SolrServerException;
-import org.apache.solr.client.solrj.response.FacetField.Count;
-import org.apache.solr.client.solrj.response.QueryResponse;
-import org.apache.solr.common.SolrDocument;
-import org.apache.solr.common.SolrDocumentList;
-import org.apache.solr.common.SolrException;
-import org.apache.solr.common.SolrInputDocument;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-
-@Component
-public class UserConfigMgr extends MgrBase {
-
-  private static final Logger logger = Logger.getLogger(UserConfigMgr.class);
-
-  @Autowired
-  private UserConfigSolrDao userConfigSolrDao;
-  @Autowired
-  private QueryGeneration queryGenerator;
-
-  public String saveUserConfig(VUserConfig vHistory) {
-
-    SolrInputDocument solrInputDoc = new SolrInputDocument();
-    if (!isValid(vHistory)) {
-      throw RESTErrorUtil.createRESTException("No FilterName Specified", MessageEnums.INVALID_INPUT_DATA);
-    }
-
-    if (isNotUnique(vHistory) && !vHistory.isOverwrite()) {
-      throw RESTErrorUtil.createRESTException( "Name '" + vHistory.getFiltername() + "' already exists", MessageEnums.INVALID_INPUT_DATA);
-    }
-    String loggedInUserName = vHistory.getUserName();
-    String filterName = vHistory.getFiltername();
-
-    solrInputDoc.addField(LogSearchConstants.ID, vHistory.getId());
-    solrInputDoc.addField(LogSearchConstants.USER_NAME, loggedInUserName);
-    solrInputDoc.addField(LogSearchConstants.VALUES, vHistory.getValues());
-    solrInputDoc.addField(LogSearchConstants.FILTER_NAME, filterName);
-    solrInputDoc.addField(LogSearchConstants.ROW_TYPE, vHistory.getRowType());
-    List<String> shareNameList = vHistory.getShareNameList();
-    if (shareNameList != null && !shareNameList.isEmpty()) {
-      solrInputDoc.addField(LogSearchConstants.SHARE_NAME_LIST, shareNameList);
-    }
-    // Check whether the Filter Name exists in solr
-    SolrQuery solrQuery = new SolrQuery();
-    SolrUtil.setMainQuery(solrQuery, null);
-    queryGenerator.setSingleIncludeFilter(solrQuery, LogSearchConstants.FILTER_NAME, SolrUtil.makeSearcableString(filterName));
-    queryGenerator.setSingleIncludeFilter(solrQuery, LogSearchConstants.USER_NAME, loggedInUserName);
-    try {
-      QueryResponse queryResponse = userConfigSolrDao.process(solrQuery);
-      if (queryResponse != null) {
-        SolrDocumentList documentList = queryResponse.getResults();
-        if (documentList != null && !documentList.isEmpty() && !vHistory.isOverwrite()) {
-          logger.error("Filtername is already present");
-          throw RESTErrorUtil.createRESTException("Filtername is already present", MessageEnums.INVALID_INPUT_DATA);
-        }
-      }
-    } catch (SolrException | SolrServerException | IOException e) {
-      logger.error("Error in checking same filtername config", e);
-      throw RESTErrorUtil.createRESTException(MessageEnums.SOLR_ERROR.getMessage().getMessage(), MessageEnums.ERROR_SYSTEM);
-    }
-
-    try {
-      userConfigSolrDao.addDocs(solrInputDoc);
-      return convertObjToString(solrInputDoc);
-    } catch (SolrException | SolrServerException | IOException e) {
-      logger.error("Error saving user config. solrDoc=" + solrInputDoc, e);
-      throw RESTErrorUtil.createRESTException(MessageEnums.SOLR_ERROR.getMessage().getMessage(), MessageEnums.ERROR_SYSTEM);
-    }
-  }
-
-  private boolean isNotUnique(VUserConfig vHistory) {
-    String filterName = vHistory.getFiltername();
-    String rowType = vHistory.getRowType();
-
-    if (filterName != null && rowType != null) {
-      SolrQuery solrQuery = new SolrQuery();
-      filterName = SolrUtil.makeSearcableString(filterName);
-      solrQuery.setQuery(LogSearchConstants.COMPOSITE_KEY + ":" + filterName + "-" + rowType);
-      SolrUtil.setRowCount(solrQuery, 0);
-      try {
-        Long numFound = userConfigSolrDao.process(solrQuery).getResults().getNumFound();
-        if (numFound > 0) {
-          return true;
-        }
-      } catch (SolrException | SolrServerException | IOException e) {
-        logger.error("Error while checking if userConfig is unique.", e);
-      }
-    }
-    return false;
-  }
-
-  private boolean isValid(VUserConfig vHistory) {
-    return !StringUtils.isBlank(vHistory.getFiltername())
-        && !StringUtils.isBlank(vHistory.getRowType())
-        && !StringUtils.isBlank(vHistory.getUserName())
-        && !StringUtils.isBlank(vHistory.getValues());
-  }
-
-  public void deleteUserConfig(String id) {
-    try {
-      userConfigSolrDao.deleteUserConfig(id);
-    } catch (SolrException | SolrServerException | IOException e) {
-      throw RESTErrorUtil.createRESTException(MessageEnums.SOLR_ERROR.getMessage().getMessage(), MessageEnums.ERROR_SYSTEM);
-    }
-  }
-
-  @SuppressWarnings("unchecked")
-  public String getUserConfig(SearchCriteria searchCriteria) {
-
-    SolrDocumentList solrList = new SolrDocumentList();
-    VUserConfigList userConfigList = new VUserConfigList();
-
-    String rowType = (String) searchCriteria.getParamValue(LogSearchConstants.ROW_TYPE);
-    if (StringUtils.isBlank(rowType)) {
-      throw RESTErrorUtil.createRESTException("row type was not specified", MessageEnums.INVALID_INPUT_DATA);
-    }
-
-    String userName = (String) searchCriteria.getParamValue(LogSearchConstants.USER_NAME);
-    if (StringUtils.isBlank(userName)) {
-      throw RESTErrorUtil.createRESTException("user name was not specified", MessageEnums.INVALID_INPUT_DATA);
-    }
-    String filterName = (String) searchCriteria.getParamValue(LogSearchConstants.FILTER_NAME);
-    filterName = StringUtils.isBlank(filterName) ? "*" : "*" + filterName + "*";
-
-    try {
-
-      SolrQuery userConfigQuery = new SolrQuery();
-      SolrUtil.setMainQuery(userConfigQuery, null);
-      queryGenerator.setPagination(userConfigQuery, searchCriteria);
-      queryGenerator.setSingleIncludeFilter(userConfigQuery, LogSearchConstants.ROW_TYPE, rowType);
-      queryGenerator.setSingleORFilter(userConfigQuery, LogSearchConstants.USER_NAME, userName, LogSearchConstants.SHARE_NAME_LIST, userName);
-      queryGenerator.setSingleIncludeFilter(userConfigQuery, LogSearchConstants.FILTER_NAME, SolrUtil.makeSearcableString(filterName));
-
-      if (StringUtils.isBlank(searchCriteria.getSortBy())) {
-        searchCriteria.setSortBy(LogSearchConstants.FILTER_NAME);
-      }
-      if (StringUtils.isBlank(searchCriteria.getSortType())) {
-        searchCriteria.setSortType("" + SolrQuery.ORDER.asc);
-      }
-
-      queryGenerator.setSingleSortOrder(userConfigQuery, searchCriteria);
-      solrList = userConfigSolrDao.process(userConfigQuery).getResults();
-
-      Collection<VUserConfig> configList = new ArrayList<VUserConfig>();
-
-      for (SolrDocument solrDoc : solrList) {
-        VUserConfig userConfig = new VUserConfig();
-        userConfig.setFiltername("" + solrDoc.get(LogSearchConstants.FILTER_NAME));
-        userConfig.setId("" + solrDoc.get(LogSearchConstants.ID));
-        userConfig.setValues("" + solrDoc.get(LogSearchConstants.VALUES));
-        userConfig.setRowType("" + solrDoc.get(LogSearchConstants.ROW_TYPE));
-        try {
-          List<String> shareNameList = (List<String>) solrDoc.get(LogSearchConstants.SHARE_NAME_LIST);
-          userConfig.setShareNameList(shareNameList);
-        } catch (Exception e) {
-          // do nothing
-        }
-
-        userConfig.setUserName("" + solrDoc.get(LogSearchConstants.USER_NAME));
-
-        configList.add(userConfig);
-      }
-
-      userConfigList.setName("historyList");
-      userConfigList.setUserConfigList(configList);
-
-      userConfigList.setStartIndex(searchCriteria.getStartIndex());
-      userConfigList.setPageSize((int) searchCriteria.getMaxRows());
-
-      userConfigList.setTotalCount((long) solrList.getNumFound());
-    } catch (SolrException | SolrServerException | IOException e) {
-      // do nothing
-      logger.error(e);
-      throw RESTErrorUtil.createRESTException(MessageEnums.SOLR_ERROR.getMessage().getMessage(), MessageEnums.ERROR_SYSTEM);
-    }
-
-    return convertObjToString(userConfigList);
-
-  }
-
-  public String updateUserConfig(VUserConfig vuserConfig) {
-    return saveUserConfig(vuserConfig);
-  }
-
-  // ////////////////////////////LEVEL FILTER/////////////////////////////////////
-
-  public String getUserFilter() {
-    VLogfeederFilterWrapper userFilter;
-    try {
-      userFilter = userConfigSolrDao.getUserFilter();
-    } catch (SolrServerException | IOException e) {
-      logger.error(e);
-      throw RESTErrorUtil.createRESTException(MessageEnums.SOLR_ERROR.getMessage().getMessage(), MessageEnums.ERROR_SYSTEM);
-    }
-    return convertObjToString(userFilter);
-  }
-
-  public String saveUserFiter(String json) {
-    if (!StringUtils.isBlank(json)) {
-      VLogfeederFilterWrapper logfeederFilterWrapper = (VLogfeederFilterWrapper) JSONUtil.jsonToObj(json, VLogfeederFilterWrapper.class);
-      try {
-        if (logfeederFilterWrapper == null) {
-          logger.error(json + " is a invalid json");
-        }
-        userConfigSolrDao.saveUserFilter(logfeederFilterWrapper);
-      } catch (SolrException | SolrServerException | IOException e) {
-        logger.error("user config not able to save", e);
-        throw RESTErrorUtil.createRESTException(MessageEnums.SOLR_ERROR.getMessage().getMessage(), MessageEnums.ERROR_SYSTEM);
-      }
-    }
-    return getUserFilter();
-  }
-
-  public String getAllUserName() {
-    List<String> userList = new ArrayList<String>();
-    try {
-      SolrQuery userListQuery = new SolrQuery();
-      SolrUtil.setMainQuery(userListQuery, null);
-      SolrUtil.setFacetField(userListQuery, LogSearchConstants.USER_NAME);
-      QueryResponse queryResponse = userConfigSolrDao.process(userListQuery);
-      if (queryResponse == null) {
-        return convertObjToString(userList);
-      }
-      List<Count> counList = queryResponse.getFacetField(LogSearchConstants.USER_NAME).getValues();
-      for (Count cnt : counList) {
-        String userName = cnt.getName();
-        userList.add(userName);
-      }
-    } catch (SolrException | SolrServerException | IOException e) {
-      logger.warn("Error getting all users.", e);
-      throw RESTErrorUtil.createRESTException(MessageEnums.SOLR_ERROR.getMessage().getMessage(), MessageEnums.ERROR_SYSTEM);
-    }
-    return convertObjToString(userList);
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/AnyGraphParamDefinition.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/AnyGraphParamDefinition.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/AnyGraphParamDefinition.java
new file mode 100644
index 0000000..e92d7bf
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/AnyGraphParamDefinition.java
@@ -0,0 +1,44 @@
+/*
+ * 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.CommonDescriptions.X_AXIS_D;
+import static org.apache.ambari.logsearch.doc.DocConstants.CommonDescriptions.Y_AXIS_D;
+import static org.apache.ambari.logsearch.doc.DocConstants.CommonDescriptions.STACK_BY_D;
+
+public interface AnyGraphParamDefinition {
+
+  String getxAxis();
+
+  @ApiParam(value = X_AXIS_D, name = LogSearchConstants.REQUEST_PARAM_XAXIS)
+  void setxAxis(String xAxis);
+
+  String getyAxis();
+
+  @ApiParam(value = Y_AXIS_D, name = LogSearchConstants.REQUEST_PARAM_YAXIS)
+  void setyAxis(String yAxis);
+
+  String getStackBy();
+
+  @ApiParam(value = STACK_BY_D, name = LogSearchConstants.REQUEST_PARAM_STACK_BY)
+  void setStackBy(String stackBy);
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/BundleIdParamDefinition.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/BundleIdParamDefinition.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/BundleIdParamDefinition.java
new file mode 100644
index 0000000..aa1a393
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/BundleIdParamDefinition.java
@@ -0,0 +1,32 @@
+/*
+ * 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.BUNDLE_ID;
+
+public interface BundleIdParamDefinition {
+
+  String getBundleId();
+
+  @ApiParam(value = BUNDLE_ID, name = LogSearchConstants.REQUEST_PARAM_BUNDLE_ID)
+  void setBundleId(String bundleId);
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/CommonSearchParamDefinition.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/CommonSearchParamDefinition.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/CommonSearchParamDefinition.java
new file mode 100644
index 0000000..ef334d1
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/CommonSearchParamDefinition.java
@@ -0,0 +1,69 @@
+/*
+ * 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.CommonDescriptions.START_TIME_D;
+import static org.apache.ambari.logsearch.doc.DocConstants.CommonDescriptions.END_TIME_D;
+import static org.apache.ambari.logsearch.doc.DocConstants.CommonDescriptions.START_INDEX_D;
+import static org.apache.ambari.logsearch.doc.DocConstants.CommonDescriptions.PAGE_D;
+import static org.apache.ambari.logsearch.doc.DocConstants.CommonDescriptions.PAGE_SIZE_D;
+import static org.apache.ambari.logsearch.doc.DocConstants.CommonDescriptions.SORT_BY_D;
+import static org.apache.ambari.logsearch.doc.DocConstants.CommonDescriptions.SORT_TYPE_D;
+
+
+public interface CommonSearchParamDefinition {
+
+  String getStartIndex();
+
+  @ApiParam(value = START_INDEX_D, name = LogSearchConstants.REQUEST_PARAM_START_INDEX)
+  void setStartIndex(String startIndex);
+
+  String getPage();
+
+  @ApiParam(value = PAGE_D, name = LogSearchConstants.REQUEST_PARAM_PAGE)
+  void setPage(String page);
+
+  String getPageSize();
+
+  @ApiParam(value = PAGE_SIZE_D, name = LogSearchConstants.REQUEST_PARAM_PAGE_SIZE)
+  void setPageSize(String pageSize);
+
+  String getSortBy();
+
+  @ApiParam(value = SORT_BY_D, name = LogSearchConstants.REQUEST_PARAM_SORT_BY)
+  void setSortBy(String sortBy);
+
+  String getSortType();
+
+  @ApiParam(value = SORT_TYPE_D, name = LogSearchConstants.REQUEST_PARAM_SORT_TYPE)
+  void setSortType(String sortType);
+
+  String getStartTime();
+
+  @ApiParam(value = START_TIME_D, name = LogSearchConstants.REQUEST_PARAM_START_TIME)
+  void setStartTime(String startTime);
+
+  String getEndTime();
+
+  @ApiParam(value = END_TIME_D, name = LogSearchConstants.REQUEST_PARAM_END_TIME)
+  void setEndTime(String endTime);
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/DateRangeParamDefinition.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/DateRangeParamDefinition.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/DateRangeParamDefinition.java
new file mode 100644
index 0000000..e6edf7c
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/DateRangeParamDefinition.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.CommonDescriptions.FROM_D;
+import static org.apache.ambari.logsearch.doc.DocConstants.CommonDescriptions.TO_D;
+
+public interface DateRangeParamDefinition {
+
+  String getFrom();
+
+  @ApiParam(value = FROM_D, name = LogSearchConstants.REQUEST_PARAM_FROM)
+  void setFrom(String from);
+
+  String getTo();
+
+  @ApiParam(value = TO_D, name = LogSearchConstants.REQUEST_PARAM_TO)
+  void setTo(String to);
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/FieldParamDefinition.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/FieldParamDefinition.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/FieldParamDefinition.java
new file mode 100644
index 0000000..396fa93
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/FieldParamDefinition.java
@@ -0,0 +1,32 @@
+/*
+ * 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.CommonDescriptions.FIELD_D;
+
+public interface FieldParamDefinition {
+
+  String getField();
+
+  @ApiParam(value = FIELD_D, name = LogSearchConstants.REQUEST_PARAM_FIELD)
+  void setField(String field);
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/FormatParamDefinition.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/FormatParamDefinition.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/FormatParamDefinition.java
new file mode 100644
index 0000000..47f0620
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/FormatParamDefinition.java
@@ -0,0 +1,32 @@
+/*
+ * 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.CommonDescriptions.FORMAT_D;
+
+public interface FormatParamDefinition {
+
+  String getFormat();
+
+  @ApiParam(value = FORMAT_D, name = LogSearchConstants.REQUEST_PARAM_FORMAT)
+  void setFormat(String format);
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/LastPageParamDefinition.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/LastPageParamDefinition.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/LastPageParamDefinition.java
new file mode 100644
index 0000000..c8531db
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/LastPageParamDefinition.java
@@ -0,0 +1,31 @@
+/*
+ * 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.CommonDescriptions.IS_LAST_PAGE_D;
+
+public interface LastPageParamDefinition {
+  boolean isLastPage();
+
+  @ApiParam(value = IS_LAST_PAGE_D, name = LogSearchConstants.REQUEST_PARAM_LAST_PAGE)
+  void setLastPage(boolean lastPage);
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/LogFileParamDefinition.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/LogFileParamDefinition.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/LogFileParamDefinition.java
new file mode 100644
index 0000000..c355989
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/LogFileParamDefinition.java
@@ -0,0 +1,45 @@
+/*
+ * 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.LogFileDescriptions.COMPONENT_D;
+import static org.apache.ambari.logsearch.doc.DocConstants.LogFileDescriptions.HOST_D;
+import static org.apache.ambari.logsearch.doc.DocConstants.LogFileDescriptions.LOG_TYPE_D;
+
+
+public interface LogFileParamDefinition {
+
+  String getComponent();
+
+  @ApiParam(value = COMPONENT_D, name = LogSearchConstants.REQUEST_PARAM_COMPONENT)
+  void setComponent(String component);
+
+  String getHost();
+
+  @ApiParam(value = HOST_D, name = LogSearchConstants.REQUEST_PARAM_HOST)
+  void setHost(String host);
+
+  String getLogType();
+
+  @ApiParam(value = LOG_TYPE_D, name = LogSearchConstants.REQUEST_PARAM_LOG_TYPE)
+  void setLogType(String logType);
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/LogFileTailParamDefinition.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/LogFileTailParamDefinition.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/LogFileTailParamDefinition.java
new file mode 100644
index 0000000..a527c48
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/LogFileTailParamDefinition.java
@@ -0,0 +1,32 @@
+/*
+ * 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.LogFileDescriptions.TAIL_SIZE_D;
+
+public interface LogFileTailParamDefinition {
+
+  String getTailSize();
+
+  @ApiParam(value = TAIL_SIZE_D, name = LogSearchConstants.REQUEST_PARAM_TAIL_SIZE)
+  void setTailSize(String tailSize);
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/LogParamDefinition.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/LogParamDefinition.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/LogParamDefinition.java
new file mode 100644
index 0000000..e503ff5
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/LogParamDefinition.java
@@ -0,0 +1,68 @@
+/*
+ * 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.CommonDescriptions.COLUMN_QUERY_D;
+import static org.apache.ambari.logsearch.doc.DocConstants.CommonDescriptions.I_MESSAGE_D;
+import static org.apache.ambari.logsearch.doc.DocConstants.CommonDescriptions.G_E_MESSAGE_D;
+import static org.apache.ambari.logsearch.doc.DocConstants.CommonDescriptions.MUST_BE_D;
+import static org.apache.ambari.logsearch.doc.DocConstants.CommonDescriptions.MUST_NOT_D;
+import static org.apache.ambari.logsearch.doc.DocConstants.CommonDescriptions.INCLUDE_QUERY_D;
+import static org.apache.ambari.logsearch.doc.DocConstants.CommonDescriptions.EXCLUDE_QUERY_D;
+
+public interface LogParamDefinition {
+
+  String getColumnQuery();
+
+  @ApiParam(value = COLUMN_QUERY_D, name = LogSearchConstants.REQUEST_PARAM_COLUMN_QUERY)
+  void setColumnQuery(String columnQuery);
+
+  String getiMessage();
+
+  @ApiParam(value = I_MESSAGE_D, name = LogSearchConstants.REQUEST_PARAM_I_MESSAGE)
+  void setiMessage(String iMessage);
+
+  String getgEMessage();
+
+  @ApiParam(value = G_E_MESSAGE_D, name = LogSearchConstants.REQUEST_PARAM_G_E_MESSAGE)
+  void setgEMessage(String gEMessage);
+
+  String getMustBe();
+
+  @ApiParam(value = MUST_BE_D, name = LogSearchConstants.REQUEST_PARAM_MUST_BE)
+  void setMustBe(String mustBe);
+
+  String getMustNot();
+
+  @ApiParam(value = MUST_NOT_D, name = LogSearchConstants.REQUEST_PARAM_MUST_NOT)
+  void setMustNot(String mustNot);
+
+  String getIncludeQuery();
+
+  @ApiParam(value = INCLUDE_QUERY_D, name = LogSearchConstants.REQUEST_PARAM_INCLUDE_QUERY)
+  void setIncludeQuery(String includeQuery);
+
+  String getExcludeQuery();
+
+  @ApiParam(value = EXCLUDE_QUERY_D, name = LogSearchConstants.REQUEST_PARAM_EXCLUDE_QUERY)
+  void setExcludeQuery(String excludeQuery);
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/LogTruncatedParamDefinition.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/LogTruncatedParamDefinition.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/LogTruncatedParamDefinition.java
new file mode 100644
index 0000000..c3e2998
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/LogTruncatedParamDefinition.java
@@ -0,0 +1,44 @@
+/*
+ * 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.ID_D;
+import static org.apache.ambari.logsearch.doc.DocConstants.ServiceDescriptions.SCROLL_TYPE_D;
+import static org.apache.ambari.logsearch.doc.DocConstants.ServiceDescriptions.NUMBER_ROWS_D;
+
+public interface LogTruncatedParamDefinition {
+
+  String getId();
+
+  @ApiParam(value = ID_D, name = LogSearchConstants.REQUEST_PARAM_ID)
+  void setId(String id);
+
+  String getScrollType();
+
+  @ApiParam(value = SCROLL_TYPE_D, name = LogSearchConstants.REQUEST_PARAM_SCROLL_TYPE)
+  void setScrollType(String scrollType);
+
+  String getNumberRows();
+
+  @ApiParam(value = NUMBER_ROWS_D, name = LogSearchConstants.REQUEST_PARAM_NUMBER_ROWS)
+  void setNumberRows(String numberRows);
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/QueryParamDefinition.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/QueryParamDefinition.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/QueryParamDefinition.java
new file mode 100644
index 0000000..3fcdbc0
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/QueryParamDefinition.java
@@ -0,0 +1,32 @@
+/*
+ * 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.CommonDescriptions.QUERY_D;
+
+public interface QueryParamDefinition {
+
+  String getQuery();
+
+  @ApiParam(value = QUERY_D, name = LogSearchConstants.REQUEST_PARAM_QUERY)
+  void setQuery(String query);
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/SearchRequest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/SearchRequest.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/SearchRequest.java
new file mode 100644
index 0000000..0015c09
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/SearchRequest.java
@@ -0,0 +1,25 @@
+/*
+ * 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 org.apache.ambari.logsearch.common.Marker;
+
+@Marker
+public interface SearchRequest {
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/ServiceLogFileParamDefinition.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/ServiceLogFileParamDefinition.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/ServiceLogFileParamDefinition.java
new file mode 100644
index 0000000..a266b3e
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/ServiceLogFileParamDefinition.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_D;
+import static org.apache.ambari.logsearch.doc.DocConstants.ServiceDescriptions.COMPONENT_D;
+
+public interface ServiceLogFileParamDefinition {
+
+  String getHostLogFile();
+
+  @ApiParam(value = HOST_D, name = LogSearchConstants.REQUEST_PARAM_HOST_LOG_FILE)
+  void setHostLogFile(String hostLogFile);
+
+  String getComponentLogFile();
+
+  @ApiParam(value = COMPONENT_D, name = LogSearchConstants.REQUEST_PARAM_COMPONENT_LOG_FILE)
+  void setComponentLogFile(String componentLogFile);
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/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
new file mode 100644
index 0000000..f280ac2
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/ServiceLogParamDefinition.java
@@ -0,0 +1,80 @@
+/*
+ * 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.LEVEL_D;
+import static org.apache.ambari.logsearch.doc.DocConstants.ServiceDescriptions.ADVANCED_SEARCH_D;
+import static org.apache.ambari.logsearch.doc.DocConstants.ServiceDescriptions.TREE_PARAMS_D;
+import static org.apache.ambari.logsearch.doc.DocConstants.CommonDescriptions.E_MESSAGE_D;
+import static org.apache.ambari.logsearch.doc.DocConstants.ServiceDescriptions.G_MUST_NOT_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;
+import static org.apache.ambari.logsearch.doc.DocConstants.ServiceDescriptions.DATE_RANGE_LABEL_D;
+
+public interface ServiceLogParamDefinition {
+
+  String getLevel();
+
+  @ApiParam(value = LEVEL_D, name = LogSearchConstants.REQUEST_PARAM_LEVEL)
+  void setLevel(String level);
+
+  String getAdvancedSearch();
+
+  @ApiParam(value = ADVANCED_SEARCH_D, name = LogSearchConstants.REQUEST_PARAM_ADVANCED_SEARCH)
+  void setAdvancedSearch(String advancedSearch);
+
+  String getTreeParams();
+
+  @ApiParam(value = TREE_PARAMS_D, name = LogSearchConstants.REQUEST_PARAM_TREE_PARAMS)
+  void setTreeParams(String treeParams);
+
+  String geteMessage();
+
+  @ApiParam(value = E_MESSAGE_D, name = LogSearchConstants.REQUEST_PARAM_E_MESSAGE)
+  void seteMessage(String eMessage);
+
+  String getgMustNot();
+
+  @ApiParam(value = G_MUST_NOT_D, name = LogSearchConstants.REQUEST_PARAM_G_MUST_NOT)
+  void setgMustNot(String gMustNot);
+
+  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)
+  void setFileName(String fileName);
+
+  String getDateRangeLabel();
+
+  @ApiParam(value = DATE_RANGE_LABEL_D, name = LogSearchConstants.REQUEST_PARAM_DATE_RANGE_LABEL)
+  void setDateRangeLabel(String dateRangeLabel);
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/ServiceLogSearchParamDefinition.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/ServiceLogSearchParamDefinition.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/ServiceLogSearchParamDefinition.java
new file mode 100644
index 0000000..9d8f1a6
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/ServiceLogSearchParamDefinition.java
@@ -0,0 +1,50 @@
+/*
+ * 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.FIND_D;
+import static org.apache.ambari.logsearch.doc.DocConstants.ServiceDescriptions.KEYWORD_TYPE_D;
+import static org.apache.ambari.logsearch.doc.DocConstants.ServiceDescriptions.SOURCE_LOG_ID_D;
+import static org.apache.ambari.logsearch.doc.DocConstants.ServiceDescriptions.TOKEN_D;
+
+public interface ServiceLogSearchParamDefinition {
+
+  String getKeyWord();
+
+  @ApiParam(value = FIND_D, name = LogSearchConstants.REQUEST_PARAM_KEYWORD)
+  void setKeyWord(String keyWord);
+
+  String getSourceLogId();
+
+  @ApiParam(value = SOURCE_LOG_ID_D, name = LogSearchConstants.REQUEST_PARAM_SOURCE_LOG_ID)
+  void setSourceLogId(String sourceLogId);
+
+  String getKeywordType();
+
+  @ApiParam(value = KEYWORD_TYPE_D, name = LogSearchConstants.REQUEST_PARAM_KEYWORD_TYPE)
+  void setKeywordType(String keywordType);
+
+  String getToken();
+
+  @ApiParam(value = TOKEN_D, name = LogSearchConstants.REQUEST_PARAM_TOKEN)
+  void setToken(String token);
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/UnitParamDefinition.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/UnitParamDefinition.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/UnitParamDefinition.java
new file mode 100644
index 0000000..3f493da
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/UnitParamDefinition.java
@@ -0,0 +1,33 @@
+/*
+ * 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.CommonDescriptions.UNIT_D;
+
+public interface UnitParamDefinition {
+
+  String getUnit();
+
+  @ApiParam(value = UNIT_D, name = LogSearchConstants.REQUEST_PARAM_UNIT)
+  void setUnit(String unit);
+
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/UserConfigParamDefinition.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/UserConfigParamDefinition.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/UserConfigParamDefinition.java
new file mode 100644
index 0000000..23b350a
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/UserConfigParamDefinition.java
@@ -0,0 +1,44 @@
+/*
+ * 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.UserConfigDescriptions.USER_ID_D;
+import static org.apache.ambari.logsearch.doc.DocConstants.UserConfigDescriptions.FILTER_NAME_D;
+import static org.apache.ambari.logsearch.doc.DocConstants.UserConfigDescriptions.ROW_TYPE_D;
+
+public interface UserConfigParamDefinition {
+
+  String getUserId();
+
+  @ApiParam(value = USER_ID_D, name = LogSearchConstants.REQUEST_PARAM_USER_ID)
+  void setUserId(String userId);
+
+  String getFilterName();
+
+  @ApiParam(value = FILTER_NAME_D, name = LogSearchConstants.REQUEST_PARAM_FILTER_NAME)
+  void setFilterName(String filterName);
+
+  String getRowType();
+
+  @ApiParam(value = ROW_TYPE_D, name = LogSearchConstants.REQUEST_PARAM_ROW_TYPE)
+  void setRowType(String rowType);
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/UtcOffsetParamDefinition.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/UtcOffsetParamDefinition.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/UtcOffsetParamDefinition.java
new file mode 100644
index 0000000..aa2be71
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/UtcOffsetParamDefinition.java
@@ -0,0 +1,32 @@
+/*
+ * 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.UTC_OFFSET_D;
+
+public interface UtcOffsetParamDefinition {
+
+  String getUtcOffset();
+
+  @ApiParam(value = UTC_OFFSET_D, name = LogSearchConstants.REQUEST_PARAM_UTC_OFFSET)
+  void setUtcOffset(String utcOffset);
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/AnyGraphRequest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/AnyGraphRequest.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/AnyGraphRequest.java
new file mode 100644
index 0000000..41da712
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/AnyGraphRequest.java
@@ -0,0 +1,109 @@
+/*
+ * 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 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;
+
+public class AnyGraphRequest extends CommonSearchRequest
+  implements AnyGraphParamDefinition, DateRangeParamDefinition, UnitParamDefinition{
+
+  @QueryParam(LogSearchConstants.REQUEST_PARAM_XAXIS)
+  private String xAxis;
+
+  @QueryParam(LogSearchConstants.REQUEST_PARAM_YAXIS)
+  private String yAxis;
+
+  @QueryParam(LogSearchConstants.REQUEST_PARAM_STACK_BY)
+  private String stackBy;
+
+  @QueryParam(LogSearchConstants.REQUEST_PARAM_FROM)
+  private String from;
+
+  @QueryParam(LogSearchConstants.REQUEST_PARAM_TO)
+  private String to;
+
+  @QueryParam(LogSearchConstants.REQUEST_PARAM_UNIT)
+  private String unit;
+
+  @Override
+  public String getxAxis() {
+    return xAxis;
+  }
+
+  @Override
+  public void setxAxis(String xAxis) {
+    this.xAxis = xAxis;
+  }
+
+  @Override
+  public String getyAxis() {
+    return yAxis;
+  }
+
+  @Override
+  public void setyAxis(String yAxis) {
+    this.yAxis = yAxis;
+  }
+
+  @Override
+  public String getStackBy() {
+    return stackBy;
+  }
+
+  @Override
+  public void setStackBy(String stackBy) {
+    this.stackBy = stackBy;
+  }
+
+  @Override
+  public String getFrom() {
+    return from;
+  }
+
+  @Override
+  public void setFrom(String from) {
+    this.from = from;
+  }
+
+  @Override
+  public String getTo() {
+    return to;
+  }
+
+  @Override
+  public void setTo(String to) {
+    this.to = to;
+  }
+
+  @Override
+  public String getUnit() {
+    return unit;
+  }
+
+  @Override
+  public void setUnit(String unit) {
+    this.unit = unit;
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/AuditBarGraphRequest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/AuditBarGraphRequest.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/AuditBarGraphRequest.java
new file mode 100644
index 0000000..91e7d1e
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/AuditBarGraphRequest.java
@@ -0,0 +1,40 @@
+/*
+ * 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 org.apache.ambari.logsearch.common.LogSearchConstants;
+import org.apache.ambari.logsearch.model.request.UnitParamDefinition;
+
+import javax.ws.rs.QueryParam;
+
+public class AuditBarGraphRequest extends BaseAuditLogRequest implements UnitParamDefinition {
+
+  @QueryParam(LogSearchConstants.REQUEST_PARAM_UNIT)
+  private String unit;
+
+  @Override
+  public String getUnit() {
+    return unit;
+  }
+
+  @Override
+  public void setUnit(String unit) {
+    this.unit = unit;
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/AuditLogRequest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/AuditLogRequest.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/AuditLogRequest.java
new file mode 100644
index 0000000..8dd13dc
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/AuditLogRequest.java
@@ -0,0 +1,40 @@
+/*
+ * 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 org.apache.ambari.logsearch.common.LogSearchConstants;
+import org.apache.ambari.logsearch.model.request.LastPageParamDefinition;
+
+import javax.ws.rs.QueryParam;
+
+public class AuditLogRequest extends BaseAuditLogRequest implements LastPageParamDefinition {
+
+  @QueryParam(LogSearchConstants.REQUEST_PARAM_LAST_PAGE)
+  private boolean isLastPage;
+
+  @Override
+  public boolean isLastPage() {
+    return isLastPage;
+  }
+
+  @Override
+  public void setLastPage(boolean lastPage) {
+    isLastPage = lastPage;
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/BaseAuditLogRequest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/BaseAuditLogRequest.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/BaseAuditLogRequest.java
new file mode 100644
index 0000000..74b4ab7
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/BaseAuditLogRequest.java
@@ -0,0 +1,53 @@
+/*
+ * 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 org.apache.ambari.logsearch.common.LogSearchConstants;
+import org.apache.ambari.logsearch.model.request.DateRangeParamDefinition;
+
+import javax.ws.rs.QueryParam;
+
+public class BaseAuditLogRequest extends BaseLogRequest implements DateRangeParamDefinition {
+
+  @QueryParam(LogSearchConstants.REQUEST_PARAM_FROM)
+  private String from;
+
+  @QueryParam(LogSearchConstants.REQUEST_PARAM_TO)
+  private String to;
+
+  @Override
+  public String getFrom() {
+    return from;
+  }
+
+  @Override
+  public void setFrom(String from) {
+    this.from = from;
+  }
+
+  @Override
+  public String getTo() {
+    return to;
+  }
+
+  @Override
+  public void setTo(String to) {
+    this.to = to;
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/BaseLogRequest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/BaseLogRequest.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/BaseLogRequest.java
new file mode 100644
index 0000000..5a96991
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/BaseLogRequest.java
@@ -0,0 +1,118 @@
+/*
+ * 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 io.swagger.annotations.ApiParam;
+import org.apache.ambari.logsearch.common.LogSearchConstants;
+import org.apache.ambari.logsearch.model.request.LogParamDefinition;
+
+import javax.ws.rs.QueryParam;
+
+public class BaseLogRequest extends QueryRequest implements LogParamDefinition {
+  @QueryParam(LogSearchConstants.REQUEST_PARAM_COLUMN_QUERY)
+  private String columnQuery;
+
+  @QueryParam(LogSearchConstants.REQUEST_PARAM_I_MESSAGE)
+  private String iMessage;
+
+  @QueryParam(LogSearchConstants.REQUEST_PARAM_G_E_MESSAGE)
+  private String gEMessage;
+
+  @QueryParam(LogSearchConstants.REQUEST_PARAM_MUST_BE)
+  private String mustBe;
+
+  @QueryParam(LogSearchConstants.REQUEST_PARAM_MUST_NOT)
+  private String mustNot;
+
+  @QueryParam(LogSearchConstants.REQUEST_PARAM_EXCLUDE_QUERY)
+  private String excludeQuery;
+
+  @QueryParam(LogSearchConstants.REQUEST_PARAM_INCLUDE_QUERY)
+  private String includeQuery;
+
+  @Override
+  public String getColumnQuery() {
+    return columnQuery;
+  }
+
+  @Override
+  public void setColumnQuery(String columnQuery) {
+    this.columnQuery = columnQuery;
+  }
+
+  @Override
+  public String getiMessage() {
+    return iMessage;
+  }
+
+  @Override
+  public void setiMessage(String iMessage) {
+    this.iMessage = iMessage;
+  }
+
+  @Override
+  public String getgEMessage() {
+    return gEMessage;
+  }
+
+  @Override
+  public void setgEMessage(String gEMessage) {
+    this.gEMessage = gEMessage;
+  }
+
+  @Override
+  public String getMustBe() {
+    return mustBe;
+  }
+
+  @Override
+  public void setMustBe(String mustBe) {
+    this.mustBe = mustBe;
+  }
+
+  @Override
+  public String getMustNot() {
+    return mustNot;
+  }
+
+  @Override
+  public void setMustNot(String mustNot) {
+    this.mustNot = mustNot;
+  }
+
+  @Override
+  public String getIncludeQuery() {
+    return includeQuery;
+  }
+
+  @Override
+  public void setIncludeQuery(String includeQuery) {
+    this.includeQuery = includeQuery;
+  }
+
+  @Override
+  public String getExcludeQuery() {
+    return excludeQuery;
+  }
+
+  @Override
+  public void setExcludeQuery(String excludeQuery) {
+    this.excludeQuery = excludeQuery;
+  }
+}


[34/58] [abbrv] ambari git commit: AMBARI-18293. Enable log search for NIFI_CA component (Miklos Gergely via oleewere)

Posted by ol...@apache.org.
AMBARI-18293. Enable log search for NIFI_CA component (Miklos Gergely via oleewere)

Change-Id: I62deb855422f53c8069f4b75a7621cdeb596846f


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

Branch: refs/heads/branch-2.5
Commit: 0c73672127b0a8033a6cf3efd6c1caf4c1ed97d0
Parents: d716420
Author: Miklos Gergely <mg...@hortonworks.com>
Authored: Mon Oct 3 16:09:10 2016 +0200
Committer: oleewere <ol...@gmail.com>
Committed: Sat Nov 5 14:46:45 2016 +0100

----------------------------------------------------------------------
 .../0.5.0/package/templates/HadoopServiceConfig.json.j2       | 3 +++
 .../0.5.0/package/templates/input.config-nifi.json.j2         | 7 ++++++-
 2 files changed, 9 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/0c736721/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/templates/HadoopServiceConfig.json.j2
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/templates/HadoopServiceConfig.json.j2 b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/templates/HadoopServiceConfig.json.j2
index 9ce3fde..7982631 100644
--- a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/templates/HadoopServiceConfig.json.j2
+++ b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/templates/HadoopServiceConfig.json.j2
@@ -281,6 +281,9 @@
         },
         {
           "name": "nifi_user"
+        },
+        {
+          "name": "nifi_ca"
         }
       ],
       "dependencies": [

http://git-wip-us.apache.org/repos/asf/ambari/blob/0c736721/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/templates/input.config-nifi.json.j2
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/templates/input.config-nifi.json.j2 b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/templates/input.config-nifi.json.j2
index 99f1740..fe5c426 100644
--- a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/templates/input.config-nifi.json.j2
+++ b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/templates/input.config-nifi.json.j2
@@ -36,8 +36,12 @@
       "type":"nifi_user",
       "rowtype":"service",
       "path":"{{nifi_log_dir}}/nifi-user.log"
+    },
+    {
+      "type":"nifi_ca",
+      "rowtype":"service",
+      "path":"{{nifi_log_dir}}/nifi-ca.stdout"
     }
-
   ],
   "filter":[
     {
@@ -49,6 +53,7 @@
             "nifi_bootstrap",
             "nifi_setup",
             "nifi_user",
+            "nifi_ca"
           ]
 
         }


[08/58] [abbrv] ambari git commit: AMBARI-18310. Refactor logsearch portal side code (oleewere)

Posted by ol...@apache.org.
http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/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
new file mode 100644
index 0000000..c4d14a9
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/manager/ServiceLogsManager.java
@@ -0,0 +1,1917 @@
+/*
+ * 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.manager;
+
+import java.io.IOException;
+import java.text.ParseException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Calendar;
+import java.util.Collection;
+import java.util.Date;
+import java.util.GregorianCalendar;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.TimeZone;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.CopyOnWriteArrayList;
+
+import javax.inject.Inject;
+import javax.ws.rs.core.Response;
+
+import org.apache.ambari.logsearch.common.ConfigHelper;
+import org.apache.ambari.logsearch.common.LogSearchConstants;
+import org.apache.ambari.logsearch.common.MessageEnums;
+import org.apache.ambari.logsearch.common.PropertiesHelper;
+import org.apache.ambari.logsearch.conf.SolrServiceLogConfig;
+import org.apache.ambari.logsearch.dao.ServiceLogsSolrDao;
+import org.apache.ambari.logsearch.graph.GraphDataGenerator;
+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.GroupListResponse;
+import org.apache.ambari.logsearch.model.response.LogData;
+import org.apache.ambari.logsearch.model.response.LogListResponse;
+import org.apache.ambari.logsearch.model.response.LogSearchResponse;
+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.ambari.logsearch.model.response.ServiceLogData;
+import org.apache.ambari.logsearch.model.response.ServiceLogResponse;
+import org.apache.ambari.logsearch.query.QueryGenerationBase;
+import org.apache.ambari.logsearch.solr.model.SolrComponentTypeLogData;
+import org.apache.ambari.logsearch.solr.model.SolrHostLogData;
+import org.apache.ambari.logsearch.solr.model.SolrServiceLogData;
+import org.apache.ambari.logsearch.util.BizUtil;
+import org.apache.ambari.logsearch.util.DateUtil;
+import org.apache.ambari.logsearch.util.FileUtil;
+import org.apache.ambari.logsearch.util.RESTErrorUtil;
+import org.apache.ambari.logsearch.util.SolrUtil;
+import org.apache.ambari.logsearch.view.VSummary;
+import org.apache.ambari.logsearch.query.model.SearchCriteria;
+import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang.time.DateUtils;
+import org.apache.log4j.Logger;
+import org.apache.solr.client.solrj.SolrQuery;
+import org.apache.solr.client.solrj.SolrServerException;
+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.SolrDocument;
+import org.apache.solr.common.SolrDocumentList;
+import org.apache.solr.common.SolrException;
+import org.apache.solr.common.util.NamedList;
+import org.apache.solr.common.util.SimpleOrderedMap;
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.stereotype.Component;
+
+import com.google.common.collect.Lists;
+
+@Component
+public class ServiceLogsManager extends ManagerBase<SolrServiceLogData, ServiceLogResponse> {
+
+  private static final Logger logger = Logger.getLogger(ServiceLogsManager.class);
+
+  private static List<String> cancelByDate = new CopyOnWriteArrayList<String>();
+
+  private static Map<String, String> mapUniqueId = new ConcurrentHashMap<String, String>();
+
+  private enum CONDITION {
+    OR, AND
+  }
+
+  @Inject
+  private ServiceLogsSolrDao serviceLogsSolrDao;
+  @Inject
+  private GraphDataGenerator graphDataGenerator;
+  @Inject
+  private SolrServiceLogConfig solrServiceLogConfig;
+
+  public ServiceLogResponse searchLogs(SearchCriteria searchCriteria) {
+    String keyword = (String) searchCriteria.getParamValue("keyword");
+    String logId = (String) searchCriteria.getParamValue("sourceLogId");
+    Boolean isLastPage = (Boolean) searchCriteria.getParamValue("isLastPage");
+
+    if (!StringUtils.isBlank(keyword)) {
+      try {
+        return (ServiceLogResponse) getPageByKeyword(searchCriteria);
+      } catch (SolrException | SolrServerException e) {
+        logger.error("Error while getting keyword=" + keyword, e);
+        throw RESTErrorUtil.createRESTException(MessageEnums.SOLR_ERROR
+            .getMessage().getMessage(), MessageEnums.ERROR_SYSTEM);
+      }
+    } else if (!StringUtils.isBlank(logId)) {
+      try {
+        return (ServiceLogResponse) getPageByLogId(searchCriteria);
+      } catch (SolrException e) {
+        logger.error("Error while getting keyword=" + keyword, e);
+        throw RESTErrorUtil.createRESTException(MessageEnums.SOLR_ERROR
+            .getMessage().getMessage(), MessageEnums.ERROR_SYSTEM);
+      }
+    } else if (isLastPage) {
+      SolrQuery lastPageQuery = queryGenerator.commonServiceFilterQuery(searchCriteria);
+      ServiceLogResponse logResponse = getLastPage(searchCriteria,LogSearchConstants.LOGTIME,serviceLogsSolrDao,lastPageQuery);
+      if(logResponse == null){
+        logResponse = new ServiceLogResponse();
+      }
+      return logResponse;
+    } else {
+      SolrQuery solrQuery = queryGenerator
+          .commonServiceFilterQuery(searchCriteria);
+
+      solrQuery.setParam("event", "/service/logs");
+
+      return getLogAsPaginationProvided(solrQuery,
+          serviceLogsSolrDao);
+    }
+  }
+
+  public GroupListResponse getHosts() {
+    return getFields(LogSearchConstants.SOLR_HOST, SolrHostLogData.class);
+  }
+  
+  private <T extends LogData> GroupListResponse getFields(String field, Class<T> clazz) {
+
+    SolrQuery solrQuery = new SolrQuery();
+    GroupListResponse collection = new GroupListResponse();
+    SolrUtil.setMainQuery(solrQuery, null);
+    SolrUtil.setFacetField(solrQuery,
+        field);
+    SolrUtil.setFacetSort(solrQuery, LogSearchConstants.FACET_INDEX);
+    try {
+      QueryResponse response = serviceLogsSolrDao.process(solrQuery);
+      if(response == null){
+        return collection;
+      }
+      FacetField facetField = response
+        .getFacetField(field);
+      if (facetField == null){
+        return collection;
+      }
+      List<Count> fieldList = facetField.getValues();
+      if (fieldList == null){
+        return collection;
+      }
+      SolrDocumentList docList = response.getResults();
+      if(docList == null){
+        return collection;
+      }
+      List<LogData> groupList = getLogDataListByFieldType(clazz, response, fieldList);
+
+      collection.setGroupList(groupList);
+      if(!docList.isEmpty()){
+        collection.setStartIndex((int) docList.getStart());
+        collection.setTotalCount(docList.getNumFound());
+      }
+      return collection;
+    } catch (IOException | SolrServerException | SolrException e) {
+      logger.error(e);
+      throw RESTErrorUtil.createRESTException(MessageEnums.SOLR_ERROR
+          .getMessage().getMessage(), MessageEnums.ERROR_SYSTEM);
+    }
+
+  }
+
+  public GroupListResponse getComponents() {
+    return getFields(LogSearchConstants.SOLR_COMPONENT, SolrComponentTypeLogData.class);
+  }
+
+  public GraphDataListResponse getAggregatedInfo(SearchCriteria searchCriteria) {
+    SolrQuery solrQuery = queryGenerator.commonServiceFilterQuery(searchCriteria);
+    String hierarchy = "host,type,level";
+    GraphDataListResponse graphInfo = new GraphDataListResponse();
+    try {
+      SolrUtil.setMainQuery(solrQuery, null);
+      SolrUtil.setFacetPivot(solrQuery, 1, hierarchy);
+      QueryResponse response = serviceLogsSolrDao.process(solrQuery);
+      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;
+    } catch (SolrException | SolrServerException | IOException e) {
+      logger.error("Error during solrQuery=" + solrQuery, e);
+      throw RESTErrorUtil.createRESTException(MessageEnums.SOLR_ERROR
+          .getMessage().getMessage(), MessageEnums.ERROR_SYSTEM);
+    }
+  }
+
+  public 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 CountDataListResponse getFieldCount(String field){
+    CountDataListResponse collection = new CountDataListResponse();
+    List<CountData> vCounts = new ArrayList<>();
+    SolrQuery solrQuery = new SolrQuery();
+    SolrUtil.setMainQuery(solrQuery, null);
+    if(field == null){
+      return collection;
+    }
+    SolrUtil.setFacetField(solrQuery, field);
+    try {
+      QueryResponse response = serviceLogsSolrDao.process(solrQuery);
+      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);
+        }
+      }
+
+    } catch (SolrException | SolrServerException | IOException e) {
+      logger.error("Error during solrQuery=" + solrQuery, e);
+      throw RESTErrorUtil.createRESTException(MessageEnums.SOLR_ERROR
+          .getMessage().getMessage(), MessageEnums.ERROR_SYSTEM);
+    }
+
+    collection.setvCounts(vCounts);
+    return collection;
+  }
+  
+  public CountDataListResponse getLogLevelCount() {
+    return getFieldCount(LogSearchConstants.SOLR_LEVEL);
+  }
+
+  public CountDataListResponse getComponentsCount() {
+    return getFieldCount(LogSearchConstants.SOLR_COMPONENT);
+  }
+
+  public CountDataListResponse getHostsCount() {
+    return getFieldCount(LogSearchConstants.SOLR_HOST);
+  }
+
+  public List<NodeData> buidTreeData(List<PivotField> pivotFields,
+                                     List<PivotField> pivotFieldHost, SolrQuery query,
+                                     String firstPriority, String secondPriority) {
+    List<NodeData> extensionTree = new ArrayList<>();
+    String hostQuery = null;
+    if (pivotFields != null) {
+      // For Host
+      for (PivotField pivotHost : pivotFields) {
+        if (pivotHost != null) {
+          NodeData hostNode = new NodeData();
+          String name = (pivotHost.getValue() == null ? "" : ""+ pivotHost.getValue());
+          String value = "" + pivotHost.getCount();
+          if(!StringUtils.isBlank(name)){
+            hostNode.setName(name);
+          }
+          if(!StringUtils.isBlank(value)){
+            hostNode.setValue(value);
+          }
+          if(!StringUtils.isBlank(firstPriority)){
+            hostNode.setType(firstPriority);
+          }
+
+          hostNode.setParent(true);
+          hostNode.setRoot(true);
+          PivotField hostPivot = null;
+          for (PivotField searchHost : pivotFieldHost) {
+            if (!StringUtils.isBlank(hostNode.getName())
+                && hostNode.getName().equals(searchHost.getValue())) {
+              hostPivot = searchHost;
+              break;
+            }
+          }
+          List<PivotField> pivotLevelHost = 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);
+          }
+
+          query.addFilterQuery(hostQuery);
+          List<PivotField> pivotComponents = pivotHost.getPivot();
+          // For Components
+          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.isBlank(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;
+  }
+
+  public NodeListResponse getTreeExtension(SearchCriteria searchCriteria) {
+    SolrQuery solrQuery = queryGenerator.commonServiceFilterQuery(searchCriteria);
+    solrQuery.setParam("event", "/getTreeExtension");
+
+    if (searchCriteria.getSortBy() == null) {
+      searchCriteria.setSortBy(LogSearchConstants.SOLR_HOST);
+      searchCriteria.setSortType(SolrQuery.ORDER.asc.toString());
+    }
+    queryGenerator.setFilterFacetSort(solrQuery, searchCriteria);
+    String hostName = ""
+      + ((searchCriteria.getParamValue("hostName") == null) ? ""
+      : searchCriteria.getParamValue("hostName"));
+    if (!StringUtils.isBlank(hostName)){
+      solrQuery.addFilterQuery(LogSearchConstants.SOLR_HOST + ":*"
+        + hostName + "*");
+    }
+    String firstHirarchy = "host,type,level";
+    String secondHirarchy = "host,level";
+    NodeListResponse list = new NodeListResponse();
+    try {
+
+      SolrUtil.setFacetPivot(solrQuery, 1, firstHirarchy,
+        secondHirarchy);
+
+      QueryResponse response = serviceLogsSolrDao.process(solrQuery);
+      List<List<PivotField>> listFirstHirarchicalPivotFields = new ArrayList<List<PivotField>>();
+      NamedList<List<PivotField>> firstNamedList = response
+        .getFacetPivot();
+      if (firstNamedList != null) {
+        listFirstHirarchicalPivotFields = firstNamedList
+          .getAll(firstHirarchy);
+      }
+      List<List<PivotField>> listSecondHirarchicalPivotFields = new ArrayList<List<PivotField>>();
+      NamedList<List<PivotField>> secondNamedList = response
+        .getFacetPivot();
+      if (secondNamedList != null) {
+        listSecondHirarchicalPivotFields = secondNamedList
+          .getAll(secondHirarchy);
+      }
+      List<PivotField> firstHirarchicalPivotFields = new ArrayList<PivotField>();
+      List<PivotField> secondHirarchicalPivotFields = new ArrayList<PivotField>();
+      if (!listFirstHirarchicalPivotFields.isEmpty()) {
+        firstHirarchicalPivotFields = listFirstHirarchicalPivotFields
+          .get(0);
+      }
+      if (!listSecondHirarchicalPivotFields.isEmpty()) {
+        secondHirarchicalPivotFields = listSecondHirarchicalPivotFields
+          .get(0);
+      }
+      List<NodeData> dataList = buidTreeData(firstHirarchicalPivotFields,
+        secondHirarchicalPivotFields, solrQuery,
+        LogSearchConstants.HOST, LogSearchConstants.COMPONENT);
+
+      list.setvNodeList(dataList);
+    } catch (SolrException | SolrServerException | IOException e) {
+      logger.error("Error during solrQuery=" + solrQuery, e);
+      throw RESTErrorUtil.createRESTException(MessageEnums.SOLR_ERROR
+          .getMessage().getMessage(), MessageEnums.ERROR_SYSTEM);
+    }
+
+    return list;
+  }
+
+  public NodeListResponse getHostListByComponent(SearchCriteria searchCriteria) {
+    SolrQuery solrQuery = queryGenerator.commonServiceFilterQuery(searchCriteria);
+    solrQuery.setParam("event", "/service/hosts/components");
+
+    NodeListResponse list = new NodeListResponse();
+    if (searchCriteria.getSortBy() == null) {
+      searchCriteria.setSortBy(LogSearchConstants.SOLR_HOST);
+      searchCriteria.setSortType(SolrQuery.ORDER.asc.toString());
+    }
+    queryGenerator.setFilterFacetSort(solrQuery, searchCriteria);
+    String componentName = ""
+      + ((searchCriteria.getParamValue("componentName") == null) ? ""
+      : searchCriteria.getParamValue("componentName"));
+    if (!StringUtils.isBlank(componentName)){
+      solrQuery.addFilterQuery(LogSearchConstants.SOLR_COMPONENT + ":"
+        + componentName);
+    } else {
+      return list;
+    }
+
+    String firstHirarchy = "type,host,level";
+    String secondHirarchy = "type,level";
+
+    try {
+      SolrUtil.setFacetPivot(solrQuery, 1, firstHirarchy,
+        secondHirarchy);
+      QueryResponse response = serviceLogsSolrDao.process(solrQuery);
+      List<List<PivotField>> firstHirarchicalPivotFields = null;
+      List<List<PivotField>> secondHirarchicalPivotFields = null;
+      NamedList<List<PivotField>> firstNamedList = response
+        .getFacetPivot();
+      if (firstNamedList != null) {
+        firstHirarchicalPivotFields = firstNamedList
+          .getAll(firstHirarchy);
+        secondHirarchicalPivotFields = firstNamedList
+          .getAll(secondHirarchy);
+      }
+
+      if (firstHirarchicalPivotFields == null
+        || secondHirarchicalPivotFields == null) {
+        return list;
+      }
+
+      List<NodeData> dataList = buidTreeData(
+        firstHirarchicalPivotFields.get(0),
+        secondHirarchicalPivotFields.get(0), solrQuery,
+        LogSearchConstants.COMPONENT, LogSearchConstants.HOST);
+      if(dataList == null){
+        return list;
+      }
+
+      list.setvNodeList(dataList);
+      return list;
+    } catch (SolrException | SolrServerException | IOException e) {
+      logger.error("Error during solrQuery=" + solrQuery, e);
+      throw RESTErrorUtil.createRESTException(MessageEnums.SOLR_ERROR
+          .getMessage().getMessage(), MessageEnums.ERROR_SYSTEM);
+    }
+  }
+
+  public NameValueDataListResponse getLogsLevelCount(SearchCriteria sc) {
+    NameValueDataListResponse nameValueList = new NameValueDataListResponse();
+    SolrQuery query = queryGenerator.commonServiceFilterQuery(sc);
+    query.setParam("event", "/service/logs/levels/counts/namevalues");
+    List<NameValueData> logsCounts = getLogLevelFacets(query);
+    nameValueList.setvNameValues(logsCounts);
+
+    return nameValueList;
+  }
+
+  public List<NameValueData> getLogLevelFacets(SolrQuery query) {
+    String defalutValue = "0";
+    HashMap<String, String> map = new HashMap<String, String>();
+    List<NameValueData> logsCounts = new ArrayList<>();
+    try {
+      SolrUtil.setFacetField(query, LogSearchConstants.SOLR_LEVEL);
+      List<Count> logLevelCounts = getFacetCounts(query,
+          LogSearchConstants.SOLR_LEVEL);
+      if (logLevelCounts == null) {
+        return logsCounts;
+      }
+      for (Count count : logLevelCounts) {
+        map.put(count.getName().toUpperCase(), "" + count.getCount());
+      }
+      for (String level : LogSearchConstants.SUPPORTED_LOG_LEVEL) {
+        NameValueData nameValue = new NameValueData();
+        String value = map.get(level);
+        if (StringUtils.isBlank(value)) {
+          value = defalutValue;
+        }
+        nameValue.setName(level);
+        nameValue.setValue(value);
+        logsCounts.add(nameValue);
+      }
+    } catch (SolrException | SolrServerException | IOException e) {
+      logger.error("Error during solrQuery=" + query, e);
+    }
+    return logsCounts;
+  }
+
+  // Get Facet Count According to FacetFeild
+  public List<Count> getFacetCounts(SolrQuery solrQuery, String facetField)
+    throws SolrServerException, IOException, SolrException {
+    List<Count> list = new ArrayList<FacetField.Count>();
+
+    QueryResponse response = serviceLogsSolrDao.process(solrQuery);
+    if(response == null){
+      return list;
+    }
+
+    FacetField field = response.getFacetField(facetField);
+    if (field == null) {
+      return list;
+    }
+    list = field.getValues();
+
+
+    return list;
+  }
+
+  public LogListResponse getPageByKeyword(SearchCriteria searchCriteria)
+    throws SolrServerException {
+    String defaultChoice = "0";
+
+    String key = (String) searchCriteria.getParamValue("keyword");
+    if(StringUtils.isBlank(key)){
+      throw RESTErrorUtil.createRESTException("Keyword was not given",
+          MessageEnums.DATA_NOT_FOUND);
+    }
+
+    String keyword = SolrUtil.escapeForStandardTokenizer(key);
+
+    if(keyword.startsWith("\"") && keyword.endsWith("\"")){
+      keyword = keyword.substring(1);
+      keyword = keyword.substring(0, keyword.length()-1);
+    }
+    keyword = "*" + keyword + "*";
+
+
+    String keyType = (String) searchCriteria.getParamValue("keywordType");
+    QueryResponse queryResponse = null;
+
+    if (!defaultChoice.equals(keyType)) {
+      try {
+        int currentPageNumber = searchCriteria.getPage();
+        int maxRows = searchCriteria.getMaxRows();
+        String nextPageLogID = "";
+
+        int lastLogIndexNumber = ((currentPageNumber + 1)
+          * maxRows);
+        String nextPageLogTime = "";
+
+
+        // Next Page Start Time Calculation
+        SolrQuery nextPageLogTimeQuery = queryGenerator
+          .commonServiceFilterQuery(searchCriteria);
+        nextPageLogTimeQuery.remove("start");
+        nextPageLogTimeQuery.remove("rows");
+        nextPageLogTimeQuery.setStart(lastLogIndexNumber);
+        nextPageLogTimeQuery.setRows(1);
+
+        queryResponse = serviceLogsSolrDao.process(
+            nextPageLogTimeQuery);
+        if(queryResponse == null){
+          throw RESTErrorUtil.createRESTException("The keyword "+"\""+key+"\""+" was not found",
+              MessageEnums.ERROR_SYSTEM);
+        }
+
+        SolrDocumentList docList = queryResponse.getResults();
+        if(docList ==null){
+          throw RESTErrorUtil.createRESTException("The keyword "+"\""+key+"\""+" was not found",
+              MessageEnums.ERROR_SYSTEM);
+        }
+
+        SolrDocument solrDoc = docList.get(0);
+
+        Date logDate = (Date) solrDoc.get(LogSearchConstants.LOGTIME);
+        if(logDate == null){
+          throw RESTErrorUtil.createRESTException("The keyword "+"\""+key+"\""+" was not found",
+              MessageEnums.ERROR_SYSTEM);
+        }
+        nextPageLogTime = DateUtil
+          .convertDateWithMillisecondsToSolrDate(logDate);
+        nextPageLogID = ""
+          + solrDoc.get(LogSearchConstants.ID);
+
+        if (StringUtils.isBlank(nextPageLogID)){
+          nextPageLogID = "0";
+        }
+
+        String filterQueryListIds = "";
+        // Remove the same Time Ids
+        SolrQuery listRemoveIds = queryGenerator
+          .commonServiceFilterQuery(searchCriteria);
+        listRemoveIds.remove("start");
+        listRemoveIds.remove("rows");
+        queryGenerator.setSingleIncludeFilter(listRemoveIds,
+          LogSearchConstants.LOGTIME, "\"" + nextPageLogTime + "\"");
+        queryGenerator.setSingleExcludeFilter(listRemoveIds,
+          LogSearchConstants.ID, nextPageLogID);
+        SolrUtil.setFl(listRemoveIds, LogSearchConstants.ID);
+        queryResponse = serviceLogsSolrDao.process(
+            listRemoveIds);
+        if(queryResponse == null){
+          throw RESTErrorUtil.createRESTException("The keyword "+"\""+key+"\""+" was not found",
+              MessageEnums.ERROR_SYSTEM);
+        }
+
+        SolrDocumentList docListIds = queryResponse.getResults();
+        if(docListIds ==null){
+          throw RESTErrorUtil.createRESTException("The keyword "+"\""+key+"\""+" was not found",
+              MessageEnums.ERROR_SYSTEM);
+        }
+        boolean isFirst = true;
+        for (SolrDocument solrDocId :  docListIds ) {
+          String id = "" + solrDocId.get(LogSearchConstants.ID);
+          if (isFirst) {
+            filterQueryListIds += LogSearchConstants.MINUS_OPERATOR + LogSearchConstants.ID + ":" + id;
+            isFirst = false;
+          } else {
+            filterQueryListIds += " "+CONDITION.AND+" " + LogSearchConstants.MINUS_OPERATOR + LogSearchConstants.ID + ":" + id;
+          }
+        }
+
+        // Keyword Sequence Number Calculation
+        String endTime = (String) searchCriteria.getParamValue("to");
+        String startTime = (String) searchCriteria
+          .getParamValue("from");
+        SolrQuery logTimeThroughRangeQuery = queryGenerator
+          .commonServiceFilterQuery(searchCriteria);
+        logTimeThroughRangeQuery.remove("start");
+        logTimeThroughRangeQuery.remove("rows");
+        logTimeThroughRangeQuery.setRows(1);
+        if (!StringUtils.isBlank(filterQueryListIds)){
+          logTimeThroughRangeQuery.setFilterQueries(filterQueryListIds);
+        }
+
+        String sortByType = searchCriteria.getSortType();
+
+        if (!StringUtils.isBlank(sortByType) && sortByType
+          .equalsIgnoreCase(LogSearchConstants.ASCENDING_ORDER)) {
+
+          queryGenerator.setSingleRangeFilter(logTimeThroughRangeQuery,
+            LogSearchConstants.LOGTIME, nextPageLogTime,
+            endTime);
+          logTimeThroughRangeQuery.set(LogSearchConstants.SORT,
+            LogSearchConstants.LOGTIME + " "
+              + LogSearchConstants.ASCENDING_ORDER);
+
+        } else {
+
+          queryGenerator.setSingleRangeFilter(logTimeThroughRangeQuery,
+            LogSearchConstants.LOGTIME, startTime,
+            nextPageLogTime);
+          logTimeThroughRangeQuery.set(LogSearchConstants.SORT,
+            LogSearchConstants.LOGTIME + " "
+              + LogSearchConstants.DESCENDING_ORDER);
+        }
+        queryGenerator.setSingleIncludeFilter(logTimeThroughRangeQuery,
+          LogSearchConstants.SOLR_KEY_LOG_MESSAGE, keyword);
+
+
+        queryResponse = serviceLogsSolrDao.process(
+            logTimeThroughRangeQuery);
+        if(queryResponse == null){
+          throw RESTErrorUtil.createRESTException("The keyword "+"\""+key+"\""+" was not found",
+              MessageEnums.ERROR_SYSTEM);
+        }
+
+        SolrDocumentList documentList = queryResponse.getResults();
+        if(documentList ==null){
+          throw RESTErrorUtil.createRESTException("The keyword "+"\""+key+"\""+" was not found",
+              MessageEnums.ERROR_SYSTEM);
+        }
+
+        SolrDocument solrDocument = new SolrDocument();
+        if (!documentList.isEmpty()){
+          solrDocument = documentList.get(0);
+        }
+
+        Date keywordLogDate = (Date) solrDocument.get(LogSearchConstants.LOGTIME);
+        if(keywordLogDate == null){
+          throw RESTErrorUtil.createRESTException("The keyword "+"\""+key+"\""+" was not found",
+              MessageEnums.ERROR_SYSTEM);
+        }
+        String originalKeywordDate = DateUtil
+          .convertDateWithMillisecondsToSolrDate(keywordLogDate);
+        String keywordId = "" + solrDocument.get(LogSearchConstants.ID);
+
+        // Getting Range Count from StartTime To Keyword Log Time
+        SolrQuery rangeLogQuery = nextPageLogTimeQuery.getCopy();
+        rangeLogQuery.remove("start");
+        rangeLogQuery.remove("rows");
+
+        if (!StringUtils.isBlank(sortByType) && sortByType
+          .equalsIgnoreCase(LogSearchConstants.ASCENDING_ORDER)) {
+          keywordLogDate = DateUtils.addMilliseconds(keywordLogDate, 1);
+          String keywordDateTime = DateUtil
+            .convertDateWithMillisecondsToSolrDate(keywordLogDate);
+          queryGenerator.setSingleRangeFilter(rangeLogQuery,
+            LogSearchConstants.LOGTIME, startTime,
+            keywordDateTime);
+        } else {
+          keywordLogDate = DateUtils.addMilliseconds(keywordLogDate, -1);
+          String keywordDateTime = DateUtil
+            .convertDateWithMillisecondsToSolrDate(keywordLogDate);
+          queryGenerator.setSingleRangeFilter(rangeLogQuery,
+            LogSearchConstants.LOGTIME, keywordDateTime,
+            endTime);
+        }
+
+
+        long countNumberLogs = countQuery(rangeLogQuery,serviceLogsSolrDao) - 1;
+
+
+        //Adding numbers on
+
+
+        try {
+          SolrQuery sameIdQuery = queryGenerator
+            .commonServiceFilterQuery(searchCriteria);
+          queryGenerator.setSingleIncludeFilter(sameIdQuery,
+            LogSearchConstants.LOGTIME, "\"" + originalKeywordDate + "\"");
+          SolrUtil.setFl(sameIdQuery, LogSearchConstants.ID);
+          SolrDocumentList sameQueryDocList = serviceLogsSolrDao.process(sameIdQuery)
+            .getResults();
+          for (SolrDocument solrDocumenent : sameQueryDocList) {
+            String id = (String) solrDocumenent
+              .getFieldValue(LogSearchConstants.ID);
+            countNumberLogs++;
+           
+            if (StringUtils.isBlank(id) && id.equals(keywordId)){
+              break;
+            }
+          }
+        } catch (SolrException | SolrServerException | IOException e) {
+          logger.error(e);
+        }
+
+        int start = (int) ((countNumberLogs / maxRows) * maxRows);
+        SolrQuery logIdQuery = nextPageLogTimeQuery.getCopy();
+        rangeLogQuery.remove("start");
+        rangeLogQuery.remove("rows");
+        logIdQuery.setStart(start);
+        logIdQuery.setRows(searchCriteria.getMaxRows());
+        LogListResponse logResponse = getLogAsPaginationProvided(logIdQuery, serviceLogsSolrDao);
+        return logResponse;
+
+      } catch (Exception e) {
+        //do nothing
+      }
+
+    } else {
+      try {
+        int currentPageNumber = searchCriteria.getPage();
+        int maxRows = searchCriteria.getMaxRows();
+
+        if (currentPageNumber == 0) {
+          throw RESTErrorUtil.createRESTException("This is first Page Not",
+            MessageEnums.DATA_NOT_FOUND);
+        }
+
+        int firstLogCurrentPage = (currentPageNumber * maxRows);
+        String lastLogsLogTime = "";
+
+        // Next Page Start Time Calculation
+        SolrQuery lastLogTime = queryGenerator
+          .commonServiceFilterQuery(searchCriteria);
+        lastLogTime.remove("start");
+        lastLogTime.remove("rows");
+
+        lastLogTime.setStart(firstLogCurrentPage);
+        lastLogTime.setRows(1);
+
+        queryResponse = serviceLogsSolrDao.process(
+            lastLogTime);
+        if(queryResponse == null){
+          throw RESTErrorUtil.createRESTException("The keyword "+"\""+key+"\""+" was not found",
+              MessageEnums.ERROR_SYSTEM);
+        }
+
+        SolrDocumentList docList = queryResponse.getResults();
+        if(docList ==null){
+          throw RESTErrorUtil.createRESTException("The keyword "+"\""+key+"\""+" was not found",
+              MessageEnums.ERROR_SYSTEM);
+        }
+        SolrDocument solrDoc = docList.get(0);
+
+        Date logDate = (Date) solrDoc.get(LogSearchConstants.LOGTIME);
+        String sortByType = searchCriteria.getSortType();
+        lastLogsLogTime = DateUtil
+          .convertDateWithMillisecondsToSolrDate(logDate);
+        String lastLogsLogId = ""
+          + solrDoc.get(LogSearchConstants.ID);
+
+
+        String filterQueryListIds = "";
+        // Remove the same Time Ids
+        SolrQuery listRemoveIds = queryGenerator
+          .commonServiceFilterQuery(searchCriteria);
+        listRemoveIds.remove("start");
+        listRemoveIds.remove("rows");
+        queryGenerator.setSingleIncludeFilter(listRemoveIds,
+          LogSearchConstants.LOGTIME, "\"" + lastLogsLogTime + "\"");
+        queryGenerator.setSingleExcludeFilter(listRemoveIds,
+          LogSearchConstants.ID, lastLogsLogId);
+        SolrUtil.setFl(listRemoveIds, LogSearchConstants.ID);
+        queryResponse = serviceLogsSolrDao.process(
+            lastLogTime);
+        if(queryResponse == null){
+          throw RESTErrorUtil.createRESTException("The keyword "+"\""+key+"\""+" was not found",
+              MessageEnums.ERROR_SYSTEM);
+        }
+
+        SolrDocumentList docListIds = queryResponse.getResults();
+        if(docListIds == null){
+          throw RESTErrorUtil.createRESTException("The keyword "+"\""+key+"\""+" was not found",
+              MessageEnums.ERROR_SYSTEM);
+        }
+        boolean isFirst = true;
+        for (SolrDocument solrDocId : docListIds) {
+          if (solrDocId != null) {
+            String id = "" + solrDocId.get(LogSearchConstants.ID);
+            if (isFirst) {
+              filterQueryListIds += LogSearchConstants.MINUS_OPERATOR + LogSearchConstants.ID + ":" + id;
+              isFirst = false;
+            } else {
+              filterQueryListIds += " "+CONDITION.AND+" " + LogSearchConstants.MINUS_OPERATOR + LogSearchConstants.ID + ":"
+                  + id;
+            }
+          }
+        }
+
+
+        // Keyword LogTime Calculation
+        String endTime = (String) searchCriteria.getParamValue("to");
+        String startTime = (String) searchCriteria
+          .getParamValue("from");
+        SolrQuery logTimeThroughRangeQuery = queryGenerator
+          .commonServiceFilterQuery(searchCriteria);
+        logTimeThroughRangeQuery.remove("start");
+        logTimeThroughRangeQuery.remove("rows");
+        logTimeThroughRangeQuery.setRows(1);
+        queryGenerator.setSingleExcludeFilter(logTimeThroughRangeQuery,
+          LogSearchConstants.ID, lastLogsLogId);
+        if (!StringUtils.isBlank(filterQueryListIds)){
+          logTimeThroughRangeQuery.setFilterQueries(filterQueryListIds);
+        }
+
+        if (!StringUtils.isBlank(sortByType) && sortByType
+          .equalsIgnoreCase(LogSearchConstants.ASCENDING_ORDER)) {
+
+          logTimeThroughRangeQuery.remove(LogSearchConstants.SORT);
+          logTimeThroughRangeQuery.set(LogSearchConstants.SORT,
+            LogSearchConstants.LOGTIME + " "
+              + LogSearchConstants.DESCENDING_ORDER);
+
+
+          queryGenerator.setSingleRangeFilter(
+            logTimeThroughRangeQuery,
+            LogSearchConstants.LOGTIME, startTime,
+            lastLogsLogTime);
+
+        } else {
+
+          logTimeThroughRangeQuery.remove(LogSearchConstants.SORT);
+          logTimeThroughRangeQuery.set(LogSearchConstants.SORT,
+            LogSearchConstants.LOGTIME + " "
+              + LogSearchConstants.ASCENDING_ORDER);
+
+
+          queryGenerator.setSingleRangeFilter(logTimeThroughRangeQuery,
+            LogSearchConstants.LOGTIME, lastLogsLogTime, endTime);
+        }
+        queryGenerator.setSingleIncludeFilter(logTimeThroughRangeQuery,
+          LogSearchConstants.SOLR_KEY_LOG_MESSAGE, keyword);
+
+
+        queryResponse = serviceLogsSolrDao.process(
+            logTimeThroughRangeQuery);
+        if(queryResponse == null){
+          throw RESTErrorUtil.createRESTException("The keyword "+"\""+key+"\""+" was not found",
+              MessageEnums.ERROR_SYSTEM);
+        }
+
+        SolrDocumentList documentList = queryResponse.getResults();
+        if(documentList == null){
+          throw RESTErrorUtil.createRESTException("The keyword "+"\""+key+"\""+" was not found",
+              MessageEnums.ERROR_SYSTEM);
+        }
+        SolrDocument solrDocument = new SolrDocument();
+        if (!documentList.isEmpty()){
+          solrDocument = documentList.get(0);
+        }
+
+        Date keywordLogDate = (Date) solrDocument.get(LogSearchConstants.LOGTIME);
+        if(keywordLogDate == null){
+          throw RESTErrorUtil.createRESTException("The keyword "+"\""+key+"\""+" was not found",
+              MessageEnums.ERROR_SYSTEM);
+        }
+        String originalKeywordDate = DateUtil
+          .convertDateWithMillisecondsToSolrDate(keywordLogDate);
+        String keywordId = "" + solrDocument.get(LogSearchConstants.ID);
+
+        // Getting Range Count from StartTime To Keyword Log Time
+        SolrQuery rangeLogQuery = lastLogTime.getCopy();
+        rangeLogQuery.remove("start");
+        rangeLogQuery.remove("rows");
+
+        if (!StringUtils.isBlank(sortByType) && sortByType
+          .equalsIgnoreCase(LogSearchConstants.ASCENDING_ORDER)) {
+       //   keywordLogDate = DateUtil.addMilliSecondsToDate(keywordLogDate, 1);
+          String keywordDateTime = DateUtil
+            .convertDateWithMillisecondsToSolrDate(keywordLogDate);
+          queryGenerator.setSingleRangeFilter(rangeLogQuery,
+            LogSearchConstants.LOGTIME, startTime,
+            keywordDateTime);
+
+
+        } else {
+     //     keywordLogDate = DateUtil.addMilliSecondsToDate(keywordLogDate, -1);
+          String keywordDateTime = DateUtil
+            .convertDateWithMillisecondsToSolrDate(keywordLogDate);
+          queryGenerator.setSingleRangeFilter(rangeLogQuery,
+            LogSearchConstants.LOGTIME, keywordDateTime,
+            endTime);
+        }
+
+
+        long countNumberLogs = countQuery(rangeLogQuery,serviceLogsSolrDao) - 1;
+
+        //Adding numbers on
+        try {
+          SolrQuery sameIdQuery = queryGenerator
+            .commonServiceFilterQuery(searchCriteria);
+          queryGenerator.setSingleIncludeFilter(sameIdQuery,
+            LogSearchConstants.LOGTIME, "\"" + originalKeywordDate + "\"");
+          SolrUtil.setFl(sameIdQuery, LogSearchConstants.ID);
+          SolrDocumentList sameQueryDocList = serviceLogsSolrDao.process(sameIdQuery)
+            .getResults();
+          for (SolrDocument solrDocumenent : sameQueryDocList) {
+            if (solrDocumenent != null) {
+              String id = (String) solrDocumenent
+                  .getFieldValue(LogSearchConstants.ID);
+              countNumberLogs++;
+              if ( StringUtils.isBlank(id) && id.equals(keywordId)) {
+                break;
+              }
+            }
+          }
+        } catch (SolrException | SolrServerException | IOException e) {
+          logger.error(e);
+        }
+        int start = (int) ((countNumberLogs / maxRows) * maxRows);
+
+        SolrQuery logIdQuery = lastLogTime.getCopy();
+        rangeLogQuery.remove("start");
+        rangeLogQuery.remove("rows");
+        logIdQuery.setStart(start);
+        logIdQuery.setRows(searchCriteria.getMaxRows());
+        return getLogAsPaginationProvided(logIdQuery, serviceLogsSolrDao);
+      } catch (Exception e) {
+        //do nothing
+      }
+
+    }
+    throw RESTErrorUtil.createRESTException("The keyword "+"\""+key+"\""+" was not found",
+        MessageEnums.ERROR_SYSTEM);
+  }
+
+  private LogSearchResponse getPageByLogId(SearchCriteria searchCriteria) {
+    LogSearchResponse logResponse = new ServiceLogResponse();
+    String endLogTime = (String) searchCriteria.getParamValue("to");
+    if(StringUtils.isBlank(endLogTime)){
+      return logResponse;
+    }
+    long startIndex = 0l;
+
+    String logId = (String) searchCriteria.getParamValue("sourceLogId");
+    if(StringUtils.isBlank(logId)){
+      return logResponse;
+    }
+    SolrQuery solrQuery = queryGenerator.commonServiceFilterQuery(searchCriteria);
+
+    String endTimeMinusOneMilli = "";
+    String logTime = "";
+    try {
+
+      SolrQuery logTimeByIdQuery = new SolrQuery();
+      SolrUtil.setMainQuery(logTimeByIdQuery, null);
+      queryGenerator.setSingleIncludeFilter(logTimeByIdQuery,
+          LogSearchConstants.ID, logId);
+      SolrUtil.setRowCount(solrQuery, 1);
+
+      QueryResponse queryResponse = serviceLogsSolrDao
+          .process(logTimeByIdQuery);
+
+      if(queryResponse == null){
+        return new ServiceLogResponse();
+      }
+
+      SolrDocumentList docList = queryResponse.getResults();
+      Date dateOfLogId = null;
+      if (docList != null && !docList.isEmpty()) {
+        SolrDocument dateLogIdDoc = docList.get(0);
+        if(dateLogIdDoc != null){
+          dateOfLogId = (Date) dateLogIdDoc.get(LogSearchConstants.LOGTIME);
+        }
+      }
+
+      if (dateOfLogId != null) {
+        logTime = DateUtil.convertDateWithMillisecondsToSolrDate(dateOfLogId);
+        Date endDate = DateUtils.addMilliseconds(dateOfLogId, 1);
+        endTimeMinusOneMilli = (String) DateUtil
+            .convertDateWithMillisecondsToSolrDate(endDate);
+      }
+
+    } catch (SolrException | SolrServerException | IOException e) {
+      logger.error(e);
+    }
+
+    try {
+      solrQuery.remove(LogSearchConstants.ID);
+      solrQuery.remove(LogSearchConstants.LOGTIME);
+      queryGenerator.setSingleRangeFilter(solrQuery,
+          LogSearchConstants.LOGTIME, endTimeMinusOneMilli, endLogTime);
+      SolrUtil.setRowCount(solrQuery, 0);
+      startIndex = countQuery(solrQuery,serviceLogsSolrDao);
+    } catch (SolrException | SolrServerException | IOException e) {
+      logger.error(e);
+    }
+
+    try {
+      SolrQuery sameIdQuery = queryGenerator.commonServiceFilterQuery(searchCriteria);
+      queryGenerator.setSingleIncludeFilter(sameIdQuery,
+          LogSearchConstants.LOGTIME, "\"" + logTime + "\"");
+      sameIdQuery.set("fl", LogSearchConstants.ID);
+
+      QueryResponse sameIdResponse = serviceLogsSolrDao.process(sameIdQuery);
+      SolrDocumentList docList = sameIdResponse.getResults();
+
+      for (SolrDocument solrDocumenent : docList) {
+        String id = (String) solrDocumenent
+            .getFieldValue(LogSearchConstants.ID);
+        startIndex++;
+        if (!StringUtils.isBlank(id)) {
+          if (id.equals(logId)) {
+            break;
+          }
+        }
+      }
+
+      SolrQuery logIdQuery = queryGenerator.commonServiceFilterQuery(searchCriteria);
+      logIdQuery.remove("rows");
+      logIdQuery.remove("start");
+      int start = (int) ((startIndex / searchCriteria.getMaxRows()) * searchCriteria
+          .getMaxRows());
+      logIdQuery.setStart(start);
+      logIdQuery.setRows(searchCriteria.getMaxRows());
+      logResponse = getLogAsPaginationProvided(logIdQuery,
+          serviceLogsSolrDao);
+      return logResponse;
+    } catch (SolrException | SolrServerException | IOException e) {
+      logger.error(e);
+    }
+
+    throw RESTErrorUtil.createRESTException("LogId not Found",
+        MessageEnums.ERROR_SYSTEM);
+  }
+
+  @SuppressWarnings("unchecked")
+  public List<NameValueData> getHistogramCounts(SolrQuery solrQuery,
+                                             String from, String to, String unit) {
+    List<NameValueData> logsCounts = new ArrayList<>();
+    try {
+
+      SolrUtil.setFacetRange(solrQuery, LogSearchConstants.LOGTIME,
+        from, to, unit);
+
+      List<RangeFacet.Count> logLevelCounts = null;
+
+      QueryResponse response = serviceLogsSolrDao.process(solrQuery);
+      if(response == null){
+        return logsCounts;
+      }
+      @SuppressWarnings("rawtypes")
+      List<RangeFacet> rangeFacetList = response.getFacetRanges();
+      if (rangeFacetList == null) {
+        return logsCounts;
+
+      }
+
+      @SuppressWarnings("rawtypes")
+      RangeFacet rangeFacet=rangeFacetList.get(0);
+      if (rangeFacet == null) {
+        return logsCounts;
+      }
+      logLevelCounts = rangeFacet.getCounts();
+
+      if(logLevelCounts == null){
+        return logsCounts;
+      }
+      for (RangeFacet.Count logCount : logLevelCounts) {
+        NameValueData nameValue = new NameValueData();
+        nameValue.setName(logCount.getValue());
+        nameValue.setValue("" + logCount.getCount());
+        logsCounts.add(nameValue);
+      }
+    } catch (SolrException | SolrServerException | IOException e) {
+      logger.error("Error during solrQuery=" + solrQuery, e);
+    }
+    return logsCounts;
+  }
+
+  public List<Count> getFacetCountsByDate(SolrQuery solrQuery,
+                                          String facetField) throws SolrServerException, IOException,
+    SolrException {
+
+    QueryResponse response = serviceLogsSolrDao.process(solrQuery);
+
+    FacetField field = response.getFacetDate(facetField);
+    return field.getValues();
+  }
+
+  @SuppressWarnings("unchecked")
+  public BarGraphDataListResponse getHistogramData(SearchCriteria searchCriteria) {
+    String deafalutValue = "0";
+    BarGraphDataListResponse dataList = new BarGraphDataListResponse();
+    SolrQuery solrQuery = queryGenerator.commonServiceFilterQuery(searchCriteria);
+    solrQuery.set("event", "/audit/logs/histogram");
+    String from = getFrom((String) searchCriteria.getParamValue("from"));
+    String to = getTo((String) searchCriteria.getParamValue("to"));
+    String unit = getUnit((String) searchCriteria.getParamValue("unit"));
+
+    List<BarGraphData> histogramData = new ArrayList<>();
+
+    String jsonHistogramQuery = queryGenerator
+      .buildJSONFacetTermTimeRangeQuery(
+        LogSearchConstants.SOLR_LEVEL,
+        LogSearchConstants.LOGTIME, from, to, unit).replace(
+        "\\", "");
+
+    try {
+      SolrUtil.setJSONFacet(solrQuery, jsonHistogramQuery);
+      SolrUtil.setRowCount(solrQuery,Integer.parseInt(deafalutValue));
+      QueryResponse response = serviceLogsSolrDao.process(solrQuery);
+      if (response == null){
+        return dataList;
+      }
+      SimpleOrderedMap<Object> jsonFacetResponse = (SimpleOrderedMap<Object>) response
+        .getResponse().get("facets");
+
+      if (jsonFacetResponse == null
+        || jsonFacetResponse.toString().equals("{count=0}")){
+        return dataList;
+      }
+
+      extractValuesFromBuckets(jsonFacetResponse, "x", "y", histogramData);
+
+      Collection<NameValueData> vNameValues = new ArrayList<NameValueData>();
+      List<BarGraphData> graphDatas = new ArrayList<BarGraphData>();
+      for (String level : LogSearchConstants.SUPPORTED_LOG_LEVEL) {
+        boolean isLevelPresent = false;
+        BarGraphData vData1 = null;
+        for (BarGraphData vData2 : histogramData) {
+          String name = vData2.getName();
+          if (level.contains(name)) {
+            isLevelPresent = true;
+            vData1 = vData2;
+            break;
+          }
+          if (vNameValues.isEmpty()) {
+            Collection<NameValueData> vNameValues2 = vData2
+              .getDataCount();
+            for (NameValueData value : vNameValues2) {
+              NameValueData value2 = new NameValueData();
+              value2.setValue(deafalutValue);
+              value2.setName(value.getName());
+              vNameValues.add(value2);
+            }
+          }
+        }
+        if (!isLevelPresent) {
+          BarGraphData vBarGraphData = new BarGraphData();
+          vBarGraphData.setName(level);
+          vBarGraphData.setDataCount(vNameValues);
+          graphDatas.add(vBarGraphData);
+        } else {
+          graphDatas.add(vData1);
+        }
+      }
+
+      dataList.setGraphData(graphDatas);
+      return dataList;
+
+    } catch (SolrServerException | SolrException | IOException e) {
+      logger.error(e);
+      throw RESTErrorUtil.createRESTException(MessageEnums.SOLR_ERROR
+          .getMessage().getMessage(), MessageEnums.ERROR_SYSTEM);
+
+    }
+  }
+
+  public void arrangeLevel(String level,
+                           List<BarGraphData> histogramDataLocal,
+                           List<BarGraphData> histogramData) {
+    for (BarGraphData histData : histogramData) {
+      if (histData != null && level.equals(histData.getName())) {
+        histogramDataLocal.add(histData);
+      }
+    }
+  }
+
+  public String cancelFindRequestByDate(String uniqueId) {
+    if (StringUtils.isEmpty(uniqueId)) {
+      logger.error("Unique id is Empty");
+      throw RESTErrorUtil.createRESTException("Unique id is Empty",
+        MessageEnums.DATA_NOT_FOUND);
+    }
+
+    if (cancelByDate.remove(uniqueId)) {
+      mapUniqueId.remove(uniqueId);
+      return "Cancel Request Successfully Procssed ";
+    }
+    return "Cancel Request Unable to Process";
+  }
+
+  public boolean cancelRequest(String uniqueId) {
+    if (StringUtils.isBlank(uniqueId)) {
+      logger.error("Unique id is Empty");
+      throw RESTErrorUtil.createRESTException("Unique id is Empty",
+        MessageEnums.DATA_NOT_FOUND);
+    }
+    for (String date : cancelByDate) {
+      if (uniqueId.equalsIgnoreCase(date)){
+        return false;
+      }
+    }
+    return true;
+  }
+
+  public Response exportToTextFile(SearchCriteria searchCriteria) {
+    String defaultFormat = "text";
+    SolrQuery solrQuery = queryGenerator.commonServiceFilterQuery(searchCriteria);
+    String from = (String) searchCriteria.getParamValue("from");
+    String to = (String) searchCriteria.getParamValue("to");
+    String utcOffset = (String) searchCriteria.getParamValue("utcOffset");
+    String format = (String) searchCriteria.getParamValue("format");
+
+    format = defaultFormat.equalsIgnoreCase(format) && format != null ? ".txt"
+        : ".json";
+    
+    if(StringUtils.isBlank(utcOffset)){
+      utcOffset = "0";
+    }
+
+    if (!DateUtil.isDateValid(from) || !DateUtil.isDateValid(to)) {
+      logger.error("Not valid date format. Valid format should be"
+          + LogSearchConstants.SOLR_DATE_FORMAT_PREFIX_Z);
+      throw RESTErrorUtil.createRESTException("Not valid date format. Valid format should be"
+          + LogSearchConstants.SOLR_DATE_FORMAT_PREFIX_Z,
+          MessageEnums.INVALID_INPUT_DATA);
+
+    } else {
+      from = from.replace("T", " ");
+      from = from.replace(".", ",");
+
+      to = to.replace("T", " ");
+      to = to.replace(".", ",");
+
+      to = DateUtil.addOffsetToDate(to, Long.parseLong(utcOffset),
+          "yyyy-MM-dd HH:mm:ss,SSS");
+      from = DateUtil.addOffsetToDate(from, Long.parseLong(utcOffset),
+          "yyyy-MM-dd HH:mm:ss,SSS");
+    }
+
+    String fileName = DateUtil.getCurrentDateInString();
+    if (searchCriteria.getParamValue("hostLogFile") != null
+      && searchCriteria.getParamValue("compLogFile") != null) {
+      fileName = searchCriteria.getParamValue("hostLogFile") + "_"
+        + searchCriteria.getParamValue("compLogFile");
+    }
+
+    String textToSave = "";
+    try {
+      QueryResponse response = serviceLogsSolrDao.process(solrQuery);
+      if (response == null) {
+        throw RESTErrorUtil.createRESTException(MessageEnums.SOLR_ERROR
+            .getMessage().getMessage(), MessageEnums.ERROR_SYSTEM);
+      }
+      SolrDocumentList docList = response.getResults();
+      if (docList == null) {
+        throw RESTErrorUtil.createRESTException(MessageEnums.SOLR_ERROR
+            .getMessage().getMessage(), MessageEnums.ERROR_SYSTEM);
+      }
+
+      VSummary vsummary = BizUtil.buildSummaryForLogFile(docList);
+      vsummary.setFormat(format);
+      vsummary.setFrom(from);
+      vsummary.setTo(to);
+
+      String includeString = (String) searchCriteria.getParamValue("iMessage");
+      if (StringUtils.isBlank(includeString)) {
+        includeString = "";
+      }
+
+      String include[] = includeString.split(LogSearchConstants.I_E_SEPRATOR);
+
+      for (String inc : include) {
+        includeString = includeString + ",\"" + inc + "\"";
+      }
+      includeString = includeString.replaceFirst(",", "");
+      if (!StringUtils.isBlank(includeString)) {
+        vsummary.setIncludeString(includeString);
+      }
+
+      String excludeString = null;
+      boolean isNormalExcluded = false;
+
+      excludeString = (String) searchCriteria.getParamValue("eMessage");
+      if (StringUtils.isBlank(excludeString)) {
+        excludeString = "";
+      }
+
+      String exclude[] = excludeString.split(LogSearchConstants.I_E_SEPRATOR);
+      for (String exc : exclude) {
+        excludeString = excludeString + ",\"" + exc + "\"";
+      }
+
+      excludeString = excludeString.replaceFirst(",", "");
+      if (!StringUtils.isBlank(excludeString)) {
+        vsummary.setExcludeString(excludeString);
+        isNormalExcluded = true;
+      }
+
+      String globalExcludeString = (String) searchCriteria
+          .getParamValue("gEMessage");
+      if (StringUtils.isBlank(globalExcludeString)) {
+        globalExcludeString = "";
+      }
+
+      String globalExclude[] = globalExcludeString
+          .split(LogSearchConstants.I_E_SEPRATOR);
+
+      for (String exc : globalExclude) {
+        excludeString = excludeString + ",\"" + exc + "\"";
+      }
+
+      if (!StringUtils.isBlank(excludeString)) {
+        if (!isNormalExcluded) {
+          excludeString = excludeString.replaceFirst(",", "");
+        }
+        vsummary.setExcludeString(excludeString);
+      }
+
+      for (SolrDocument solrDoc : docList) {
+
+        Date logTimeDateObj = (Date) solrDoc.get(LogSearchConstants.LOGTIME);
+        if(logTimeDateObj != null){
+        String logTime = DateUtil.convertSolrDateToNormalDateFormat(
+            logTimeDateObj.getTime(), Long.parseLong(utcOffset));
+        solrDoc.remove(LogSearchConstants.LOGTIME);
+        solrDoc.addField(LogSearchConstants.LOGTIME, logTime);
+        }
+      }
+
+      if (format.toLowerCase(Locale.ENGLISH).equals(".txt")) {
+        textToSave = BizUtil.convertObjectToNormalText(docList);
+      } else if (format.toLowerCase(Locale.ENGLISH).equals(".json")) {
+        textToSave = convertObjToString(docList);
+      } else {
+        throw RESTErrorUtil.createRESTException(
+            "unsoported format either should be json or text",
+            MessageEnums.ERROR_SYSTEM);
+      }
+      return FileUtil.saveToFile(textToSave, fileName, vsummary);
+
+    } catch (SolrException | SolrServerException | IOException
+      | ParseException e) {
+      logger.error("Error during solrQuery=" + solrQuery, e);
+      throw RESTErrorUtil.createRESTException(MessageEnums.SOLR_ERROR
+          .getMessage().getMessage(), MessageEnums.ERROR_SYSTEM);
+    }
+  }
+
+  public NodeListResponse getComponentListWithLevelCounts(SearchCriteria searchCriteria) {
+    SolrQuery solrQuery = queryGenerator.commonServiceFilterQuery(searchCriteria);
+    solrQuery.setParam("event", "/service/logs/components/levels/counts");
+
+    if (searchCriteria.getSortBy() == null) {
+      searchCriteria.setSortBy(LogSearchConstants.SOLR_COMPONENT);
+      searchCriteria.setSortType(SolrQuery.ORDER.asc.toString());
+    }
+    queryGenerator.setFilterFacetSort(solrQuery, searchCriteria);
+    String componentLevelHirachy = "type,level";
+    NodeListResponse list = new NodeListResponse();
+    try {
+
+      SolrUtil.setFacetPivot(solrQuery, 1, componentLevelHirachy);
+
+      QueryResponse response = serviceLogsSolrDao.process(solrQuery);
+
+      List<List<PivotField>> listPivotField = new ArrayList<List<PivotField>>();
+      NamedList<List<PivotField>> namedList = response.getFacetPivot();
+      if (namedList != null) {
+        listPivotField = namedList.getAll(componentLevelHirachy);
+      }
+      List<PivotField> secondHirarchicalPivotFields = null;
+      if (listPivotField == null || listPivotField.isEmpty()) {
+        return list;
+      } else {
+        secondHirarchicalPivotFields = listPivotField.get(0);
+      }
+      List<NodeData> datatList = new ArrayList<>();
+      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);
+        }
+      }
+      list.setvNodeList(datatList);
+      return list;
+    } catch (SolrException | SolrServerException | IOException e) {
+      logger.error(e.getMessage() + "SolrQuery"+solrQuery);
+      throw RESTErrorUtil.createRESTException(MessageEnums.SOLR_ERROR
+          .getMessage().getMessage(), MessageEnums.ERROR_SYSTEM);
+    }
+  }
+
+  public NameValueDataListResponse getExtremeDatesForBundelId(SearchCriteria searchCriteria) {
+    SolrQuery solrQuery = new SolrQuery();
+    NameValueDataListResponse nameValueList = new NameValueDataListResponse();
+    try {
+      String bundelId = (String) searchCriteria
+        .getParamValue(LogSearchConstants.BUNDLE_ID);
+      if(StringUtils.isBlank(bundelId)){
+        bundelId = "";
+      }
+
+      queryGenerator.setSingleIncludeFilter(solrQuery,
+        LogSearchConstants.BUNDLE_ID, bundelId);
+
+      SolrUtil.setMainQuery(solrQuery, null);
+      solrQuery.setSort(LogSearchConstants.LOGTIME, SolrQuery.ORDER.asc);
+      SolrUtil.setRowCount(solrQuery, 1);
+
+      List<NameValueData> vNameValues = new ArrayList<>();
+      QueryResponse response = serviceLogsSolrDao.process(solrQuery);
+
+      if(response == null){
+        return nameValueList;
+      }
+
+      SolrDocumentList solrDocList = response.getResults();
+      if(solrDocList == null){
+        return nameValueList;
+      }
+      for (SolrDocument solrDoc : solrDocList) {
+
+        Date logTimeAsc = (Date) solrDoc
+          .getFieldValue(LogSearchConstants.LOGTIME);
+        if (logTimeAsc != null) {
+          NameValueData nameValue = new NameValueData();
+          nameValue.setName("From");
+          nameValue.setValue("" + logTimeAsc.getTime());
+          vNameValues.add(nameValue);
+        }
+      }
+
+      solrQuery.clear();
+      SolrUtil.setMainQuery(solrQuery, null);
+      queryGenerator.setSingleIncludeFilter(solrQuery,
+        LogSearchConstants.BUNDLE_ID, bundelId);
+      solrQuery.setSort(LogSearchConstants.LOGTIME, SolrQuery.ORDER.desc);
+      SolrUtil.setRowCount(solrQuery, 1);
+
+      solrDocList.clear();
+      response = serviceLogsSolrDao.process(solrQuery);
+
+      solrDocList = response.getResults();
+      for (SolrDocument solrDoc : solrDocList) {
+        if (solrDoc != null) {
+          Date logTimeDesc = (Date) solrDoc
+              .getFieldValue(LogSearchConstants.LOGTIME);
+
+          if (logTimeDesc != null) {
+            NameValueData nameValue = new NameValueData();
+            nameValue.setName("To");
+            nameValue.setValue("" + logTimeDesc.getTime());
+            vNameValues.add(nameValue);
+          }
+        }
+      }
+      nameValueList.setvNameValues(vNameValues);
+
+
+    } catch (SolrServerException | SolrException | IOException e) {
+      logger.error(e.getMessage() + "SolrQuery"+solrQuery);
+      nameValueList = new NameValueDataListResponse();
+    }
+    return nameValueList;
+  }
+
+  public String getServiceLogsFieldsName() {
+    List<String> fieldsNames = solrServiceLogConfig.getFields();
+    if (fieldsNames.size() > 0) {
+
+      List<String> uiFieldNames = new ArrayList<String>();
+      String temp = null;
+      for (String field : fieldsNames) {
+        temp = solrServiceLogConfig.getSolrAndUiColumns().get(field + LogSearchConstants.SOLR_SUFFIX);
+        if (temp == null){
+          uiFieldNames.add(field);
+        }else{
+          uiFieldNames.add(temp);
+        }
+      }
+      return convertObjToString(uiFieldNames);
+
+    }
+    throw RESTErrorUtil.createRESTException(
+      "No field name found in property file",
+      MessageEnums.DATA_NOT_FOUND);
+
+  }
+
+  public String getServiceLogsSchemaFieldsName() {
+
+    List<String> fieldNames = new ArrayList<String>();
+    String excludeArray[] = Arrays.copyOf(solrServiceLogConfig.getExcludeColumnList().toArray(),
+      solrServiceLogConfig.getExcludeColumnList().size(), String[].class);
+
+    HashMap<String, String> uiFieldColumnMapping = new LinkedHashMap<String, String>();
+    ConfigHelper.getSchemaFieldsName(excludeArray, fieldNames,serviceLogsSolrDao);
+
+    for (String fieldName : fieldNames) {
+      String uiField = solrServiceLogConfig.getSolrAndUiColumns().get(fieldName + LogSearchConstants.SOLR_SUFFIX);
+      if (uiField != null) {
+        uiFieldColumnMapping.put(fieldName, uiField);
+      } else {
+        uiFieldColumnMapping.put(fieldName, fieldName);
+      }
+    }
+
+    HashMap<String, String> uiFieldColumnMappingSorted = new LinkedHashMap<String, String>();
+    uiFieldColumnMappingSorted.put(LogSearchConstants.SOLR_LOG_MESSAGE, LogSearchConstants.SOLR_LOG_MESSAGE);
+
+    Iterator<Entry<String, String>> it = BizUtil
+        .sortHashMapByValues(uiFieldColumnMapping).entrySet().iterator();
+    while (it.hasNext()) {
+      @SuppressWarnings("rawtypes")
+      Map.Entry pair = (Map.Entry) it.next();
+      uiFieldColumnMappingSorted.put("" + pair.getKey(), "" + pair.getValue());
+    }
+
+    return convertObjToString(uiFieldColumnMappingSorted);
+
+  }
+
+  @SuppressWarnings("unchecked")
+  public void extractValuesFromBuckets(
+    SimpleOrderedMap<Object> jsonFacetResponse, String outerField,
+    String innerField, List<BarGraphData> histogramData) {
+    NamedList<Object> stack = (NamedList<Object>) jsonFacetResponse
+      .get(outerField);
+    ArrayList<Object> stackBuckets = (ArrayList<Object>) stack
+      .get("buckets");
+    for (Object temp : stackBuckets) {
+      BarGraphData vBarGraphData = new BarGraphData();
+
+      SimpleOrderedMap<Object> level = (SimpleOrderedMap<Object>) temp;
+      String name = ((String) level.getVal(0)).toUpperCase();
+      vBarGraphData.setName(name);
+
+      Collection<NameValueData> vNameValues = new ArrayList<NameValueData>();
+      vBarGraphData.setDataCount(vNameValues);
+      ArrayList<Object> levelBuckets = (ArrayList<Object>) ((NamedList<Object>) level
+        .get(innerField)).get("buckets");
+      for (Object temp1 : levelBuckets) {
+        SimpleOrderedMap<Object> countValue = (SimpleOrderedMap<Object>) temp1;
+        String value = DateUtil
+          .convertDateWithMillisecondsToSolrDate((Date) countValue
+            .getVal(0));
+
+        String count = "" + countValue.getVal(1);
+        NameValueData vNameValue = new NameValueData();
+        vNameValue.setName(value);
+        vNameValue.setValue(count);
+        vNameValues.add(vNameValue);
+      }
+      histogramData.add(vBarGraphData);
+    }
+  }
+
+  public BarGraphDataListResponse getAnyGraphData(SearchCriteria searchCriteria) {
+    searchCriteria.addParam("fieldTime", LogSearchConstants.LOGTIME);
+    SolrQuery solrQuery = queryGenerator.commonServiceFilterQuery(searchCriteria);
+    BarGraphDataListResponse result = graphDataGenerator.getAnyGraphData(searchCriteria, serviceLogsSolrDao, solrQuery);
+    if (result == null) {
+      result = new BarGraphDataListResponse();
+    }
+    return result;
+
+  }
+
+  public ServiceLogResponse getAfterBeforeLogs(SearchCriteria searchCriteria) {
+    ServiceLogResponse logResponse = new ServiceLogResponse();
+    List<SolrServiceLogData> docList = null;
+    String id = (String) searchCriteria
+      .getParamValue(LogSearchConstants.ID);
+    if (StringUtils.isBlank(id)) {
+      return logResponse;
+
+    }
+    String maxRows = "";
+
+    maxRows = (String) searchCriteria.getParamValue("numberRows");
+    if (StringUtils.isBlank(maxRows)){
+      maxRows = ""+maxRows;
+    }
+    String scrollType = (String) searchCriteria.getParamValue("scrollType");
+    if(StringUtils.isBlank(scrollType)){
+      scrollType = "";
+    }
+
+    String logTime = null;
+    String sequenceId = null;
+    try {
+      SolrQuery solrQuery = new SolrQuery();
+      SolrUtil.setMainQuery(solrQuery,
+        queryGenerator.buildFilterQuery(LogSearchConstants.ID, id));
+      SolrUtil.setRowCount(solrQuery, 1);
+      QueryResponse response = serviceLogsSolrDao.process(solrQuery);
+      if(response == null){
+        return logResponse;
+      }
+      docList = convertToSolrBeans(response);
+      if (docList != null && !docList.isEmpty()) {
+        Date date = docList.get(0).getLogTime();
+        logTime = DateUtil.convertDateWithMillisecondsToSolrDate(date);
+        sequenceId = ""
+          + docList.get(0).getSeqNum();
+      }
+      if (StringUtils.isBlank(logTime)) {
+        return logResponse;
+      }
+    } catch (SolrServerException | SolrException | IOException e) {
+      throw RESTErrorUtil.createRESTException(MessageEnums.SOLR_ERROR
+          .getMessage().getMessage(), MessageEnums.ERROR_SYSTEM);
+    }
+    if (LogSearchConstants.SCROLL_TYPE_BEFORE.equals(scrollType)) {
+      logResponse = whenScrollUp(searchCriteria, logTime,
+        sequenceId, maxRows);
+
+      List<ServiceLogData> solrDocList = new ArrayList<>();
+      for (ServiceLogData solrDoc : logResponse.getLogList()) {
+        solrDocList.add(solrDoc);
+      }
+      logResponse.setLogList(solrDocList);
+        return logResponse;
+
+    } else if (LogSearchConstants.SCROLL_TYPE_AFTER.equals(scrollType)) {
+      List<ServiceLogData> solrDocList = new ArrayList<>();
+      logResponse = new ServiceLogResponse();
+      for (ServiceLogData solrDoc : whenScrollDown(searchCriteria, logTime,
+          sequenceId, maxRows).getLogList()) {
+        solrDocList.add(solrDoc);
+      }
+      logResponse.setLogList(solrDocList);
+      return logResponse;
+
+    } else {
+      logResponse = new ServiceLogResponse();
+      List<ServiceLogData> initial = new ArrayList<>();
+      List<ServiceLogData> before = whenScrollUp(searchCriteria, logTime,
+        sequenceId, maxRows).getLogList();
+      List<ServiceLogData> after = whenScrollDown(searchCriteria, logTime,
+        sequenceId, maxRows).getLogList();
+      if (before != null && !before.isEmpty()) {
+        for (ServiceLogData solrDoc : Lists.reverse(before)) {
+          initial.add(solrDoc);
+        }
+      }
+
+      initial.add(docList.get(0));
+      if (after != null && !after.isEmpty()) {
+        for (ServiceLogData solrDoc : after) {
+          initial.add(solrDoc);
+        }
+      }
+
+      logResponse.setLogList(initial);
+
+      return logResponse;
+
+    }
+  }
+
+  private ServiceLogResponse whenScrollUp(SearchCriteria searchCriteria,
+                                          String logTime, String sequenceId, String maxRows) {
+    SolrQuery solrQuery = new SolrQuery();
+    SolrUtil.setMainQuery(solrQuery, null);
+    try {
+      int seq_num = Integer.parseInt(sequenceId) - 1;
+      sequenceId = "" + seq_num;
+    } catch (Exception e) {
+
+    }
+    queryGenerator.setSingleRangeFilter(
+      solrQuery,
+      LogSearchConstants.SEQUNCE_ID, "*", sequenceId);
+
+    queryGenerator.applyLogFileFilter(solrQuery, searchCriteria);
+
+    queryGenerator.setSingleRangeFilter(solrQuery,
+      LogSearchConstants.LOGTIME, "*", logTime);
+    SolrUtil.setRowCount(solrQuery, Integer.parseInt(maxRows));
+    String order1 = LogSearchConstants.LOGTIME + " "
+      + LogSearchConstants.DESCENDING_ORDER;
+    String order2 = LogSearchConstants.SEQUNCE_ID + " "
+      + LogSearchConstants.DESCENDING_ORDER;
+    List<String> sortOrder = new ArrayList<String>();
+    sortOrder.add(order1);
+    sortOrder.add(order2);
+    searchCriteria.addParam(LogSearchConstants.SORT, sortOrder);
+    queryGenerator.setMultipleSortOrder(solrQuery, searchCriteria);
+
+    return (ServiceLogResponse) getLogAsPaginationProvided(solrQuery, serviceLogsSolrDao);
+  }
+
+  private ServiceLogResponse whenScrollDown(SearchCriteria searchCriteria,
+                                            String logTime, String sequenceId, String maxRows) {
+    SolrQuery solrQuery = new SolrQuery();
+    SolrUtil.setMainQuery(solrQuery, null);
+    queryGenerator.applyLogFileFilter(solrQuery, searchCriteria);
+
+    try {
+      int seq_num = Integer.parseInt(sequenceId) + 1;
+      sequenceId = "" + seq_num;
+    } catch (Exception e) {
+
+    }
+    queryGenerator.setSingleRangeFilter(
+      solrQuery,
+      LogSearchConstants.SEQUNCE_ID, sequenceId, "*");
+    queryGenerator.setSingleRangeFilter(solrQuery,
+      LogSearchConstants.LOGTIME, logTime, "*");
+    SolrUtil.setRowCount(solrQuery, Integer.parseInt(maxRows));
+
+    String order1 = LogSearchConstants.LOGTIME + " "
+      + LogSearchConstants.ASCENDING_ORDER;
+    String order2 = LogSearchConstants.SEQUNCE_ID + " "
+      + LogSearchConstants.ASCENDING_ORDER;
+    List<String> sortOrder = new ArrayList<String>();
+    sortOrder.add(order1);
+    sortOrder.add(order2);
+    searchCriteria.addParam(LogSearchConstants.SORT, sortOrder);
+    queryGenerator.setMultipleSortOrder(solrQuery, searchCriteria);
+
+    return (ServiceLogResponse) getLogAsPaginationProvided(solrQuery, serviceLogsSolrDao);
+  }
+
+  @Scheduled(cron = "${logsearch.solr.warming.cron}")
+  public void warmingSolrServer(){
+    logger.info("solr warming triggered.");
+    SolrQuery solrQuery = new SolrQuery();
+    TimeZone gmtTimeZone = TimeZone.getTimeZone("GMT");
+    GregorianCalendar utc = new GregorianCalendar(gmtTimeZone);
+    utc.setTimeInMillis(new Date().getTime());
+    utc.set(Calendar.HOUR, 0);
+    utc.set(Calendar.MINUTE, 0);
+    utc.set(Calendar.MILLISECOND, 001);
+    utc.set(Calendar.SECOND, 0);
+    DateUtil.convertDateWithMillisecondsToSolrDate(utc.getTime());
+    String from = DateUtil.convertDateWithMillisecondsToSolrDate(utc.getTime());
+    utc.set(Calendar.MILLISECOND, 999);
+    utc.set(Calendar.SECOND, 59);
+    utc.set(Calendar.MINUTE, 59);
+    utc.set(Calendar.HOUR, 23);
+    String to = DateUtil.convertDateWithMillisecondsToSolrDate(utc.getTime());
+    queryGenerator.setSingleRangeFilter(solrQuery,
+        LogSearchConstants.LOGTIME, from,to);
+    String level = LogSearchConstants.FATAL+","+LogSearchConstants.ERROR+","+LogSearchConstants.WARN;
+    queryGenerator.setFilterClauseWithFieldName(solrQuery, level,
+        LogSearchConstants.SOLR_LEVEL, "", QueryGenerationBase.Condition.OR);
+    try {
+      serviceLogsSolrDao.process(solrQuery);
+    } catch (SolrServerException | IOException e) {
+      logger.error("Error while warming solr server",e);
+    }
+  }
+
+  @Override
+  protected List<SolrServiceLogData> convertToSolrBeans(QueryResponse response) {
+    return response.getBeans(SolrServiceLogData.class);
+  }
+
+  @Override
+  protected ServiceLogResponse createLogSearchResponse() {
+    return new ServiceLogResponse();
+  }
+
+  private List<LogData> getLogDataListByFieldType(Class clazz, QueryResponse response, List<Count> fieldList) {
+    List<LogData> groupList = getComponentBeans(clazz, response);
+    String temp = "";
+    for (Count cnt : fieldList) {
+      LogData logData = createNewFieldByType(clazz, cnt, temp);
+      groupList.add(logData);
+    }
+    return groupList;
+  }
+
+  private <T extends LogData> List<LogData> getComponentBeans(Class<T> clazz, QueryResponse response) {
+    if (clazz.isAssignableFrom(SolrHostLogData.class) || clazz.isAssignableFrom(SolrComponentTypeLogData.class)) {
+      return (List<LogData>) response.getBeans(clazz);
+    } else {
+      throw new UnsupportedOperationException();
+    }
+  }
+
+  private <T extends LogData> LogData createNewFieldByType(Class<T> clazz, Count count, String temp) {
+    temp = count.getName();
+    LogData result = null;
+    if (clazz.isAssignableFrom(SolrHostLogData.class)) {
+      SolrHostLogData fieldData = new SolrHostLogData();
+      fieldData.setHost(temp);
+      result = fieldData;
+    } else if (clazz.isAssignableFrom(SolrComponentTypeLogData.class)) {
+      SolrComponentTypeLogData fieldData = new SolrComponentTypeLogData();
+      fieldData.setType(temp);
+      result = fieldData;
+    }
+    if (result != null) {
+      return result;
+    }
+    throw new UnsupportedOperationException();
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/manager/SessionManager.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/manager/SessionManager.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/manager/SessionManager.java
new file mode 100644
index 0000000..206636a
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/manager/SessionManager.java
@@ -0,0 +1,76 @@
+/*
+ * 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.manager;
+
+import org.apache.ambari.logsearch.common.LogSearchContext;
+import org.apache.ambari.logsearch.web.model.User;
+import org.apache.log4j.Logger;
+import org.springframework.security.core.Authentication;
+import org.springframework.security.core.context.SecurityContextHolder;
+import org.springframework.security.web.authentication.WebAuthenticationDetails;
+import org.springframework.stereotype.Component;
+
+@Component
+public class SessionManager {
+
+  private static final Logger logger = Logger.getLogger(SessionManager.class);
+
+  public SessionManager() {
+    logger.debug("SessionManager created");
+  }
+
+  public User processSuccessLogin() {
+    boolean newSessionCreation = true;
+    Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
+    WebAuthenticationDetails details = (WebAuthenticationDetails) authentication.getDetails();
+    String currentLoginId = authentication.getName();
+    LogSearchContext context = LogSearchContext.getContext();
+    User user = context.getUser();
+    if (user != null) {
+      if (validateUser(user, currentLoginId)) {
+        newSessionCreation = false;
+      }
+    }
+    //
+    if (newSessionCreation) {
+      user = new User();
+      user.setUsername(currentLoginId);
+      if (details != null) {
+        logger.info("Login Success: loginId=" + currentLoginId + ", sessionId=" + details.getSessionId()
+          + ", requestId=" + details.getRemoteAddress());
+      } else {
+        logger.info("Login Success: loginId=" + currentLoginId + ", msaSessionId=" + ", details is null");
+      }
+
+    }
+
+    return user;
+  }
+
+  private boolean validateUser(User user, String currentUsername) {
+    if (currentUsername.equalsIgnoreCase(user.getUsername())) {
+      return true;
+    } else {
+      logger.info("loginId doesn't match loginId from HTTPSession. Will create new session. loginId="
+        + currentUsername + ", user=" + user, new Exception());
+      return false;
+    }
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/manager/SessionMgr.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/manager/SessionMgr.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/manager/SessionMgr.java
deleted file mode 100644
index c6f7dc5..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/manager/SessionMgr.java
+++ /dev/null
@@ -1,76 +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.manager;
-
-import org.apache.ambari.logsearch.common.LogSearchContext;
-import org.apache.ambari.logsearch.web.model.User;
-import org.apache.log4j.Logger;
-import org.springframework.security.core.Authentication;
-import org.springframework.security.core.context.SecurityContextHolder;
-import org.springframework.security.web.authentication.WebAuthenticationDetails;
-import org.springframework.stereotype.Component;
-
-@Component
-public class SessionMgr {
-
-  private static final Logger logger = Logger.getLogger(SessionMgr.class);
-
-  public SessionMgr() {
-    logger.debug("SessionManager created");
-  }
-
-  public User processSuccessLogin() {
-    boolean newSessionCreation = true;
-    Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
-    WebAuthenticationDetails details = (WebAuthenticationDetails) authentication.getDetails();
-    String currentLoginId = authentication.getName();
-    LogSearchContext context = LogSearchContext.getContext();
-    User user = context.getUser();
-    if (user != null) {
-      if (validateUser(user, currentLoginId)) {
-        newSessionCreation = false;
-      }
-    }
-    //
-    if (newSessionCreation) {
-      user = new User();
-      user.setUsername(currentLoginId);
-      if (details != null) {
-        logger.info("Login Success: loginId=" + currentLoginId + ", sessionId=" + details.getSessionId()
-          + ", requestId=" + details.getRemoteAddress());
-      } else {
-        logger.info("Login Success: loginId=" + currentLoginId + ", msaSessionId=" + ", details is null");
-      }
-
-    }
-
-    return user;
-  }
-
-  private boolean validateUser(User user, String currentUsername) {
-    if (currentUsername.equalsIgnoreCase(user.getUsername())) {
-      return true;
-    } else {
-      logger.info("loginId doesn't match loginId from HTTPSession. Will create new session. loginId="
-        + currentUsername + ", user=" + user, new Exception());
-      return false;
-    }
-  }
-
-}


[12/58] [abbrv] ambari git commit: AMBARI-18310. Refactor logsearch portal side code (oleewere)

Posted by ol...@apache.org.
http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/configsets/audit_logs/conf/managed-schema
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/configsets/audit_logs/conf/managed-schema b/ambari-logsearch/ambari-logsearch-portal/src/main/configsets/audit_logs/conf/managed-schema
index f58652c..f77bec0 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/configsets/audit_logs/conf/managed-schema
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/configsets/audit_logs/conf/managed-schema
@@ -106,7 +106,6 @@
   <field name="file" type="key_lower_case" multiValued="false"/>
   <field name="log_message" type="key_lower_case" multiValued="false" omitNorms="false"/>
   <field name="logfile_line_number" type="tint" omitNorms="false"/>
-  <!-- <field name="message" type="text_std_token_lower_case" indexed="true" stored="true"/> -->
   <field name="message_md5" type="string" multiValued="false"/>
   <field name="type" type="key_lower_case" multiValued="false"/>
   

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/configsets/hadoop_logs/conf/managed-schema
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/configsets/hadoop_logs/conf/managed-schema b/ambari-logsearch/ambari-logsearch-portal/src/main/configsets/hadoop_logs/conf/managed-schema
index 3b4cf19..c6f498b 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/configsets/hadoop_logs/conf/managed-schema
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/configsets/hadoop_logs/conf/managed-schema
@@ -101,7 +101,6 @@
   <field name="logger_name" type="key_lower_case" multiValued="false"/>
   <field name="logtime" type="tdate" multiValued="false"  docValues="true"/>
   <field name="logtype" type="key_lower_case" multiValued="false"/>
-  <!-- <field name="message" type="text_std_token_lower_case" indexed="true" stored="true"/> -->
   <field name="message_md5" type="string" multiValued="false"/>
   <field name="method" type="key_lower_case" multiValued="false" omitNorms="false"/>
   <field name="path" type="key_lower_case" multiValued="false"/>
@@ -117,28 +116,5 @@
   <dynamicField name='key_*' type="key_lower_case" multiValued="false" stored="false"/>
   <dynamicField name="ws_*" type="text_ws" multiValued="false" omitNorms="false" stored="false"/>
   <copyField source="log_message" dest="key_log_message"/>
-  <!-- <copyField source="log_message" dest="ws_log_message"/> -->
 
-  
-  <!-- Copy Fields-->
-  <!-- ngram fields -->
-  <!-- Whenever using a copy field provide following structure "ngram_"<OriginalFieldName> --> 
-<!-- Commenting till we test properly. Now it is not used and it is taking unnecessary cpu, memory and disk space
-  <copyField source="bundle_id" dest="ngram_bundle_id"/>
-  <copyField source="case_id" dest="ngram_case_id"/>
-  <copyField source="cluster" dest="ngram_cluster"/>
-  <copyField source="file" dest="ngram_file"/>
-  <copyField source="host" dest="ngram_host"/>
-  <copyField source="level" dest="ngram_level"/>
-  <copyField source="log_message" dest="ngram_log_message"/>
-  <copyField source="logger_name" dest="ngram_logger_name"/>
-  <copyField source="logtype" dest="ngram_logtype"/>
-  <copyField source="method" dest="ngram_method"/>
-  <copyField source="path" dest="ngram_path"/>
-  <copyField source="thread_name" dest="ngram_thread_name"/>
-  <copyField source="type" dest="ngram_type"/>
-  
--->
-
-  
 </schema>

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/dev/solrcloud/README.md
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/dev/solrcloud/README.md b/ambari-logsearch/ambari-logsearch-portal/src/main/dev/solrcloud/README.md
deleted file mode 100644
index 3cc4915..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/dev/solrcloud/README.md
+++ /dev/null
@@ -1,35 +0,0 @@
-<!--
-{% comment %}
-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.
-{% endcomment %}
--->
-
-This folder contains scripts to configure and run SolrCloud for development. 
-
-This helps in seting up SolrCloud using embedded zookeeper.
-
-##Setup Solr Collections
-```./update_config.sh <path to solr install folder>
-```
-
-
-##Run Solr
-```./restart_solr.sh
-```
-
-##Delete collections
-```./reset_collections.sh
-```
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/dev/solrcloud/reset_collections.sh
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/dev/solrcloud/reset_collections.sh b/ambari-logsearch/ambari-logsearch-portal/src/main/dev/solrcloud/reset_collections.sh
deleted file mode 100755
index 7c742c0..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/dev/solrcloud/reset_collections.sh
+++ /dev/null
@@ -1,28 +0,0 @@
-#!/bin/bash
-# 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.
-
-# This script is used to delete all the documents in Solr
-host_port=localhost:8983
-if [ $# -eq 1 ]; then
-    host_port=$1
-fi
-set -x
-curl http://${host_port}/solr/hadoop_logs/update --data '<delete><query>*:*</query></delete>' -H 'Content-type:text/xml; charset=utf-8'
-curl http://${host_port}/solr/hadoop_logs/update --data '<commit/>' -H 'Content-type:text/xml; charset=utf-8'
-
-curl http://${host_port}/solr/audit_logs/update --data '<delete><query>*:*</query></delete>' -H 'Content-type:text/xml; charset=utf-8'
-curl http://${host_port}/solr/audit_logs/update --data '<commit/>' -H 'Content-type:text/xml; charset=utf-8'
-

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/dev/solrcloud/restart_solr.sh
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/dev/solrcloud/restart_solr.sh b/ambari-logsearch/ambari-logsearch-portal/src/main/dev/solrcloud/restart_solr.sh
deleted file mode 100755
index bd436bb..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/dev/solrcloud/restart_solr.sh
+++ /dev/null
@@ -1,37 +0,0 @@
-#!/bin/bash
-# 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.
-
-
-function usage {
-    echo "Usage: $0 <Solr Install Folder>"
-}
-
-if [ $# -ne 1 ]; then
-    usage
-    exit 1
-fi
-
-SOLR_INSTALL=$1
-if [ -x $SOLR_INSTALL/bin/solr ]; then
-    SOLR_BIN=$SOLR_INSTALL/bin/solr
-else
-    echo "ERROR: Invalid Solr install folder $SOLR_INSTALL"
-    usage
-    exit 1
-fi
-
-set -x
-$SOLR_BIN restart -c

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/dev/solrcloud/update_config.sh
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/dev/solrcloud/update_config.sh b/ambari-logsearch/ambari-logsearch-portal/src/main/dev/solrcloud/update_config.sh
deleted file mode 100755
index 93e3496..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/dev/solrcloud/update_config.sh
+++ /dev/null
@@ -1,49 +0,0 @@
-#!/bin/bash
-# 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.
-
-function usage {
-    echo "Usage: $0 <Solr Install Folder> [zk_hosts]"
-}
-
-if [ $# -lt 1 ]; then
-    usage
-    exit 1
-fi
-
-curr_dir=`pwd`
-cd `dirname $0`; script_dir=`pwd`; cd $curr_dir
-
-SOLR_INSTALL=$1
-if [ -x $SOLR_INSTALL/server/scripts/cloud-scripts/zkcli.sh ]; then
-    ZK_CLI=$SOLR_INSTALL/server/scripts/cloud-scripts/zkcli.sh
-else
-    echo "ERROR: Invalid Solr install folder $SOLR_INSTALL"
-    usage
-    exit 1
-fi
-
-zk_hosts="localhost:9983"
-if [ $# -eq 2 ]; then
-    zk_hosts=$2
-fi
-
-
-CONFIGSET_FOLDER=$script_dir/../../configsets
-
-set -x
-$ZK_CLI -zkhost $zk_hosts -cmd upconfig -confdir $CONFIGSET_FOLDER/audit_logs/conf -confname audit_logs
-$ZK_CLI -zkhost $zk_hosts -cmd upconfig -confdir $CONFIGSET_FOLDER/hadoop_logs/conf -confname hadoop_logs
-$ZK_CLI -zkhost $zk_hosts -cmd upconfig -confdir $CONFIGSET_FOLDER/history/conf -confname history

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/LogSearch.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/LogSearch.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/LogSearch.java
index 15355a1..27b943a 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/LogSearch.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/LogSearch.java
@@ -92,7 +92,6 @@ public class LogSearch {
     logger.debug(server.dump());
     logger
         .debug("==============================================================================");
-    ConfigHelper.initializeApplicationConfig();
     server.join();
   }
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/common/ConfigHelper.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/common/ConfigHelper.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/common/ConfigHelper.java
index edb4ffa..a3a71ea 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/common/ConfigHelper.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/common/ConfigHelper.java
@@ -25,48 +25,18 @@ import java.util.List;
 import java.util.Map;
 
 import org.apache.ambari.logsearch.dao.SolrDaoBase;
-import org.apache.ambari.logsearch.manager.MgrBase;
+import org.apache.ambari.logsearch.manager.ManagerBase;
 import org.apache.commons.lang.ArrayUtils;
 import org.apache.log4j.Logger;
 import org.codehaus.jettison.json.JSONArray;
 import org.codehaus.jettison.json.JSONObject;
 
 public class ConfigHelper {
-  private static final Logger logger = Logger.getLogger(MgrBase.class);
-
-  public static HashMap<String, String> serviceLogsColumnMapping = new HashMap<String, String>();
-  public static HashMap<String, String> auditLogsColumnMapping = new HashMap<String, String>();
+  private static final Logger logger = Logger.getLogger(ManagerBase.class);
 
   private ConfigHelper() {
     throw new UnsupportedOperationException();
   }
-  
-  public static void initializeApplicationConfig() {
-    String serviceLogsColumnMappingArray[] = PropertiesHelper.getPropertyStringList("logsearch.solr.service.logs.column.mapping");
-    String auditLogsColumnMappingArray[] = PropertiesHelper.getPropertyStringList("logsearch.solr.audit.logs.column.mapping");
-
-    // Initializing column mapping for Service Logs
-    intializeUISolrColumnMapping(serviceLogsColumnMappingArray, serviceLogsColumnMapping);
-
-    // Initializing column mapping for Audit Logs
-    intializeUISolrColumnMapping(auditLogsColumnMappingArray, auditLogsColumnMapping);
-  }
-
-  private static void intializeUISolrColumnMapping(String columnMappingArray[], HashMap<String, String> columnMappingMap) {
-
-    if (columnMappingArray != null && columnMappingArray.length > 0) {
-      for (String columnMapping : columnMappingArray) {
-        String mapping[] = columnMapping.split(":");
-        if (mapping.length > 1) {
-          String solrField = mapping[0];
-          String uiField = mapping[1];
-          
-          columnMappingMap.put(solrField + LogSearchConstants.SOLR_SUFFIX, uiField);
-          columnMappingMap.put(uiField + LogSearchConstants.UI_SUFFIX, solrField);
-        }
-      }
-    }
-  }
 
   public static void extractSchemaFieldsName(String responseString, HashMap<String, String> schemaFieldsNameMap,
       HashMap<String, String> schemaFieldTypeMap) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/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 5235fab..edc78d1 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,11 +22,13 @@ import java.util.List;
 import java.util.Map;
 
 import javax.annotation.PostConstruct;
+import javax.inject.Inject;
 import javax.ws.rs.client.Invocation;
 import javax.ws.rs.client.WebTarget;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.MultivaluedMap;
 
+import org.apache.ambari.logsearch.conf.AuthConfig;
 import org.apache.ambari.logsearch.web.security.LogsearchAbstractAuthenticationProvider;
 import org.apache.commons.lang.StringUtils;
 import org.apache.log4j.Logger;
@@ -41,6 +43,7 @@ import org.springframework.stereotype.Component;
  */
 @Component
 public class ExternalServerClient {
+
   private static Logger LOG = Logger.getLogger(ExternalServerClient.class);
   private static final ThreadLocal<JerseyClient> localJerseyClient = new ThreadLocal<JerseyClient>(){
     @Override
@@ -48,15 +51,11 @@ public class ExternalServerClient {
       return JerseyClientBuilder.createClient();
     }
   };
-  private String hostURL = "http://host:ip";// default
-  private boolean enableLog = false;// default
 
-  @PostConstruct
-  public void initialization() {
-    hostURL = PropertiesHelper.getProperty(
-        LogsearchAbstractAuthenticationProvider.AUTH_METHOD_PROP_START_WITH
-            + "external_auth.host_url", hostURL);
-  }
+  @Inject
+  private AuthConfig authConfig;
+
+  private boolean enableLog = false;// default
 
   /**
    * Send GET request to an external server
@@ -65,7 +64,7 @@ public class ExternalServerClient {
   public Object sendGETRequest(String url, Class klass, MultivaluedMap<String, String> queryParam,
                                String username, String password)
       throws Exception {
-    url = hostURL + url;
+    url = authConfig.getExternalAuthHostUrl() + url;
     JerseyClient client = localJerseyClient.get();
     HttpAuthenticationFeature authFeature = HttpAuthenticationFeature.basicBuilder().build();
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/common/LogSearchConstants.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/common/LogSearchConstants.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/common/LogSearchConstants.java
index 142b29b..36ecb81 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/common/LogSearchConstants.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/common/LogSearchConstants.java
@@ -118,6 +118,60 @@ public class LogSearchConstants {
   public static final String FACET_RANGE_GAP = "facet.range.gap";
   public static final String FACET_GROUP = "group";
   public static final String FACET_GROUP_MAIN = "group.main";
-  public static final String FACET_GROUP_FIELD = "group.field"; 
-  
+  public static final String FACET_GROUP_FIELD = "group.field";
+
+  // Request params
+  public static final String REQUEST_PARAM_QUERY = "q";
+  public static final String REQUEST_PARAM_XAXIS = "xAxis";
+  public static final String REQUEST_PARAM_YAXIS = "yAxis";
+  public static final String REQUEST_PARAM_STACK_BY = "stackBy";
+  public static final String REQUEST_PARAM_UNIT = "unit";
+  public static final String REQUEST_PARAM_BUNDLE_ID = "bundle_id";
+  public static final String REQUEST_PARAM_START_INDEX = "startIndex";
+  public static final String REQUEST_PARAM_PAGE = "page";
+  public static final String REQUEST_PARAM_PAGE_SIZE = "pageSize";
+  public static final String REQUEST_PARAM_SORT_BY = "sortBy";
+  public static final String REQUEST_PARAM_SORT_TYPE = "sortType";
+  public static final String REQUEST_PARAM_START_TIME = "start_time";
+  public static final String REQUEST_PARAM_END_TIME = "end_time";
+  public static final String REQUEST_PARAM_FROM = "from";
+  public static final String REQUEST_PARAM_TO = "to";
+  public static final String REQUEST_PARAM_FIELD = "field";
+  public static final String REQUEST_PARAM_FORMAT = "format";
+  public static final String REQUEST_PARAM_LAST_PAGE = "lastPage";
+  public static final String REQUEST_PARAM_LOG_TYPE = "logType";
+  public static final String REQUEST_PARAM_COMPONENT = "component";
+  public static final String REQUEST_PARAM_HOST = "host";
+  public static final String REQUEST_PARAM_TAIL_SIZE = "tailSize";
+  public static final String REQUEST_PARAM_COLUMN_QUERY = "columnQuery";
+  public static final String REQUEST_PARAM_I_MESSAGE = "iMessage";
+  public static final String REQUEST_PARAM_G_E_MESSAGE = "gEMessage";
+  public static final String REQUEST_PARAM_MUST_BE = "mustBe";
+  public static final String REQUEST_PARAM_MUST_NOT = "mustNot";
+  public static final String REQUEST_PARAM_INCLUDE_QUERY = "includeQuery";
+  public static final String REQUEST_PARAM_EXCLUDE_QUERY = "excludeQuery";
+  public static final String REQUEST_PARAM_ID = "id";
+  public static final String REQUEST_PARAM_SCROLL_TYPE = "scrollType";
+  public static final String REQUEST_PARAM_NUMBER_ROWS = "numberRows";
+  public static final String REQUEST_PARAM_HOST_LOG_FILE = "host";
+  public static final String REQUEST_PARAM_COMPONENT_LOG_FILE = "component";
+  public static final String REQUEST_PARAM_LEVEL = "level";
+  public static final String REQUEST_PARAM_ADVANCED_SEARCH = "advancedSearch";
+  public static final String REQUEST_PARAM_TREE_PARAMS = "treeParams";
+  public static final String REQUEST_PARAM_E_MESSAGE = "eMessage";
+  public static final String REQUEST_PARAM_G_MUST_NOT = "gMustNot";
+  public static final String REQUEST_PARAM_HOST_NAME = "host_name";
+  public static final String REQUEST_PARAM_COMPONENT_NAME = "component_name";
+  public static final String REQUEST_PARAM_FILE_NAME = "file_name";
+  public static final String REQUEST_PARAM_DATE_RANGE_LABEL = "dateRangeLabel";
+  public static final String REQUEST_PARAM_KEYWORD = "find";
+  public static final String REQUEST_PARAM_SOURCE_LOG_ID = "sourceLogId";
+  public static final String REQUEST_PARAM_KEYWORD_TYPE = "keywordType";
+  public static final String REQUEST_PARAM_TOKEN = "token";
+  public static final String REQUEST_PARAM_USER_ID = "userId";
+  public static final String REQUEST_PARAM_FILTER_NAME = "filterName";
+  public static final String REQUEST_PARAM_ROW_TYPE = "rowType";
+  public static final String REQUEST_PARAM_UTC_OFFSET = "utcOffset";
+
+
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/common/Marker.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/common/Marker.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/common/Marker.java
new file mode 100644
index 0000000..3e088ba
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/common/Marker.java
@@ -0,0 +1,29 @@
+/*
+ * 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.common;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Target({ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+public @interface Marker {
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/common/PropertyMapper.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/common/PropertyMapper.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/common/PropertyMapper.java
new file mode 100644
index 0000000..90e2114
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/common/PropertyMapper.java
@@ -0,0 +1,59 @@
+/*
+ * 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.common;
+
+import com.google.common.base.Splitter;
+import org.springframework.stereotype.Component;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@Component("propertyMapper")
+public class PropertyMapper {
+
+  public Map<String, String> map(String property) {
+    return this.map(property, ",");
+  }
+
+  public List<String> list(String property) {
+    return this.list(property, ",");
+  }
+
+  public Map<String, String> solrUiMap(String property) { return this.solrUiMap(property, ","); }
+
+  private List<String> list(String property, String splitter) {
+    return Splitter.on(splitter).omitEmptyStrings().trimResults().splitToList(property);
+  }
+
+  private Map<String, String> map(String property, String splitter) {
+    return Splitter.on(splitter).omitEmptyStrings().trimResults().withKeyValueSeparator(":").split(property);
+  }
+
+  private Map<String, String> solrUiMap(String property, String splitter) {
+    Map<String, String> result = new HashMap<>();
+    Map<String, String> map = this.map(property, splitter);
+    for (Map.Entry<String, String> propEntry : map.entrySet()) {
+      result.put(propEntry.getKey() + LogSearchConstants.SOLR_SUFFIX, propEntry.getValue());
+      result.put(propEntry.getValue() + LogSearchConstants.UI_SUFFIX, propEntry.getKey());
+    }
+    return result;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/common/SearchCriteria.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/common/SearchCriteria.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/common/SearchCriteria.java
deleted file mode 100644
index 6b74144..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/common/SearchCriteria.java
+++ /dev/null
@@ -1,304 +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.common;
-
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Locale;
-import java.util.Map;
-import java.util.Set;
-
-import javax.servlet.http.HttpServletRequest;
-
-import org.apache.commons.lang.StringEscapeUtils;
-
-public class SearchCriteria {
-  private int startIndex = 0;
-  private int maxRows = Integer.MAX_VALUE;
-  private String sortBy = null;
-  private String sortType = null;
-  private int page = 0;
-
-  private String globalStartTime = null;
-  private String globalEndTime = null;
-
-  private boolean getCount = true;
-  private boolean isDistinct = false;
-  private HashMap<String, Object> paramList = new HashMap<String, Object>();
-  final private Set<String> nullParamList = new HashSet<String>();
-  final private Set<String> notNullParamList = new HashSet<String>();
-
-  private Map<String, Object> urlParamMap = new HashMap<String, Object>();
-
-  public SearchCriteria(HttpServletRequest request) {
-    try {
-      if (request.getParameter("startIndex") != null && (!request.getParameter("startIndex").isEmpty())) {
-        this.startIndex = new Integer(request.getParameter("startIndex"));
-      }
-      if (request.getParameter("page") != null && (!request.getParameter("page").isEmpty())) {
-        this.page = new Integer(request.getParameter("page"));
-      }
-      if (request.getParameter("pageSize") != null && (!request.getParameter("pageSize").isEmpty())) {
-        this.maxRows = new Integer(request.getParameter("pageSize"));
-      } else {
-        this.maxRows = PropertiesHelper.getIntProperty("db.maxResults", 50);
-      }
-    } catch (NumberFormatException e) {
-      // do nothing
-    }
-
-    // Sort fields
-    if (request.getParameter("sortBy") != null && (!request.getParameter("sortBy").isEmpty())) {
-      this.sortBy = "" + request.getParameter("sortBy");
-    }
-    if (request.getParameter("sortType") != null && (!request.getParameter("sortType").isEmpty())) {
-      this.sortType = "" + request.getParameter("sortType");
-    }
-
-    // url params
-    if (request.getParameter("start_time") != null && (!request.getParameter("start_time").isEmpty())) {
-      this.globalStartTime = "" + request.getParameter("start_time");
-      this.urlParamMap.put("globalStartTime", request.getParameter("start_time"));
-    }
-    if (request.getParameter("end_time") != null && (!request.getParameter("end_time").isEmpty())) {
-      this.globalEndTime = "" + request.getParameter("end_time");
-      this.urlParamMap.put("globalEndTime", request.getParameter("end_time"));
-    }
-  }
-
-  public SearchCriteria() {
-    // Auto-generated constructor stub
-  }
-
-  /**
-   * @return the startIndex
-   */
-  public int getStartIndex() {
-    return startIndex;
-  }
-
-  /**
-   * @param startIndex the startIndex to set
-   */
-  public void setStartIndex(int startIndex) {
-    this.startIndex = startIndex;
-  }
-
-  /**
-   * @return the maxRows
-   */
-  public int getMaxRows() {
-    return maxRows;
-  }
-
-  /**
-   * @param maxRows the maxRows to set
-   */
-  public void setMaxRows(int maxRows) {
-    this.maxRows = maxRows;
-  }
-
-  /**
-   * @return the sortType
-   */
-
-  public String getSortType() {
-    return sortType;
-  }
-
-  /**
-   * @param sortType the sortType to set
-   */
-
-  public boolean isGetCount() {
-    return getCount;
-  }
-
-  public void setGetCount(boolean getCount) {
-    this.getCount = getCount;
-  }
-
-  /**
-   * @return the paramList
-   */
-  public HashMap<String, Object> getParamList() {
-    return paramList;
-  }
-
-  /**
-   * @param paramList the paramList to set
-   */
-  public void setParamList(HashMap<String, Object> paramList) {
-    this.paramList = paramList;
-  }
-
-  /**
-   * @param request
-   */
-  public void addRequiredServiceLogsParams(HttpServletRequest request) {
-    this.addParam("advanceSearch", StringEscapeUtils.unescapeXml(request.getParameter("advanceSearch")));
-    this.addParam("q", request.getParameter("q"));
-    this.addParam("treeParams", StringEscapeUtils.unescapeHtml(request.getParameter("treeParams")));
-    this.addParam("level", request.getParameter("level"));
-    this.addParam("gMustNot", request.getParameter("gMustNot"));
-    this.addParam("from", request.getParameter("from"));
-    this.addParam("to", request.getParameter("to"));
-    this.addParam("selectComp", request.getParameter("mustBe"));
-    this.addParam("unselectComp", request.getParameter("mustNot"));
-    this.addParam("iMessage", StringEscapeUtils.unescapeXml(request.getParameter("iMessage")));
-    this.addParam("gEMessage", StringEscapeUtils.unescapeXml(request.getParameter("gEMessage")));
-    this.addParam("eMessage", StringEscapeUtils.unescapeXml(request.getParameter("eMessage")));
-    this.addParam(LogSearchConstants.BUNDLE_ID, request.getParameter(LogSearchConstants.BUNDLE_ID));
-    this.addParam("host_name", request.getParameter("host_name"));
-    this.addParam("component_name", request.getParameter("component_name"));
-    this.addParam("file_name", request.getParameter("file_name"));
-    this.addParam("startDate", request.getParameter("start_time"));
-    this.addParam("endDate", request.getParameter("end_time"));
-    this.addParam("excludeQuery", StringEscapeUtils.unescapeXml(request.getParameter("excludeQuery")));
-    this.addParam("includeQuery", StringEscapeUtils.unescapeXml(request.getParameter("includeQuery")));
-  }
-
-  /**
-   * @param request
-   */
-  public void addRequiredAuditLogsParams(HttpServletRequest request) {
-    this.addParam("q", request.getParameter("q"));
-    this.addParam("columnQuery", StringEscapeUtils.unescapeXml(request.getParameter("columnQuery")));
-    this.addParam("iMessage", StringEscapeUtils.unescapeXml(request.getParameter("iMessage")));
-    this.addParam("gEMessage", StringEscapeUtils.unescapeXml(request.getParameter("gEMessage")));
-    this.addParam("eMessage", StringEscapeUtils.unescapeXml(request.getParameter("eMessage")));
-    this.addParam("includeString", request.getParameter("mustBe"));
-    this.addParam("unselectComp", request.getParameter("mustNot"));
-    this.addParam("excludeQuery", StringEscapeUtils.unescapeXml(request.getParameter("excludeQuery")));
-    this.addParam("includeQuery", StringEscapeUtils.unescapeXml(request.getParameter("includeQuery")));
-    this.addParam("startTime", request.getParameter("from"));
-    this.addParam("endTime", request.getParameter("to"));
-  }
-
-  /**
-   * @param string
-   * @param caId
-   */
-  public void addParam(String name, Object value) {
-    String solrValue = PropertiesHelper.getProperty(name);
-    if (solrValue == null || solrValue.isEmpty()) {
-      paramList.put(name, value);
-    } else {
-      try {
-        String propertyFieldMappings[] = solrValue.split(",");
-        HashMap<String, String> propertyFieldValue = new HashMap<String, String>();
-        for (String temp : propertyFieldMappings) {
-          String arrayValue[] = temp.split(":");
-          propertyFieldValue.put(arrayValue[0].toLowerCase(Locale.ENGLISH), arrayValue[1].toLowerCase(Locale.ENGLISH));
-        }
-        String originalValue = propertyFieldValue.get(value.toString().toLowerCase(Locale.ENGLISH));
-        if (originalValue != null && !originalValue.isEmpty())
-          paramList.put(name, originalValue);
-
-      } catch (Exception e) {
-        //do nothing
-      }
-    }
-  }
-
-  public void setNullParam(String name) {
-    nullParamList.add(name);
-  }
-
-  public void setNotNullParam(String name) {
-    notNullParamList.add(name);
-  }
-
-  public Object getParamValue(String name) {
-    return paramList.get(name);
-  }
-
-  /**
-   * @return the nullParamList
-   */
-  public Set<String> getNullParamList() {
-    return nullParamList;
-  }
-
-  /**
-   * @return the notNullParamList
-   */
-  public Set<String> getNotNullParamList() {
-    return notNullParamList;
-  }
-
-  /**
-   * @return the isDistinct
-   */
-  public boolean isDistinct() {
-    return isDistinct;
-  }
-
-  public String getSortBy() {
-    return sortBy;
-  }
-
-  public void setSortBy(String sortBy) {
-    this.sortBy = sortBy;
-  }
-
-  public void setSortType(String sortType) {
-    this.sortType = sortType;
-  }
-
-  /**
-   * @param isDistinct the isDistinct to set
-   */
-  public void setDistinct(boolean isDistinct) {
-    this.isDistinct = isDistinct;
-  }
-
-  public int getPage() {
-    return page;
-  }
-
-  public void setPage(int page) {
-    this.page = page;
-  }
-
-  public String getGlobalStartTime() {
-    return globalStartTime;
-  }
-
-  public void setGlobalStartTime(String globalStartTime) {
-    this.globalStartTime = globalStartTime;
-  }
-
-  public String getGlobalEndTime() {
-    return globalEndTime;
-  }
-
-  public void setGlobalEndTime(String globalEndTime) {
-    this.globalEndTime = globalEndTime;
-  }
-
-  public Map<String, Object> getUrlParamMap() {
-    return urlParamMap;
-  }
-
-  public void setUrlParamMap(Map<String, Object> urlParamMap) {
-    this.urlParamMap = urlParamMap;
-  }
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/ApiDocConfig.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/ApiDocConfig.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/ApiDocConfig.java
new file mode 100644
index 0000000..0ddad65
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/ApiDocConfig.java
@@ -0,0 +1,59 @@
+/*
+ * 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.conf;
+
+import io.swagger.jaxrs.config.BeanConfig;
+import io.swagger.jaxrs.listing.ApiListingResource;
+import io.swagger.jaxrs.listing.SwaggerSerializers;
+
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+
+@Configuration
+public class ApiDocConfig {
+
+  @Bean
+  public ApiListingResource apiListingResource() {
+    return new ApiListingResource();
+  }
+
+  @Bean
+  public SwaggerSerializers swaggerSerializers() {
+    return new SwaggerSerializers();
+  }
+
+  @Bean
+  public BeanConfig swaggerConfig() throws UnknownHostException {
+    BeanConfig beanConfig = new BeanConfig();
+    beanConfig.setSchemes(new String[]{"http", "https"});
+    beanConfig.setHost(InetAddress.getLocalHost().getHostAddress() + ":61888"); // TODO: port from property
+    beanConfig.setBasePath("/api/v1");
+    beanConfig.setTitle("Log Search REST API");
+    beanConfig.setDescription("Log aggregation, analysis, and visualization.");
+    beanConfig.setLicense("Apache 2.0");
+    beanConfig.setLicenseUrl("http://www.apache.org/licenses/LICENSE-2.0.html");
+    beanConfig.setScan(true);
+    beanConfig.setVersion("1.0.0");
+    beanConfig.setResourcePackage("org.apache.ambari.logsearch.rest");
+    return beanConfig;
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/ApplicationConfig.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/ApplicationConfig.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/ApplicationConfig.java
new file mode 100644
index 0000000..72ea942
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/ApplicationConfig.java
@@ -0,0 +1,84 @@
+/*
+ * 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.conf;
+
+import org.apache.ambari.logsearch.query.converter.AnyGraphRequestConverter;
+import org.apache.ambari.logsearch.query.converter.AuditBarGraphRequestConverter;
+import org.apache.ambari.logsearch.query.converter.AuditLogRequestConverter;
+import org.apache.ambari.logsearch.query.converter.BaseAuditLogRequestConverter;
+import org.apache.ambari.logsearch.query.converter.BaseServiceLogRequestConverter;
+import org.apache.ambari.logsearch.query.converter.FieldAuditLogRequestConverter;
+import org.apache.ambari.logsearch.query.converter.FieldBarGraphRequestConverter;
+import org.apache.ambari.logsearch.query.converter.ServiceAnyGraphRequestConverter;
+import org.apache.ambari.logsearch.query.converter.ServiceExtremeDatesRequestConverter;
+import org.apache.ambari.logsearch.query.converter.ServiceGraphRequestConverter;
+import org.apache.ambari.logsearch.query.converter.ServiceLogExportRequestConverter;
+import org.apache.ambari.logsearch.query.converter.ServiceLogFileRequestConverter;
+import org.apache.ambari.logsearch.query.converter.ServiceLogRequestConverter;
+import org.apache.ambari.logsearch.query.converter.ServiceLogTruncatedRequestConverter;
+import org.apache.ambari.logsearch.query.converter.SimpleQueryRequestConverter;
+import org.apache.ambari.logsearch.query.converter.UserExportRequestConverter;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.ComponentScan;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.ImportResource;
+import org.springframework.context.annotation.PropertySource;
+import org.springframework.context.support.ConversionServiceFactoryBean;
+import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
+import org.springframework.core.convert.converter.Converter;
+
+import java.util.HashSet;
+import java.util.Set;
+
+@Configuration
+@ComponentScan("org.apache.ambari.logsearch")
+@PropertySource(value = {"classpath:default.properties", "classpath:logsearch.properties"})
+@ImportResource("META-INF/security-applicationContext.xml")
+public class ApplicationConfig {
+
+  @Bean
+  public static PropertySourcesPlaceholderConfigurer propertyConfigurer() {
+    return new PropertySourcesPlaceholderConfigurer();
+  }
+
+  @Bean(name="conversionService")
+  public ConversionServiceFactoryBean conversionServiceFactoryBean() {
+    ConversionServiceFactoryBean conversionServiceFactoryBean = new ConversionServiceFactoryBean();
+    Set<Converter> converters = new HashSet<>();
+    converters.add(new AnyGraphRequestConverter());
+    converters.add(new AuditBarGraphRequestConverter());
+    converters.add(new AuditLogRequestConverter());
+    converters.add(new BaseAuditLogRequestConverter());
+    converters.add(new BaseServiceLogRequestConverter());
+    converters.add(new FieldAuditLogRequestConverter());
+    converters.add(new FieldBarGraphRequestConverter());
+    converters.add(new SimpleQueryRequestConverter());
+    converters.add(new UserExportRequestConverter());
+    converters.add(new ServiceAnyGraphRequestConverter());
+    converters.add(new ServiceExtremeDatesRequestConverter());
+    converters.add(new ServiceGraphRequestConverter());
+    converters.add(new ServiceLogExportRequestConverter());
+    converters.add(new ServiceLogFileRequestConverter());
+    converters.add(new ServiceLogRequestConverter());
+    converters.add(new ServiceLogTruncatedRequestConverter());
+    conversionServiceFactoryBean.setConverters(converters);
+    return conversionServiceFactoryBean;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/AuthConfig.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/AuthConfig.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/AuthConfig.java
new file mode 100644
index 0000000..3398a83
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/AuthConfig.java
@@ -0,0 +1,87 @@
+/*
+ * 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.conf;
+
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.Configuration;
+
+@Configuration
+public class AuthConfig {
+
+  @Value("${logsearch.auth.file.enable:true}")
+  boolean authFileEnabled;
+  @Value("${logsearch.auth.ldap.enable:false}")
+  boolean authLdapEnabled;
+  @Value("${logsearch.auth.simple.enable:false}")
+  boolean authSimpleEnabled;
+  @Value("${logsearch.auth.external_auth.host_url:'http://ip:port'}")
+  private String externalAuthHostUrl;
+  @Value("${logsearch.auth.login_url:/api/v1/users/$USERNAME/privileges?fields=*}")
+  private String externalAuthLoginUrl;
+  @Value("${logsearch.login.credentials.file:user_pass.json}")
+  private String credentialsFile;
+
+  public boolean isAuthFileEnabled() {
+    return authFileEnabled;
+  }
+
+  public void setAuthFileEnabled(boolean authFileEnabled) {
+    this.authFileEnabled = authFileEnabled;
+  }
+
+  public boolean isAuthLdapEnabled() {
+    return authLdapEnabled;
+  }
+
+  public void setAuthLdapEnabled(boolean authLdapEnabled) {
+    this.authLdapEnabled = authLdapEnabled;
+  }
+
+  public boolean isAuthSimpleEnabled() {
+    return authSimpleEnabled;
+  }
+
+  public void setAuthSimpleEnabled(boolean authSimpleEnabled) {
+    this.authSimpleEnabled = authSimpleEnabled;
+  }
+
+  public String getCredentialsFile() {
+    return credentialsFile;
+  }
+
+  public void setCredentialsFile(String credentialsFile) {
+    this.credentialsFile = credentialsFile;
+  }
+
+  public String getExternalAuthHostUrl() {
+    return externalAuthHostUrl;
+  }
+
+  public void setExternalAuthHostUrl(String externalAuthHostUrl) {
+    this.externalAuthHostUrl = externalAuthHostUrl;
+  }
+
+  public String getExternalAuthLoginUrl() {
+    return externalAuthLoginUrl;
+  }
+
+  public void setExternalAuthLoginUrl(String externalAuthLoginUrl) {
+    this.externalAuthLoginUrl = externalAuthLoginUrl;
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/SolrAuditLogConfig.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/SolrAuditLogConfig.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/SolrAuditLogConfig.java
new file mode 100644
index 0000000..ae4dca9
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/SolrAuditLogConfig.java
@@ -0,0 +1,181 @@
+/*
+ * 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.conf;
+
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.Configuration;
+
+import java.util.List;
+import java.util.Map;
+
+@Configuration
+public class SolrAuditLogConfig implements SolrConfig, SolrColumnConfig {
+
+  @Value("${logsearch.solr.audit.logs.url:}")
+  private String solrUrl;
+
+  @Value("${logsearch.solr.audit.logs.zk_connect_string:}")
+  private String zkConnectString;
+
+  @Value("${logsearch.solr.collection.audit.logs:audit_logs}")
+  private String collection;
+
+  @Value("${logsearch.ranger.audit.logs.collection.name:}")
+  private String rangerCollection;
+
+  @Value("${logsearch.solr.audit.logs.config.name:audit_logs}")
+  private String configName;
+
+  @Value("${logsearch.solr.audit.logs.alias.name:audit_logs_alias}")
+  private String aliasNameIn;
+
+  @Value("${logsearch.audit.logs.split.interval.mins:none}")
+  private String splitInterval;
+
+  @Value("${logsearch.collection.audit.logs.numshards:1}")
+  private Integer numberOfShards;
+
+  @Value("${logsearch.collection.audit.logs.replication.factor:1}")
+  private Integer replicationFactor;
+
+  @Value("#{propertyMapper.map('${logsearch.solr.audit.logs.column.mapping}')}")
+  private Map<String, String> columnMapping;
+
+  @Value("#{propertyMapper.list('${logsearch.solr.audit.logs.exclude.columnlist}')}")
+  private List<String> excludeColumnList;
+
+  @Value("#{propertyMapper.solrUiMap('${logsearch.solr.audit.logs.column.mapping}')}")
+  private Map<String, String> solrAndUiColumns;
+
+  @Override
+  public String getSolrUrl() {
+    return solrUrl;
+  }
+
+  @Override
+  public void setSolrUrl(String solrUrl) {
+    this.solrUrl = solrUrl;
+  }
+
+  @Override
+  public String getCollection() {
+    return collection;
+  }
+
+  @Override
+  public void setCollection(String collection) {
+    this.collection = collection;
+  }
+
+  @Override
+  public String getZkConnectString() {
+    return zkConnectString;
+  }
+
+  @Override
+  public void setZkConnectString(String zkConnectString) {
+    this.zkConnectString = zkConnectString;
+  }
+
+  @Override
+  public String getConfigName() {
+    return configName;
+  }
+
+  @Override
+  public void setConfigName(String configName) {
+    this.configName = configName;
+  }
+
+  @Override
+  public Integer getNumberOfShards() {
+    return numberOfShards;
+  }
+
+  @Override
+  public void setNumberOfShards(Integer numberOfShards) {
+    this.numberOfShards = numberOfShards;
+  }
+
+  @Override
+  public Integer getReplicationFactor() {
+    return replicationFactor;
+  }
+
+  @Override
+  public void setReplicationFactor(Integer replicationFactor) {
+    this.replicationFactor = replicationFactor;
+  }
+
+  @Override
+  public String getSplitInterval() {
+    return splitInterval;
+  }
+
+  @Override
+  public void setSplitInterval(String splitInterval) {
+    this.splitInterval = splitInterval;
+  }
+
+  @Override
+  public List<String> getExcludeColumnList() {
+    return excludeColumnList;
+  }
+
+  @Override
+  public void setExcludeColumnList(List<String> excludeColumnList) {
+    this.excludeColumnList = excludeColumnList;
+  }
+
+  @Override
+  public Map<String, String> getColumnMapping() {
+    return columnMapping;
+  }
+
+  @Override
+  public void setColumnMapping(Map<String, String> columnMappings) {
+    this.columnMapping = columnMappings;
+  }
+
+  @Override
+  public Map<String, String> getSolrAndUiColumns() {
+    return solrAndUiColumns;
+  }
+
+  @Override
+  public void setSolrAndUiColumns(Map<String, String> solrAndUiColumns) {
+    this.solrAndUiColumns = solrAndUiColumns;
+  }
+
+  public String getRangerCollection() {
+    return rangerCollection;
+  }
+
+  public void setRangerCollection(String rangerCollection) {
+    this.rangerCollection = rangerCollection;
+  }
+
+  public String getAliasNameIn() {
+    return aliasNameIn;
+  }
+
+  public void setAliasNameIn(String aliasNameIn) {
+    this.aliasNameIn = aliasNameIn;
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/SolrColumnConfig.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/SolrColumnConfig.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/SolrColumnConfig.java
new file mode 100644
index 0000000..a12b2ce
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/SolrColumnConfig.java
@@ -0,0 +1,36 @@
+/*
+ * 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.conf;
+
+import java.util.List;
+import java.util.Map;
+
+public interface SolrColumnConfig {
+  Map<String, String> getColumnMapping();
+
+  void setColumnMapping(Map<String, String> columnMapping);
+
+  List<String> getExcludeColumnList();
+
+  void setExcludeColumnList(List<String> excludeColumnList);
+
+  Map<String, String> getSolrAndUiColumns();
+
+  void setSolrAndUiColumns(Map<String, String> solrAndUiColumns);
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/SolrConfig.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/SolrConfig.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/SolrConfig.java
new file mode 100644
index 0000000..cfbe097
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/SolrConfig.java
@@ -0,0 +1,50 @@
+/*
+ * 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.conf;
+
+public interface SolrConfig {
+  String getSolrUrl();
+
+  void setSolrUrl(String solrUrl);
+
+  String getZkConnectString();
+
+  void setZkConnectString(String zkConnectString);
+
+  String getCollection();
+
+  void setCollection(String collection);
+
+  String getConfigName();
+
+  void setConfigName(String configName);
+
+  Integer getNumberOfShards();
+
+  void setNumberOfShards(Integer numberOfShards);
+
+  Integer getReplicationFactor();
+
+  void setReplicationFactor(Integer replicationFactor);
+
+  String getSplitInterval();
+
+  void setSplitInterval(String splitInterval);
+
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/SolrConnectionConfig.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/SolrConnectionConfig.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/SolrConnectionConfig.java
new file mode 100644
index 0000000..b3dceea
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/SolrConnectionConfig.java
@@ -0,0 +1,49 @@
+/*
+ * 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.conf;
+
+import org.springframework.beans.factory.annotation.Value;
+
+public abstract class SolrConnectionConfig implements SolrConfig {
+  @Value("${logsearch.solr.url:}")
+  private String solrUrl;
+
+  @Value("${logsearch.solr.zk_connect_string:}")
+  private String zkConnectString;
+
+  @Override
+  public String getSolrUrl() {
+    return solrUrl;
+  }
+
+  @Override
+  public void setSolrUrl(String solrUrl) {
+    this.solrUrl = solrUrl;
+  }
+
+  @Override
+  public String getZkConnectString() {
+    return zkConnectString;
+  }
+
+  @Override
+  public void setZkConnectString(String zkConnectString) {
+    this.zkConnectString = zkConnectString;
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/SolrKerberosConfig.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/SolrKerberosConfig.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/SolrKerberosConfig.java
new file mode 100644
index 0000000..7cf79b0
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/SolrKerberosConfig.java
@@ -0,0 +1,48 @@
+/*
+ * 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.conf;
+
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.Configuration;
+
+@Configuration
+public class SolrKerberosConfig {
+
+  @Value("${logsearch.solr.jaas.file:/usr/lib/ambari-logsearch-portal/logsearch_solr_jaas.conf}")
+  private String jaasFile;
+
+  @Value("${logsearch.solr.kerberos.enable:false}")
+  private boolean enabled;
+
+  public String getJaasFile() {
+    return jaasFile;
+  }
+
+  public void setJaasFile(String jaasFile) {
+    this.jaasFile = jaasFile;
+  }
+
+  public boolean isEnabled() {
+    return enabled;
+  }
+
+  public void setEnabled(boolean enabled) {
+    this.enabled = enabled;
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/SolrServiceLogConfig.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/SolrServiceLogConfig.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/SolrServiceLogConfig.java
new file mode 100644
index 0000000..e768402
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/SolrServiceLogConfig.java
@@ -0,0 +1,144 @@
+/*
+ * 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.conf;
+
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.Configuration;
+
+import java.util.List;
+import java.util.Map;
+
+@Configuration
+public class SolrServiceLogConfig extends SolrConnectionConfig implements SolrColumnConfig {
+
+  @Value("${logsearch.solr.collection.service.logs:hadoop_logs}")
+  private String collection;
+
+  @Value("${logsearch.service.logs.split.interval.mins:none}")
+  private String splitInterval;
+
+  @Value("${logsearch.solr.service.logs.config.name:hadoop_logs}")
+  private String configName;
+
+  @Value("${logsearch.collection.service.logs.numshards:1}")
+  private Integer numberOfShards;
+
+  @Value("${logsearch.collection.service.logs.replication.factor:1}")
+  private Integer replicationFactor;
+
+  @Value("#{propertyMapper.list('${logsearch.service.logs.fields}')}")
+  private List<String> fields;
+
+  @Value("#{propertyMapper.map('${logsearch.solr.audit.logs.column.mapping}')}")
+  private Map<String, String> columnMapping;
+
+  @Value("#{propertyMapper.list('${logsearch.solr.audit.logs.exclude.columnlist}')}")
+  private List<String> excludeColumnList;
+
+  @Value("#{propertyMapper.solrUiMap('${logsearch.solr.audit.logs.column.mapping}}')}")
+  private Map<String, String> solrAndUiColumns;
+
+  @Override
+  public String getCollection() {
+    return collection;
+  }
+
+  @Override
+  public void setCollection(String collection) {
+    this.collection = collection;
+  }
+
+  @Override
+  public String getSplitInterval() {
+    return splitInterval;
+  }
+
+  @Override
+  public void setSplitInterval(String splitInterval) {
+    this.splitInterval = splitInterval;
+  }
+
+  @Override
+  public String getConfigName() {
+    return configName;
+  }
+
+  @Override
+  public void setConfigName(String configName) {
+    this.configName = configName;
+  }
+
+  @Override
+  public Integer getNumberOfShards() {
+    return numberOfShards;
+  }
+
+  @Override
+  public void setNumberOfShards(Integer numberOfShards) {
+    this.numberOfShards = numberOfShards;
+  }
+
+  @Override
+  public Integer getReplicationFactor() {
+    return replicationFactor;
+  }
+
+  @Override
+  public void setReplicationFactor(Integer replicationFactor) {
+    this.replicationFactor = replicationFactor;
+  }
+
+  @Override
+  public Map<String, String> getColumnMapping() {
+    return columnMapping;
+  }
+
+  @Override
+  public void setColumnMapping(Map<String, String> columnMapping) {
+    this.columnMapping = columnMapping;
+  }
+
+  @Override
+  public List<String> getExcludeColumnList() {
+    return excludeColumnList;
+  }
+
+  @Override
+  public void setExcludeColumnList(List<String> excludeColumnList) {
+    this.excludeColumnList = excludeColumnList;
+  }
+
+  @Override
+  public Map<String, String> getSolrAndUiColumns() {
+    return solrAndUiColumns;
+  }
+
+  @Override
+  public void setSolrAndUiColumns(Map<String, String> solrAndUiColumns) {
+    this.solrAndUiColumns = solrAndUiColumns;
+  }
+
+  public List<String> getFields() {
+    return fields;
+  }
+
+  public void setFields(List<String> fields) {
+    this.fields = fields;
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/SolrUserConfig.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/SolrUserConfig.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/SolrUserConfig.java
new file mode 100644
index 0000000..8ae630a
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/SolrUserConfig.java
@@ -0,0 +1,104 @@
+/*
+ * 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.conf;
+
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.Configuration;
+
+import java.util.List;
+
+@Configuration
+public class SolrUserConfig extends SolrConnectionConfig {
+
+  @Value("${logsearch.solr.collection.history:history}")
+  private String collection;
+
+  @Value("${logsearch.history.split.interval.mins:none}")
+  private String splitInterval;
+
+  @Value("${logsearch.solr.history.config.name:history}")
+  private String configName;
+
+  @Value("${logsearch.collection.history.numshards:1}")
+  private Integer numberOfShards;
+
+  @Value("${logsearch.collection.history.replication.factor:2}")
+  private Integer replicationFactor;
+
+  @Value("#{'${logsearch.logfeeder.include.default.level:FATAL,ERROR,WARN,INFO,DEBUG,TRACE,UNKNOWN}'.split(',')}")
+  private List<String> logLevels;
+
+  @Override
+  public String getCollection() {
+    return collection;
+  }
+
+  @Override
+  public void setCollection(String collection) {
+    this.collection = collection;
+  }
+
+  @Override
+  public String getSplitInterval() {
+    return splitInterval;
+  }
+
+  @Override
+  public void setSplitInterval(String splitInterval) {
+    this.splitInterval = splitInterval;
+  }
+
+  @Override
+  public String getConfigName() {
+    return configName;
+  }
+
+  @Override
+  public void setConfigName(String configName) {
+    this.configName = configName;
+  }
+
+  @Override
+  public Integer getNumberOfShards() {
+    return numberOfShards;
+  }
+
+  @Override
+  public void setNumberOfShards(Integer numberOfShards) {
+    this.numberOfShards = numberOfShards;
+  }
+
+  @Override
+  public Integer getReplicationFactor() {
+    return replicationFactor;
+  }
+
+  @Override
+  public void setReplicationFactor(Integer replicationFactor) {
+    this.replicationFactor = replicationFactor;
+  }
+
+  public List<String> getLogLevels() {
+    return logLevels;
+  }
+
+  public void setLogLevels(List<String> logLevels) {
+    this.logLevels = logLevels;
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/AuditSolrDao.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/AuditSolrDao.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/AuditSolrDao.java
index 64aa776..4f5e734 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/AuditSolrDao.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/AuditSolrDao.java
@@ -23,9 +23,11 @@ import java.util.Arrays;
 import java.util.Collection;
 
 import javax.annotation.PostConstruct;
+import javax.inject.Inject;
 
 import org.apache.ambari.logsearch.common.PropertiesHelper;
-import org.apache.ambari.logsearch.manager.MgrBase.LogType;
+import org.apache.ambari.logsearch.conf.SolrAuditLogConfig;
+import org.apache.ambari.logsearch.manager.ManagerBase.LogType;
 import org.apache.commons.lang.StringUtils;
 import org.apache.log4j.Logger;
 import org.springframework.stereotype.Component;
@@ -33,23 +35,26 @@ import org.springframework.stereotype.Component;
 @Component
 public class AuditSolrDao extends SolrDaoBase {
 
-  static private Logger logger = Logger.getLogger(AuditSolrDao.class);
-  
+  private static final Logger logger = Logger.getLogger(AuditSolrDao.class);
+
+  @Inject
+  private SolrAuditLogConfig solrAuditLogConfig;
+
   public AuditSolrDao() {
     super(LogType.AUDIT);
   }
 
   @PostConstruct
   public void postConstructor() {
-    String solrUrl = PropertiesHelper.getProperty("logsearch.solr.audit.logs.url");
-    String zkConnectString = PropertiesHelper.getProperty("logsearch.solr.audit.logs.zk_connect_string");
-    String collection = PropertiesHelper.getProperty("logsearch.solr.collection.audit.logs", "audit_logs");
-    String aliasNameIn = PropertiesHelper.getProperty("logsearch.solr.audit.logs.alias.name", "audit_logs_alias");
-    String rangerAuditCollection = PropertiesHelper.getProperty("logsearch.ranger.audit.logs.collection.name");
-    String splitInterval = PropertiesHelper.getProperty("logsearch.audit.logs.split.interval.mins", "none");
-    String configName = PropertiesHelper.getProperty("logsearch.solr.audit.logs.config.name", "audit_logs");
-    int numberOfShards = PropertiesHelper.getIntProperty("logsearch.collection.audit.logs.numshards", 1);
-    int replicationFactor = PropertiesHelper.getIntProperty("logsearch.collection.audit.logs.replication.factor", 1);
+    String solrUrl = solrAuditLogConfig.getSolrUrl();
+    String zkConnectString = solrAuditLogConfig.getZkConnectString();
+    String collection = solrAuditLogConfig.getCollection();
+    String aliasNameIn = solrAuditLogConfig.getAliasNameIn();
+    String rangerAuditCollection = solrAuditLogConfig.getRangerCollection();
+    String splitInterval = solrAuditLogConfig.getSplitInterval();
+    String configName = solrAuditLogConfig.getConfigName();
+    int numberOfShards = solrAuditLogConfig.getNumberOfShards();
+    int replicationFactor = solrAuditLogConfig.getReplicationFactor();
 
     try {
       connectToSolr(solrUrl, zkConnectString, collection);

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/ServiceLogsSolrDao.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/ServiceLogsSolrDao.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/ServiceLogsSolrDao.java
index 6e2bb4b..e338b7c 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/ServiceLogsSolrDao.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/ServiceLogsSolrDao.java
@@ -20,9 +20,11 @@
 package org.apache.ambari.logsearch.dao;
 
 import javax.annotation.PostConstruct;
+import javax.inject.Inject;
 
 import org.apache.ambari.logsearch.common.PropertiesHelper;
-import org.apache.ambari.logsearch.manager.MgrBase.LogType;
+import org.apache.ambari.logsearch.conf.SolrServiceLogConfig;
+import org.apache.ambari.logsearch.manager.ManagerBase.LogType;
 import org.apache.log4j.Logger;
 import org.springframework.stereotype.Component;
 
@@ -30,6 +32,9 @@ import org.springframework.stereotype.Component;
 public class ServiceLogsSolrDao extends SolrDaoBase {
 
   private static final Logger logger = Logger.getLogger(ServiceLogsSolrDao.class);
+
+  @Inject
+  private SolrServiceLogConfig solrServiceLogConfig;
   
   public ServiceLogsSolrDao() {
     super(LogType.SERVICE);
@@ -38,13 +43,13 @@ public class ServiceLogsSolrDao extends SolrDaoBase {
   @PostConstruct
   public void postConstructor() {
     logger.info("postConstructor() called.");
-    String solrUrl = PropertiesHelper.getProperty("logsearch.solr.url");
-    String zkConnectString = PropertiesHelper.getProperty("logsearch.solr.zk_connect_string");
-    String collection = PropertiesHelper.getProperty("logsearch.solr.collection.service.logs", "hadoop_logs");
-    String splitInterval = PropertiesHelper.getProperty("logsearch.service.logs.split.interval.mins", "none");
-    String configName = PropertiesHelper.getProperty("logsearch.solr.service.logs.config.name", "hadoop_logs");
-    int numberOfShards = PropertiesHelper.getIntProperty("logsearch.collection.service.logs.numshards", 1);
-    int replicationFactor = PropertiesHelper.getIntProperty("logsearch.collection.service.logs.replication.factor", 1);
+    String solrUrl = solrServiceLogConfig.getSolrUrl();
+    String zkConnectString = solrServiceLogConfig.getZkConnectString();
+    String collection = solrServiceLogConfig.getCollection();
+    String splitInterval = solrServiceLogConfig.getSplitInterval();
+    String configName = solrServiceLogConfig.getConfigName();
+    int numberOfShards = solrServiceLogConfig.getNumberOfShards();
+    int replicationFactor = solrServiceLogConfig.getReplicationFactor();
 
     try {
       connectToSolr(solrUrl, zkConnectString, collection);

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/SolrDaoBase.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/SolrDaoBase.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/SolrDaoBase.java
index 8cdb6eb..b325171 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/SolrDaoBase.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/SolrDaoBase.java
@@ -30,7 +30,9 @@ import org.apache.ambari.logsearch.common.ConfigHelper;
 import org.apache.ambari.logsearch.common.LogSearchContext;
 import org.apache.ambari.logsearch.common.MessageEnums;
 import org.apache.ambari.logsearch.common.PropertiesHelper;
-import org.apache.ambari.logsearch.manager.MgrBase.LogType;
+import org.apache.ambari.logsearch.conf.SolrKerberosConfig;
+import org.apache.ambari.logsearch.conf.SolrUserConfig;
+import org.apache.ambari.logsearch.manager.ManagerBase.LogType;
 import org.apache.ambari.logsearch.util.RESTErrorUtil;
 import org.apache.commons.lang.StringUtils;
 import org.apache.log4j.Logger;
@@ -58,6 +60,8 @@ import org.apache.solr.common.util.NamedList;
 
 import com.google.common.annotations.VisibleForTesting;
 
+import javax.inject.Inject;
+
 public abstract class SolrDaoBase {
   private static final Logger logger = Logger.getLogger(SolrDaoBase.class);
   private static final Logger logPerformance = Logger.getLogger("org.apache.ambari.logsearch.performance");
@@ -85,6 +89,11 @@ public abstract class SolrDaoBase {
   private String solrDetail = "";
 
   private boolean populateFieldsThreadActive = false;
+
+  @Inject
+  private SolrKerberosConfig solrKerberosConfig;
+  @Inject
+  private SolrUserConfig solrUserConfig;
   
   protected SolrDaoBase(LogType logType) {
     this.logType = logType;
@@ -461,8 +470,8 @@ public abstract class SolrDaoBase {
   }
 
   private void setupSecurity() {
-    String jaasFile = PropertiesHelper.getProperty("logsearch.solr.jaas.file", "/etc/security/keytabs/logsearch_solr.service.keytab");
-    boolean securityEnabled = PropertiesHelper.getBooleanProperty("logsearch.solr.kerberos.enable", false);
+    String jaasFile = solrKerberosConfig.getJaasFile();
+    boolean securityEnabled = solrKerberosConfig.isEnabled();
     if (securityEnabled) {
       System.setProperty("java.security.auth.login.config", jaasFile);
       HttpClientUtil.setConfigurer(new Krb5HttpClientConfigurer());
@@ -512,12 +521,12 @@ public abstract class SolrDaoBase {
     SolrRequest<SchemaResponse> request = new SchemaRequest();
     request.setMethod(METHOD.GET);
     request.setPath("/schema");
-    String historyCollection = PropertiesHelper.getProperty("logsearch.solr.collection.history","history");
+    String historyCollection = solrUserConfig.getCollection();
     if (solrClient != null && !collectionName.equals(historyCollection)) {
       NamedList<Object> namedList = null;
       try {
         namedList = solrClient.request(request);
-        logger.info("populateSchemaFields() collection=" + collectionName + ", fields=" + namedList);
+        logger.debug("populateSchemaFields() collection=" + collectionName + ", fields=" + namedList);
       } catch (SolrException | SolrServerException | IOException e) {
         logger.error("Error occured while popuplating field. collection=" + collectionName, e);
       }

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/UserConfigSolrDao.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/UserConfigSolrDao.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/UserConfigSolrDao.java
index 026c78f..a9fb8d2 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/UserConfigSolrDao.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/UserConfigSolrDao.java
@@ -21,15 +21,17 @@ package org.apache.ambari.logsearch.dao;
 
 import java.io.File;
 import java.io.IOException;
-import java.util.Arrays;
 import java.util.Date;
 import java.util.HashMap;
 import java.util.Iterator;
+import java.util.List;
 import java.util.Scanner;
 import javax.annotation.PostConstruct;
+import javax.inject.Inject;
+
+import org.apache.ambari.logsearch.conf.SolrUserConfig;
 import org.apache.ambari.logsearch.view.VLogfeederFilterWrapper;
 import org.apache.ambari.logsearch.common.LogSearchConstants;
-import org.apache.ambari.logsearch.common.PropertiesHelper;
 import org.apache.solr.client.solrj.SolrQuery;
 import org.apache.solr.client.solrj.SolrServerException;
 import org.apache.solr.client.solrj.response.QueryResponse;
@@ -42,7 +44,7 @@ import org.codehaus.jettison.json.JSONException;
 import org.codehaus.jettison.json.JSONObject;
 import com.google.gson.JsonParseException;
 
-import org.apache.ambari.logsearch.manager.MgrBase.LogType;
+import org.apache.ambari.logsearch.manager.ManagerBase.LogType;
 import org.apache.ambari.logsearch.util.JSONUtil;
 import org.apache.log4j.Logger;
 import org.springframework.stereotype.Component;
@@ -52,7 +54,9 @@ import org.springframework.util.CollectionUtils;
 public class UserConfigSolrDao extends SolrDaoBase {
 
   private static final Logger logger = Logger.getLogger(UserConfigSolrDao.class);
-  private static final String DEFAULT_LEVELS = "FATAL,ERROR,WARN,INFO,DEBUG,TRACE";
+
+  @Inject
+  private SolrUserConfig solrUserConfig;
 
   public UserConfigSolrDao() {
     super(LogType.SERVICE);
@@ -60,13 +64,13 @@ public class UserConfigSolrDao extends SolrDaoBase {
 
   @PostConstruct
   public void postConstructor() {
-    String solrUrl = PropertiesHelper.getProperty("logsearch.solr.url");
-    String zkConnectString = PropertiesHelper.getProperty("logsearch.solr.zk_connect_string");
-    String collection = PropertiesHelper.getProperty("logsearch.solr.collection.history", "history");
-    String configName = PropertiesHelper.getProperty("logsearch.solr.history.config.name", "history");
-    int replicationFactor = PropertiesHelper.getIntProperty("logsearch.collection.history.replication.factor", 2);
-    String splitInterval = "none";
-    int numberOfShards = 1;
+    String solrUrl = solrUserConfig.getSolrUrl();
+    String zkConnectString = solrUserConfig.getZkConnectString();
+    String collection = solrUserConfig.getCollection();
+    String configName = solrUserConfig.getConfigName();
+    int replicationFactor = solrUserConfig.getReplicationFactor();
+    String splitInterval = solrUserConfig.getSplitInterval();
+    int numberOfShards = solrUserConfig.getNumberOfShards();
 
     try {
       connectToSolr(solrUrl, zkConnectString, collection);
@@ -117,14 +121,14 @@ public class UserConfigSolrDao extends SolrDaoBase {
     if (!CollectionUtils.isEmpty(documentList)) {
       SolrDocument configDoc = documentList.get(0);
       String configJson = JSONUtil.objToJson(configDoc);
-      HashMap<String, Object> configMap = (HashMap<String, Object>) JSONUtil.jsonToMapObject(configJson);
+      HashMap<String, Object> configMap = JSONUtil.jsonToMapObject(configJson);
       String json = (String) configMap.get(LogSearchConstants.VALUES);
       logfeederFilterWrapper = (VLogfeederFilterWrapper) JSONUtil.jsonToObj(json, VLogfeederFilterWrapper.class);
       logfeederFilterWrapper.setId("" + configDoc.get(LogSearchConstants.ID));
 
     } else {
-      String logfeederDefaultLevels = PropertiesHelper.getProperty("logsearch.logfeeder.include.default.level", DEFAULT_LEVELS);
-      JSONArray levelJsonArray = new JSONArray(Arrays.asList(logfeederDefaultLevels.split(",")));
+      List<String> logfeederDefaultLevels = solrUserConfig.getLogLevels();
+      JSONArray levelJsonArray = new JSONArray(logfeederDefaultLevels);
 
       String hadoopServiceString = getHadoopServiceConfigJSON();
       String key = null;

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/UserDao.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/UserDao.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/UserDao.java
index 39f0e25..a04dee4 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/UserDao.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/UserDao.java
@@ -24,8 +24,9 @@ import java.util.Arrays;
 import java.util.HashMap;
 
 import javax.annotation.PostConstruct;
+import javax.inject.Inject;
 
-import org.springframework.beans.factory.annotation.Autowired;
+import org.apache.ambari.logsearch.conf.AuthConfig;
 import org.springframework.security.core.GrantedAuthority;
 import org.springframework.stereotype.Repository;
 import org.apache.ambari.logsearch.common.PropertiesHelper;
@@ -50,9 +51,12 @@ public class UserDao {
   private static final String ENC_PASSWORD = "en_password";
   private static final String NAME = "name";
 
-  @Autowired
+  @Inject
   private LogsearchFileAuthenticationProvider fileAuthenticationProvider;
 
+  @Inject
+  private AuthConfig authConfig;
+
   private ArrayList<HashMap<String, String>> userList = null;
 
   @SuppressWarnings("unchecked")
@@ -60,7 +64,7 @@ public class UserDao {
   public void initialization() {
     if (fileAuthenticationProvider.isEnable()) {
       try {
-        String userPassJsonFileName = PropertiesHelper.getProperty("logsearch.login.credentials.file");
+        String userPassJsonFileName = authConfig.getCredentialsFile();
         logger.info("USER PASS JSON  file NAME:" + userPassJsonFileName);
         File jsonFile = FileUtil.getFileFromClasspath(userPassJsonFileName);
         if (jsonFile == null || !jsonFile.exists()) {


[56/58] [abbrv] ambari git commit: AMBARI-18606. Improve Audit Log processing by Logfeeder (Miklos Gergely via oleewere)

Posted by ol...@apache.org.
AMBARI-18606. Improve Audit Log processing by Logfeeder (Miklos Gergely via oleewere)

Change-Id: I9e357536115a691801013932cf13051908170d93


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

Branch: refs/heads/branch-2.5
Commit: a9094ab8ddcc8ac42d2c02de2c66656049d61f7c
Parents: 0e852c1
Author: Miklos Gergely <mg...@hortonworks.com>
Authored: Wed Oct 19 17:24:58 2016 +0200
Committer: oleewere <ol...@gmail.com>
Committed: Sat Nov 5 14:46:47 2016 +0100

----------------------------------------------------------------------
 .../ambari/logfeeder/filter/FilterKeyValue.java |  65 ++-
 .../logfeeder/mapper/MapperFieldCopy.java       |  58 ++
 .../src/main/resources/alias_config.json        |   3 +
 .../logfeeder/mapper/MapperFieldCopyTest.java   |  71 +++
 .../configsets/audit_logs/conf/managed-schema   |   5 +
 .../logsearch/common/LogSearchConstants.java    |   2 +-
 .../ambari/logsearch/dao/AuditSolrDao.java      |   2 +-
 .../ambari/logsearch/dao/SolrCollectionDao.java |   2 +-
 .../logsearch/dao/SolrSchemaFieldDao.java       | 105 ++--
 .../apache/ambari/logsearch/dao/UserDao.java    |   2 +-
 .../logsearch/graph/GraphDataGenerator.java     |  10 +-
 .../ambari/logsearch/manager/ManagerBase.java   |   3 +-
 .../logsearch/manager/ServiceLogsManager.java   |   6 +-
 .../logsearch/manager/UserConfigManager.java    |   8 +-
 .../logsearch/model/response/CommonLogData.java |  13 +-
 .../logsearch/solr/model/SolrAuditLogData.java  |   1 -
 .../logsearch/solr/model/SolrCommonLogData.java |  42 ++
 .../solr/model/SolrServiceLogData.java          |  34 --
 .../apache/ambari/logsearch/util/SolrUtil.java  |  62 +-
 .../LogsearchKRBAuthenticationFilter.java       |  12 +-
 .../logsearch/web/security/LdapProperties.java  |   2 +-
 .../scripts/views/audit/AuditTabLayoutView.js   |   2 +-
 .../src/main/webapp/static/schema_fields.json   |  19 +-
 .../test-config/logfeeder/logfeeder.properties  |   3 +-
 .../shipper-conf/input.config-ambari.json       | 585 +++++++++++++++++++
 .../test-logs/ambari-server/ambari-audit.log    | 390 +++++++++++++
 .../templates/input.config-ambari.json.j2       | 119 ++++
 .../templates/input.config-falcon.json.j2       |   2 +-
 28 files changed, 1458 insertions(+), 170 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/a9094ab8/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/filter/FilterKeyValue.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/filter/FilterKeyValue.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/filter/FilterKeyValue.java
index 5bb15ff..b04a439 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/filter/FilterKeyValue.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/filter/FilterKeyValue.java
@@ -19,6 +19,7 @@
 
 package org.apache.ambari.logfeeder.filter;
 
+import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.regex.Pattern;
@@ -68,18 +69,26 @@ public class FilterKeyValue extends Filter {
     if (sourceField == null) {
       return;
     }
-    Object valueObj = jsonObj.get(sourceField);
-    if (valueObj != null) {
+    if (jsonObj.containsKey(sourceField)) {
+      String keyValueString = (String) jsonObj.get(sourceField);
+      Map<String, String> valueMap = new HashMap<>();
+      if (valueBorders != null) {
+        keyValueString = preProcessBorders(keyValueString, valueMap);
+      }
+      
       String splitPattern = Pattern.quote(fieldSplit);
-      String[] tokens = valueObj.toString().split(splitPattern);
+      String[] tokens = keyValueString.split(splitPattern);
       for (String nv : tokens) {
         String[] nameValue = getNameValue(nv);
         String name = nameValue != null && nameValue.length == 2 ? nameValue[0] : null;
         String value = nameValue != null && nameValue.length == 2 ? nameValue[1] : null;
         if (name != null && value != null) {
-            jsonObj.put(name, value);
-         } else {
-           logParseError("name=" + name + ", pair=" + nv + ", field=" + sourceField + ", field_value=" + valueObj);
+          if (valueMap.containsKey(value)) {
+            value = valueMap.get(value);
+          }
+          jsonObj.put(name, value);
+        } else {
+         logParseError("name=" + name + ", pair=" + nv + ", field=" + sourceField + ", field_value=" + keyValueString);
         }
       }
     }
@@ -87,19 +96,41 @@ public class FilterKeyValue extends Filter {
     statMetric.value++;
   }
 
-  private String[] getNameValue(String nv) {
-    if (valueBorders != null) {
-      if (nv.charAt(nv.length() - 1) == valueBorders.charAt(1)) {
-        String splitPattern = Pattern.quote("" + valueBorders.charAt(0));
-        return nv.substring(0, nv.length() - 1).split(splitPattern);
-      } else {
-        return null;
+  private String preProcessBorders(String keyValueString, Map<String, String> valueMap) {
+    char openBorder = valueBorders.charAt(0);
+    char closeBorder = valueBorders.charAt(1);
+    
+    StringBuilder processed = new StringBuilder();
+    int lastPos = 0;
+    int openBorderNum = 0;
+    int valueNum = 0;
+    for (int pos = 0; pos < keyValueString.length(); pos++) {
+      char c = keyValueString.charAt(pos);
+      if (c == openBorder) {
+        if (openBorderNum == 0 ) {
+          processed.append(keyValueString.substring(lastPos, pos));
+          lastPos = pos + 1;
+        }
+        openBorderNum++;
+      }
+      if (c == closeBorder) {
+        openBorderNum--;
+        if (openBorderNum == 0) {
+          String value = keyValueString.substring(lastPos, pos).trim();
+          String valueId = "$VALUE" + (++valueNum);
+          valueMap.put(valueId, value);
+          processed.append(valueSplit + valueId);
+          lastPos = pos + 1;
+        }
       }
     }
-    else {
-      String splitPattern = Pattern.quote(valueSplit);
-      return nv.split(splitPattern);
-    }
+    
+    return processed.toString();
+  }
+
+  private String[] getNameValue(String nv) {
+    String splitPattern = Pattern.quote(valueSplit);
+    return nv.split(splitPattern);
   }
 
   private void logParseError(String inputStr) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/a9094ab8/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/mapper/MapperFieldCopy.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/mapper/MapperFieldCopy.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/mapper/MapperFieldCopy.java
new file mode 100644
index 0000000..39e1ff4
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/mapper/MapperFieldCopy.java
@@ -0,0 +1,58 @@
+/*
+ * 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.logfeeder.mapper;
+
+import java.util.Map;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.log4j.Logger;
+
+/**
+ * Overrides the value for the field
+ */
+public class MapperFieldCopy extends Mapper {
+  private static final Logger LOG = Logger.getLogger(MapperFieldCopy.class);
+  
+  private String copyName = null;
+
+  @Override
+  public boolean init(String inputDesc, String fieldName, String mapClassCode, Object mapConfigs) {
+    init(inputDesc, fieldName, mapClassCode);
+    if (!(mapConfigs instanceof Map)) {
+      LOG.fatal("Can't initialize object. mapConfigs class is not of type Map. " + mapConfigs.getClass().getName());
+      return false;
+    }
+    
+    @SuppressWarnings("unchecked")
+    Map<String, Object> mapObjects = (Map<String, Object>) mapConfigs;
+    copyName = (String) mapObjects.get("copy_name");
+    if (StringUtils.isEmpty(copyName)) {
+      LOG.fatal("Map copy name is empty.");
+      return false;
+    }
+    return true;
+  }
+
+  @Override
+  public Object apply(Map<String, Object> jsonObj, Object value) {
+    jsonObj.put(copyName, value);
+    return value;
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/a9094ab8/ambari-logsearch/ambari-logsearch-logfeeder/src/main/resources/alias_config.json
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/resources/alias_config.json b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/resources/alias_config.json
index b15db63..e2ed625 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/resources/alias_config.json
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/resources/alias_config.json
@@ -25,6 +25,9 @@
     "map_date": {
       "klass": "org.apache.ambari.logfeeder.mapper.MapperDate"
     },
+    "map_fieldcopy": {
+      "klass": "org.apache.ambari.logfeeder.mapper.MapperFieldCopy"
+    },
     "map_fieldname": {
       "klass": "org.apache.ambari.logfeeder.mapper.MapperFieldName"
     },

http://git-wip-us.apache.org/repos/asf/ambari/blob/a9094ab8/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/mapper/MapperFieldCopyTest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/mapper/MapperFieldCopyTest.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/mapper/MapperFieldCopyTest.java
new file mode 100644
index 0000000..108c96e
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/mapper/MapperFieldCopyTest.java
@@ -0,0 +1,71 @@
+/*
+ * 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.logfeeder.mapper;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.log4j.Logger;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+public class MapperFieldCopyTest {
+  private static final Logger LOG = Logger.getLogger(MapperFieldCopyTest.class);
+
+  @Test
+  public void testMapperFieldCopy_copyField() {
+    LOG.info("testMapperFieldCopy_copyField()");
+
+    Map<String, Object> mapConfigs = new HashMap<>();
+    mapConfigs.put("copy_name", "someOtherField");
+
+    MapperFieldCopy mapperFieldCopy = new MapperFieldCopy();
+    assertTrue("Could not initialize!", mapperFieldCopy.init(null, "someField", null, mapConfigs));
+
+    Map<String, Object> jsonObj = new HashMap<>();
+    jsonObj.put("someField", "someValue");
+
+    mapperFieldCopy.apply(jsonObj, "someValue");
+
+    assertEquals("Old field name wasn't removed", "someValue", jsonObj.remove("someField"));
+    assertEquals("New field wasn't put", "someValue", jsonObj.remove("someOtherField"));
+    assertTrue("jsonObj is not empty", jsonObj.isEmpty());
+  }
+
+  @Test
+  public void testMapperFielCopy_configNotMap() {
+    LOG.info("testMapperFieldCopy_configNotMap()");
+
+    MapperFieldCopy mapperFieldCopy = new MapperFieldCopy();
+    assertFalse("Was able to initialize!", mapperFieldCopy.init(null, "someField", null, ""));
+  }
+
+  @Test
+  public void testMapperFieldCopy_noNewFieldName() {
+    LOG.info("testMapperFieldCopy_noNewFieldName()");
+
+    Map<String, Object> mapConfigs = new HashMap<>();
+
+    MapperFieldCopy mapperFieldCopy = new MapperFieldCopy();
+    assertFalse("Was able to initialize!", mapperFieldCopy.init(null, "someField", null, mapConfigs));
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/a9094ab8/ambari-logsearch/ambari-logsearch-portal/src/main/configsets/audit_logs/conf/managed-schema
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/configsets/audit_logs/conf/managed-schema b/ambari-logsearch/ambari-logsearch-portal/src/main/configsets/audit_logs/conf/managed-schema
index f77bec0..4cd412b 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/configsets/audit_logs/conf/managed-schema
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/configsets/audit_logs/conf/managed-schema
@@ -109,4 +109,9 @@
   <field name="message_md5" type="string" multiValued="false"/>
   <field name="type" type="key_lower_case" multiValued="false"/>
   
+  <dynamicField name='ngram_*' type="n_gram" multiValued="false" stored="true"/>
+  <dynamicField name='std_*' type="text_std_token_lower_case" multiValued="false" stored="true"/>
+  <dynamicField name='key_*' type="key_lower_case" multiValued="false" stored="true"/>
+  <dynamicField name="ws_*" type="text_ws" multiValued="false" omitNorms="false" stored="true"/>
+  
 </schema>

http://git-wip-us.apache.org/repos/asf/ambari/blob/a9094ab8/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/common/LogSearchConstants.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/common/LogSearchConstants.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/common/LogSearchConstants.java
index b13768f..fe31e6d 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/common/LogSearchConstants.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/common/LogSearchConstants.java
@@ -41,7 +41,7 @@ public class LogSearchConstants {
   public static final String I_E_SEPRATOR = "\\|i\\:\\:e\\|";
 
   //SUFFIX
-  public static final String NGRAM_SUFFIX = "ngram_";
+  public static final String NGRAM_PREFIX = "ngram_";
 
   //Date Format for SOLR
   public static final String SOLR_DATE_FORMAT = "yyyy-MM-dd HH:mm:ss,SSS";

http://git-wip-us.apache.org/repos/asf/ambari/blob/a9094ab8/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/AuditSolrDao.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/AuditSolrDao.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/AuditSolrDao.java
index 959d6f4..2fbdb46 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/AuditSolrDao.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/AuditSolrDao.java
@@ -67,7 +67,7 @@ public class AuditSolrDao extends SolrDaoBase {
 
     try {
       solrCollectionDao.checkSolrStatus(getSolrClient());
-      boolean createAlias = (aliasNameIn != null && !StringUtils.isBlank(rangerAuditCollection));
+      boolean createAlias = (aliasNameIn != null && StringUtils.isNotBlank(rangerAuditCollection));
       solrCollectionDao.setupCollections(getSolrClient(), solrAuditLogPropsConfig);
       if (createAlias) {
         solrAliasDao.setupAlias(solrSchemaFieldDao, getSolrClient(), solrAuditLogPropsConfig);

http://git-wip-us.apache.org/repos/asf/ambari/blob/a9094ab8/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/SolrCollectionDao.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/SolrCollectionDao.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/SolrCollectionDao.java
index 1cbac31..c83cd99 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/SolrCollectionDao.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/SolrCollectionDao.java
@@ -30,6 +30,7 @@ import org.apache.solr.common.cloud.Slice;
 import org.apache.solr.common.cloud.ZkStateReader;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import static org.apache.ambari.logsearch.solr.SolrConstants.CommonLogConstants.ROUTER_FIELD;
 
 import javax.inject.Named;
 import java.io.IOException;
@@ -43,7 +44,6 @@ public class SolrCollectionDao {
 
   private static final Logger LOG = LoggerFactory.getLogger(SolrCollectionDao.class);
 
-  private static final String ROUTER_FIELD = "_router_field_";
   private static final int SETUP_RETRY_SECOND = 30;
 
   /**

http://git-wip-us.apache.org/repos/asf/ambari/blob/a9094ab8/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/SolrSchemaFieldDao.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/SolrSchemaFieldDao.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/SolrSchemaFieldDao.java
index f16dc41..35bc2dc 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/SolrSchemaFieldDao.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/SolrSchemaFieldDao.java
@@ -25,11 +25,13 @@ import org.apache.ambari.logsearch.conf.SolrUserPropsConfig;
 import org.apache.solr.client.solrj.SolrRequest;
 import org.apache.solr.client.solrj.SolrServerException;
 import org.apache.solr.client.solrj.impl.CloudSolrClient;
+import org.apache.solr.client.solrj.request.LukeRequest;
+import org.apache.solr.client.solrj.request.schema.FieldTypeDefinition;
 import org.apache.solr.client.solrj.request.schema.SchemaRequest;
+import org.apache.solr.client.solrj.response.LukeResponse;
+import org.apache.solr.client.solrj.response.LukeResponse.FieldInfo;
 import org.apache.solr.client.solrj.response.schema.SchemaResponse;
 import org.apache.solr.common.SolrException;
-import org.apache.solr.common.util.NamedList;
-import org.codehaus.jettison.json.JSONArray;
 import org.codehaus.jettison.json.JSONObject;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -37,15 +39,17 @@ import org.slf4j.LoggerFactory;
 import javax.inject.Inject;
 import java.io.IOException;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
+import java.util.Map.Entry;
 
 public class SolrSchemaFieldDao {
 
   private static final Logger LOG = LoggerFactory.getLogger(SolrSchemaFieldDao.class);
 
   private static final int SETUP_RETRY_SECOND = 30;
-  private static final int SETUP_UPDATE_SECOND = 10 * 60; // 10 min
-
+  private static final int SETUP_UPDATE_SECOND = 1 * 60; // 1 min
+  
   private boolean populateFieldsThreadActive = false;
 
   private Map<String, String> schemaFieldNameMap = new HashMap<>();
@@ -93,73 +97,84 @@ public class SolrSchemaFieldDao {
    * Called from the thread. Don't call this directly
    */
   private boolean _populateSchemaFields(CloudSolrClient solrClient, SolrPropsConfig solrPropsConfig) {
-    SolrRequest<SchemaResponse> request = new SchemaRequest();
-    request.setMethod(SolrRequest.METHOD.GET);
-    request.setPath("/schema");
     String historyCollection = solrUserPropsConfig.getCollection();
     if (solrClient != null && !solrPropsConfig.getCollection().equals(historyCollection)) {
-      NamedList<Object> namedList = null;
+      LukeResponse lukeResponse = null;
+      SchemaResponse schemaResponse = null;
       try {
-        namedList = solrClient.request(request);
-        LOG.debug("populateSchemaFields() collection=" + solrPropsConfig.getCollection() + ", fields=" + namedList);
+        LukeRequest lukeRequest = new LukeRequest();
+        lukeRequest.setNumTerms(0);
+        lukeResponse = lukeRequest.process(solrClient);
+        
+        SolrRequest<SchemaResponse> schemaRequest = new SchemaRequest();
+        schemaRequest.setMethod(SolrRequest.METHOD.GET);
+        schemaRequest.setPath("/schema");
+        schemaResponse = schemaRequest.process(solrClient);
+        
+        LOG.debug("populateSchemaFields() collection=" + solrPropsConfig.getCollection() + ", luke=" + lukeResponse +
+            ", schema= " + schemaResponse);
       } catch (SolrException | SolrServerException | IOException e) {
         LOG.error("Error occured while popuplating field. collection=" + solrPropsConfig.getCollection(), e);
       }
 
-      if (namedList != null) {
-        extractSchemaFieldsName(namedList.toString(), schemaFieldNameMap, schemaFieldTypeMap);
+      if (lukeResponse != null && schemaResponse != null) {
+        extractSchemaFieldsName(lukeResponse, schemaResponse);
         return true;
       }
     }
     return false;
   }
 
-  public void extractSchemaFieldsName(String responseString,
-                                      final Map<String, String> schemaFieldsNameMap,
-                                      final Map<String, String> schemaFieldTypeMap) {
+  private void extractSchemaFieldsName(LukeResponse lukeResponse, SchemaResponse schemaResponse) {
     try {
-      JSONObject jsonObject = new JSONObject(responseString);
-      JSONObject schemajsonObject = jsonObject.getJSONObject("schema");
-      JSONArray jsonArrayList = schemajsonObject.getJSONArray("fields");
-      JSONArray fieldTypeJsonArray = schemajsonObject
-        .getJSONArray("fieldTypes");
-      if (jsonArrayList == null) {
-        return;
-      }
-      if (fieldTypeJsonArray == null) {
-        return;
-      }
+      HashMap<String, String> _schemaFieldNameMap = new HashMap<>();
       HashMap<String, String> _schemaFieldTypeMap = new HashMap<>();
-      HashMap<String, String> _schemaFieldsNameMap = new HashMap<String, String>();
-      for (int i = 0; i < fieldTypeJsonArray.length(); i++) {
-        JSONObject typeObject = fieldTypeJsonArray.getJSONObject(i);
-        String name = typeObject.getString("name");
-        String fieldTypeJson = typeObject.toString();
+      
+      for (Entry<String, FieldInfo> e : lukeResponse.getFieldInfo().entrySet()) {
+        String name = e.getKey();
+        String type = e.getValue().getType();
+        if (!name.contains("@") && !name.startsWith("_") && !name.contains("_md5") && !name.contains("_ms") &&
+          !name.contains(LogSearchConstants.NGRAM_PREFIX) && !name.contains("tags") && !name.contains("_str")) {
+          _schemaFieldNameMap.put(name, type);
+        }
+      }
+      
+      List<FieldTypeDefinition> fieldTypes = schemaResponse.getSchemaRepresentation().getFieldTypes();
+      for (FieldTypeDefinition fieldType : fieldTypes) {
+        Map<String, Object> fieldAttributes = fieldType.getAttributes();
+        String name = (String) fieldAttributes.get("name");
+        String fieldTypeJson = new JSONObject(fieldAttributes).toString();
         _schemaFieldTypeMap.put(name, fieldTypeJson);
       }
-      for (int i = 0; i < jsonArrayList.length(); i++) {
-        JSONObject explrObject = jsonArrayList.getJSONObject(i);
-        String name = explrObject.getString("name");
-        String type = explrObject.getString("type");
+      
+      List<Map<String, Object>> fields = schemaResponse.getSchemaRepresentation().getFields();
+      for (Map<String, Object> field : fields) {
+        String name = (String) field.get("name");
+        String type = (String) field.get("type");
         if (!name.contains("@") && !name.startsWith("_") && !name.contains("_md5") && !name.contains("_ms") &&
-          !name.contains(LogSearchConstants.NGRAM_SUFFIX) && !name.contains("tags") && !name.contains("_str")) {
-          _schemaFieldsNameMap.put(name, type);
+          !name.contains(LogSearchConstants.NGRAM_PREFIX) && !name.contains("tags") && !name.contains("_str")) {
+          _schemaFieldNameMap.put(name, type);
         }
       }
-      schemaFieldsNameMap.clear();
-      schemaFieldTypeMap.clear();
-      schemaFieldsNameMap.putAll(_schemaFieldsNameMap);
-      schemaFieldTypeMap.putAll(_schemaFieldTypeMap);
+      
+      if (_schemaFieldNameMap.isEmpty() || _schemaFieldTypeMap.isEmpty()) {
+        return;
+      }
+      
+      synchronized (this) {
+        schemaFieldNameMap = _schemaFieldNameMap;
+        schemaFieldTypeMap = _schemaFieldTypeMap;
+      }
     } catch (Exception e) {
       LOG.error(e + "Credentials not specified in logsearch.properties " + MessageEnums.ERROR_SYSTEM);
     }
   }
 
-  public Map<String, String> getSchemaFieldTypeMap() {
-    return schemaFieldTypeMap;
+  public synchronized Map<String, String> getSchemaFieldNameMap() {
+    return schemaFieldNameMap;
   }
 
-  public Map<String, String> getSchemaFieldNameMap() {
-    return schemaFieldNameMap;
+  public synchronized Map<String, String> getSchemaFieldTypeMap() {
+    return schemaFieldTypeMap;
   }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/a9094ab8/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/UserDao.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/UserDao.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/UserDao.java
index 912442d..63cc89e 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/UserDao.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/UserDao.java
@@ -135,7 +135,7 @@ public class UserDao {
       String encPassword = user.get(ENC_PASSWORD);
       String username = user.get(USER_NAME);
       String password = user.get(PASSWORD);
-      if (!StringUtils.isBlank(password)) {
+      if (StringUtils.isNotBlank(password)) {
         encPassword = CommonUtil.encryptPassword(username, password);
         user.put(PASSWORD, "");
         user.put(ENC_PASSWORD, encPassword);

http://git-wip-us.apache.org/repos/asf/ambari/blob/a9094ab8/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
index 85b5fda..741c523 100644
--- 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
@@ -249,13 +249,13 @@ public class GraphDataGenerator {
           NodeData hostNode = new NodeData();
           String name = (pivotHost.getValue() == null ? "" : "" + pivotHost.getValue());
           String value = "" + pivotHost.getCount();
-          if (!StringUtils.isBlank(name)) {
+          if (StringUtils.isNotBlank(name)) {
             hostNode.setName(name);
           }
-          if (!StringUtils.isBlank(value)) {
+          if (StringUtils.isNotBlank(value)) {
             hostNode.setValue(value);
           }
-          if (!StringUtils.isBlank(firstPriority)) {
+          if (StringUtils.isNotBlank(firstPriority)) {
             hostNode.setType(firstPriority);
           }
 
@@ -263,7 +263,7 @@ public class GraphDataGenerator {
           hostNode.setRoot(true);
           PivotField hostPivot = null;
           for (PivotField searchHost : secondHirarchicalPivotFields) {
-            if (!StringUtils.isBlank(hostNode.getName())
+            if (StringUtils.isNotBlank(hostNode.getName())
               && hostNode.getName().equals(searchHost.getValue())) {
               hostPivot = searchHost;
               break;
@@ -291,7 +291,7 @@ public class GraphDataGenerator {
                 NodeData compNode = new NodeData();
                 String compName = (pivotComp.getValue() == null ? "" : "" + pivotComp.getValue());
                 compNode.setName(compName);
-                if (!StringUtils.isBlank(secondPriority)) {
+                if (StringUtils.isNotBlank(secondPriority)) {
                   compNode.setType(secondPriority);
                 }
                 compNode.setValue("" + pivotComp.getCount());

http://git-wip-us.apache.org/repos/asf/ambari/blob/a9094ab8/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/manager/ManagerBase.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/manager/ManagerBase.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/manager/ManagerBase.java
index 45d66cf..6c280ac 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/manager/ManagerBase.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/manager/ManagerBase.java
@@ -32,6 +32,7 @@ import org.apache.ambari.logsearch.model.response.LogSearchResponse;
 import org.apache.ambari.logsearch.dao.SolrDaoBase;
 import org.apache.ambari.logsearch.util.JSONUtil;
 import org.apache.ambari.logsearch.util.RESTErrorUtil;
+import org.apache.commons.collections.CollectionUtils;
 import org.apache.log4j.Logger;
 import org.apache.solr.client.solrj.SolrQuery;
 import org.apache.solr.client.solrj.response.QueryResponse;
@@ -110,7 +111,7 @@ public abstract class ManagerBase<LOG_DATA_TYPE extends LogData, SEARCH_RESPONSE
     SEARCH_RESPONSE logResponse = createLogSearchResponse();
     SolrDocumentList docList = response.getResults();
     List<LOG_DATA_TYPE> serviceLogDataList = convertToSolrBeans(response);
-    if (docList != null && !docList.isEmpty()) {
+    if (CollectionUtils.isNotEmpty(docList)) {
       logResponse.setLogList(serviceLogDataList);
       logResponse.setStartIndex((int) docList.getStart());
       logResponse.setTotalCount(docList.getNumFound());

http://git-wip-us.apache.org/repos/asf/ambari/blob/a9094ab8/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 d276769..74c549a 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
@@ -118,7 +118,7 @@ public class ServiceLogsManager extends ManagerBase<SolrServiceLogData, ServiceL
     String keyword = request.getKeyWord();
     Boolean isLastPage = request.isLastPage();
     SimpleQuery solrQuery = conversionService.convert(request, SimpleQuery.class);
-    if (!StringUtils.isBlank(keyword)) {
+    if (StringUtils.isNotBlank(keyword)) {
       try {
         return (ServiceLogResponse) getPageByKeyword(request, event);
       } catch (SolrException | SolrServerException e) {
@@ -170,7 +170,7 @@ public class ServiceLogsManager extends ManagerBase<SolrServiceLogData, ServiceL
     SimpleFacetQuery facetQuery = conversionService.convert(request, SimpleFacetQuery.class);
     SolrQuery solrQuery = new DefaultQueryParser().doConstructSolrQuery(facetQuery);
     String hostName = request.getHostName() == null ? "" : request.getHostName();
-    if (!StringUtils.isBlank(hostName)){
+    if (StringUtils.isNotBlank(hostName)){
       solrQuery.addFilterQuery(String.format("%s:*%s*", HOST, hostName));
     }
     QueryResponse response = serviceLogsSolrDao.process(solrQuery, "/service/logs/tree");
@@ -187,7 +187,7 @@ public class ServiceLogsManager extends ManagerBase<SolrServiceLogData, ServiceL
 
     NodeListResponse list = new NodeListResponse();
     String componentName = request.getComponentName() == null ? "" : request.getComponentName();
-    if (!StringUtils.isBlank(componentName)){
+    if (StringUtils.isNotBlank(componentName)){
       solrQuery.addFilterQuery(COMPONENT + ":"
         + componentName);
       QueryResponse response = serviceLogsSolrDao.process(solrQuery, "/service/logs/hosts/components");

http://git-wip-us.apache.org/repos/asf/ambari/blob/a9094ab8/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/manager/UserConfigManager.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/manager/UserConfigManager.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/manager/UserConfigManager.java
index 00ae332..03535b1 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/manager/UserConfigManager.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/manager/UserConfigManager.java
@@ -137,10 +137,10 @@ public class UserConfigManager extends JsonManagerBase {
   }
 
   private boolean isValid(UserConfigData vHistory) {
-    return !StringUtils.isBlank(vHistory.getFiltername())
-        && !StringUtils.isBlank(vHistory.getRowType())
-        && !StringUtils.isBlank(vHistory.getUserName())
-        && !StringUtils.isBlank(vHistory.getValues());
+    return StringUtils.isNotBlank(vHistory.getFiltername())
+        && StringUtils.isNotBlank(vHistory.getRowType())
+        && StringUtils.isNotBlank(vHistory.getUserName())
+        && StringUtils.isNotBlank(vHistory.getValues());
   }
 
   public void deleteUserConfig(String id) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/a9094ab8/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/CommonLogData.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/CommonLogData.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/CommonLogData.java
index e2bba3f..21bfc5a 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/CommonLogData.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/CommonLogData.java
@@ -18,10 +18,12 @@
  */
 package org.apache.ambari.logsearch.model.response;
 
+import com.fasterxml.jackson.annotation.JsonAnyGetter;
 import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
 import com.fasterxml.jackson.annotation.JsonProperty;
 
 import java.util.Date;
+import java.util.Map;
 
 @JsonIgnoreProperties(ignoreUnknown = true)
 public interface CommonLogData extends LogData {
@@ -82,14 +84,14 @@ public interface CommonLogData extends LogData {
   void setEventCount(Long eventCount);
 
   @JsonProperty("event_md5")
-  public String getEventMd5();
+  String getEventMd5();
 
-  public void setEventMd5(String eventMd5);
+  void setEventMd5(String eventMd5);
 
   @JsonProperty("event_dur_ms")
-  public Long getEventDurationMs();
+  Long getEventDurationMs();
 
-  public void setEventDurationMs(Long eventDurationMs);
+  void setEventDurationMs(Long eventDurationMs);
 
   @JsonProperty("_ttl_")
   String getTtl();
@@ -110,4 +112,7 @@ public interface CommonLogData extends LogData {
   Integer getRouterField();
 
   void setRouterField(Integer routerField);
+  
+  @JsonAnyGetter
+  Map<String, Object> getAllDynamicFields();
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/a9094ab8/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/model/SolrAuditLogData.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/model/SolrAuditLogData.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/model/SolrAuditLogData.java
index 0fd65a3..9de05db 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/model/SolrAuditLogData.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/model/SolrAuditLogData.java
@@ -23,7 +23,6 @@ import org.apache.solr.client.solrj.beans.Field;
 
 import java.util.Date;
 import java.util.List;
-import java.util.Map;
 
 import static org.apache.ambari.logsearch.solr.SolrConstants.AuditLogConstants.*;
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/a9094ab8/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/model/SolrCommonLogData.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/model/SolrCommonLogData.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/model/SolrCommonLogData.java
index bac5080..b5ce7ad 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/model/SolrCommonLogData.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/model/SolrCommonLogData.java
@@ -22,8 +22,13 @@ import org.apache.ambari.logsearch.model.response.CommonLogData;
 import org.apache.solr.client.solrj.beans.Field;
 
 import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
 
 import static org.apache.ambari.logsearch.solr.SolrConstants.CommonLogConstants.*;
+import static org.apache.ambari.logsearch.solr.SolrConstants.ServiceLogConstants.KEY_DYNAMIC_FIELDS;
+import static org.apache.ambari.logsearch.solr.SolrConstants.ServiceLogConstants.STORED_TOKEN_DYNAMIC_FIELDS;
+import static org.apache.ambari.logsearch.solr.SolrConstants.ServiceLogConstants.WS_DYNAMIC_FIELDS;
 
 public class SolrCommonLogData implements CommonLogData {
 
@@ -78,6 +83,15 @@ public class SolrCommonLogData implements CommonLogData {
   @Field(ROUTER_FIELD)
   private Integer routerField;
 
+  @Field(STORED_TOKEN_DYNAMIC_FIELDS)
+  private Map<String, Object> stdDynamicFields;
+
+  @Field(KEY_DYNAMIC_FIELDS)
+  private Map<String, Object> keyDynamicFields;
+
+  @Field(WS_DYNAMIC_FIELDS)
+  private Map<String, Object> wsDynamicFields;
+
   @Override
   public String getId() {
     return this.id;
@@ -247,4 +261,32 @@ public class SolrCommonLogData implements CommonLogData {
   public void setType(String type) {
     this.type = type;
   }
+
+  @Override
+  public Map<String, Object> getAllDynamicFields() {
+    Map<String, Object> allDynamicFields = new HashMap<>();
+    if (stdDynamicFields != null) {
+      allDynamicFields.putAll(stdDynamicFields);
+    }
+    if (keyDynamicFields != null) {
+      allDynamicFields.putAll(keyDynamicFields);
+    }
+    if (wsDynamicFields != null) {
+      allDynamicFields.putAll(wsDynamicFields);
+    }
+    
+    return allDynamicFields;
+  }
+
+  public void setStdDynamicFields(Map<String, Object> stdDynamicFields) {
+    this.stdDynamicFields = stdDynamicFields;
+  }
+
+  public void setKeyDynamicFields(Map<String, Object> keyDynamicFields) {
+    this.keyDynamicFields = keyDynamicFields;
+  }
+
+  public void setWsDynamicFields(Map<String, Object> wsDynamicFields) {
+    this.wsDynamicFields = wsDynamicFields;
+  }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/a9094ab8/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/model/SolrServiceLogData.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/model/SolrServiceLogData.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/model/SolrServiceLogData.java
index 1d4cecf..c6fdba3 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/model/SolrServiceLogData.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/model/SolrServiceLogData.java
@@ -22,7 +22,6 @@ import org.apache.ambari.logsearch.model.response.ServiceLogData;
 import org.apache.solr.client.solrj.beans.Field;
 
 import java.util.Date;
-import java.util.Map;
 
 import static org.apache.ambari.logsearch.solr.SolrConstants.ServiceLogConstants.*;
 
@@ -49,15 +48,6 @@ public class SolrServiceLogData extends SolrCommonLogData implements ServiceLogD
   @Field(HOST)
   private String host;
 
-  @Field(STORED_TOKEN_DYNAMIC_FIELDS)
-  private Map<String, Object> stdDynamicFields;
-
-  @Field(KEY_DYNAMIC_FIELDS)
-  private Map<String, Object> keyDynamicFields;
-
-  @Field(WS_DYNAMIC_FIELDS)
-  private Map<String, Object> wsDynamicFields;
-
   @Override
   public String getPath() {
     return path;
@@ -127,28 +117,4 @@ public class SolrServiceLogData extends SolrCommonLogData implements ServiceLogD
   public void setLevel(String level) {
     this.level = level;
   }
-
-  public Map<String, Object> getStdDynamicFields() {
-    return stdDynamicFields;
-  }
-
-  public void setStdDynamicFields(Map<String, Object> stdDynamicFields) {
-    this.stdDynamicFields = stdDynamicFields;
-  }
-
-  public Map<String, Object> getKeyDynamicFields() {
-    return keyDynamicFields;
-  }
-
-  public void setKeyDynamicFields(Map<String, Object> keyDynamicFields) {
-    this.keyDynamicFields = keyDynamicFields;
-  }
-
-  public Map<String, Object> getWsDynamicFields() {
-    return wsDynamicFields;
-  }
-
-  public void setWsDynamicFields(Map<String, Object> wsDynamicFields) {
-    this.wsDynamicFields = wsDynamicFields;
-  }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/a9094ab8/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/util/SolrUtil.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/util/SolrUtil.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/util/SolrUtil.java
index 6369107..7a856d2 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/util/SolrUtil.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/util/SolrUtil.java
@@ -28,11 +28,13 @@ import org.apache.ambari.logsearch.common.LogSearchConstants;
 import org.apache.lucene.analysis.core.KeywordTokenizerFactory;
 import org.apache.lucene.analysis.path.PathHierarchyTokenizerFactory;
 import org.apache.lucene.analysis.standard.StandardTokenizerFactory;
+import org.apache.lucene.analysis.util.TokenizerFactory;
 import org.apache.solr.client.solrj.SolrQuery;
 import org.apache.solr.schema.TrieDoubleField;
 import org.apache.solr.schema.TrieFloatField;
 import org.apache.solr.schema.TrieIntField;
 import org.apache.solr.schema.TrieLongField;
+import org.apache.commons.collections.MapUtils;
 import org.apache.commons.lang.StringUtils;
 
 public class SolrUtil {
@@ -116,18 +118,7 @@ public class SolrUtil {
     return search;
   }
 
-  public static String makeSolrSearchString(String search) {
-    String newString = search.trim();
-    String newSearch = newString.replaceAll("(?=[]\\[+&|!(){},:\"^~/=$@%?:.\\\\])", "\\\\");
-    newSearch = newSearch.replace("\n", "*");
-    newSearch = newSearch.replace("\t", "*");
-    newSearch = newSearch.replace("\r", "*");
-    newSearch = newSearch.replace("**", "*");
-    newSearch = newSearch.replace("***", "*");
-    return "*" + newSearch + "*";
-  }
-
-  public static String makeSolrSearchStringWithoutAsterisk(String search) {
+  private static String makeSolrSearchStringWithoutAsterisk(String search) {
     String newString = search.trim();
     String newSearch = newString.replaceAll("(?=[]\\[+&|!(){}^\"~=/$@%?:.\\\\])", "\\\\");
     newSearch = newSearch.replace("\n", "*");
@@ -161,28 +152,19 @@ public class SolrUtil {
   }
   
 
-  public static boolean isSolrFieldNumber(String fieldType, Map<String, String> schemaFieldsMap) {
+  private static boolean isSolrFieldNumber(String fieldType, Map<String, String> schemaFieldsMap) {
     if (StringUtils.isBlank(fieldType)) {
       return false;
     } else {
       HashMap<String, Object> typeInfoMap = getFieldTypeInfoMap(fieldType, schemaFieldsMap);
-      if (typeInfoMap == null || typeInfoMap.isEmpty()) {
+      if (MapUtils.isEmpty(typeInfoMap)) {
         return false;
       }
       String fieldTypeClassName = (String) typeInfoMap.get("class");
-      if (fieldTypeClassName.equalsIgnoreCase(TrieIntField.class.getSimpleName())) {
-        return true;
-      }
-      if (fieldTypeClassName.equalsIgnoreCase(TrieDoubleField.class.getSimpleName())) {
-        return true;
-      }
-      if (fieldTypeClassName.equalsIgnoreCase(TrieFloatField.class.getSimpleName())) {
-        return true;
-      }
-      if (fieldTypeClassName.equalsIgnoreCase(TrieLongField.class.getSimpleName())) {
-        return true;
-      }
-      return false;
+      return fieldTypeClassName.equalsIgnoreCase(TrieIntField.class.getSimpleName()) ||
+             fieldTypeClassName.equalsIgnoreCase(TrieDoubleField.class.getSimpleName()) ||
+             fieldTypeClassName.equalsIgnoreCase(TrieFloatField.class.getSimpleName()) ||
+             fieldTypeClassName.equalsIgnoreCase(TrieLongField.class.getSimpleName());
     }
   }
 
@@ -237,7 +219,7 @@ public class SolrUtil {
     }
   }
   
-  public static HashMap<String, Object> getFieldTypeInfoMap(String fieldType, Map<String, String> schemaFieldsTypeMap) {
+  private static HashMap<String, Object> getFieldTypeInfoMap(String fieldType, Map<String, String> schemaFieldsTypeMap) {
     String fieldTypeMetaData = schemaFieldsTypeMap.get(fieldType);
     HashMap<String, Object> fieldTypeMap = JSONUtil.jsonToMapObject(fieldTypeMetaData);
     if (fieldTypeMap == null) {
@@ -273,7 +255,7 @@ public class SolrUtil {
     setFacetLimit(solrQuery, -1);
   }
 
-  public static void setFacetLimit(SolrQuery solrQuery, int limit) {
+  private static void setFacetLimit(SolrQuery solrQuery, int limit) {
     solrQuery.set("facet.limit", limit);
   }
 
@@ -286,22 +268,20 @@ public class SolrUtil {
     }
   }
 
-  private static boolean checkTokenizer(String fieldType, Class tokenizerFactoryClass, Map<String, String> schemaFieldsMap) {
+  @SuppressWarnings("unchecked")
+  private static boolean checkTokenizer(String fieldType, Class<? extends TokenizerFactory> tokenizerFactoryClass,
+      Map<String, String> schemaFieldsMap) {
     HashMap<String, Object> fieldTypeMap = SolrUtil.getFieldTypeInfoMap(fieldType ,schemaFieldsMap);
     HashMap<String, Object> analyzer = (HashMap<String, Object>) fieldTypeMap.get("analyzer");
-    if (analyzer != null) {
-      HashMap<String, Object> tokenizerMap = (HashMap<String, Object>) analyzer.get("tokenizer");
-      if (tokenizerMap != null) {
-        String tokenizerClass = (String) tokenizerMap.get("class");
-        if (!StringUtils.isEmpty(tokenizerClass)) {
-          tokenizerClass =tokenizerClass.replace("solr.", "");
-          if (tokenizerClass.equalsIgnoreCase(tokenizerFactoryClass
-            .getSimpleName())) {
-            return true;
-          }
-        }
+    HashMap<String, Object> tokenizerMap = (HashMap<String, Object>)MapUtils.getObject(analyzer, "tokenizer");
+    if (tokenizerMap != null) {
+      String tokenizerClass = (String) tokenizerMap.get("class");
+      if (StringUtils.isNotEmpty(tokenizerClass)) {
+        tokenizerClass = tokenizerClass.replace("solr.", "");
+        return tokenizerClass.equalsIgnoreCase(tokenizerFactoryClass.getSimpleName());
       }
     }
+    
     return false;
   }
   

http://git-wip-us.apache.org/repos/asf/ambari/blob/a9094ab8/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/filters/LogsearchKRBAuthenticationFilter.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/filters/LogsearchKRBAuthenticationFilter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/filters/LogsearchKRBAuthenticationFilter.java
index 29fd5b2..808320d 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/filters/LogsearchKRBAuthenticationFilter.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/filters/LogsearchKRBAuthenticationFilter.java
@@ -148,7 +148,7 @@ public class LogsearchKRBAuthenticationFilter extends LogsearchKrbFilter {
       HttpServletResponse response) throws IOException, ServletException {
     logger.debug("LogsearchKRBAuthenticationFilter private filter");
     String userName = getUsernameFromResponse(response);
-    if (!StringUtils.isEmpty(userName)) {
+    if (StringUtils.isNotEmpty(userName)) {
       Authentication existingAuth = SecurityContextHolder.getContext()
           .getAuthentication();
       if (existingAuth == null || !existingAuth.isAuthenticated()) {
@@ -199,7 +199,7 @@ public class LogsearchKRBAuthenticationFilter extends LogsearchKrbFilter {
       KerberosName.setRules(PropertiesHelper.getProperty(NAME_RULES, "DEFAULT"));
       String userName = getUsernameFromRequest(httpRequest);
       if ((existingAuth == null || !existingAuth.isAuthenticated())
-          && (!StringUtils.isEmpty(userName))) {
+          && (StringUtils.isNotEmpty(userName))) {
         // --------------------------- To Create Logsearch Session--------------------------------------
         // if we get the userName from the token then log into logsearch using the same user
         final List<GrantedAuthority> grantedAuths = new ArrayList<>();
@@ -236,8 +236,8 @@ public class LogsearchKRBAuthenticationFilter extends LogsearchKrbFilter {
       String keytab = PropertiesHelper.getProperty(KEYTAB);
       String principal = PropertiesHelper.getProperty(PRINCIPAL);
       String hostname = PropertiesHelper.getProperty(HOST_NAME);
-      if (!StringUtils.isEmpty(keytab) && !StringUtils.isEmpty(principal)
-          && !StringUtils.isEmpty(hostname)) {
+      if (StringUtils.isNotEmpty(keytab) && StringUtils.isNotEmpty(principal)
+          && StringUtils.isNotEmpty(hostname)) {
         spnegoEnable = true;
       }
     }
@@ -306,7 +306,7 @@ public class LogsearchKRBAuthenticationFilter extends LogsearchKrbFilter {
         Iterator<String> iterator = cookiesCollection.iterator();
         while (iterator.hasNext()) {
           String cookie = iterator.next();
-          if (!StringUtils.isEmpty(cookie)) {
+          if (StringUtils.isNotEmpty(cookie)) {
             if (cookie.toLowerCase().startsWith(AUTH_COOKIE_NAME.toLowerCase())) {
               Matcher m = usernamePattern.matcher(cookie);
               if (m.find()) {
@@ -314,7 +314,7 @@ public class LogsearchKRBAuthenticationFilter extends LogsearchKrbFilter {
               }
             }
           }
-          if (!StringUtils.isEmpty(userName)) {
+          if (StringUtils.isNotEmpty(userName)) {
             break;
           }
         }

http://git-wip-us.apache.org/repos/asf/ambari/blob/a9094ab8/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LdapProperties.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LdapProperties.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LdapProperties.java
index 2a1b4ee..82e71fe 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LdapProperties.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LdapProperties.java
@@ -63,7 +63,7 @@ public class LdapProperties {
     } else {
       List<String> list = new ArrayList<String>();
       list.add(protocol + primaryUrl);
-      if (!StringUtils.isEmpty(secondaryUrl)) {
+      if (StringUtils.isNotEmpty(secondaryUrl)) {
         list.add(protocol + secondaryUrl);
       }
       return list;

http://git-wip-us.apache.org/repos/asf/ambari/blob/a9094ab8/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/audit/AuditTabLayoutView.js
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/audit/AuditTabLayoutView.js b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/audit/AuditTabLayoutView.js
index 4e09e88..7710156 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/audit/AuditTabLayoutView.js
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/audit/AuditTabLayoutView.js
@@ -312,7 +312,7 @@ define(['require',
           if (columns[name] === undefined && value != "_version_") {
             var columnObj = {
               name: Globals.invertedAuditLogMappings[value],
-              label:value,
+              label: value,
               cell: "String",
               sortType: 'toggle',
               editable: false

http://git-wip-us.apache.org/repos/asf/ambari/blob/a9094ab8/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/static/schema_fields.json
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/static/schema_fields.json b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/static/schema_fields.json
index 7b1a9a9..55f1d3c 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/static/schema_fields.json
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/static/schema_fields.json
@@ -65,7 +65,24 @@
     "text": "Text",
     "type": "Type",
     "ugi": "UGI",
-    "reqUser": "User"
+    "reqUser": "User",
+    
+    "ws_base_url": "Base URL",
+    "ws_command": "Command",
+    "ws_component": "Component",
+    "ws_details": "Details",
+    "ws_display_name": "Display Name",
+    "ws_os": "OS",
+    "ws_repo_id": "Repo Id",
+    "ws_repo_version": "Repo Version",
+    "ws_repositories": "Repositories",
+    "ws_result_status": "Result Status",
+    "ws_roles": "Roles",
+    "ws_stack_version": "Stack Version",
+    "ws_stack": "Stack",
+    "ws_status": "Status",
+    "ws_version_note": "Version Note",
+    "ws_version_number": "Version Number"
   },
   "auditLogExcludes": ["tags","tags_str", "seq_num"]
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/a9094ab8/ambari-logsearch/docker/test-config/logfeeder/logfeeder.properties
----------------------------------------------------------------------
diff --git a/ambari-logsearch/docker/test-config/logfeeder/logfeeder.properties b/ambari-logsearch/docker/test-config/logfeeder/logfeeder.properties
index f930ec9..879b786 100644
--- a/ambari-logsearch/docker/test-config/logfeeder/logfeeder.properties
+++ b/ambari-logsearch/docker/test-config/logfeeder/logfeeder.properties
@@ -22,7 +22,8 @@ logfeeder.config.files=shipper-conf/global.config.json,\
   shipper-conf/input.config-hst.json,\
   shipper-conf/input.config-system_message.json,\
   shipper-conf/input.config-secure_log.json,\
-  shipper-conf/input.config-hdfs.json
+  shipper-conf/input.config-hdfs.json,\
+  shipper-conf/input.config-ambari.json
 logfeeder.log.filter.enable=true
 logfeeder.solr.config.interval=5
 logfeeder.solr.core.config.name=history

http://git-wip-us.apache.org/repos/asf/ambari/blob/a9094ab8/ambari-logsearch/docker/test-config/logfeeder/shipper-conf/input.config-ambari.json
----------------------------------------------------------------------
diff --git a/ambari-logsearch/docker/test-config/logfeeder/shipper-conf/input.config-ambari.json b/ambari-logsearch/docker/test-config/logfeeder/shipper-conf/input.config-ambari.json
new file mode 100644
index 0000000..576bfa8
--- /dev/null
+++ b/ambari-logsearch/docker/test-config/logfeeder/shipper-conf/input.config-ambari.json
@@ -0,0 +1,585 @@
+{
+  "input":[
+    {
+      "type":"ambari_agent",
+      "rowtype":"service",
+      "path":"/root/test-logs/ambari-server/ambari-agent.log"
+    },
+    {
+      "type":"ambari_server",
+      "rowtype":"service",
+      "path":"/root/test-logs/ambari-server/ambari-server.log"
+    },
+    {
+      "type":"ambari_alerts",
+      "rowtype":"service",
+      "add_fields":{
+        "level":"INFO"
+      },
+      "path":"/root/test-logs/ambari-server/ambari-alerts.log"
+    },
+    {
+      "type":"ambari_config_changes",
+      "rowtype":"service",
+      "path":"/root/test-logs/ambari-server/ambari-config-changes.log"
+    },
+    {
+      "type":"ambari_eclipselink",
+      "rowtype":"service",
+      "path":"/root/test-logs/ambari-server/ambari-eclipselink.log"
+    },
+    {
+      "type":"ambari_server_check_database",
+      "rowtype":"service",
+      "path":"/root/test-logs/ambari-server/ambari-server-check-database.log"
+    },
+    {
+      "type":"ambari_audit",
+      "rowtype":"audit",
+      "add_fields":{
+        "logType":"AmbariAudit",
+        "enforcer":"ambari-acl",
+        "repoType":"1",
+        "repo":"ambari",
+        "level":"INFO"
+      },
+      "path":"/root/test-logs/ambari-server/ambari-audit.log"
+    }
+
+  ],
+  "filter":[
+    {
+      "filter":"grok",
+      "conditions":{
+        "fields":{
+          "type":[
+            "ambari_agent"
+          ]
+
+        }
+
+      },
+      "log4j_format":"",
+      "multiline_pattern":"^(%{LOGLEVEL:level} %{TIMESTAMP_ISO8601:logtime})",
+      "message_pattern":"(?m)^%{LOGLEVEL:level} %{TIMESTAMP_ISO8601:logtime} %{JAVAFILE:file}:%{INT:line_number} - %{GREEDYDATA:log_message}",
+      "post_map_values":{
+        "logtime":{
+          "map_date":{
+            "target_date_pattern":"yyyy-MM-dd HH:mm:ss,SSS"
+          }
+
+        },
+        "level":{
+          "map_fieldvalue":{
+            "pre_value":"WARNING",
+            "post_value":"WARN"
+          }
+
+        }
+
+      }
+
+    },
+    {
+      "filter":"grok",
+      "conditions":{
+        "fields":{
+          "type":[
+            "ambari_server"
+          ]
+          
+        }
+        
+      },
+      "log4j_format":"%d{DATE} %5p [%t] %c{1}:%L - %m%n",
+      "multiline_pattern":"^(%{USER_SYNC_DATE:logtime})",
+      "message_pattern":"(?m)^%{USER_SYNC_DATE:logtime}%{SPACE}%{LOGLEVEL:level}%{SPACE}\\[%{DATA:thread_name}\\]%{SPACE}%{JAVACLASS:logger_name}:%{INT:line_number}%{SPACE}-%{SPACE}%{GREEDYDATA:log_message}",
+      "post_map_values":{
+        "logtime":{
+          "map_date":{
+            "target_date_pattern":"dd MMM yyyy HH:mm:ss"
+          }
+
+        }
+
+      }
+
+    },
+    {
+      "filter":"grok",
+      "conditions":{
+        "fields":{
+          "type":[
+            "ambari_alerts"
+          ]
+          
+        }
+        
+      },
+      "log4j_format":"%d{DATE} %5p [%t] %c{1}:%L - %m%n",
+      "multiline_pattern":"^(%{TIMESTAMP_ISO8601:logtime})",
+      "message_pattern":"(?m)^%{TIMESTAMP_ISO8601:logtime}%{SPACE}%{GREEDYDATA:log_message}",
+      "post_map_values":{
+        "logtime":{
+          "map_date":{
+            "target_date_pattern":"yyyy-MM-dd HH:mm:ss,SSS"
+          }
+
+        }
+
+      }
+
+    },
+    {
+      "filter":"grok",
+      "conditions":{
+        "fields":{
+          "type":[
+            "ambari_config_changes"
+          ]
+          
+        }
+        
+      },
+      "log4j_format":"%d{DATE} %5p [%t] %c{1}:%L - %m%n",
+      "multiline_pattern":"^(%{TIMESTAMP_ISO8601:logtime})",
+      "message_pattern":"(?m)^%{TIMESTAMP_ISO8601:logtime}%{SPACE}%{LOGLEVEL:level}%{SPACE}-%{SPACE}%{GREEDYDATA:log_message}",
+      "post_map_values":{
+        "logtime":{
+          "map_date":{
+            "target_date_pattern":"yyyy-MM-dd HH:mm:ss,SSS"
+          }
+
+        }
+
+      }
+
+    },
+    {
+      "filter":"grok",
+      "conditions":{
+        "fields":{
+          "type":[
+            "ambari_eclipselink"
+          ]
+          
+        }
+        
+      },
+      "log4j_format":"%d{DATE} %5p [%t] %c{1}:%L - %m%n",
+      "multiline_pattern":"^(\\[EL%{SPACE}%{LOGLEVEL:level}\\])",
+      "message_pattern":"(?m)^\\[EL%{SPACE}%{LOGLEVEL:level}\\]:%{SPACE}%{TIMESTAMP_ISO8601:logtime}%{GREEDYDATA:log_message}",
+      "post_map_values":{
+        "logtime":{
+          "map_date":{
+            "target_date_pattern":"yyyy-MM-dd HH:mm:ss.SSS"
+          }
+
+        },
+        "level":{
+          "map_fieldvalue":{
+            "pre_value":"Warning",
+            "post_value":"Warn"
+          }
+
+        }
+
+      }
+
+    },
+    {
+      "filter":"grok",
+      "conditions":{
+        "fields":{
+          "type":[
+            "ambari_server_check_database"
+          ]
+          
+        }
+        
+      },
+      "log4j_format":"%d{DATE} %5p [%t] %c{1}:%L - %m%n",
+      "multiline_pattern":"^(%{TIMESTAMP_ISO8601:logtime})",
+      "message_pattern":"(?m)^%{TIMESTAMP_ISO8601:logtime}%{SPACE}%{LOGLEVEL:level}%{SPACE}-%{SPACE}%{GREEDYDATA:log_message}",
+      "post_map_values":{
+        "logtime":{
+          "map_date":{
+            "target_date_pattern":"yyyy-MM-dd HH:mm:ss,SSS"
+          }
+
+        }
+
+      }
+
+    },
+    {
+      "filter":"grok",
+      "conditions":{
+        "fields":{
+          "type":[
+            "ambari_audit"
+          ]
+
+        }
+
+      },
+      "log4j_format":"%d{ISO8601} %-5p %c{2} (%F:%M(%L)) - %m%n",
+      "multiline_pattern":"^(%{TIMESTAMP_ISO8601:evtTime})",
+      "message_pattern":"(?m)^%{TIMESTAMP_ISO8601:evtTime},%{SPACE}%{GREEDYDATA:log_message}",
+      "post_map_values":{
+        "evtTime":{
+          "map_date":{
+            "target_date_pattern":"yyyy-MM-dd'T'HH:mm:ss.SSSXX"
+          }
+
+        }
+
+      }
+
+    },
+    {
+      "filter":"keyvalue",
+      "sort_order":1,
+      "conditions":{
+        "fields":{
+          "type":[
+            "ambari_audit"
+          ]
+
+        }
+
+      },
+      "source_field":"log_message",
+      "field_split":", ",
+      "value_borders":"()",
+      "post_map_values":{
+        "User":{
+          "map_fieldvalue":{
+            "pre_value":"null",
+            "post_value":"unknown"
+          },
+          "map_fieldname":{
+            "new_fieldname":"reqUser"
+          }
+        },
+        "Hostname":{
+          "map_fieldname":{
+            "new_fieldname":"host"
+          }
+        },
+        "Host name":{
+          "map_fieldname":{
+            "new_fieldname":"host"
+          }
+        },
+        "RemoteIp":{
+          "map_fieldname":{
+            "new_fieldname":"cliIP"
+          }
+        },
+        "RequestType":{
+          "map_fieldname":{
+            "new_fieldname":"cliType"
+          }
+        },
+        "RequestId":{
+          "map_fieldname":{
+            "new_fieldname":"request_id"
+          }
+        },
+        "TaskId":{
+          "map_fieldname":{
+            "new_fieldname":"task_id"
+          }
+        },
+        "Operation":{
+          "map_fieldname":{
+            "new_fieldname":"action"
+          }
+        },
+        "url":{
+          "map_fieldname":{
+            "new_fieldname":"resource"
+          }
+        },
+        "ResourcePath":{
+          "map_fieldname":{
+            "new_fieldname":"resource"
+          }
+        },
+        "Cluster name":{
+          "map_fieldname":{
+            "new_fieldname":"cluster"
+          }
+        },
+        "Reason":{
+          "map_fieldname":{
+            "new_fieldname":"reason"
+          }
+        },
+        "Base URL":{
+          "map_fieldname":{
+            "new_fieldname":"ws_base_url"
+          }
+        },
+        "Command":{
+          "map_fieldvalue":{
+            "pre_value":"null",
+            "post_value":"unknown"
+          },
+          "map_fieldname":{
+            "new_fieldname":"ws_command"
+          }
+        },
+        "Component":{
+          "map_fieldname":{
+            "new_fieldname":"ws_component"
+          }
+        },
+        "Details":{
+          "map_fieldname":{
+            "new_fieldname":"ws_details"
+          }
+        },
+        "Display name":{
+          "map_fieldvalue":{
+            "pre_value":"null",
+            "post_value":"unknown"
+          },
+          "map_fieldname":{
+            "new_fieldname":"ws_display_name"
+          }
+        },
+        "OS":{
+          "map_fieldname":{
+            "new_fieldname":"ws_os"
+          }
+        },
+        "Repo id":{
+          "map_fieldname":{
+            "new_fieldname":"ws_repo_id"
+          }
+        },
+        "Repo version":{
+          "map_fieldvalue":{
+            "pre_value":"null",
+            "post_value":"unknown"
+          },
+          "map_fieldname":{
+            "new_fieldname":"ws_repo_version"
+          }
+        },
+        "Repositories":{
+          "map_fieldname":{
+            "new_fieldname":"ws_repositories"
+          }
+        },
+        "Roles":{
+          "map_fieldname":{
+            "new_fieldname":"ws_roles"
+          }
+        },
+        "Stack":{
+          "map_fieldname":{
+            "new_fieldname":"ws_stack"
+          }
+        },
+        "Stack version":{
+          "map_fieldname":{
+            "new_fieldname":"ws_stack_version"
+          }
+        },
+        "VersionNote":{
+          "map_fieldvalue":{
+            "pre_value":"null",
+            "post_value":"unknown"
+          },
+          "map_fieldname":{
+            "new_fieldname":"ws_version_note"
+          }
+        },
+        "VersionNumber":{
+          "map_fieldvalue":{
+            "pre_value":"null",
+            "post_value":"unknown"
+          },
+          "map_fieldname":{
+            "new_fieldname":"ws_version_number"
+          }
+        },
+        "Status":[
+         {
+           "map_fieldcopy":{
+             "copy_name": "ws_status"
+           }
+         },
+         {
+            "map_fieldvalue":{
+              "pre_value":"Success",
+              "post_value":"1"
+            }
+          },
+          {
+            "map_fieldvalue":{
+              "pre_value":"Successfully queued",
+              "post_value":"1"
+            }
+          },
+          {
+            "map_fieldvalue":{
+              "pre_value":"QUEUED",
+              "post_value":"1"
+            }
+          },
+          {
+            "map_fieldvalue":{
+              "pre_value":"PENDING",
+              "post_value":"1"
+            }
+          },
+          {
+            "map_fieldvalue":{
+              "pre_value":"COMPLETED",
+              "post_value":"1"
+            }
+          },
+          {
+            "map_fieldvalue":{
+              "pre_value":"IN_PROGRESS",
+              "post_value":"1"
+            }
+          },
+          {
+            "map_fieldvalue":{
+              "pre_value":"Failed",
+              "post_value":"0"
+            }
+          },
+          {
+            "map_fieldvalue":{
+              "pre_value":"Failed to queue",
+              "post_value":"0"
+            }
+          },
+          {
+            "map_fieldvalue":{
+              "pre_value":"HOLDING",
+              "post_value":"0"
+            }
+          },
+          {
+            "map_fieldvalue":{
+              "pre_value":"HOLDING_FAILED",
+              "post_value":"0"
+            }
+          },
+          {
+            "map_fieldvalue":{
+              "pre_value":"HOLDING_TIMEDOUT",
+              "post_value":"0"
+            }
+          },
+          {
+            "map_fieldvalue":{
+              "pre_value":"FAILED",
+              "post_value":"0"
+            }
+          },
+          {
+            "map_fieldvalue":{
+              "pre_value":"TIMEDOUT",
+              "post_value":"0"
+            }
+          },
+          {
+            "map_fieldvalue":{
+              "pre_value":"ABORTED",
+              "post_value":"0"
+            }
+          },
+          {
+            "map_fieldvalue":{
+              "pre_value":"SKIPPED_FAILED",
+              "post_value":"0"
+            }
+          },
+          {
+            "map_fieldname":{
+              "new_fieldname":"result"
+            }
+          }
+        ],
+        "ResultStatus":[
+          {
+            "map_fieldcopy":{
+              "copy_name": "ws_result_status"
+            }
+          },
+          {
+            "map_fieldvalue":{
+              "pre_value":"200 OK",
+              "post_value":"1"
+            }
+          },
+          {
+            "map_fieldvalue":{
+              "pre_value":"201 Created",
+              "post_value":"1"
+            }
+          },
+          {
+            "map_fieldvalue":{
+              "pre_value":"202 Accepted",
+              "post_value":"1"
+            }
+          },
+          {
+            "map_fieldvalue":{
+              "pre_value":"400 Bad Request",
+              "post_value":"0"
+            }
+          },
+          {
+            "map_fieldvalue":{
+              "pre_value":"401 Unauthorized",
+              "post_value":"0"
+            }
+          },
+          {
+            "map_fieldvalue":{
+              "pre_value":"403 Forbidden",
+              "post_value":"0"
+            }
+          },
+          {
+            "map_fieldvalue":{
+              "pre_value":"404 Not Found",
+              "post_value":"0"
+            }
+          },
+          {
+            "map_fieldvalue":{
+              "pre_value":"409 Resource Conflict",
+              "post_value":"0"
+            }
+          },
+          {
+            "map_fieldvalue":{
+              "pre_value":"500 Internal Server Error",
+              "post_value":"0"
+            }
+          },
+          {
+            "map_fieldname":{
+              "new_fieldname":"result"
+            }
+          }
+        ]
+
+      }
+
+    }
+
+  ]
+
+}


[04/58] [abbrv] ambari git commit: AMBARI-18310. Refactor logsearch portal side code (oleewere)

Posted by ol...@apache.org.
http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/SearchCriteria.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/SearchCriteria.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/SearchCriteria.java
new file mode 100644
index 0000000..091194e
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/SearchCriteria.java
@@ -0,0 +1,136 @@
+/*
+ * 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.query.model;
+
+import java.util.HashMap;
+import java.util.Locale;
+import java.util.Map;
+
+import org.apache.ambari.logsearch.common.PropertiesHelper;
+
+public class SearchCriteria {
+  private int startIndex = 0;
+  private int maxRows = Integer.MAX_VALUE;
+  private String sortBy = null;
+  private String sortType = null;
+  private int page = 0;
+
+  private String globalStartTime = null;
+  private String globalEndTime = null;
+
+  private HashMap<String, Object> paramList = new HashMap<String, Object>();
+
+  private Map<String, Object> urlParamMap = new HashMap<String, Object>();
+
+  public SearchCriteria() {
+    // Auto-generated constructor stub
+  }
+
+  public int getStartIndex() {
+    return startIndex;
+  }
+
+  public void setStartIndex(int startIndex) {
+    this.startIndex = startIndex;
+  }
+
+  public int getMaxRows() {
+    return maxRows;
+  }
+
+  public void setMaxRows(int maxRows) {
+    this.maxRows = maxRows;
+  }
+
+  public String getSortType() {
+    return sortType;
+  }
+
+
+  public void addParam(String name, Object value) {
+    String solrValue = PropertiesHelper.getProperty(name);
+    if (solrValue == null || solrValue.isEmpty()) {
+      paramList.put(name, value);
+    } else {
+      try {
+        String propertyFieldMappings[] = solrValue.split(",");
+        HashMap<String, String> propertyFieldValue = new HashMap<String, String>();
+        for (String temp : propertyFieldMappings) {
+          String arrayValue[] = temp.split(":");
+          propertyFieldValue.put(arrayValue[0].toLowerCase(Locale.ENGLISH), arrayValue[1].toLowerCase(Locale.ENGLISH));
+        }
+        String originalValue = propertyFieldValue.get(value.toString().toLowerCase(Locale.ENGLISH));
+        if (originalValue != null && !originalValue.isEmpty())
+          paramList.put(name, originalValue);
+
+      } catch (Exception e) {
+        //do nothing
+      }
+    }
+  }
+
+  public Object getParamValue(String name) {
+    return paramList.get(name);
+  }
+
+  public String getSortBy() {
+    return sortBy;
+  }
+
+  public void setSortBy(String sortBy) {
+    this.sortBy = sortBy;
+  }
+
+  public void setSortType(String sortType) {
+    this.sortType = sortType;
+  }
+
+  public int getPage() {
+    return page;
+  }
+
+  public void setPage(int page) {
+    this.page = page;
+  }
+
+  public String getGlobalStartTime() {
+    return globalStartTime;
+  }
+
+  public void setGlobalStartTime(String globalStartTime) {
+    this.globalStartTime = globalStartTime;
+  }
+
+  public String getGlobalEndTime() {
+    return globalEndTime;
+  }
+
+  public void setGlobalEndTime(String globalEndTime) {
+    this.globalEndTime = globalEndTime;
+  }
+
+  public Map<String, Object> getUrlParamMap() {
+    return urlParamMap;
+  }
+
+  public void setUrlParamMap(Map<String, Object> urlParamMap) {
+    this.urlParamMap = urlParamMap;
+  }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceAnyGraphSearchCriteria.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceAnyGraphSearchCriteria.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceAnyGraphSearchCriteria.java
new file mode 100644
index 0000000..0ef5bdf
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceAnyGraphSearchCriteria.java
@@ -0,0 +1,25 @@
+/*
+ * 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.query.model;
+
+import org.apache.ambari.logsearch.common.Marker;
+
+@Marker
+public class ServiceAnyGraphSearchCriteria extends ServiceLogFileSearchCriteria {
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceExtremeDatesCriteria.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceExtremeDatesCriteria.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceExtremeDatesCriteria.java
new file mode 100644
index 0000000..3fc6ff8
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceExtremeDatesCriteria.java
@@ -0,0 +1,25 @@
+/*
+ * 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.query.model;
+
+import org.apache.ambari.logsearch.common.Marker;
+
+@Marker
+public class ServiceExtremeDatesCriteria extends CommonSearchCriteria {
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceGraphSearchCriteria.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceGraphSearchCriteria.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceGraphSearchCriteria.java
new file mode 100644
index 0000000..31a57a4
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceGraphSearchCriteria.java
@@ -0,0 +1,25 @@
+/*
+ * 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.query.model;
+
+import org.apache.ambari.logsearch.common.Marker;
+
+@Marker
+public class ServiceGraphSearchCriteria extends ServiceLogFileSearchCriteria {
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceLogExportSearchCriteria.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceLogExportSearchCriteria.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceLogExportSearchCriteria.java
new file mode 100644
index 0000000..8bab7f0
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceLogExportSearchCriteria.java
@@ -0,0 +1,25 @@
+/*
+ * 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.query.model;
+
+import org.apache.ambari.logsearch.common.Marker;
+
+@Marker
+public class ServiceLogExportSearchCriteria extends ServiceLogFileSearchCriteria {
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceLogFileSearchCriteria.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceLogFileSearchCriteria.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceLogFileSearchCriteria.java
new file mode 100644
index 0000000..a9f5926
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceLogFileSearchCriteria.java
@@ -0,0 +1,25 @@
+/*
+ * 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.query.model;
+
+import org.apache.ambari.logsearch.common.Marker;
+
+@Marker
+public class ServiceLogFileSearchCriteria extends CommonSearchCriteria {
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceLogSearchCriteria.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceLogSearchCriteria.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceLogSearchCriteria.java
new file mode 100644
index 0000000..d41c589
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceLogSearchCriteria.java
@@ -0,0 +1,25 @@
+/*
+ * 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.query.model;
+
+import org.apache.ambari.logsearch.common.Marker;
+
+@Marker
+public class ServiceLogSearchCriteria extends ServiceLogFileSearchCriteria {
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceLogTruncatedSearchCriteria.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceLogTruncatedSearchCriteria.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceLogTruncatedSearchCriteria.java
new file mode 100644
index 0000000..24dc9a8
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/ServiceLogTruncatedSearchCriteria.java
@@ -0,0 +1,25 @@
+/*
+ * 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.query.model;
+
+import org.apache.ambari.logsearch.common.Marker;
+
+@Marker
+public class ServiceLogTruncatedSearchCriteria extends ServiceLogFileSearchCriteria {
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/UserConfigSearchCriteria.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/UserConfigSearchCriteria.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/UserConfigSearchCriteria.java
new file mode 100644
index 0000000..8798cd6
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/UserConfigSearchCriteria.java
@@ -0,0 +1,25 @@
+/*
+ * 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.query.model;
+
+import org.apache.ambari.logsearch.common.Marker;
+
+@Marker
+public class UserConfigSearchCriteria extends CommonSearchCriteria {
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/UserExportSearchCriteria.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/UserExportSearchCriteria.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/UserExportSearchCriteria.java
new file mode 100644
index 0000000..755c673
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/model/UserExportSearchCriteria.java
@@ -0,0 +1,25 @@
+/*
+ * 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.query.model;
+
+import org.apache.ambari.logsearch.common.Marker;
+
+@Marker
+public class UserExportSearchCriteria extends FieldAuditLogSearchCriteria {
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/AuditLogsREST.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/AuditLogsREST.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/AuditLogsREST.java
deleted file mode 100644
index 3d99dc0..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/AuditLogsREST.java
+++ /dev/null
@@ -1,283 +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.rest;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
-import javax.ws.rs.Produces;
-import javax.ws.rs.QueryParam;
-import javax.ws.rs.core.Context;
-import javax.ws.rs.core.Response;
-
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiImplicitParam;
-import io.swagger.annotations.ApiImplicitParams;
-import io.swagger.annotations.ApiOperation;
-import org.apache.ambari.logsearch.common.SearchCriteria;
-import org.apache.ambari.logsearch.manager.AuditMgr;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Scope;
-import org.springframework.stereotype.Component;
-
-import static org.apache.ambari.logsearch.doc.DocConstants.CommonDescriptions.*;
-import static org.apache.ambari.logsearch.doc.DocConstants.AuditOperationDescriptions.*;
-
-@Api(value = "audit/logs", description = "Audit log operations")
-@Path("audit/logs")
-@Component
-@Scope("request")
-public class AuditLogsREST {
-
-  @Autowired
-  AuditMgr auditMgr;
-
-  @GET
-  @Path("/schema/fields")
-  @Produces({"application/json"})
-  @ApiOperation(GET_AUDIT_SCHEMA_FIELD_LIST_OD)
-  public String getSolrFieldList(@Context HttpServletRequest request) {
-    return auditMgr.getAuditLogsSchemaFieldsName();
-  }
-
-  @GET
-  @Produces({"application/json"})
-  @ApiOperation(GET_AUDIT_LOGS_OD)
-  @ApiImplicitParams(value = {
-    @ApiImplicitParam(value = QUERY_D, name = "q", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = COLUMN_QUERY_D, name = "columnQuery", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = I_MESSAGE_D, name = "iMessage", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = G_E_MESSAGE_D, name = "gEMessage", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = E_MESSAGE_D, name = "eMessage", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = MUST_BE_D, name = "mustBe", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = MUST_NOT_D, name = "mustNot", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = EXCLUDE_QUERY_D, name = "excludeQuery", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = INCLUDE_QUERY_D, name = "includeQuery", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = FROM_D, name = "from", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = TO_D, name = "to", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = IS_LAST_PAGE_D, name = "isLastPage", dataType = "boolean", paramType = "query")
-  })
-  public String getAuditLogs(@Context HttpServletRequest request) {
-    SearchCriteria searchCriteria = new SearchCriteria(request);
-    searchCriteria.addRequiredAuditLogsParams(request);
-    searchCriteria.addParam("isLastPage", request.getParameter("isLastPage"));
-    return auditMgr.getLogs(searchCriteria);
-  }
-
-  @GET
-  @Path("/components")
-  @Produces({"application/json"})
-  @ApiOperation(GET_AUDIT_COMPONENTS_OD)
-  @ApiImplicitParams(value = {
-    @ApiImplicitParam(value = QUERY_D, name = "q", dataType = "string", paramType = "query"),
-  })
-  public String getAuditComponents(@Context HttpServletRequest request) {
-
-    SearchCriteria searchCriteria = new SearchCriteria(request);
-    searchCriteria.addParam("q", request.getParameter("q"));
-    return auditMgr.getAuditComponents(searchCriteria);
-  }
-
-  @GET
-  @Path("/linegraph")
-  @Produces({"application/json"})
-  @ApiOperation(GET_AUDIT_LINE_GRAPH_DATA_OD)
-  @ApiImplicitParams(value = {
-    @ApiImplicitParam(value = QUERY_D, name = "q", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = COLUMN_QUERY_D, name = "columnQuery", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = I_MESSAGE_D, name = "iMessage", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = G_E_MESSAGE_D, name = "gEMessage", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = E_MESSAGE_D, name = "eMessage", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = MUST_BE_D, name = "mustBe", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = MUST_NOT_D, name = "mustNot", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = EXCLUDE_QUERY_D, name = "excludeQuery", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = INCLUDE_QUERY_D, name = "includeQuery", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = FROM_D, name = "from", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = TO_D, name = "to", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = UNIT_D, name = "unit", dataType = "string", paramType = "query")
-  })
-  public String getAuditLineGraphData(@Context HttpServletRequest request) {
-    SearchCriteria searchCriteria = new SearchCriteria(request);
-    searchCriteria.addRequiredAuditLogsParams(request);
-    searchCriteria.addParam("unit", request.getParameter("unit"));
-    return auditMgr.getAuditLineGraphData(searchCriteria);
-  }
-
-  @GET
-  @Path("/users")
-  @Produces({"application/json"})
-  @ApiOperation(GET_TOP_AUDIT_USERS_OD)
-  @ApiImplicitParams(value = {
-    @ApiImplicitParam(value = QUERY_D, name = "q", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = COLUMN_QUERY_D, name = "columnQuery", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = I_MESSAGE_D, name = "iMessage", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = G_E_MESSAGE_D, name = "gEMessage", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = E_MESSAGE_D, name = "eMessage", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = MUST_BE_D, name = "mustBe", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = MUST_NOT_D, name = "mustNot", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = EXCLUDE_QUERY_D, name = "excludeQuery", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = INCLUDE_QUERY_D, name = "includeQuery", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = FROM_D, name = "from", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = TO_D, name = "to", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = FIELD_D, name = "field", dataType = "string", paramType = "query")
-  })
-  public String getTopAuditUsers(@Context HttpServletRequest request) {
-    SearchCriteria searchCriteria = new SearchCriteria(request);
-    searchCriteria.addRequiredAuditLogsParams(request);
-    searchCriteria.addParam("field", request.getParameter("field"));
-    return auditMgr.topTenUsers(searchCriteria);
-  }
-
-  @GET
-  @Path("/resources")
-  @Produces({"application/json"})
-  @ApiOperation(GET_TOP_AUDIT_RESOURCES_OD)
-  @ApiImplicitParams(value = {
-    @ApiImplicitParam(value = QUERY_D, name = "q", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = COLUMN_QUERY_D, name = "columnQuery", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = I_MESSAGE_D, name = "iMessage", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = G_E_MESSAGE_D, name = "gEMessage", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = E_MESSAGE_D, name = "eMessage", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = MUST_BE_D, name = "mustBe", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = MUST_NOT_D, name = "mustNot", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = EXCLUDE_QUERY_D, name = "excludeQuery", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = INCLUDE_QUERY_D, name = "includeQuery", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = FROM_D, name = "from", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = TO_D, name = "to", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = FIELD_D, name = "field", dataType = "string", paramType = "query")
-  })
-  public String getTopAuditResources(@Context HttpServletRequest request) {
-    SearchCriteria searchCriteria = new SearchCriteria(request);
-    searchCriteria.addRequiredAuditLogsParams(request);
-    searchCriteria.addParam("field", request.getParameter("field"));
-    //return auditMgr.getTopAuditFieldCount(searchCriteria);
-    return auditMgr.topTenResources(searchCriteria);
-
-  }
-
-  @GET
-  @Path("/live/count")
-  @Produces({"application/json"})
-  @ApiOperation(GET_LIVE_LOGS_COUNT_OD)
-  public String getLiveLogsCount() {
-    return auditMgr.getLiveLogCounts();
-  }
-
-  @GET
-  @Path("/request/user/linegraph")
-  @Produces({"application/json"})
-  @ApiOperation(GET_REQUEST_USER_LINE_GRAPH_OD)
-  @ApiImplicitParams(value = {
-    @ApiImplicitParam(value = QUERY_D, name = "q", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = COLUMN_QUERY_D, name = "columnQuery", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = I_MESSAGE_D, name = "iMessage", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = G_E_MESSAGE_D, name = "gEMessage", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = E_MESSAGE_D, name = "eMessage", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = MUST_BE_D, name = "mustBe", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = MUST_NOT_D, name = "mustNot", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = EXCLUDE_QUERY_D, name = "excludeQuery", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = INCLUDE_QUERY_D, name = "includeQuery", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = FROM_D, name = "from", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = TO_D, name = "to", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = FIELD_D, name = "field", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = UNIT_D, name = "unit", dataType = "string", paramType = "query")
-  })
-  public String getRequestUserLineGraph(@Context HttpServletRequest request) {
-    SearchCriteria searchCriteria = new SearchCriteria(request);
-    searchCriteria.addRequiredAuditLogsParams(request);
-    searchCriteria.addParam("field", request.getParameter("field"));
-    searchCriteria.addParam("unit", request.getParameter("unit"));
-    return auditMgr.getRequestUserLineGraph(searchCriteria);
-  }
-
-  @GET
-  @Path("/anygraph")
-  @Produces({"application/json"})
-  @ApiOperation(GET_ANY_GRAPH_DATA_OD)
-  @ApiImplicitParams(value = {
-    @ApiImplicitParam(value = X_AXIS_D, name = "xAxis", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = Y_AXIS_D, name = "yAxis", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = STACK_BY_D, name = "stackBy", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = FROM_D, name = "from", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = TO_D, name = "to", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = UNIT_D, name = "unit", dataType = "string", paramType = "query")
-  })
-  public String getAnyGraphData(@Context HttpServletRequest request) {
-    SearchCriteria searchCriteria = new SearchCriteria(request);
-    searchCriteria.addParam("xAxis", request.getParameter("xAxis"));
-    searchCriteria.addParam("yAxis", request.getParameter("yAxis"));
-    searchCriteria.addParam("stackBy", request.getParameter("stackBy"));
-    searchCriteria.addParam("from", request.getParameter("from"));
-    searchCriteria.addParam("to", request.getParameter("to"));
-    searchCriteria.addParam("unit", request.getParameter("unit"));
-    return auditMgr.getAnyGraphData(searchCriteria);
-  }
-
-  @GET
-  @Path("/users/export")
-  @Produces({"application/json"})
-  @ApiOperation(EXPORT_USER_TALBE_TO_TEXT_FILE_OD)
-  @ApiImplicitParams(value = {
-    @ApiImplicitParam(value = QUERY_D, name = "q", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = COLUMN_QUERY_D, name = "columnQuery", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = I_MESSAGE_D, name = "iMessage", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = G_E_MESSAGE_D, name = "gEMessage", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = E_MESSAGE_D, name = "eMessage", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = MUST_BE_D, name = "mustBe", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = MUST_NOT_D, name = "mustNot", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = EXCLUDE_QUERY_D, name = "excludeQuery", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = INCLUDE_QUERY_D, name = "includeQuery", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = FROM_D, name = "from", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = TO_D, name = "to", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = FIELD_D, name = "field", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = FORMAT_D, name = "format", dataType = "string", paramType = "query")
-  })
-  public Response exportUserTableToTextFile(@Context HttpServletRequest request) {
-    SearchCriteria searchCriteria = new SearchCriteria(request);
-    searchCriteria.addRequiredAuditLogsParams(request);
-    searchCriteria.addParam("field", request.getParameter("field"));
-    searchCriteria.addParam("format", request.getParameter("format"));
-    return auditMgr.exportUserTableToTextFile(searchCriteria);
-  }
-
-  @GET
-  @Path("/serviceload")
-  @Produces({"application/json"})
-  @ApiOperation(GET_SERVICE_LOAD_OD)
-  @ApiImplicitParams(value = {
-    @ApiImplicitParam(value = QUERY_D, name = "q", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = COLUMN_QUERY_D, name = "columnQuery", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = I_MESSAGE_D, name = "iMessage", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = G_E_MESSAGE_D, name = "gEMessage", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = E_MESSAGE_D, name = "eMessage", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = MUST_BE_D, name = "mustBe", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = MUST_NOT_D, name = "mustNot", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = EXCLUDE_QUERY_D, name = "excludeQuery", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = INCLUDE_QUERY_D, name = "includeQuery", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = FROM_D, name = "from", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = TO_D, name = "to", dataType = "string", paramType = "query"),
-  })
-  public String getServiceLoad(@Context HttpServletRequest request) {
-    SearchCriteria searchCriteria = new SearchCriteria(request);
-    searchCriteria.addRequiredAuditLogsParams(request);
-    return auditMgr.getServiceLoad(searchCriteria);
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/AuditLogsResource.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/AuditLogsResource.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/AuditLogsResource.java
new file mode 100644
index 0000000..82e21e8
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/AuditLogsResource.java
@@ -0,0 +1,157 @@
+/*
+ * 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.rest;
+
+import javax.inject.Inject;
+import javax.ws.rs.BeanParam;
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.Response;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.apache.ambari.logsearch.model.request.impl.AnyGraphRequest;
+import org.apache.ambari.logsearch.model.request.impl.AuditBarGraphRequest;
+import org.apache.ambari.logsearch.model.request.impl.BaseAuditLogRequest;
+import org.apache.ambari.logsearch.model.request.impl.FieldAuditBarGraphRequest;
+import org.apache.ambari.logsearch.model.request.impl.FieldAuditLogRequest;
+import org.apache.ambari.logsearch.model.request.impl.SimpleQueryRequest;
+import org.apache.ambari.logsearch.model.request.impl.UserExportRequest;
+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.NameValueDataListResponse;
+import org.apache.ambari.logsearch.query.model.AnyGraphSearchCriteria;
+import org.apache.ambari.logsearch.query.model.AuditLogSearchCriteria;
+import org.apache.ambari.logsearch.query.model.AuditBarGraphSearchCriteria;
+import org.apache.ambari.logsearch.query.model.CommonSearchCriteria;
+import org.apache.ambari.logsearch.query.model.FieldAuditLogSearchCriteria;
+import org.apache.ambari.logsearch.query.model.FieldAuditBarGraphSearchCriteria;
+import org.apache.ambari.logsearch.query.model.SearchCriteria;
+import org.apache.ambari.logsearch.model.request.impl.AuditLogRequest;
+import org.apache.ambari.logsearch.manager.AuditLogsManager;
+import org.apache.ambari.logsearch.query.model.UserExportSearchCriteria;
+import org.springframework.context.annotation.Scope;
+import org.springframework.core.convert.ConversionService;
+import org.springframework.stereotype.Component;
+
+import static org.apache.ambari.logsearch.doc.DocConstants.AuditOperationDescriptions.*;
+
+@Api(value = "audit/logs", description = "Audit log operations")
+@Path("audit/logs")
+@Component
+@Scope("request")
+public class AuditLogsResource {
+
+  @Inject
+  private AuditLogsManager auditLogsManager;
+
+  @Inject
+  private ConversionService conversionService;
+
+  @GET
+  @Path("/schema/fields")
+  @Produces({"application/json"})
+  @ApiOperation(GET_AUDIT_SCHEMA_FIELD_LIST_OD)
+  public String getSolrFieldList() {
+    return auditLogsManager.getAuditLogsSchemaFieldsName();
+  }
+
+  @GET
+  @Produces({"application/json"})
+  @ApiOperation(GET_AUDIT_LOGS_OD)
+  public AuditLogResponse getAuditLogs(@BeanParam AuditLogRequest auditLogRequest) {
+    return auditLogsManager.getLogs(conversionService.convert(auditLogRequest, AuditLogSearchCriteria.class));
+  }
+
+  @GET
+  @Path("/components")
+  @Produces({"application/json"})
+  @ApiOperation(GET_AUDIT_COMPONENTS_OD)
+  public GroupListResponse getAuditComponents(@BeanParam SimpleQueryRequest request) {
+    return auditLogsManager.getAuditComponents(conversionService.convert(request, SearchCriteria.class));
+  }
+
+  @GET
+  @Path("/bargraph")
+  @Produces({"application/json"})
+  @ApiOperation(GET_AUDIT_LINE_GRAPH_DATA_OD)
+  public BarGraphDataListResponse getAuditBarGraphData(@BeanParam AuditBarGraphRequest request) {
+    return auditLogsManager.getAuditBarGraphData(conversionService.convert(request, AuditBarGraphSearchCriteria.class));
+  }
+
+  @GET
+  @Path("/users")
+  @Produces({"application/json"})
+  @ApiOperation(GET_TOP_AUDIT_USERS_OD)
+  public BarGraphDataListResponse getTopAuditUsers(@BeanParam FieldAuditBarGraphRequest request) {
+    return auditLogsManager.topTenUsers(conversionService.convert(request, FieldAuditBarGraphSearchCriteria.class));
+  }
+
+  @GET
+  @Path("/resources")
+  @Produces({"application/json"})
+  @ApiOperation(GET_TOP_AUDIT_RESOURCES_OD)
+  public BarGraphDataListResponse getTopAuditResources(@BeanParam FieldAuditLogRequest request) {
+    return auditLogsManager.topTenResources(conversionService.convert(request, FieldAuditLogSearchCriteria.class));
+  }
+
+  @GET
+  @Path("/live/count")
+  @Produces({"application/json"})
+  @ApiOperation(GET_LIVE_LOGS_COUNT_OD)
+  public NameValueDataListResponse getLiveLogsCount() {
+    return auditLogsManager.getLiveLogCounts();
+  }
+
+  @GET
+  @Path("/request/user/bargraph")
+  @Produces({"application/json"})
+  @ApiOperation(GET_REQUEST_USER_LINE_GRAPH_OD)
+  public BarGraphDataListResponse getRequestUserBarGraph(@BeanParam FieldAuditBarGraphRequest request) {
+    return auditLogsManager.getRequestUserLineGraph(conversionService.convert(request, FieldAuditBarGraphSearchCriteria.class));
+  }
+
+  @GET
+  @Path("/anygraph")
+  @Produces({"application/json"})
+  @ApiOperation(GET_ANY_GRAPH_DATA_OD)
+  public BarGraphDataListResponse getAnyGraphData(@BeanParam AnyGraphRequest request) {
+    return auditLogsManager.getAnyGraphData(conversionService.convert(request, AnyGraphSearchCriteria.class));
+  }
+
+  @GET
+  @Path("/users/export")
+  @Produces({"application/json"})
+  @ApiOperation(EXPORT_USER_TALBE_TO_TEXT_FILE_OD)
+  public Response exportUserTableToTextFile(@BeanParam UserExportRequest request) {
+    return auditLogsManager.exportUserTableToTextFile(conversionService.convert(request, UserExportSearchCriteria.class));
+  }
+
+  @GET
+  @Path("/serviceload")
+  @Produces({"application/json"})
+  @ApiOperation(GET_SERVICE_LOAD_OD)
+  public BarGraphDataListResponse getServiceLoad(@BeanParam BaseAuditLogRequest request) {
+    return auditLogsManager.getServiceLoad(conversionService.convert(request, CommonSearchCriteria.class));
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/LogFileREST.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/LogFileREST.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/LogFileREST.java
deleted file mode 100644
index 6099e0f..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/LogFileREST.java
+++ /dev/null
@@ -1,84 +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.rest;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.Context;
-
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiImplicitParam;
-import io.swagger.annotations.ApiImplicitParams;
-import io.swagger.annotations.ApiOperation;
-import org.apache.ambari.logsearch.common.SearchCriteria;
-import org.apache.ambari.logsearch.manager.LogFileMgr;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Scope;
-import org.springframework.stereotype.Component;
-
-import static org.apache.ambari.logsearch.doc.DocConstants.LogFileDescriptions.*;
-import static org.apache.ambari.logsearch.doc.DocConstants.LogFileOperationDescriptions.*;
-
-@Api(value = "logfile", description = "Logfile operations")
-@Path("logfile")
-@Component
-@Scope("request")
-public class LogFileREST {
-
-  @Autowired
-  LogFileMgr logFileMgr;
-
-  @GET
-  @Produces({"application/json"})
-  @ApiOperation(SEARCH_LOG_FILES_OD)
-  @ApiImplicitParams(value = {
-    @ApiImplicitParam(value = COMPONENT_D, name = "component", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = HOST_D, name = "host", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = LOG_TYPE_D, name = "logType", dataType = "string", paramType = "query")
-  })
-  public String searchLogFiles(@Context HttpServletRequest request) {
-    SearchCriteria searchCriteria = new SearchCriteria(request);
-    searchCriteria.addParam("component", request.getParameter("component"));
-    searchCriteria.addParam("host", request.getParameter("host"));
-    searchCriteria.addParam("logType", request.getParameter("logType"));
-    return logFileMgr.searchLogFiles(searchCriteria);
-  }
-
-  @GET
-  @Path("/tail")
-  @Produces({"application/json"})
-  @ApiOperation(GET_LOG_FILE_TAIL_OD)
-  @ApiImplicitParams(value = {
-    @ApiImplicitParam(value = COMPONENT_D, name = "component", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = HOST_D, name = "host", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = LOG_TYPE_D, name = "logType", dataType = "string", paramType = "query"),
-    @ApiImplicitParam(value = TAIL_SIZE_D, name = "tailSize", dataType = "string", paramType = "query")
-  })
-  public String getLogFileTail(@Context HttpServletRequest request) {
-    SearchCriteria searchCriteria = new SearchCriteria();
-    searchCriteria.addParam("host", request.getParameter("host"));
-    searchCriteria.addParam("component", request.getParameter("component"));
-    searchCriteria.addParam("name", request.getParameter("name"));
-    searchCriteria.addParam("tailSize", request.getParameter("tailSize"));
-    return logFileMgr.getLogFileTail(searchCriteria);
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/LogFileResource.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/LogFileResource.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/LogFileResource.java
new file mode 100644
index 0000000..c23f457
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/LogFileResource.java
@@ -0,0 +1,69 @@
+/*
+ * 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.rest;
+
+import javax.inject.Inject;
+import javax.ws.rs.BeanParam;
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.apache.ambari.logsearch.model.request.impl.LogFileRequest;
+import org.apache.ambari.logsearch.model.request.impl.LogFileTailRequest;
+import org.apache.ambari.logsearch.model.response.LogFileDataListResponse;
+import org.apache.ambari.logsearch.model.response.LogListResponse;
+import org.apache.ambari.logsearch.query.model.LogFileSearchCriteria;
+import org.apache.ambari.logsearch.query.model.LogFileTailSearchCriteria;
+import org.apache.ambari.logsearch.manager.LogFileManager;
+import org.springframework.context.annotation.Scope;
+import org.springframework.core.convert.ConversionService;
+import org.springframework.stereotype.Component;
+
+import static org.apache.ambari.logsearch.doc.DocConstants.LogFileOperationDescriptions.*;
+
+@Api(value = "logfile", description = "Logfile operations")
+@Path("logfile")
+@Component
+@Scope("request")
+public class LogFileResource {
+
+  @Inject
+  private LogFileManager logFileManager;
+
+  @Inject
+  private ConversionService conversionService;
+
+  @GET
+  @Produces({"application/json"})
+  @ApiOperation(SEARCH_LOG_FILES_OD)
+  public LogFileDataListResponse searchLogFiles(@BeanParam LogFileRequest request) {
+    return logFileManager.searchLogFiles(conversionService.convert(request, LogFileSearchCriteria.class));
+  }
+
+  @GET
+  @Path("/tail")
+  @Produces({"application/json"})
+  @ApiOperation(GET_LOG_FILE_TAIL_OD)
+  public LogListResponse getLogFileTail(@BeanParam LogFileTailRequest request) {
+    return logFileManager.getLogFileTail(conversionService.convert(request, LogFileTailSearchCriteria.class));
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/PublicREST.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/PublicREST.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/PublicREST.java
deleted file mode 100644
index 5218f5d..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/PublicREST.java
+++ /dev/null
@@ -1,48 +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.rest;
-
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
-
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import org.apache.ambari.logsearch.manager.PublicMgr;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Scope;
-import org.springframework.stereotype.Component;
-
-import static org.apache.ambari.logsearch.doc.DocConstants.PublicOperationDescriptions.OBTAIN_GENERAL_CONFIG_OD;
-
-@Api(value = "public", description = "Public operations")
-@Path("public")
-@Component
-@Scope("request")
-public class PublicREST {
-
-  @Autowired
-  PublicMgr generalMgr;
-
-  @GET
-  @Path("/config")
-  @ApiOperation(OBTAIN_GENERAL_CONFIG_OD)
-  public String getGeneralConfig() {
-    return generalMgr.getGeneralConfig();
-  }
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/77f9e8ff/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/PublicResource.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/PublicResource.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/PublicResource.java
new file mode 100644
index 0000000..94bf059
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/PublicResource.java
@@ -0,0 +1,48 @@
+/*
+ * 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.rest;
+
+import javax.inject.Inject;
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.apache.ambari.logsearch.manager.PublicManager;
+import org.springframework.context.annotation.Scope;
+import org.springframework.stereotype.Component;
+
+import static org.apache.ambari.logsearch.doc.DocConstants.PublicOperationDescriptions.OBTAIN_GENERAL_CONFIG_OD;
+
+@Api(value = "public", description = "Public operations")
+@Path("public")
+@Component
+@Scope("request")
+public class PublicResource {
+
+  @Inject
+  private PublicManager publicManager;
+
+  @GET
+  @Path("/config")
+  @ApiOperation(OBTAIN_GENERAL_CONFIG_OD)
+  public String getGeneralConfig() {
+    return publicManager.getGeneralConfig();
+  }
+}


[35/58] [abbrv] ambari git commit: AMBARI-18310. Logsearch - Refactor solr query layer (oleewere)

Posted by ol...@apache.org.
http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/tabs/HierarchyTabLayoutView.js
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/tabs/HierarchyTabLayoutView.js b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/tabs/HierarchyTabLayoutView.js
index 43ee5db..605560e 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/tabs/HierarchyTabLayoutView.js
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/tabs/HierarchyTabLayoutView.js
@@ -276,6 +276,7 @@ define(['require',
         require(['views/tabs/VisualSearchView'], function (VisualSearchView) {
           var data = _.values(Globals.serviceLogsColumns);
           var columns = _.without(data, _.findWhere(data, "logtime"));
+          console.log("service columns: " + JSON.stringify(columns))
           that.RVisualSearchIncCol.show(new VisualSearchView({
             viewName: "includeServiceColumns",
             placeholder: "Include Search",
@@ -287,7 +288,7 @@ define(['require',
               var obj = ViewUtils.replaceColumnNamesWithKeys(searchCollection, Globals.invertedServiceLogMappings, false);
               return {
                 includeQuery: JSON.stringify(obj),
-                query: query
+                iMessage: query
               }
             }
           }));
@@ -302,7 +303,7 @@ define(['require',
               var obj = ViewUtils.replaceColumnNamesWithKeys(searchCollection, Globals.invertedServiceLogMappings, false);
               return {
                 excludeQuery: JSON.stringify(obj),
-                query: query
+                eMessage: query
               }
             }
           }));

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/tabs/LogFileView.js
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/tabs/LogFileView.js b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/tabs/LogFileView.js
index 3740716..2d39e36 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/tabs/LogFileView.js
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/tabs/LogFileView.js
@@ -199,9 +199,6 @@ define(['require',
             downloadLogFile: function(obj) {
                 obj.utcOffset = moment().utcOffset();
                 obj.startIndex = this.logFileCollection.state.currentPage * this.logFileCollection.state.pageSize;
-                //			var params = $.param(_.pick(_.extend({},this.logFileCollection.queryParams,
-                //				{startIndex : this.logFileCollection.state.currentPage * this.logFileCollection.state.pageSize},obj),
-                //				'component','from','to','host','level','unit','startIndex','pageSize','format','utcOffset'));
                 var params = $.param(_.extend({}, this.logFileCollection.queryParams, obj));
                 var url = "api/v1/service/logs/export?" + params;
                 window.open(url);
@@ -305,60 +302,43 @@ define(['require',
                 });
             },
             renderVisualSearch: function() {
-                var that = this;
-                var data = _.values(Globals.serviceLogsColumns);
-                var columns = _.without(data, _.findWhere(data, "logtime"));
-                require(['views/tabs/VisualSearchView'], function(VisualSearchView) {
-                    /*that.RVSSearch.show(new VisualSearchView({
-                    	viewName : "includeExclude",
-                    	vent : that.vent,
-                    	globalVent:that.globalVent,
-                    	params : that.params,
-                    	eventName : "search:include:exclude"
-                    }));*/
-                    that.RVisualSearchIncCol.show(new VisualSearchView({
-                        params: that.params,
-                        viewName: "includeServiceColumns",
-                        placeholder: "Include Search",
-                        vent: that.vent,
-                        globalVent: that.globalVent,
-                        customOptions: columns,
-                        eventName: Globals.eventName.serviceLogsIncludeColumns,
-                        myFormatData: function(query, searchCollection) {
-                            var obj = [];
-                            searchCollection.each(function(m) {
-                                var data = {};
-                                data[m.get("category")] = m.get("value");
-                                obj.push(data);
-                            });
-                            return {
-                                includeQuery: JSON.stringify(obj),
-                                query: query
-                            }
-                        }
-                    }));
-                    that.RVisualSearchExCol.show(new VisualSearchView({
-                        params: that.params,
-                        viewName: "excludeServiceColumns",
-                        placeholder: "Exclude Search",
-                        vent: that.vent,
-                        globalVent: that.globalVent,
-                        customOptions: columns,
-                        eventName: Globals.eventName.serviceLogsExcludeColumns,
-                        myFormatData: function(query, searchCollection) {
-                            var obj = [];
-                            searchCollection.each(function(m) {
-                                var data = {};
-                                data[m.get("category")] = m.get("value");
-                                obj.push(data);
-                            });
-                            return {
-                                excludeQuery: JSON.stringify(obj),
-                                query: query
-                            }
-                        }
-                    }));
-                });
+              var that = this;
+              var data = _.values(Globals.serviceLogsColumns);
+              var columns = _.without(data, _.findWhere(data, "logtime"));
+              require(['views/tabs/VisualSearchView'], function (VisualSearchView) {
+                that.RVisualSearchIncCol.show(new VisualSearchView({
+                  params: that.params,
+                  viewName: "includeServiceColumns",
+                  placeholder: "Include Search",
+                  vent: that.vent,
+                  globalVent: that.globalVent,
+                  customOptions: columns,
+                  eventName: Globals.eventName.serviceLogsIncludeColumns,
+                  myFormatData: function (query, searchCollection) {
+                    var obj = ViewUtils.replaceColumnNamesWithKeys(searchCollection, Globals.invertedServiceLogMappings, false);
+                    return {
+                      includeQuery: JSON.stringify(obj),
+                      iMessage: query
+                    }
+                  }
+                }));
+                that.RVisualSearchExCol.show(new VisualSearchView({
+                  params: that.params,
+                  viewName: "excludeServiceColumns",
+                  placeholder: "Exclude Search",
+                  vent: that.vent,
+                  globalVent: that.globalVent,
+                  customOptions: columns,
+                  eventName: Globals.eventName.serviceLogsExcludeColumns,
+                  myFormatData: function (query, searchCollection) {
+                    var obj = ViewUtils.replaceColumnNamesWithKeys(searchCollection, Globals.invertedServiceLogMappings, false);
+                    return {
+                      excludeQuery: JSON.stringify(obj),
+                      eMessage: query
+                    }
+                  }
+                }));
+              });
             },
             renderHistogram: function() {
                 var that = this;

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/troubleshoot/TroubleShootLayoutView.js
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/troubleshoot/TroubleShootLayoutView.js b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/troubleshoot/TroubleShootLayoutView.js
index a6445c6..b19f3ce 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/troubleshoot/TroubleShootLayoutView.js
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/troubleshoot/TroubleShootLayoutView.js
@@ -82,7 +82,7 @@ define(['backbone',
 
                     }
                 });
-                this.serviceLogsCollection.url = Globals.baseURL + "service/logs/anygraph";
+                this.serviceLogsCollection.url = Globals.baseURL + "service/logs/count/anygraph";
                 this.serviceLogsCollection.modelAttrName = "graphData";
                 
             	this.topUsers = new VNameValueList([],{
@@ -91,7 +91,7 @@ define(['backbone',
                         pageSize: 9999
                     }
     			});
-    			this.topUsers.url = Globals.baseURL + "audit/logs/users";
+    			this.topUsers.url = Globals.baseURL + "audit/logs/resources/10";
     			this.topUsers.modelAttrName = "graphData";
     			
     			this.serviceLoadCollection = new VLogList([], {
@@ -133,7 +133,7 @@ define(['backbone',
             },
             onRender : function(){
             	var that = this;
-            	this.fetchTopUsers(this.params);
+            	this.fetchTopUsers(_.extend({field : "reqUser"},this.params));
             	this.serviceLogsCollection.getServicesInfo({
                 	success : function(resp){
                 		Globals.servicesInfo = resp;

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/static/schema_fields.json
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/static/schema_fields.json b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/static/schema_fields.json
index 8620c11..7b1a9a9 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/static/schema_fields.json
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/static/schema_fields.json
@@ -61,7 +61,7 @@
     "resType": "Res Type",
     "resource": "Resource",
     "result": "Result",
-    "sess": "Sess",
+    "sess": "Session",
     "text": "Text",
     "type": "Type",
     "ugi": "UGI",

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/templates/tabs/LogFileView_tmpl.html
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/templates/tabs/LogFileView_tmpl.html b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/templates/tabs/LogFileView_tmpl.html
index f86190c..0f0f143 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/templates/tabs/LogFileView_tmpl.html
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/templates/tabs/LogFileView_tmpl.html
@@ -15,38 +15,6 @@
   limitations under the License.
 -->
 <div class="row">
-	<!--  div class="col-md-3">
-		<div class="row">
-			<div class="col-md-12">
-				<div class="box">
-					<div class="box-header">
-						<div class="box-name">
-							<span>Search</span>
-						</div>
-						<div class="box-icons">
-							<a class="collapse-link"> <i class="fa fa-chevron-up"></i>
-							</a> <a class=""> <i class="fa fa-gear"></i>
-							</a> <a class="close-link"> <i class="fa fa-close"></i>
-							</a>
-						</div>
-						<div class="no-move"></div>
-					</div>
-					<div class="box-content">
-						<div class="input-group">
-							<input data-id="hierarchySearch" type="text" class="form-control"
-								placeholder="Search" value="*:*"> <span
-								class="input-group-btn">
-								<button data-id="hierarchySearchBtn"
-									class="btn btn-default btn-search" type="button">
-									<i class="fa fa-search"></i>
-								</button>
-							</span>
-						</div>
-					</div>
-				</div>
-			</div>
-		</div>
-	</div-->
 	<div class="col-md-12">
 		<div class="row topLevelFilter">
             <div id="r_LogLevel" class="col-md-5"></div>
@@ -54,28 +22,17 @@
             <div id="r_LogSnapShot" class="col-md-1 col-sm-2"></div>
             <div class="row ">
 				<div class="col-md-12 fixedSearchBox hiddeBox">
-					<!-- div id="r_VSSearch"></div-->
 					<div class="col-md-6" data-id="r_vsSearchIncCol"></div>
 					<div class="col-md-6" data-id="r_vsSearchExCol"></div>	
 				</div>
 			</div>
         </div>
         <div class="setHeight_LogFile"></div>
-<!-- 		<div class="row">
-			<div class="col-md-12">
-				<div id="r_LogLevel"></div>
-			</div>
-		</div> -->
 		<div class="row">
 			<div class="col-md-12">
 					<div id="r_Histogram"></div>
 			</div>
 		</div>
-	<!-- 	<div class="row row-margin-bottom">
-			<div class="col-md-12">
-				<div id="r_VSSearch"></div>
-			</div>
-		</div> -->
 		<div class="row">
 			<div class="col-md-12">
 				<div class="box">
@@ -97,17 +54,13 @@
 								<i class="fa fa-sign-out"></i>
 							</a>
 							<a class="collapse-link"> <i class="fa fa-chevron-up"></i>
-							</a> 
-							<!-- <a class="expand-link"> <i class="fa fa-expand"></i></a>
-							<a class="close-link"> <i class="fa fa-close"></i></a> -->
-							
+							</a>
 						</div>
 						<div class="no-move"></div>
 					</div>
 					<div class="box-content">
 						<div class="col-md-4 advance-find">
 							<div class="input-group">
-								<!-- span class="input-group-addon">1 of 40</span -->
 								<span class="input-group-btn">
     							<button data-id="lock" title="Lock position" class="btn btn-default btn-search no-margin" type="button"><i class="fa fa-unlock"></i>
     							</button></span> 
@@ -135,7 +88,6 @@
 									</button>
 									<button data-id="cancelFind" class="btn btn-default btn-search no-margin" style="display:none;">cancel</button>
 									<button style="display:none;" class="no-margin btn-notification pageNotation" type="button"> </button>
-									<!-- <span class="pageNotation"></span> -->
 								</span>
 							</div>
 						</div>

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/AbstractRequestConverterTest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/AbstractRequestConverterTest.java b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/AbstractRequestConverterTest.java
new file mode 100644
index 0000000..04bd1af
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/AbstractRequestConverterTest.java
@@ -0,0 +1,42 @@
+/*
+ * 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.BaseLogRequest;
+import org.apache.ambari.logsearch.model.request.impl.CommonSearchRequest;
+
+public class AbstractRequestConverterTest {
+
+  public void fillBaseLogRequestWithTestData(BaseLogRequest request) {
+    fillCommonRequestWithTestData(request);
+    request.setFrom("2016-09-13T22:00:01.000Z");
+    request.setTo("2016-09-14T22:00:01.000Z");
+    request.setMustBe("logsearch_app,secure_log");
+    request.setMustNot("hst_agent,system_message");
+    request.setIncludeQuery("[{\"log_message\" : \"myincludemessage\"}]");
+    request.setExcludeQuery("[{\"log_message\" : \"myexcludemessage\"}]");
+  }
+
+  public void fillCommonRequestWithTestData(CommonSearchRequest request) {
+    request.setStartIndex("0");
+    request.setPage("0");
+    request.setPageSize("25");
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/AuditBarGraphRequestQueryConverterTest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/AuditBarGraphRequestQueryConverterTest.java b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/AuditBarGraphRequestQueryConverterTest.java
new file mode 100644
index 0000000..ef12f71
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/AuditBarGraphRequestQueryConverterTest.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.AuditBarGraphRequest;
+import org.apache.solr.client.solrj.SolrQuery;
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+
+public class AuditBarGraphRequestQueryConverterTest extends AbstractRequestConverterTest {
+
+  private AuditBarGraphRequestQueryConverter underTest;
+
+  @Before
+  public void setUp() {
+    underTest = new AuditBarGraphRequestQueryConverter();
+  }
+
+  @Test
+  public void testConvert() {
+    // GIVEN
+    AuditBarGraphRequest request = new AuditBarGraphRequest();
+    // WHEN
+    fillBaseLogRequestWithTestData(request);
+    request.setUnit("+1HOUR");
+    // THEN
+    SolrQuery query = underTest.convert(request);
+    assertEquals("?q=*%3A*&facet=true&facet.pivot=%7B%21range%3Dr1%7Drepo&facet.mincount=1&facet.limit=-1&facet.sort=index" +
+      "&facet.range=%7B%21tag%3Dr1%7DevtTime&f.evtTime.facet.range.start=2016-09-13T22%3A00%3A01.000Z&f.evtTime.facet.range.end=2016-09-14T22%3A00%3A01.000Z&f.evtTime.facet.range.gap=%2B1HOUR&rows=0&start=0",
+      query.toQueryString());
+  }
+
+  @Test
+  public void testConvertWithoutData() {
+    // GIVEN
+    AuditBarGraphRequest request = new AuditBarGraphRequest();
+    // WHEN
+    SolrQuery query = underTest.convert(request);
+    // THEN
+    assertEquals(Integer.valueOf(0), query.getRows());
+    assertEquals(-1, query.getFacetLimit());
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/AuditComponentRequestQueryConverterTest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/AuditComponentRequestQueryConverterTest.java b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/AuditComponentRequestQueryConverterTest.java
new file mode 100644
index 0000000..d6ecdd5
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/AuditComponentRequestQueryConverterTest.java
@@ -0,0 +1,66 @@
+/*
+ * 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.AuditComponentRequest;
+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.SimpleFacetQuery;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertEquals;
+
+public class AuditComponentRequestQueryConverterTest extends AbstractRequestConverterTest {
+
+  private AuditComponentsRequestQueryConverter underTest;
+
+  @Before
+  public void setUp() {
+    underTest = new AuditComponentsRequestQueryConverter();
+  }
+
+  @Test
+  public void testConvert() {
+    // GIVEN
+    AuditComponentRequest request = new AuditComponentRequest();
+    fillCommonRequestWithTestData(request);
+    // WHEN
+    SimpleFacetQuery facetQuery = underTest.convert(request);
+    SolrQuery query = new DefaultQueryParser().doConstructSolrQuery(facetQuery);
+    // THEN
+    assertEquals("?q=*%3A*&start=0&rows=25&sort=repo+asc&facet=true&facet.mincount=1&facet.limit=-1&facet.sort=index&facet.field=repo",
+      query.toQueryString());
+  }
+
+  @Test
+  public void testConvertWithoutData() {
+    // GIVEN
+    AuditComponentRequest request = new AuditComponentRequest();
+    // WHEN
+    SimpleFacetQuery facetQuery = underTest.convert(request);
+    SolrQuery query = new DefaultQueryParser().doConstructSolrQuery(facetQuery);
+    // THEN
+    assertNotNull(facetQuery);
+    assertEquals("?q=*%3A*&start=0&rows=99999&sort=repo+asc&facet=true&facet.mincount=1&facet.limit=-1&facet.sort=index&facet.field=repo",
+      query.toQueryString());
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/AuditLogRequestConverterTest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/AuditLogRequestConverterTest.java b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/AuditLogRequestConverterTest.java
new file mode 100644
index 0000000..ec6aad7
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/AuditLogRequestConverterTest.java
@@ -0,0 +1,64 @@
+/*
+ * 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.AuditLogRequest;
+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;
+
+public class AuditLogRequestConverterTest extends AbstractRequestConverterTest {
+
+  private AuditLogRequestQueryConverter underTest;
+
+  @Before
+  public void setUp() {
+    underTest = new AuditLogRequestQueryConverter();
+  }
+
+  @Test
+  public void testConvert() {
+    // GIVEN
+    AuditLogRequest request = new AuditLogRequest();
+    fillBaseLogRequestWithTestData(request);
+    // WHEN
+    SimpleQuery simpleQuery = underTest.convert(request);
+    SolrQuery queryResult = new DefaultQueryParser().doConstructSolrQuery(simpleQuery);
+    // THEN
+    assertEquals("?q=*%3A*&start=0&rows=25&fq=repo%3A%28logsearch_app+secure_log%29&fq=-repo%3A%28hst_agent+system_message%29" +
+      "&fq=log_message%3A*myincludemessage*&fq=-log_message%3A*myexcludemessage*&sort=evtTime+desc%2Cseq_num+desc",
+      queryResult.toQueryString());
+  }
+
+  @Test
+  public void testConvertWithoutData() {
+    // GIVEN
+    AuditLogRequest request = new AuditLogRequest();
+    // WHEN
+    SimpleQuery simpleQuery = underTest.convert(request);
+    SolrQuery queryResult = new DefaultQueryParser().doConstructSolrQuery(simpleQuery);
+    // THEN
+    assertEquals("?q=*%3A*&start=0&rows=99999&sort=evtTime+desc%2Cseq_num+desc", queryResult.toQueryString());
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/AuditServiceLoadRequestQueryConverterTest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/AuditServiceLoadRequestQueryConverterTest.java b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/AuditServiceLoadRequestQueryConverterTest.java
new file mode 100644
index 0000000..71e91e1
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/AuditServiceLoadRequestQueryConverterTest.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.model.request.impl.AuditServiceLoadRequest;
+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 AuditServiceLoadRequestQueryConverterTest extends AbstractRequestConverterTest {
+
+  private AuditServiceLoadRequestQueryConverter underTest;
+
+  @Before
+  public void setUp() {
+    underTest = new AuditServiceLoadRequestQueryConverter();
+  }
+
+  @Test
+  public void testConvert() {
+    // GIVEN
+    AuditServiceLoadRequest request = new AuditServiceLoadRequest();
+    fillBaseLogRequestWithTestData(request);
+    // WHEN
+    SolrQuery solrQuery = new DefaultQueryParser().doConstructSolrQuery(underTest.convert(request));
+    // THEN
+    assertEquals("?q=*%3A*&rows=0&fq=evtTime%3A%5B2016-09-13T22%3A00%3A01.000Z+TO+2016-09-14T22%3A00%3A01.000Z%5D&fq=log_message%3A*myincludemessage*&" +
+      "fq=-log_message%3A*myexcludemessage*&fq=repo%3A%28logsearch_app+secure_log%29&fq=-repo%3A%28hst_agent+system_message%29" +
+      "&facet=true&facet.mincount=1&facet.limit=10&facet.field=repo", solrQuery.toQueryString());
+  }
+
+  @Test
+  public void testConvertWithoutData() {
+    // GIVEN
+    AuditServiceLoadRequest request = new AuditServiceLoadRequest();
+    // WHEN
+    SolrQuery solrQuery = new DefaultQueryParser().doConstructSolrQuery(underTest.convert(request));
+    // THEN
+    assertEquals("?q=*%3A*&rows=0&fq=evtTime%3A%5B*+TO+*%5D&facet=true&facet.mincount=1&facet.limit=10&facet.field=repo",
+      solrQuery.toQueryString());
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/BaseServiceLogRequestQueryConverterTest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/BaseServiceLogRequestQueryConverterTest.java b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/BaseServiceLogRequestQueryConverterTest.java
new file mode 100644
index 0000000..1ade3c0
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/BaseServiceLogRequestQueryConverterTest.java
@@ -0,0 +1,70 @@
+/*
+ * 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.ServiceLogRequest;
+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;
+
+public class BaseServiceLogRequestQueryConverterTest extends AbstractRequestConverterTest {
+
+  private BaseServiceLogRequestQueryConverter underTest;
+
+  @Before
+  public void setUp() {
+    underTest = new BaseServiceLogRequestQueryConverter();
+  }
+
+  @Test
+  public void testConvertRequest() {
+    // GIVEN
+    ServiceLogRequest logRequest = new ServiceLogRequest();
+    fillBaseLogRequestWithTestData(logRequest);
+    logRequest.setLevel("FATAL,ERROR,WARN,UNKNOWN");
+    logRequest.setFileName("myfile");
+    logRequest.setComponentName("component");
+    logRequest.setHostName("logsearch.com");
+    // WHEN
+    SimpleQuery query = underTest.convert(logRequest);
+    DefaultQueryParser defaultQueryParser = new DefaultQueryParser();
+    SolrQuery solrQuery = defaultQueryParser.doConstructSolrQuery(query);
+
+    // THEN
+    assertEquals("?q=*%3A*&start=0&rows=25&fq=log_message%3A*myincludemessage*&fq=-log_message%3A*myexcludemessage*" +
+      "&fq=host%3Alogsearch.com&fq=path%3Amyfile&fq=type%3Acomponent&fq=level%3A%28FATAL+ERROR+WARN+UNKNOWN%29" +
+      "&fq=logtime%3A%5B2016-09-13T22%3A00%3A01.000Z+TO+2016-09-14T22%3A00%3A01.000Z%5D&sort=logtime+desc%2Cseq_num+desc",
+      solrQuery.toQueryString());
+  }
+
+  @Test
+  public void testConvertRequestWithoutData() {
+    // GIVEN
+    ServiceLogRequest logRequest = new ServiceLogRequest();
+    // WHEN
+    SimpleQuery query = underTest.convert(logRequest);
+    // THEN
+    assertEquals(Integer.valueOf(99999), query.getRows());
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/FieldAuditLogRequestQueryConverterTest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/FieldAuditLogRequestQueryConverterTest.java b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/FieldAuditLogRequestQueryConverterTest.java
new file mode 100644
index 0000000..1864af3
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/FieldAuditLogRequestQueryConverterTest.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.model.request.impl.FieldAuditLogRequest;
+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 FieldAuditLogRequestQueryConverterTest extends AbstractRequestConverterTest {
+
+  private FieldAuditLogRequestQueryConverter underTest;
+
+  @Before
+  public void setUp() {
+    underTest = new FieldAuditLogRequestQueryConverter();
+  }
+
+  @Test
+  public void testConvert() {
+    // GIVEN
+    FieldAuditLogRequest request = new FieldAuditLogRequest();
+    fillBaseLogRequestWithTestData(request);
+    request.setTop(10);
+    request.setField("myfield");
+    // WHEN
+    SolrQuery query = new DefaultQueryParser().doConstructSolrQuery(underTest.convert(request));
+    // THEN
+    assertEquals("?q=*%3A*&rows=0&fq=evtTime%3A%5B2016-09-13T22%3A00%3A01.000Z+TO+2016-09-14T22%3A00%3A01.000Z%5D&" +
+      "fq=log_message%3A*myincludemessage*&fq=-log_message%3A*myexcludemessage*&fq=repo%3A%28logsearch_app+secure_log%29&" +
+      "fq=-repo%3A%28hst_agent+system_message%29&facet=true&facet.mincount=1&facet.limit=10&facet.pivot=myfield%2Crepo",
+      query.toQueryString());
+  }
+
+  @Test(expected = IllegalArgumentException.class) // TODO: later use @Valid on the fields to validate object
+  public void testConvertWithoutData() {
+    // GIVEN
+    FieldAuditLogRequest request = new FieldAuditLogRequest();
+    // WHEN
+    new DefaultQueryParser().doConstructSolrQuery(underTest.convert(request));
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/ServiceLogAnyGraphRequestConverterTest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/ServiceLogAnyGraphRequestConverterTest.java b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/ServiceLogAnyGraphRequestConverterTest.java
new file mode 100644
index 0000000..487ad11
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/ServiceLogAnyGraphRequestConverterTest.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.ServiceAnyGraphRequest;
+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 ServiceLogAnyGraphRequestConverterTest extends AbstractRequestConverterTest {
+
+  private ServiceLogAnyGraphRequestQueryConverter underTest;
+
+  @Before
+  public void setUp() {
+    underTest = new ServiceLogAnyGraphRequestQueryConverter();
+  }
+
+  @Test
+  public void testConverter() {
+    // GIVEN
+    ServiceAnyGraphRequest request = new ServiceAnyGraphRequest();
+    request.setUnit("+1HOUR");
+    fillBaseLogRequestWithTestData(request);
+    // WHEN
+    SolrQuery query = new DefaultQueryParser().doConstructSolrQuery(underTest.convert(request));
+    // THEN
+    assertEquals("?q=*%3A*&rows=0&fq=logtime%3A%5B2016-09-13T22%3A00%3A01.000Z+TO+2016-09-14T22%3A00%3A01.000Z%5D&fq=log_message%3A*myincludemessage*" +
+      "&fq=-log_message%3A*myexcludemessage*&fq=type%3A%28logsearch_app+secure_log%29&fq=-type%3A%28hst_agent+system_message%29" +
+      "&facet=true&facet.mincount=1&facet.limit=10&facet.field=level", query.toQueryString());
+  }
+
+  @Test
+  public void testConverterWithoutData() {
+    // GIVEN
+    ServiceAnyGraphRequest request = new ServiceAnyGraphRequest();
+    // WHEN
+    SolrQuery query = new DefaultQueryParser().doConstructSolrQuery(underTest.convert(request));
+    // THEN
+    assertEquals("?q=*%3A*&rows=0&fq=logtime%3A%5B*+TO+*%5D&facet=true&facet.mincount=1&facet.limit=10&facet.field=level",
+      query.toQueryString());
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/ServiceLogComponentLevelRequestQueryConverterTest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/ServiceLogComponentLevelRequestQueryConverterTest.java b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/ServiceLogComponentLevelRequestQueryConverterTest.java
new file mode 100644
index 0000000..47f7a6d
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/ServiceLogComponentLevelRequestQueryConverterTest.java
@@ -0,0 +1,65 @@
+/*
+ * 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.ServiceLogComponentLevelRequest;
+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 ServiceLogComponentLevelRequestQueryConverterTest extends AbstractRequestConverterTest {
+
+  private ServiceLogComponentLevelRequestQueryConverter underTest;
+
+  @Before
+  public void setUp() {
+    underTest = new ServiceLogComponentLevelRequestQueryConverter();
+  }
+
+  @Test
+  public void testConverter() {
+    // GIVEN
+    ServiceLogComponentLevelRequest request = new ServiceLogComponentLevelRequest();
+    fillBaseLogRequestWithTestData(request);
+    request.setComponentName("mycomponent");
+    request.setLevel("WARN,ERROR,FATAL");
+    // WHEN
+    SolrQuery query = new DefaultQueryParser().doConstructSolrQuery(underTest.convert(request));
+    // THEN
+    assertEquals("?q=*%3A*&rows=0&fq=logtime%3A%5B2016-09-13T22%3A00%3A01.000Z+TO+2016-09-14T22%3A00%3A01.000Z%5D&fq=log_message%3A*myincludemessage*" +
+      "&fq=-log_message%3A*myexcludemessage*&fq=type%3A%28logsearch_app+secure_log%29&fq=-type%3A%28hst_agent+system_message%29" +
+      "&fq=level%3A%28WARN+ERROR+FATAL%29&facet=true&facet.mincount=1&facet.limit=10&facet.sort=index&facet.pivot=type%2Clevel",
+      query.toQueryString());
+  }
+
+  @Test
+  public void testConverterWithoutData() {
+    // GIVEN
+    ServiceLogComponentLevelRequest request = new ServiceLogComponentLevelRequest();
+    request.setLevel("WARN,ERROR,FATAL");
+    // WHEN
+    SolrQuery query = new DefaultQueryParser().doConstructSolrQuery(underTest.convert(request));
+    // THEN
+    assertEquals("?q=*%3A*&rows=0&fq=logtime%3A%5B*+TO+*%5D&fq=level%3A%28WARN+ERROR+FATAL%29&facet=true" +
+      "&facet.mincount=1&facet.limit=10&facet.sort=index&facet.pivot=type%2Clevel", query.toQueryString());
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/ServiceLogComponentRequestFacetQueryConverterTest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/ServiceLogComponentRequestFacetQueryConverterTest.java b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/ServiceLogComponentRequestFacetQueryConverterTest.java
new file mode 100644
index 0000000..d40bda0
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/ServiceLogComponentRequestFacetQueryConverterTest.java
@@ -0,0 +1,67 @@
+/*
+ * 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.ServiceLogComponentHostRequest;
+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 ServiceLogComponentRequestFacetQueryConverterTest extends AbstractRequestConverterTest {
+
+  private ServiceLogComponentRequestFacetQueryConverter underTest;
+
+  @Before
+  public void setUp() {
+    underTest = new ServiceLogComponentRequestFacetQueryConverter();
+  }
+
+  @Test
+  public void testConverter() {
+    // GIVEN
+    ServiceLogComponentHostRequest request = new ServiceLogComponentHostRequest();
+    fillBaseLogRequestWithTestData(request);
+    request.setComponentName("mycomponent");
+    request.setLevel("WARN,ERROR,FATAL");
+    // WHEN
+    SolrQuery query = new DefaultQueryParser().doConstructSolrQuery(underTest.convert(request));
+    // THEN
+    assertEquals("?q=*%3A*&rows=0&fq=logtime%3A%5B2016-09-13T22%3A00%3A01.000Z+TO+2016-09-14T22%3A00%3A01.000Z%5D" +
+      "&fq=log_message%3A*myincludemessage*&fq=-log_message%3A*myexcludemessage*&fq=type%3A%28logsearch_app+secure_log%29" +
+      "&fq=-type%3A%28hst_agent+system_message%29&fq=level%3A%28WARN+ERROR+FATAL%29&facet=true&facet.mincount=1&facet.limit=10" +
+      "&facet.sort=index&facet.pivot=type%2Chost%2Clevel&facet.pivot=type%2Clevel",
+      query.toQueryString());
+  }
+
+  @Test
+  public void testConverterWithoutData() {
+    // GIVEN
+    ServiceLogComponentHostRequest request = new ServiceLogComponentHostRequest();
+    request.setLevel("WARN,ERROR,FATAL");
+    // WHEN
+    SolrQuery query = new DefaultQueryParser().doConstructSolrQuery(underTest.convert(request));
+    // THEN
+    assertEquals("?q=*%3A*&rows=0&fq=logtime%3A%5B*+TO+*%5D&fq=level%3A%28WARN+ERROR+FATAL%29" +
+      "&facet=true&facet.mincount=1&facet.limit=10&facet.sort=index&facet.pivot=type%2Chost%2Clevel&facet.pivot=type%2Clevel",
+      query.toQueryString());
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/ServiceLogLevelCountRequestQueryConverterTest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/ServiceLogLevelCountRequestQueryConverterTest.java b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/ServiceLogLevelCountRequestQueryConverterTest.java
new file mode 100644
index 0000000..a4a3256
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/ServiceLogLevelCountRequestQueryConverterTest.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.ServiceLogLevelCountRequest;
+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 ServiceLogLevelCountRequestQueryConverterTest extends AbstractRequestConverterTest {
+
+  private ServiceLogLevelCountRequestQueryConverter underTest;
+
+  @Before
+  public void setUp() {
+    underTest = new ServiceLogLevelCountRequestQueryConverter();
+  }
+
+  @Test
+  public void testConvert() {
+    // GIVEN
+    ServiceLogLevelCountRequest request = new ServiceLogLevelCountRequest();
+    fillBaseLogRequestWithTestData(request);
+    // WHEN
+    SolrQuery query = new DefaultQueryParser().doConstructSolrQuery(underTest.convert(request));
+    // THEN
+    assertEquals("?q=*%3A*&rows=0&fq=logtime%3A%5B2016-09-13T22%3A00%3A01.000Z+TO+2016-09-14T22%3A00%3A01.000Z%5D" +
+      "&fq=log_message%3A*myincludemessage*&fq=-log_message%3A*myexcludemessage*&fq=type%3A%28logsearch_app+secure_log%29" +
+      "&fq=-type%3A%28hst_agent+system_message%29&facet=true&facet.mincount=1&facet.limit=10&facet.field=level",
+      query.toQueryString());
+  }
+
+  @Test
+  public void testConvertWithoutData() {
+    // GIVEN
+    ServiceLogLevelCountRequest request = new ServiceLogLevelCountRequest();
+    // WHEN
+    SolrQuery query = new DefaultQueryParser().doConstructSolrQuery(underTest.convert(request));
+    // THEN
+    assertEquals("?q=*%3A*&rows=0&fq=logtime%3A%5B*+TO+*%5D&facet=true&facet.mincount=1&facet.limit=10&facet.field=level",
+      query.toQueryString());
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/ServiceLogLevelDateRangeRequestQueryConverterTest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/ServiceLogLevelDateRangeRequestQueryConverterTest.java b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/ServiceLogLevelDateRangeRequestQueryConverterTest.java
new file mode 100644
index 0000000..b941437
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/ServiceLogLevelDateRangeRequestQueryConverterTest.java
@@ -0,0 +1,68 @@
+/*
+ * 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.ServiceGraphRequest;
+import org.apache.solr.client.solrj.SolrQuery;
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+
+public class ServiceLogLevelDateRangeRequestQueryConverterTest extends AbstractRequestConverterTest {
+
+  private ServiceLogLevelDateRangeRequestQueryConverter underTest;
+
+  @Before
+  public void setUp() {
+    underTest = new ServiceLogLevelDateRangeRequestQueryConverter();
+  }
+
+  @Test
+  public void testConvert() {
+    // GIVEN
+    ServiceGraphRequest request = new ServiceGraphRequest();
+    fillBaseLogRequestWithTestData(request);
+    request.setUnit("+1HOUR");
+    request.setLevel("WARN,ERROR,FATAL");
+    // WHEN
+    SolrQuery query = underTest.convert(request);
+    // THEN
+    assertEquals("?q=*%3A*&facet=true&facet.pivot=%7B%21range%3Dr1%7Dlevel&facet.mincount=1&facet.limit=-1" +
+      "&facet.sort=index&facet.range=%7B%21tag%3Dr1%7Dlogtime&f.logtime.facet.range.start=2016-09-13T22%3A00%3A01.000Z" +
+      "&f.logtime.facet.range.end=2016-09-14T22%3A00%3A01.000Z&f.logtime.facet.range.gap=%2B1HOUR&rows=0&start=0&fq=level%3A%28WARN+OR+ERROR+OR+FATAL%29",
+      query.toQueryString());
+  }
+
+  @Test
+  public void testConvertWithoutData() {
+    // GIVEN
+    ServiceGraphRequest request = new ServiceGraphRequest();
+    request.setUnit("+1HOUR"); // minimal data for date range gap
+    request.setFrom("2016-09-13T22:00:01.000Z");
+    request.setTo("2016-09-14T22:00:01.000Z");
+    // WHEN
+    SolrQuery query = underTest.convert(request);
+    // THEN
+    assertEquals("?q=*%3A*&facet=true&facet.pivot=%7B%21range%3Dr1%7Dlevel&facet.mincount=1&facet.limit=-1&facet.sort=index" +
+      "&facet.range=%7B%21tag%3Dr1%7Dlogtime&f.logtime.facet.range.start=2016-09-13T22%3A00%3A01.000Z" +
+      "&f.logtime.facet.range.end=2016-09-14T22%3A00%3A01.000Z&f.logtime.facet.range.gap=%2B1HOUR&rows=0&start=0",
+      query.toQueryString());
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/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
new file mode 100644
index 0000000..481bfeb
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/ServiceLogTreeRequestFacetQueryConverterTest.java
@@ -0,0 +1,65 @@
+/*
+ * 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.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;
+import org.springframework.data.solr.core.DefaultQueryParser;
+
+import static org.junit.Assert.assertEquals;
+
+public class ServiceLogTreeRequestFacetQueryConverterTest extends AbstractRequestConverterTest {
+  private ServiceLogTreeRequestFacetQueryConverter underTest;
+
+  @Before
+  public void setUp() {
+    underTest = new ServiceLogTreeRequestFacetQueryConverter();
+  }
+
+  @Test
+  public void testConvert() {
+    // GIVEN
+    ServiceLogHostComponentRequest request = new ServiceLogHostComponentRequest();
+    fillBaseLogRequestWithTestData(request);
+    request.setLevel("WARN,ERROR,FATAL");
+    // WHEN
+    SolrQuery query = new DefaultQueryParser().doConstructSolrQuery(underTest.convert(request));
+    // THEN
+    assertEquals("?q=*%3A*&rows=0&fq=logtime%3A%5B2016-09-13T22%3A00%3A01.000Z+TO+2016-09-14T22%3A00%3A01.000Z%5D&fq=log_message%3A*myincludemessage*" +
+      "&fq=-log_message%3A*myexcludemessage*&fq=type%3A%28logsearch_app+secure_log%29&fq=-type%3A%28hst_agent+system_message%29&fq=level%3A%28WARN+ERROR+FATAL%29" +
+      "&facet=true&facet.mincount=1&facet.limit=10&facet.sort=index&facet.pivot=host%2Ctype%2Clevel&facet.pivot=host%2Clevel",
+      query.toQueryString());
+  }
+
+  @Test
+  public void testConvertWithoutData() {
+    // GIVEN
+    ServiceLogHostComponentRequest request = new ServiceLogHostComponentRequest();
+    request.setLevel("WARN,ERROR,FATAL");
+    // WHEN
+    SolrQuery query = new DefaultQueryParser().doConstructSolrQuery(underTest.convert(request));
+    // THEN
+    assertEquals("?q=*%3A*&rows=0&fq=logtime%3A%5B*+TO+*%5D&fq=level%3A%28WARN+ERROR+FATAL%29&facet=true&facet.mincount=1" +
+      "&facet.limit=10&facet.sort=index&facet.pivot=host%2Ctype%2Clevel&facet.pivot=host%2Clevel",
+      query.toQueryString());
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/ServiceLogTruncatedRequestQueryConverterTest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/ServiceLogTruncatedRequestQueryConverterTest.java b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/ServiceLogTruncatedRequestQueryConverterTest.java
new file mode 100644
index 0000000..41761bc
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/ServiceLogTruncatedRequestQueryConverterTest.java
@@ -0,0 +1,64 @@
+/*
+ * 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.ServiceLogTruncatedRequest;
+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 ServiceLogTruncatedRequestQueryConverterTest extends AbstractRequestConverterTest {
+
+  private ServiceLogTruncatedRequestQueryConverter underTest;
+
+  @Before
+  public void setUp() {
+    underTest = new ServiceLogTruncatedRequestQueryConverter();
+  }
+
+  @Test
+  public void testConvert() {
+    // GIVEN
+    ServiceLogTruncatedRequest request = new ServiceLogTruncatedRequest();
+    fillBaseLogRequestWithTestData(request);
+    request.setScrollType("0");
+    request.setNumberRows(10);
+    request.setId("id");
+    // WHEN
+    SolrQuery query = new DefaultQueryParser().doConstructSolrQuery(underTest.convert(request));
+    // THEN
+    assertEquals("?q=*%3A*&start=0&rows=10&fq=type%3A%28logsearch_app+secure_log%29&fq=-type%3A%28hst_agent+system_message%29" +
+      "&fq=log_message%3A*myincludemessage*&fq=-log_message%3A*myexcludemessage*&sort=logtime+desc%2Cseq_num+desc",
+      query.toQueryString());
+  }
+
+  @Test
+  public void testConvertWithoutData() {
+    // GIVEN
+    ServiceLogTruncatedRequest request = new ServiceLogTruncatedRequest();
+    // WHEN
+    SolrQuery query = new DefaultQueryParser().doConstructSolrQuery(underTest.convert(request));
+    // THEN
+    assertEquals("?q=*%3A*&start=0&sort=logtime+desc%2Cseq_num+desc",
+      query.toQueryString());
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/StringFieldFacetQueryConverterTest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/StringFieldFacetQueryConverterTest.java b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/StringFieldFacetQueryConverterTest.java
new file mode 100644
index 0000000..3597779
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/StringFieldFacetQueryConverterTest.java
@@ -0,0 +1,48 @@
+/*
+ * 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.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;
+
+public class StringFieldFacetQueryConverterTest extends AbstractRequestConverterTest {
+  private StringFieldFacetQueryConverter underTest;
+
+  @Before
+  public void setUp() {
+    underTest = new StringFieldFacetQueryConverter();
+  }
+
+  @Test
+  public void testConvert() {
+    // GIVEN
+    String field = "myfield";
+    // WHEN
+    SimpleQuery simpleQuery = underTest.convert(field);
+    SolrQuery queryResult = new DefaultQueryParser().doConstructSolrQuery(simpleQuery);
+    // THEN
+    assertEquals("?q=*%3A*&rows=0&facet=true&facet.mincount=1&facet.limit=-1&facet.field=myfield",
+      queryResult.toQueryString());
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/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
new file mode 100644
index 0000000..adeaf5b
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/UserConfigRequestQueryConverterTest.java
@@ -0,0 +1,54 @@
+/*
+ * 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.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;
+
+public class UserConfigRequestQueryConverterTest extends AbstractRequestConverterTest {
+
+  private UserConfigRequestQueryConverter underTest;
+
+  @Before
+  public void setUp() {
+    underTest = new UserConfigRequestQueryConverter();
+  }
+
+  @Test
+  public void testConvert() {
+    // GIVEN
+    UserConfigRequest request = new UserConfigRequest();
+    request.setRowType("myRowType"); // TODO: validate these 3 fields @Valid on UserConfigRequest object -> not null
+    request.setUserId("myUserId");
+    request.setFilterName("myFilterName");
+    // WHEN
+    SolrQuery queryResult = underTest.convert(request);
+    // THEN
+    assertEquals("?q=*%3A*&fq=rowtype%3AmyRowType&fq=username%3AmyUserId+OR+share_username_list%3AmyUserId" +
+      "&fq=filtername%3A*myFilterName*&start=0&rows=10&sort=filtername+asc",
+      queryResult.toQueryString());
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/UserExportRequestQueryConverterTest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/UserExportRequestQueryConverterTest.java b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/UserExportRequestQueryConverterTest.java
new file mode 100644
index 0000000..7728876
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/converter/UserExportRequestQueryConverterTest.java
@@ -0,0 +1,63 @@
+/*
+ * 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.UserExportRequest;
+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 UserExportRequestQueryConverterTest extends AbstractRequestConverterTest {
+  private UserExportRequestQueryConverter underTest;
+
+  @Before
+  public void setUp() {
+    underTest = new UserExportRequestQueryConverter();
+  }
+
+  @Test
+  public void testConverter() {
+    // GIVEN
+    UserExportRequest request = new UserExportRequest();
+    fillBaseLogRequestWithTestData(request);
+    request.setFormat("myFormat");
+    // WHEN
+    SolrQuery query = new DefaultQueryParser().doConstructSolrQuery(underTest.convert(request));
+    // THEN
+    assertEquals("?q=*%3A*&rows=0&fq=evtTime%3A%5B2016-09-13T22%3A00%3A01.000Z+TO+2016-09-14T22%3A00%3A01.000Z%5D" +
+      "&fq=log_message%3A*myincludemessage*&fq=-log_message%3A*myexcludemessage*&fq=repo%3A%28logsearch_app+secure_log%29" +
+      "&fq=-repo%3A%28hst_agent+system_message%29&facet=true&facet.mincount=1&facet.limit=10&facet.pivot=reqUser%2Crepo&facet.pivot=resource%2Crepo",
+      query.toQueryString());
+  }
+
+  @Test
+  public void testConverterWithoutData() {
+    // GIVEN
+    UserExportRequest request = new UserExportRequest();
+    // WHEN
+    SolrQuery query = new DefaultQueryParser().doConstructSolrQuery(underTest.convert(request));
+    // THEN
+    assertEquals("?q=*%3A*&rows=0&fq=evtTime%3A%5B*+TO+*%5D&facet=true&facet.mincount=1&facet.limit=10" +
+      "&facet.pivot=reqUser%2Crepo&facet.pivot=resource%2Crepo",
+      query.toQueryString());
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-server/src/main/java/org/apache/ambari/server/controller/logging/LoggingRequestHelperImpl.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/logging/LoggingRequestHelperImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/logging/LoggingRequestHelperImpl.java
index 061c607..eab0c04 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/logging/LoggingRequestHelperImpl.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/logging/LoggingRequestHelperImpl.java
@@ -64,7 +64,7 @@ public class LoggingRequestHelperImpl implements LoggingRequestHelper {
 
   private static final String LOGSEARCH_QUERY_PATH = "/api/v1/service/logs";
 
-  private static final String LOGSEARCH_GET_LOG_LEVELS_PATH = "/api/v1/service/logs/levels/counts/namevalues";
+  private static final String LOGSEARCH_GET_LOG_LEVELS_PATH = "/api/v1/service/logs/levels/counts";
 
   private static final String LOGSEARCH_ADMIN_CREDENTIAL_NAME = "logsearch.admin.credential";
 


[19/58] [abbrv] ambari git commit: AMBARI-18310. Refactor logsearch portal code - part 3 (oleewere)

Posted by ol...@apache.org.
http://git-wip-us.apache.org/repos/asf/ambari/blob/6fa4abfe/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/SolrCollectionDao.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/SolrCollectionDao.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/SolrCollectionDao.java
new file mode 100644
index 0000000..ed93b4d
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/SolrCollectionDao.java
@@ -0,0 +1,259 @@
+/*
+ * 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.dao;
+
+import org.apache.ambari.logsearch.conf.SolrPropsConfig;
+import org.apache.commons.lang.StringUtils;
+import org.apache.solr.client.solrj.SolrServerException;
+import org.apache.solr.client.solrj.impl.CloudSolrClient;
+import org.apache.solr.client.solrj.request.CollectionAdminRequest;
+import org.apache.solr.client.solrj.response.CollectionAdminResponse;
+import org.apache.solr.common.SolrException;
+import org.apache.solr.common.cloud.Replica;
+import org.apache.solr.common.cloud.Slice;
+import org.apache.solr.common.cloud.ZkStateReader;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Component;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.List;
+
+@Component
+public class SolrCollectionDao {
+
+  private static final Logger LOG = LoggerFactory.getLogger(SolrCollectionDao.class);
+
+  private static final String ROUTER_FIELD = "_router_field_";
+  private static final int SETUP_RETRY_SECOND = 30;
+
+  /**
+   * This will try to get the collections from the Solr. Ping doesn't work if
+   * collection is not given
+   */
+  public boolean checkSolrStatus(CloudSolrClient cloudSolrClient) {
+    int waitDurationMS = 3 * 60 * 1000;
+    boolean status = false;
+    try {
+      long beginTimeMS = System.currentTimeMillis();
+      long waitIntervalMS = 2000;
+      int pingCount = 0;
+      while (true) {
+        pingCount++;
+        try {
+          List<String> collectionList = getCollections(cloudSolrClient);
+          if (collectionList != null) {
+            LOG.info("checkSolrStatus(): Solr getCollections() is success. collectionList=" + collectionList);
+            status = true;
+            break;
+          }
+        } catch (Exception ex) {
+          LOG.error("Error while doing Solr check", ex);
+        }
+        if (System.currentTimeMillis() - beginTimeMS > waitDurationMS) {
+          LOG.error("Solr is not reachable even after " + (System.currentTimeMillis() - beginTimeMS) + " ms. " +
+            "If you are using alias, then you might have to restart LogSearch after Solr is up and running.");
+          break;
+        } else {
+          LOG.warn("Solr is not not reachable yet. getCollections() attempt count=" + pingCount + ". " +
+            "Will sleep for " + waitIntervalMS + " ms and try again.");
+        }
+        Thread.sleep(waitIntervalMS);
+
+      }
+    } catch (Throwable t) {
+      LOG.error("Seems Solr is not up.");
+    }
+    return status;
+  }
+
+  public void setupCollections(final CloudSolrClient solrClient, final SolrPropsConfig solrPropsConfig) throws Exception {
+    boolean setupStatus = createCollectionsIfNeeded(solrClient, solrPropsConfig);
+    LOG.info("Setup status for " + solrPropsConfig.getCollection() + " is " + setupStatus);
+    if (!setupStatus) {
+      // Start a background thread to do setup
+      Thread setupThread = new Thread("setup_collection_" + solrPropsConfig.getCollection()) {
+        @Override
+        public void run() {
+          LOG.info("Started monitoring thread to check availability of Solr server. collection=" + solrPropsConfig.getCollection());
+          int retryCount = 0;
+          while (true) {
+            try {
+              Thread.sleep(SETUP_RETRY_SECOND * 1000);
+              retryCount++;
+              boolean setupStatus = createCollectionsIfNeeded(solrClient, solrPropsConfig);
+              if (setupStatus) {
+                LOG.info("Setup for collection " + solrPropsConfig.getCollection() + " is successful. Exiting setup retry thread");
+                break;
+              }
+            } catch (InterruptedException sleepInterrupted) {
+              LOG.info("Sleep interrupted while setting up collection " + solrPropsConfig.getCollection());
+              break;
+            } catch (Exception e) {
+              LOG.error("Error setting up collection=" + solrPropsConfig.getCollection(), e);
+            }
+            LOG.error("Error setting collection. collection=" + solrPropsConfig.getCollection() + ", retryCount=" + retryCount);
+          }
+        }
+      };
+      setupThread.setDaemon(true);
+      setupThread.start();
+    }
+  }
+
+  private boolean createCollectionsIfNeeded(CloudSolrClient solrClient, SolrPropsConfig solrPropsConfig) {
+    boolean result = false;
+    try {
+      List<String> allCollectionList = getCollections(solrClient);
+      if (solrPropsConfig.getSplitInterval().equalsIgnoreCase("none")) {
+        result = createCollection(solrClient, solrPropsConfig, allCollectionList);
+      } else {
+        result = setupCollectionsWithImplicitRouting(solrClient, solrPropsConfig, allCollectionList);
+      }
+    } catch (Exception ex) {
+      LOG.error("Error creating collection. collectionName=" + solrPropsConfig.getCollection(), ex);
+    }
+    return result;
+  }
+
+  @SuppressWarnings("unchecked")
+  public List<String> getCollections(CloudSolrClient solrClient) throws SolrServerException,
+    IOException {
+    try {
+      CollectionAdminRequest.List colListReq = new CollectionAdminRequest.List();
+      CollectionAdminResponse response = colListReq.process(solrClient);
+      if (response.getStatus() != 0) {
+        LOG.error("Error getting collection list from solr.  response=" + response);
+        return null;
+      }
+      return (List<String>) response.getResponse().get("collections");
+    } catch (SolrException e) {
+      LOG.error("getCollections() operation failed", e);
+      return new ArrayList<>();
+    }
+  }
+
+  private boolean setupCollectionsWithImplicitRouting(CloudSolrClient solrClient, SolrPropsConfig solrPropsConfig, List<String> allCollectionList)
+    throws Exception {
+    LOG.info("setupCollectionsWithImplicitRouting(). collectionName=" + solrPropsConfig.getCollection()
+      + ", numberOfShards=" + solrPropsConfig.getNumberOfShards());
+
+    // Default is true, because if the collection and shard is already there, then it will return true
+    boolean returnValue = true;
+
+    List<String> shardsList = new ArrayList<String>();
+    for (int i = 0; i < solrPropsConfig.getNumberOfShards(); i++) {
+      shardsList.add("shard" + i);
+    }
+    String shardsListStr = StringUtils.join(shardsList, ',');
+
+    // Check if collection is already in zookeeper
+    if (!allCollectionList.contains(solrPropsConfig.getCollection())) {
+      LOG.info("Creating collection " + solrPropsConfig.getCollection() + ", shardsList=" + shardsList);
+      CollectionAdminRequest.Create collectionCreateRequest = new CollectionAdminRequest.Create();
+      collectionCreateRequest.setCollectionName(solrPropsConfig.getCollection());
+      collectionCreateRequest.setRouterName("implicit");
+      collectionCreateRequest.setShards(shardsListStr);
+      collectionCreateRequest.setNumShards(solrPropsConfig.getNumberOfShards());
+      collectionCreateRequest.setReplicationFactor(solrPropsConfig.getReplicationFactor());
+      collectionCreateRequest.setConfigName(solrPropsConfig.getConfigName());
+      collectionCreateRequest.setRouterField(ROUTER_FIELD);
+      collectionCreateRequest.setMaxShardsPerNode(solrPropsConfig.getReplicationFactor() * solrPropsConfig.getNumberOfShards());
+
+      CollectionAdminResponse createResponse = collectionCreateRequest.process(solrClient);
+      if (createResponse.getStatus() != 0) {
+        returnValue = false;
+        LOG.error("Error creating collection. collectionName=" + solrPropsConfig.getCollection()
+          + ", shardsList=" + shardsList +", response=" + createResponse);
+      } else {
+        LOG.info("Created collection " + solrPropsConfig.getCollection() + ", shardsList=" + shardsList);
+      }
+    } else {
+      LOG.info("Collection " + solrPropsConfig.getCollection() + " is already there. Will check whether it has the required shards");
+      Collection<String> existingShards = getShards(solrClient, solrPropsConfig);
+      for (String shard : shardsList) {
+        if (!existingShards.contains(shard)) {
+          try {
+            LOG.info("Going to add Shard " + shard + " to collection " + solrPropsConfig.getCollection());
+            CollectionAdminRequest.CreateShard createShardRequest = new CollectionAdminRequest.CreateShard();
+            createShardRequest.setCollectionName(solrPropsConfig.getCollection());
+            createShardRequest.setShardName(shard);
+            CollectionAdminResponse response = createShardRequest.process(solrClient);
+            if (response.getStatus() != 0) {
+              LOG.error("Error creating shard " + shard + " in collection " + solrPropsConfig.getCollection() + ", response=" + response);
+              returnValue = false;
+              break;
+            } else {
+              LOG.info("Successfully created shard " + shard + " in collection " + solrPropsConfig.getCollection());
+            }
+          } catch (Throwable t) {
+            LOG.error("Error creating shard " + shard + " in collection " + solrPropsConfig.getCollection(), t);
+            returnValue = false;
+            break;
+          }
+        }
+      }
+    }
+    return returnValue;
+  }
+
+  private Collection<String> getShards(CloudSolrClient solrClient, SolrPropsConfig solrPropsConfig) {
+    Collection<String> list = new HashSet<>();
+    ZkStateReader reader = solrClient.getZkStateReader();
+    Collection<Slice> slices = reader.getClusterState().getSlices(solrPropsConfig.getCollection());
+    for (Slice slice : slices) {
+      for (Replica replica : slice.getReplicas()) {
+        LOG.info("colName=" + solrPropsConfig.getCollection() + ", slice.name=" + slice.getName() + ", slice.state=" + slice.getState() +
+          ", replica.core=" + replica.getStr("core") + ", replica.state=" + replica.getStr("state"));
+        list.add(slice.getName());
+      }
+    }
+    return list;
+  }
+
+  private boolean createCollection(CloudSolrClient solrClient, SolrPropsConfig solrPropsConfig, List<String> allCollectionList) throws SolrServerException, IOException {
+
+    if (allCollectionList.contains(solrPropsConfig.getCollection())) {
+      LOG.info("Collection " + solrPropsConfig.getCollection() + " is already there. Won't create it");
+      return true;
+    }
+
+    LOG.info("Creating collection " + solrPropsConfig.getCollection() + ", numberOfShards=" + solrPropsConfig.getNumberOfShards() +
+      ", replicationFactor=" + solrPropsConfig.getReplicationFactor());
+
+    CollectionAdminRequest.Create collectionCreateRequest = new CollectionAdminRequest.Create();
+    collectionCreateRequest.setCollectionName(solrPropsConfig.getCollection());
+    collectionCreateRequest.setNumShards(solrPropsConfig.getNumberOfShards());
+    collectionCreateRequest.setReplicationFactor(solrPropsConfig.getReplicationFactor());
+    collectionCreateRequest.setConfigName(solrPropsConfig.getConfigName());
+    collectionCreateRequest.setMaxShardsPerNode(solrPropsConfig.getReplicationFactor() * solrPropsConfig.getNumberOfShards());
+    CollectionAdminResponse createResponse = collectionCreateRequest.process(solrClient);
+    if (createResponse.getStatus() != 0) {
+      LOG.error("Error creating collection. collectionName=" + solrPropsConfig.getCollection() + ", response=" + createResponse);
+      return false;
+    } else {
+      LOG.info("Created collection " + solrPropsConfig.getCollection() + ", numberOfShards=" + solrPropsConfig.getNumberOfShards() +
+        ", replicationFactor=" + solrPropsConfig.getReplicationFactor());
+      return true;
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/6fa4abfe/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/SolrDaoBase.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/SolrDaoBase.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/SolrDaoBase.java
index ac7f56f..8381948 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/SolrDaoBase.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/SolrDaoBase.java
@@ -22,426 +22,47 @@ package org.apache.ambari.logsearch.dao;
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.Date;
 import java.util.HashMap;
-import java.util.HashSet;
 import java.util.List;
+import java.util.Map;
 
-import org.apache.ambari.logsearch.common.ConfigHelper;
 import org.apache.ambari.logsearch.common.LogSearchContext;
 import org.apache.ambari.logsearch.common.MessageEnums;
-import org.apache.ambari.logsearch.conf.SolrKerberosConfig;
-import org.apache.ambari.logsearch.conf.SolrUserConfig;
 import org.apache.ambari.logsearch.manager.ManagerBase.LogType;
+import org.apache.ambari.logsearch.model.response.BarGraphData;
+import org.apache.ambari.logsearch.model.response.NameValueData;
+import org.apache.ambari.logsearch.util.DateUtil;
 import org.apache.ambari.logsearch.util.RESTErrorUtil;
-import org.apache.commons.lang.StringUtils;
 import org.apache.log4j.Logger;
-import org.apache.solr.client.solrj.SolrClient;
 import org.apache.solr.client.solrj.SolrQuery;
-import org.apache.solr.client.solrj.SolrRequest;
 import org.apache.solr.client.solrj.SolrRequest.METHOD;
 import org.apache.solr.client.solrj.SolrServerException;
 import org.apache.solr.client.solrj.impl.CloudSolrClient;
-import org.apache.solr.client.solrj.impl.HttpClientUtil;
-import org.apache.solr.client.solrj.impl.HttpSolrClient;
-import org.apache.solr.client.solrj.impl.Krb5HttpClientConfigurer;
-import org.apache.solr.client.solrj.request.CollectionAdminRequest;
-import org.apache.solr.client.solrj.request.schema.SchemaRequest;
-import org.apache.solr.client.solrj.response.CollectionAdminResponse;
 import org.apache.solr.client.solrj.response.QueryResponse;
-import org.apache.solr.client.solrj.response.UpdateResponse;
-import org.apache.solr.client.solrj.response.schema.SchemaResponse;
-import org.apache.solr.common.SolrException;
-import org.apache.solr.common.SolrInputDocument;
-import org.apache.solr.common.cloud.Replica;
-import org.apache.solr.common.cloud.Slice;
-import org.apache.solr.common.cloud.ZkStateReader;
 import org.apache.solr.common.util.NamedList;
-
-import com.google.common.annotations.VisibleForTesting;
-
-import javax.inject.Inject;
+import org.apache.solr.common.util.SimpleOrderedMap;
 
 public abstract class SolrDaoBase {
-  private static final Logger logger = Logger.getLogger(SolrDaoBase.class);
-  private static final Logger logPerformance = Logger.getLogger("org.apache.ambari.logsearch.performance");
-  
-  public HashMap<String, String> schemaFieldsNameMap = new HashMap<String, String>();
-  public HashMap<String, String> schemaFieldTypeMap = new HashMap<String, String>();
-
-  private static final String ROUTER_FIELD = "_router_field_";
-  
-  private static final int SETUP_RETRY_SECOND = 30;
-  private static final int SETUP_UPDATE_SECOND = 10*60; //10 min
-  private static final int ALIAS_SETUP_RETRY_SECOND = 30*60;
 
-  private LogType logType;
-
-  @VisibleForTesting
-  protected String collectionName = null;
-  @VisibleForTesting
-  protected SolrClient solrClient = null;
-  @VisibleForTesting
-  protected CloudSolrClient solrClouldClient = null;
-  @VisibleForTesting
-  protected boolean isZkConnectString = false;
-  
-  private String solrDetail = "";
+  private static final Logger LOG_PERFORMANCE = Logger.getLogger("org.apache.ambari.logsearch.performance");
 
-  private boolean populateFieldsThreadActive = false;
+  public Map<String, String> schemaFieldNameMap = new HashMap<>();
+  public Map<String, String> schemaFieldTypeMap = new HashMap<>();
 
-  @Inject
-  private SolrKerberosConfig solrKerberosConfig;
-  @Inject
-  private SolrUserConfig solrUserConfig;
+  private LogType logType;
   
   protected SolrDaoBase(LogType logType) {
     this.logType = logType;
   }
 
-  protected SolrClient connectToSolr(String url, String zkConnectString, String collection) throws Exception {
-    this.collectionName = collection;
-    solrDetail = "zkConnectString=" + zkConnectString + ", collection=" + collection + ", url=" + url;
-
-    logger.info("connectToSolr() " + solrDetail);
-    if (StringUtils.isBlank(collection)) {
-      throw new Exception("For solr, collection name is mandatory. " + solrDetail);
-    }
-    
-    setupSecurity();
-    
-    if (solrClient != null) {
-      return solrClient;
-    }
-      
-    if (!StringUtils.isBlank(zkConnectString)) {
-      isZkConnectString = true;
-      solrDetail = "zkConnectString=" + zkConnectString + ", collection=" + collection;
-      logger.info("Using zookeeper. " + solrDetail);
-      solrClouldClient = new CloudSolrClient(zkConnectString);
-      solrClouldClient.setDefaultCollection(collection);
-      solrClient = solrClouldClient;
-      int waitDurationMS = 3 * 60 * 1000;
-      checkSolrStatus(waitDurationMS);
-    } else {
-      if (StringUtils.isBlank(url)) {
-        throw new Exception("Both zkConnectString and URL are empty. zkConnectString=" + zkConnectString + ", " +
-            "collection=" + collection + ", url=" + url);
-      }
-      solrDetail = "collection=" + collection + ", url=" + url;
-      String collectionURL = url + "/" + collection;
-      logger.info("Connecting to  solr : " + collectionURL);
-      solrClient = new HttpSolrClient(collectionURL);
-    }
-    return solrClient;
-  }
-  
-  /**
-   * This will try to get the collections from the Solr. Ping doesn't work if
-   * collection is not given
-   */
-  protected boolean checkSolrStatus(int waitDurationMS) {
-    boolean status = false;
-    try {
-      long beginTimeMS = System.currentTimeMillis();
-      long waitIntervalMS = 2000;
-      int pingCount = 0;
-      while (true) {
-        pingCount++;
-        try {
-          List<String> collectionList = getCollections();
-          if (collectionList != null) {
-            logger.info("checkSolrStatus(): Solr getCollections() is success. solr=" + solrDetail + ", collectionList=" + collectionList);
-            status = true;
-            break;
-          }
-        } catch (Exception ex) {
-          logger.error("Error while doing Solr check", ex);
-        }
-        if (System.currentTimeMillis() - beginTimeMS > waitDurationMS) {
-          logger.error("Solr is not reachable even after " + (System.currentTimeMillis() - beginTimeMS) + " ms. " +
-              "If you are using alias, then you might have to restart LogSearch after Solr is up and running. solr=" + solrDetail);
-          break;
-        } else {
-          logger.warn("Solr is not not reachable yet. getCollections() attempt count=" + pingCount + ". " +
-              "Will sleep for " + waitIntervalMS + " ms and try again." + " solr=" + solrDetail);
-        }
-        Thread.sleep(waitIntervalMS);
-
-      }
-    } catch (Throwable t) {
-      logger.error("Seems Solr is not up. solrDetail=" + solrDetail);
-    }
-    return status;
-  }
-
-  protected void setupAlias(final String aliasNameIn, final Collection<String> collectionListIn ) throws Exception {
-    if (aliasNameIn == null || collectionListIn == null || collectionListIn.size() == 0 || solrClouldClient == null) {
-      logger.info("Will not create alias " + aliasNameIn + " for " +
-          (collectionListIn == null ? null: collectionListIn.toString()) + ", solrCloudClient=" + solrClouldClient);
-      return;
-    }
-    
-    logger.info("setupAlias " + aliasNameIn + " for " + (collectionListIn == null ? null: collectionListIn.toString()));
-    // Start a background thread to do setup
-    Thread setupThread = new Thread("setup_alias_" + aliasNameIn) {
-      @Override
-      public void run() {
-        logger.info("Started monitoring thread to check availability of Solr server. alias=" + aliasNameIn +
-            ", collections=" + collectionListIn.toString());
-        int retryCount = 0;
-        while (true) {
-          try {
-            int count = createAlias(aliasNameIn, collectionListIn);
-            if (count > 0) {
-              solrClouldClient.setDefaultCollection(aliasNameIn);
-              if (count == collectionListIn.size()) {
-                logger.info("Setup for alias " + aliasNameIn + " is successful. Exiting setup retry thread. " +
-                    "Collections=" + collectionListIn);
-                populateSchemaFields();
-                break;
-              }
-            } else {
-              logger.warn("Not able to create alias=" + aliasNameIn + ", retryCount=" + retryCount);
-            }
-          } catch (Exception e) {
-            logger.error("Error setting up alias=" + aliasNameIn, e);
-          }
-          try {
-            Thread.sleep(ALIAS_SETUP_RETRY_SECOND * 1000);
-          } catch (InterruptedException sleepInterrupted) {
-            logger.info("Sleep interrupted while setting up alias " + aliasNameIn);
-            break;
-          }
-          retryCount++;
-        }
-      }
-    };
-    setupThread.setDaemon(true);
-    setupThread.start();
-  }
-  
-  private int createAlias(String aliasNameIn, Collection<String> collectionListIn) throws SolrServerException, IOException {
-    List<String> collectionToAdd = getCollections();
-    collectionToAdd.retainAll(collectionListIn);
-    
-    String collectionsCSV = null;
-    if (!collectionToAdd.isEmpty()) {
-      collectionsCSV = StringUtils.join(collectionToAdd, ',');
-      CollectionAdminRequest.CreateAlias aliasCreateRequest = new CollectionAdminRequest.CreateAlias(); 
-      aliasCreateRequest.setAliasName(aliasNameIn);
-      aliasCreateRequest.setAliasedCollections(collectionsCSV);
-      CollectionAdminResponse createResponse = aliasCreateRequest.process(solrClouldClient);
-      if (createResponse.getStatus() != 0) {
-        logger.error("Error creating alias. alias=" + aliasNameIn + ", collectionList=" + collectionsCSV +
-            ", solrDetail=" + solrDetail + ", response=" + createResponse);
-        return 0;
-      }
-    } 
-    if ( collectionToAdd.size() == collectionListIn.size()) {
-      logger.info("Created alias for all collections. alias=" + aliasNameIn + ", collectionsCSV=" + collectionsCSV +
-          ", solrDetail=" + solrDetail);
-    } else {
-      logger.info("Created alias for " + collectionToAdd.size() + " out of " + collectionListIn.size() + " collections. " +
-          "alias=" + aliasNameIn + ", collectionsCSV=" + collectionsCSV + ", solrDetail=" + solrDetail);
-    }
-    return collectionToAdd.size();
-  }
-
-  protected void setupCollections(final String splitInterval, final String configName, final int numberOfShards,
-      final int replicationFactor, boolean needToPopulateSchemaField) throws Exception {
-    if (isZkConnectString) {
-      boolean setupStatus = createCollectionsIfNeeded(splitInterval, configName, numberOfShards, replicationFactor);
-      logger.info("Setup status for " + collectionName + " is " + setupStatus);
-      if (!setupStatus) {
-        // Start a background thread to do setup
-        Thread setupThread = new Thread("setup_collection_" + collectionName) {
-          @Override
-          public void run() {
-            logger.info("Started monitoring thread to check availability of Solr server. collection=" + collectionName);
-            int retryCount = 0;
-            while (true) {
-              try {
-                Thread.sleep(SETUP_RETRY_SECOND * 1000);
-                retryCount++;
-                boolean setupStatus = createCollectionsIfNeeded(splitInterval, configName, numberOfShards, replicationFactor);
-                if (setupStatus) {
-                  logger.info("Setup for collection " + collectionName + " is successful. Exiting setup retry thread");
-                  break;
-                }
-              } catch (InterruptedException sleepInterrupted) {
-                logger.info("Sleep interrupted while setting up collection " + collectionName);
-                break;
-              } catch (Exception e) {
-                logger.error("Error setting up collection=" + collectionName, e);
-              }
-              logger.error("Error setting collection. collection=" + collectionName + ", retryCount=" + retryCount);
-            }
-          }
-        };
-        setupThread.setDaemon(true);
-        setupThread.start();
-      }
-    }
-    
-    if (needToPopulateSchemaField){
-      populateSchemaFields();
-    }
-  }
-
-  private boolean createCollectionsIfNeeded(String splitInterval, String configName, int numberOfShards, int replicationFactor) {
-    boolean result = false;
-    try {
-      List<String> allCollectionList = getCollections();
-      if (splitInterval.equalsIgnoreCase("none")) {
-        result = createCollection(configName, numberOfShards, replicationFactor, allCollectionList);
-      } else {
-        result = setupCollectionsWithImplicitRouting(configName, numberOfShards, replicationFactor, allCollectionList);
-      }
-    } catch (Exception ex) {
-      logger.error("Error creating collection. collectionName=" + collectionName, ex);
-    }
-    return result;
-  }
-
-  private List<String> getCollections() throws SolrServerException,
-    IOException {
-    try {
-      CollectionAdminRequest.List colListReq = new CollectionAdminRequest.List();
-      CollectionAdminResponse response = colListReq.process(solrClient);
-      if (response.getStatus() != 0) {
-        logger.error("Error getting collection list from solr.  response=" + response);
-        return null;
-      }
-
-      @SuppressWarnings("unchecked")
-      List<String> allCollectionList = (List<String>) response.getResponse().get("collections");
-      return allCollectionList;
-    } catch (SolrException e) {
-      logger.error(e);
-      return new ArrayList<String>();
-    }
-  }
-
-  private boolean setupCollectionsWithImplicitRouting(String configName, int numberOfShards, int replicationFactor,
-                                                     List<String> allCollectionList) throws Exception {
-    logger.info("setupCollectionsWithImplicitRouting(). collectionName=" + collectionName + ", numberOfShards=" + numberOfShards);
-
-    // Default is true, because if the collection and shard is already there, then it will return true
-    boolean returnValue = true;
-    
-    List<String> shardsList = new ArrayList<String>();
-    for (int i = 0; i < numberOfShards; i++) {
-      shardsList.add("shard" + i);
-    }
-    String shardsListStr = StringUtils.join(shardsList, ',');
-
-    // Check if collection is already in zookeeper
-    if (!allCollectionList.contains(collectionName)) {
-      logger.info("Creating collection " + collectionName + ", shardsList=" + shardsList + ", solrDetail=" + solrDetail);
-      CollectionAdminRequest.Create collectionCreateRequest = new CollectionAdminRequest.Create();
-      collectionCreateRequest.setCollectionName(collectionName);
-      collectionCreateRequest.setRouterName("implicit");
-      collectionCreateRequest.setShards(shardsListStr);
-      collectionCreateRequest.setNumShards(numberOfShards);
-      collectionCreateRequest.setReplicationFactor(replicationFactor);
-      collectionCreateRequest.setConfigName(configName);
-      collectionCreateRequest.setRouterField(ROUTER_FIELD);
-      collectionCreateRequest.setMaxShardsPerNode(replicationFactor * numberOfShards);
-
-      CollectionAdminResponse createResponse = collectionCreateRequest.process(solrClient);
-      if (createResponse.getStatus() != 0) {
-        returnValue = false;
-        logger.error("Error creating collection. collectionName=" + collectionName + ", shardsList=" + shardsList +
-            ", solrDetail=" + solrDetail + ", response=" + createResponse);
-      } else {
-        logger.info("Created collection " + collectionName + ", shardsList=" + shardsList + ", solrDetail=" + solrDetail);
-      }
-    } else {
-      logger.info("Collection " + collectionName + " is already there. Will check whether it has the required shards");
-      Collection<String> existingShards = getShards();
-      for (String shard : shardsList) {
-        if (!existingShards.contains(shard)) {
-          try {
-            logger.info("Going to add Shard " + shard + " to collection " + collectionName);
-            CollectionAdminRequest.CreateShard createShardRequest = new CollectionAdminRequest.CreateShard();
-            createShardRequest.setCollectionName(collectionName);
-            createShardRequest.setShardName(shard);
-            CollectionAdminResponse response = createShardRequest.process(solrClient);
-            if (response.getStatus() != 0) {
-              logger.error("Error creating shard " + shard + " in collection " + collectionName + ", response=" + response +
-                  ", solrDetail=" + solrDetail);
-              returnValue = false;
-              break;
-            } else {
-              logger.info("Successfully created shard " + shard + " in collection " + collectionName);
-            }
-          } catch (Throwable t) {
-            logger.error("Error creating shard " + shard + " in collection " + collectionName + ", solrDetail=" + solrDetail, t);
-            returnValue = false;
-            break;
-          }
-        }
-      }
-    }
-    return returnValue;
-  }
-
-  private Collection<String> getShards() {
-    Collection<String> list = new HashSet<String>();
-
-    if (solrClouldClient == null) {
-      logger.error("getShards(). Only supporting in SolrCloud mode");
-      return list;
-    }
-
-    ZkStateReader reader = solrClouldClient.getZkStateReader();
-    Collection<Slice> slices = reader.getClusterState().getSlices(collectionName);
-    for (Slice slice : slices) {
-      for (Replica replica : slice.getReplicas()) {
-        logger.info("colName=" + collectionName + ", slice.name=" + slice.getName() + ", slice.state=" + slice.getState() +
-            ", replica.core=" + replica.getStr("core") + ", replica.state=" + replica.getStr("state"));
-        list.add(slice.getName());
-      }
-    }
-    return list;
-  }
-
-  private boolean createCollection(String configName, int numberOfShards, int replicationFactor,
-                                  List<String> allCollectionList) throws SolrServerException, IOException {
-    if (allCollectionList.contains(collectionName)) {
-      logger.info("Collection " + collectionName + " is already there. Won't create it");
-      return true;
-    }
-
-    logger.info("Creating collection " + collectionName + ", numberOfShards=" + numberOfShards +
-        ", replicationFactor=" + replicationFactor + ", solrDetail=" + solrDetail);
-
-    CollectionAdminRequest.Create collectionCreateRequest = new CollectionAdminRequest.Create();
-    collectionCreateRequest.setCollectionName(collectionName);
-    collectionCreateRequest.setNumShards(numberOfShards);
-    collectionCreateRequest.setReplicationFactor(replicationFactor);
-    collectionCreateRequest.setConfigName(configName);
-    collectionCreateRequest.setMaxShardsPerNode(replicationFactor * numberOfShards);
-    CollectionAdminResponse createResponse = collectionCreateRequest.process(solrClient);
-    if (createResponse.getStatus() != 0) {
-      logger.error("Error creating collection. collectionName=" + collectionName + ", solrDetail=" + solrDetail + ", response=" +
-    createResponse);
-      return false;
-    } else {
-      logger.info("Created collection " + collectionName + ", numberOfShards=" + numberOfShards +
-          ", replicationFactor=" + replicationFactor + ", solrDetail=" + solrDetail);
-      return true;
-    }
-  }
-
   public QueryResponse process(SolrQuery solrQuery) throws SolrServerException, IOException {
-    if (solrClient != null) {
+    if (getSolrClient() != null) {
       String event = solrQuery.get("event");
       solrQuery.remove("event");
-      QueryResponse queryResponse = solrClient.query(solrQuery, METHOD.POST);
-
+      QueryResponse queryResponse = getSolrClient().query(solrQuery, METHOD.POST);
       if (event != null && !"/audit/logs/live/count".equalsIgnoreCase(event)) {
-        logPerformance.info("\n Username :- " + LogSearchContext.getCurrentUsername() + " Event :- " + event + " SolrQuery :- " +
+        LOG_PERFORMANCE.info("\n Username :- " + LogSearchContext.getCurrentUsername() + " Event :- " + event + " SolrQuery :- " +
             solrQuery + "\nQuery Time Execution :- " + queryResponse.getQTime() + " Total Time Elapsed is :- " +
             queryResponse.getElapsedTime());
       }
@@ -452,89 +73,34 @@ public abstract class SolrDaoBase {
     }
   }
 
-  public UpdateResponse addDocs(SolrInputDocument doc) throws SolrServerException, IOException, SolrException {
-    UpdateResponse updateResoponse = solrClient.add(doc);
-    logPerformance.info("\n Username :- " + LogSearchContext.getCurrentUsername() +
-        " Update Time Execution :- " + updateResoponse.getQTime() + " Total Time Elapsed is :- " + updateResoponse.getElapsedTime());
-    solrClient.commit();
-    return updateResoponse;
-  }
+  @SuppressWarnings("unchecked")
+  public void extractValuesFromBuckets(SimpleOrderedMap<Object> jsonFacetResponse, String outerField, String innerField,
+                                        List<BarGraphData> histogramData) {
+    NamedList<Object> stack = (NamedList<Object>) jsonFacetResponse.get(outerField);
+    ArrayList<Object> stackBuckets = (ArrayList<Object>) stack.get("buckets");
+    for (Object temp : stackBuckets) {
+      BarGraphData vBarGraphData = new BarGraphData();
 
-  public UpdateResponse removeDoc(String query) throws SolrServerException, IOException, SolrException {
-    UpdateResponse updateResoponse = solrClient.deleteByQuery(query);
-    solrClient.commit();
-    logPerformance.info("\n Username :- " + LogSearchContext.getCurrentUsername() +
-        " Remove Time Execution :- " + updateResoponse.getQTime() + " Total Time Elapsed is :- " + updateResoponse.getElapsedTime());
-    return updateResoponse;
-  }
+      SimpleOrderedMap<Object> level = (SimpleOrderedMap<Object>) temp;
+      String name = ((String) level.getVal(0)).toUpperCase();
+      vBarGraphData.setName(name);
 
-  private void setupSecurity() {
-    String jaasFile = solrKerberosConfig.getJaasFile();
-    boolean securityEnabled = solrKerberosConfig.isEnabled();
-    if (securityEnabled) {
-      System.setProperty("java.security.auth.login.config", jaasFile);
-      HttpClientUtil.setConfigurer(new Krb5HttpClientConfigurer());
-      logger.info("setupSecurity() called for kerberos configuration, jaas file: " + jaasFile);
-    }
-  }
+      Collection<NameValueData> vNameValues = new ArrayList<>();
+      vBarGraphData.setDataCount(vNameValues);
+      ArrayList<Object> levelBuckets = (ArrayList<Object>) ((NamedList<Object>) level.get(innerField)).get("buckets");
+      for (Object temp1 : levelBuckets) {
+        SimpleOrderedMap<Object> countValue = (SimpleOrderedMap<Object>) temp1;
+        String value = DateUtil.convertDateWithMillisecondsToSolrDate((Date) countValue.getVal(0));
 
-  private void populateSchemaFields() {
-    if (!populateFieldsThreadActive) {
-      populateFieldsThreadActive = true;
-      logger.info("Creating thread to populated fields for collection=" + collectionName);
-      Thread fieldPopulationThread = new Thread("populated_fields_" + collectionName) {
-        @Override
-        public void run() {
-          logger.info("Started thread to get fields for collection=" + collectionName);
-          int retryCount = 0;
-          while (true) {
-            try {
-              Thread.sleep(SETUP_RETRY_SECOND * 1000);
-              retryCount++;
-              boolean _result = _populateSchemaFields();
-              if (_result) {
-                logger.info("Populate fields for collection " + collectionName + " is success, Update it after " +
-                    SETUP_UPDATE_SECOND + " sec");
-                Thread.sleep(SETUP_UPDATE_SECOND * 1000);
-              }
-            } catch (InterruptedException sleepInterrupted) {
-              logger.info("Sleep interrupted while populating fields for collection " + collectionName);
-              break;
-            } catch (Exception ex) {
-              logger.error("Error while populating fields for collection " + collectionName + ", retryCount=" + retryCount);
-            }
-          }
-          populateFieldsThreadActive = false;
-          logger.info("Exiting thread for populating fields. collection=" + collectionName);
-        }
-      };
-      fieldPopulationThread.setDaemon(true);
-      fieldPopulationThread.start();
-    }
-  }
-
-  /**
-   * Called from the thread. Don't call this directly
-   */
-  private boolean _populateSchemaFields() {
-    SolrRequest<SchemaResponse> request = new SchemaRequest();
-    request.setMethod(METHOD.GET);
-    request.setPath("/schema");
-    String historyCollection = solrUserConfig.getCollection();
-    if (solrClient != null && !collectionName.equals(historyCollection)) {
-      NamedList<Object> namedList = null;
-      try {
-        namedList = solrClient.request(request);
-        logger.debug("populateSchemaFields() collection=" + collectionName + ", fields=" + namedList);
-      } catch (SolrException | SolrServerException | IOException e) {
-        logger.error("Error occured while popuplating field. collection=" + collectionName, e);
-      }
-      
-      if (namedList != null) {
-        ConfigHelper.extractSchemaFieldsName(namedList.toString(), schemaFieldsNameMap,schemaFieldTypeMap);
-        return true;
+        String count = "" + countValue.getVal(1);
+        NameValueData vNameValue = new NameValueData();
+        vNameValue.setName(value);
+        vNameValue.setValue(count);
+        vNameValues.add(vNameValue);
       }
+      histogramData.add(vBarGraphData);
     }
-    return false;
   }
+
+  public abstract CloudSolrClient getSolrClient();
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/6fa4abfe/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/SolrSchemaFieldDao.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/SolrSchemaFieldDao.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/SolrSchemaFieldDao.java
new file mode 100644
index 0000000..b6764d0
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/SolrSchemaFieldDao.java
@@ -0,0 +1,159 @@
+/*
+ * 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.dao;
+
+import org.apache.ambari.logsearch.common.LogSearchConstants;
+import org.apache.ambari.logsearch.common.MessageEnums;
+import org.apache.ambari.logsearch.conf.SolrPropsConfig;
+import org.apache.ambari.logsearch.conf.SolrUserPropsConfig;
+import org.apache.solr.client.solrj.SolrRequest;
+import org.apache.solr.client.solrj.SolrServerException;
+import org.apache.solr.client.solrj.impl.CloudSolrClient;
+import org.apache.solr.client.solrj.request.schema.SchemaRequest;
+import org.apache.solr.client.solrj.response.schema.SchemaResponse;
+import org.apache.solr.common.SolrException;
+import org.apache.solr.common.util.NamedList;
+import org.codehaus.jettison.json.JSONArray;
+import org.codehaus.jettison.json.JSONObject;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.context.annotation.Scope;
+import org.springframework.stereotype.Component;
+
+import javax.inject.Inject;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+
+@Component
+@Scope(value = "prototype")
+public class SolrSchemaFieldDao {
+
+  private static final Logger LOG = LoggerFactory.getLogger(SolrSchemaFieldDao.class);
+
+  private static final int SETUP_RETRY_SECOND = 30;
+  private static final int SETUP_UPDATE_SECOND = 10 * 60; // 10 min
+
+  private boolean populateFieldsThreadActive = false;
+
+  @Inject
+  private SolrUserPropsConfig solrUserPropsConfig;
+
+  public void populateSchemaFields(final CloudSolrClient solrClient, final SolrPropsConfig solrPropsConfig,
+                                   final SolrDaoBase solrDao) {
+    if (!populateFieldsThreadActive) {
+      populateFieldsThreadActive = true;
+      LOG.info("Creating thread to populated fields for collection=" + solrPropsConfig.getCollection());
+      Thread fieldPopulationThread = new Thread("populated_fields_" + solrPropsConfig.getCollection()) {
+        @Override
+        public void run() {
+          LOG.info("Started thread to get fields for collection=" + solrPropsConfig.getCollection());
+          int retryCount = 0;
+          while (true) {
+            try {
+              Thread.sleep(SETUP_RETRY_SECOND * 1000);
+              retryCount++;
+              boolean _result = _populateSchemaFields(solrClient, solrPropsConfig, solrDao);
+              if (_result) {
+                LOG.info("Populate fields for collection " + solrPropsConfig.getCollection() + " is success, Update it after " +
+                  SETUP_UPDATE_SECOND + " sec");
+                Thread.sleep(SETUP_UPDATE_SECOND * 1000);
+              }
+            } catch (InterruptedException sleepInterrupted) {
+              LOG.info("Sleep interrupted while populating fields for collection " + solrPropsConfig.getCollection());
+              break;
+            } catch (Exception ex) {
+              LOG.error("Error while populating fields for collection " + solrPropsConfig.getCollection() + ", retryCount=" + retryCount);
+            }
+          }
+          populateFieldsThreadActive = false;
+          LOG.info("Exiting thread for populating fields. collection=" + solrPropsConfig.getCollection());
+        }
+      };
+      fieldPopulationThread.setDaemon(true);
+      fieldPopulationThread.start();
+    }
+  }
+
+  /**
+   * Called from the thread. Don't call this directly
+   */
+  private boolean _populateSchemaFields(CloudSolrClient solrClient, SolrPropsConfig solrPropsConfig, SolrDaoBase solrDao) {
+    SolrRequest<SchemaResponse> request = new SchemaRequest();
+    request.setMethod(SolrRequest.METHOD.GET);
+    request.setPath("/schema");
+    String historyCollection = solrUserPropsConfig.getCollection();
+    if (solrClient != null && !solrPropsConfig.getCollection().equals(historyCollection)) {
+      NamedList<Object> namedList = null;
+      try {
+        namedList = solrClient.request(request);
+        LOG.debug("populateSchemaFields() collection=" + solrPropsConfig.getCollection() + ", fields=" + namedList);
+      } catch (SolrException | SolrServerException | IOException e) {
+        LOG.error("Error occured while popuplating field. collection=" + solrPropsConfig.getCollection(), e);
+      }
+
+      if (namedList != null) {
+        extractSchemaFieldsName(namedList.toString(), solrDao.schemaFieldNameMap, solrDao.schemaFieldTypeMap);
+        return true;
+      }
+    }
+    return false;
+  }
+
+  public void extractSchemaFieldsName(String responseString,
+                                      final Map<String, String> schemaFieldsNameMap,
+                                      final Map<String, String> schemaFieldTypeMap) {
+    try {
+      JSONObject jsonObject = new JSONObject(responseString);
+      JSONObject schemajsonObject = jsonObject.getJSONObject("schema");
+      JSONArray jsonArrayList = schemajsonObject.getJSONArray("fields");
+      JSONArray fieldTypeJsonArray = schemajsonObject
+        .getJSONArray("fieldTypes");
+      if (jsonArrayList == null) {
+        return;
+      }
+      if (fieldTypeJsonArray == null) {
+        return;
+      }
+      HashMap<String, String> _schemaFieldTypeMap = new HashMap<>();
+      HashMap<String, String> _schemaFieldsNameMap = new HashMap<String, String>();
+      for (int i = 0; i < fieldTypeJsonArray.length(); i++) {
+        JSONObject typeObject = fieldTypeJsonArray.getJSONObject(i);
+        String name = typeObject.getString("name");
+        String fieldTypeJson = typeObject.toString();
+        _schemaFieldTypeMap.put(name, fieldTypeJson);
+      }
+      for (int i = 0; i < jsonArrayList.length(); i++) {
+        JSONObject explrObject = jsonArrayList.getJSONObject(i);
+        String name = explrObject.getString("name");
+        String type = explrObject.getString("type");
+        if (!name.contains("@") && !name.startsWith("_") && !name.contains("_md5") && !name.contains("_ms") &&
+          !name.contains(LogSearchConstants.NGRAM_SUFFIX) && !name.contains("tags") && !name.contains("_str")) {
+          _schemaFieldsNameMap.put(name, type);
+        }
+      }
+      schemaFieldsNameMap.clear();
+      schemaFieldTypeMap.clear();
+      schemaFieldsNameMap.putAll(_schemaFieldsNameMap);
+      schemaFieldTypeMap.putAll(_schemaFieldTypeMap);
+    } catch (Exception e) {
+      LOG.error(e + "Credentials not specified in logsearch.properties " + MessageEnums.ERROR_SYSTEM);
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/6fa4abfe/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/UserConfigSolrDao.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/UserConfigSolrDao.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/UserConfigSolrDao.java
index a9fb8d2..88c4577 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/UserConfigSolrDao.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/UserConfigSolrDao.java
@@ -29,12 +29,15 @@ import java.util.Scanner;
 import javax.annotation.PostConstruct;
 import javax.inject.Inject;
 
-import org.apache.ambari.logsearch.conf.SolrUserConfig;
+import org.apache.ambari.logsearch.common.LogSearchContext;
+import org.apache.ambari.logsearch.conf.SolrUserPropsConfig;
 import org.apache.ambari.logsearch.view.VLogfeederFilterWrapper;
 import org.apache.ambari.logsearch.common.LogSearchConstants;
 import org.apache.solr.client.solrj.SolrQuery;
 import org.apache.solr.client.solrj.SolrServerException;
+import org.apache.solr.client.solrj.impl.CloudSolrClient;
 import org.apache.solr.client.solrj.response.QueryResponse;
+import org.apache.solr.client.solrj.response.UpdateResponse;
 import org.apache.solr.common.SolrDocument;
 import org.apache.solr.common.SolrDocumentList;
 import org.apache.solr.common.SolrException;
@@ -47,38 +50,55 @@ import com.google.gson.JsonParseException;
 import org.apache.ambari.logsearch.manager.ManagerBase.LogType;
 import org.apache.ambari.logsearch.util.JSONUtil;
 import org.apache.log4j.Logger;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.data.solr.core.SolrTemplate;
 import org.springframework.stereotype.Component;
 import org.springframework.util.CollectionUtils;
 
 @Component
 public class UserConfigSolrDao extends SolrDaoBase {
 
-  private static final Logger logger = Logger.getLogger(UserConfigSolrDao.class);
+  private static final Logger LOG = Logger.getLogger(UserConfigSolrDao.class);
+
+  private static final Logger LOG_PERFORMANCE = Logger.getLogger("org.apache.ambari.logsearch.performance");
+
+  @Inject
+  private SolrUserPropsConfig solrUserConfig;
+
+  @Inject
+  private SolrCollectionDao solrCollectionDao;
+
+  @Inject
+  private SolrSchemaFieldDao solrSchemaFieldDao;
 
   @Inject
-  private SolrUserConfig solrUserConfig;
+  @Qualifier("userConfigSolrTemplate")
+  private SolrTemplate userConfigSolrTemplate;
 
   public UserConfigSolrDao() {
     super(LogType.SERVICE);
   }
 
+  @Override
+  public CloudSolrClient getSolrClient() {
+    return (CloudSolrClient) userConfigSolrTemplate.getSolrClient();
+  }
+
+
   @PostConstruct
   public void postConstructor() {
     String solrUrl = solrUserConfig.getSolrUrl();
     String zkConnectString = solrUserConfig.getZkConnectString();
     String collection = solrUserConfig.getCollection();
-    String configName = solrUserConfig.getConfigName();
-    int replicationFactor = solrUserConfig.getReplicationFactor();
-    String splitInterval = solrUserConfig.getSplitInterval();
-    int numberOfShards = solrUserConfig.getNumberOfShards();
 
     try {
-      connectToSolr(solrUrl, zkConnectString, collection);
-      setupCollections(splitInterval, configName, numberOfShards, replicationFactor, true);
+      solrCollectionDao.checkSolrStatus(getSolrClient());
+      solrCollectionDao.setupCollections(getSolrClient(), solrUserConfig);
+      solrSchemaFieldDao.populateSchemaFields(getSolrClient(), solrUserConfig, this);
       intializeLogFeederFilter();
 
     } catch (Exception e) {
-      logger.error("error while connecting to Solr for history logs : solrUrl=" + solrUrl + ", zkConnectString=" + zkConnectString +
+      LOG.error("error while connecting to Solr for history logs : solrUrl=" + solrUrl + ", zkConnectString=" + zkConnectString +
           ", collection=" + collection, e);
     }
   }
@@ -87,7 +107,7 @@ public class UserConfigSolrDao extends SolrDaoBase {
     try {
       getUserFilter();
     } catch (SolrServerException | IOException e) {
-      logger.error("not able to save logfeeder filter while initialization", e);
+      LOG.error("not able to save logfeeder filter while initialization", e);
     }
   }
 
@@ -107,6 +127,22 @@ public class UserConfigSolrDao extends SolrDaoBase {
     removeDoc("id:" + id);
   }
 
+  public UpdateResponse addDocs(SolrInputDocument doc) throws SolrServerException, IOException, SolrException {
+    UpdateResponse updateResoponse = getSolrClient().add(doc);
+    LOG_PERFORMANCE.info("\n Username :- " + LogSearchContext.getCurrentUsername() +
+      " Update Time Execution :- " + updateResoponse.getQTime() + " Total Time Elapsed is :- " + updateResoponse.getElapsedTime());
+    getSolrClient().commit();
+    return updateResoponse;
+  }
+
+  public UpdateResponse removeDoc(String query) throws SolrServerException, IOException, SolrException {
+    UpdateResponse updateResoponse = getSolrClient().deleteByQuery(query);
+    getSolrClient().commit();
+    LOG_PERFORMANCE.info("\n Username :- " + LogSearchContext.getCurrentUsername() +
+      " Remove Time Execution :- " + updateResoponse.getQTime() + " Total Time Elapsed is :- " + updateResoponse.getElapsedTime());
+    return updateResoponse;
+  }
+
 	@SuppressWarnings("unchecked")
   public VLogfeederFilterWrapper getUserFilter() throws SolrServerException, IOException {
 
@@ -158,7 +194,7 @@ public class UserConfigSolrDao extends SolrDaoBase {
         saveUserFilter(logfeederFilterWrapper);
 
       } catch (JsonParseException | JSONException je) {
-        logger.error("Error parsing JSON. key=" + key + ", componentArray=" + componentArray, je);
+        LOG.error("Error parsing JSON. key=" + key + ", componentArray=" + componentArray, je);
         logfeederFilterWrapper = new VLogfeederFilterWrapper();
       }
     }
@@ -182,7 +218,7 @@ public class UserConfigSolrDao extends SolrDaoBase {
       scanner.close();
 
     } catch (IOException e) {
-      logger.error("Unable to read HadoopServiceConfig.json", e);
+      LOG.error("Unable to read HadoopServiceConfig.json", e);
     }
 
     String hadoopServiceConfig = result.toString();
@@ -191,5 +227,4 @@ public class UserConfigSolrDao extends SolrDaoBase {
     }
     return null;
   }
-
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/6fa4abfe/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/UserDao.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/UserDao.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/UserDao.java
index 4ca9df6..0810571 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/UserDao.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/UserDao.java
@@ -26,17 +26,15 @@ import java.util.HashMap;
 import javax.annotation.PostConstruct;
 import javax.inject.Inject;
 
-import org.apache.ambari.logsearch.conf.AuthConfig;
+import org.apache.ambari.logsearch.conf.AuthPropsConfig;
 import org.springframework.security.core.GrantedAuthority;
 import org.springframework.stereotype.Repository;
-import org.apache.ambari.logsearch.common.PropertiesHelper;
 import org.apache.ambari.logsearch.util.CommonUtil;
 import org.apache.ambari.logsearch.util.FileUtil;
 import org.apache.ambari.logsearch.util.JSONUtil;
 import org.apache.ambari.logsearch.web.model.Privilege;
 import org.apache.ambari.logsearch.web.model.Role;
 import org.apache.ambari.logsearch.web.model.User;
-import org.apache.ambari.logsearch.web.security.LogsearchFileAuthenticationProvider;
 import org.apache.commons.collections.CollectionUtils;
 import org.apache.commons.collections.Predicate;
 import org.apache.commons.lang.StringUtils;
@@ -52,16 +50,16 @@ public class UserDao {
   private static final String NAME = "name";
 
   @Inject
-  private AuthConfig authConfig;
+  private AuthPropsConfig authPropsConfig;
 
   private ArrayList<HashMap<String, String>> userList = null;
 
   @SuppressWarnings("unchecked")
   @PostConstruct
   public void initialization() {
-    if (authConfig.isAuthFileEnabled()) {
+    if (authPropsConfig.isAuthFileEnabled()) {
       try {
-        String userPassJsonFileName = authConfig.getCredentialsFile();
+        String userPassJsonFileName = authPropsConfig.getCredentialsFile();
         logger.info("USER PASS JSON  file NAME:" + userPassJsonFileName);
         File jsonFile = FileUtil.getFileFromClasspath(userPassJsonFileName);
         if (jsonFile == null || !jsonFile.exists()) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/6fa4abfe/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 8e14452..0df2ca3 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
@@ -39,9 +39,7 @@ public class DocConstants {
     public static final String PAGE_SIZE_D = "Page size of the results";
     public static final String UNIT_D = "Aggregate the data with time gap as unit i.e 1MINUTE";
     public static final String QUERY_D = "not required";
-    public static final String COLUMN_QUERY_D = "not required";
     public static final String I_MESSAGE_D = "Include query which will query against message column";
-    public static final String G_E_MESSAGE_D = "not required";
     public static final String E_MESSAGE_D = "Exclude query which will query against message column";
     public static final String IS_LAST_PAGE_D = "Show last page (true/false)";
     public static final String FIELD_D = "Get values for particular field";
@@ -64,17 +62,13 @@ public class DocConstants {
 
   public class ServiceDescriptions {
     public static final String LEVEL_D = "filter for log level";
-    public static final String ADVANCED_SEARCH_D = "not required";
     public static final String BUNDLE_ID = "filter for host";
-    public static final String TREE_PARAMS_D = "Host hierarchy shown on UI, filtering there is supported by this param";
     public static final String FILE_NAME_D = "File name filter which is supported from browser url";
-    public static final String HOST_NAME_D = "Host name filter which is supported from browser url";
     public static final String DATE_RANGE_LABEL_D = "Date range label (e.g.: Today)";
+    public static final String HOST_NAME_D = "Host name filter which is supported from browser url";
     public static final String COMPONENT_NAME_D = "Component name filter which is supported from browser url";
     public static final String FIND_D = "Finding particular text on subsequent pages in case of table view with pagination";
     public static final String ID_D = "Log id value for traversing to that particular record with that log id";
-    public static final String HOST_D = "filter for host";
-    public static final String COMPONENT_D = "filter for component";
     public static final String KEYWORD_TYPE_D = "Serching the find param value in previous or next in paginated table";
     public static final String TOKEN_D = "unique number used along with FIND_D. The request can be canceled using this token";
     public static final String SOURCE_LOG_ID_D = "fetch the record set having that log Id";
@@ -106,19 +100,6 @@ 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 class LogFileDescriptions {
-    public static final String HOST_D = "not required";
-    public static final String COMPONENT_D = "not required";
-    public static final String LOG_TYPE_D = "not required";
-    public static final String TAIL_SIZE_D = "not required";
-  }
-
-  public class LogFileOperationDescriptions {
-    public static final String SEARCH_LOG_FILES_OD = "not required";
-    public static final String GET_LOG_FILE_TAIL_OD = "not required";
-  }
-
   public class PublicOperationDescriptions {
     public static final String OBTAIN_GENERAL_CONFIG_OD = "Obtain general config";
   }

http://git-wip-us.apache.org/repos/asf/ambari/blob/6fa4abfe/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
index bc377e5..287ff6c 100644
--- 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
@@ -63,7 +63,7 @@ public class GraphDataGenerator extends GraphDataGeneratorBase {
     String from = (String) searchCriteria.getParamValue("from");
     String to = (String) searchCriteria.getParamValue("to");
     String unit = (String) searchCriteria.getParamValue("unit");
-    String typeXAxis = solrDaoBase.schemaFieldsNameMap.get(xAxisField);
+    String typeXAxis = solrDaoBase.schemaFieldNameMap.get(xAxisField);
     typeXAxis = (StringUtils.isBlank(typeXAxis)) ? "string" : typeXAxis;
 
     // Y axis credentials

http://git-wip-us.apache.org/repos/asf/ambari/blob/6fa4abfe/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 c64cf71..52482c2 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
@@ -28,17 +28,14 @@ import java.io.FileOutputStream;
 import java.io.IOException;
 import java.text.ParseException;
 import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.Collection;
 import java.util.Date;
-import java.util.HashMap;
 import java.util.List;
 
-import org.apache.ambari.logsearch.common.ConfigHelper;
 import org.apache.ambari.logsearch.common.LogSearchConstants;
 import org.apache.ambari.logsearch.common.ManageStartEndTime;
 import org.apache.ambari.logsearch.common.MessageEnums;
-import org.apache.ambari.logsearch.conf.SolrAuditLogConfig;
+import org.apache.ambari.logsearch.conf.SolrAuditLogPropsConfig;
 import org.apache.ambari.logsearch.dao.AuditSolrDao;
 import org.apache.ambari.logsearch.graph.GraphDataGenerator;
 import org.apache.ambari.logsearch.model.response.AuditLogResponse;
@@ -63,7 +60,6 @@ import org.apache.ambari.logsearch.util.RESTErrorUtil;
 import org.apache.ambari.logsearch.util.SolrUtil;
 import org.apache.ambari.logsearch.view.VResponse;
 import org.apache.ambari.logsearch.query.model.AuditLogSearchCriteria;
-import org.apache.ambari.logsearch.query.model.SearchCriteria;
 import org.apache.log4j.Logger;
 import org.apache.solr.client.solrj.SolrQuery;
 import org.apache.solr.client.solrj.SolrServerException;
@@ -85,7 +81,7 @@ public class AuditLogsManager extends ManagerBase<SolrAuditLogData, AuditLogResp
   @Inject
   private GraphDataGenerator graphDataGenerator;
   @Inject
-  private SolrAuditLogConfig solrAuditLogConfig;
+  private SolrAuditLogPropsConfig solrAuditLogPropsConfig;
 
   public AuditLogResponse getLogs(AuditLogSearchCriteria searchCriteria) {
     Boolean isLastPage = searchCriteria.isLastPage();
@@ -159,29 +155,7 @@ public class AuditLogsManager extends ManagerBase<SolrAuditLogData, AuditLogResp
     String jsonHistogramQuery = queryGenerator.buildJSONFacetTermTimeRangeQuery(LogSearchConstants.AUDIT_COMPONENT,
       LogSearchConstants.AUDIT_EVTTIME, from, to, unit).replace("\\", "");
 
-    try {
-      SolrUtil.setJSONFacet(solrQuery, jsonHistogramQuery);
-      SolrUtil.setRowCount(solrQuery, 0);
-      QueryResponse response = auditSolrDao.process(solrQuery);
-      if (response == null) {
-        return dataList;
-      }
-      SimpleOrderedMap<Object> jsonFacetResponse = (SimpleOrderedMap<Object>) response.getResponse().get("facets");
-
-      if (jsonFacetResponse == null || jsonFacetResponse.toString().equals("{count=0}")) {
-        return dataList;
-      }
-
-      extractValuesFromBucket(jsonFacetResponse, "x", "y", histogramData);
-
-      dataList.setGraphData(histogramData);
-      return dataList;
-
-    } catch (SolrServerException | SolrException | IOException e) {
-      logger.error(e);
-      throw RESTErrorUtil.createRESTException(MessageEnums.SOLR_ERROR.getMessage().getMessage(), MessageEnums.ERROR_SYSTEM);
-
-    }
+    return getGraphResponse(dataList, solrQuery, histogramData, jsonHistogramQuery);
   }
 
   @SuppressWarnings({"unchecked", "rawtypes"})
@@ -316,49 +290,11 @@ public class AuditLogsManager extends ManagerBase<SolrAuditLogData, AuditLogResp
     String jsonHistogramQuery = queryGenerator.buildJSONFacetTermTimeRangeQuery(LogSearchConstants.AUDIT_REQUEST_USER,
       LogSearchConstants.AUDIT_EVTTIME, from, to, unit).replace("\\", "");
 
-    try {
-      SolrUtil.setJSONFacet(solrQuery, jsonHistogramQuery);
-      SolrUtil.setRowCount(solrQuery, 0);
-      QueryResponse response = auditSolrDao.process(solrQuery);
-      if (response == null) {
-        return dataList;
-      }
-      SimpleOrderedMap<Object> jsonFacetResponse = (SimpleOrderedMap<Object>) response.getResponse().get("facets");
-
-      if (jsonFacetResponse == null || jsonFacetResponse.toString().equals("{count=0}")) {
-        return dataList;
-      }
-      extractValuesFromBucket(jsonFacetResponse, "x", "y", histogramData);
-
-      dataList.setGraphData(histogramData);
-      return dataList;
-
-    } catch (SolrException | IOException | SolrServerException e) {
-      logger.error("Error during solrQuery=" + solrQuery, e);
-      throw RESTErrorUtil.createRESTException(MessageEnums.SOLR_ERROR.getMessage().getMessage(), MessageEnums.ERROR_SYSTEM);
-    }
-
+    return getGraphResponse(dataList, solrQuery, histogramData, jsonHistogramQuery);
   }
 
   public String getAuditLogsSchemaFieldsName() {
-    String excludeArray[] = Arrays.copyOf(solrAuditLogConfig.getExcludeColumnList().toArray(),
-      solrAuditLogConfig.getExcludeColumnList().size(), String[].class);
-    List<String> fieldNames = new ArrayList<String>();
-    HashMap<String, String> uiFieldColumnMapping = new HashMap<String, String>();
-    ConfigHelper.getSchemaFieldsName(excludeArray, fieldNames, auditSolrDao);
-
-    for (String fieldName : fieldNames) {
-      String uiField = solrAuditLogConfig.getSolrAndUiColumns().get(fieldName + LogSearchConstants.SOLR_SUFFIX);
-      if (uiField == null) {
-        uiFieldColumnMapping.put(fieldName, fieldName);
-      } else {
-        uiFieldColumnMapping.put(fieldName, uiField);
-      }
-    }
-
-    uiFieldColumnMapping = BizUtil.sortHashMapByValues(uiFieldColumnMapping);
-    return convertObjToString(uiFieldColumnMapping);
-
+    return convertObjToString(auditSolrDao.schemaFieldNameMap);
   }
 
   public BarGraphDataListResponse getAnyGraphData(AnyGraphSearchCriteria searchCriteria) {
@@ -372,35 +308,6 @@ public class AuditLogsManager extends ManagerBase<SolrAuditLogData, AuditLogResp
 
   }
 
-  @SuppressWarnings("unchecked")
-  private void extractValuesFromBucket(SimpleOrderedMap<Object> jsonFacetResponse, String outerField, String innerField,
-                                       List<BarGraphData> histogramData) {
-    NamedList<Object> stack = (NamedList<Object>) jsonFacetResponse.get(outerField);
-    ArrayList<Object> stackBuckets = (ArrayList<Object>) stack.get("buckets");
-    for (Object temp : stackBuckets) {
-      BarGraphData vBarGraphData = new BarGraphData();
-
-      SimpleOrderedMap<Object> level = (SimpleOrderedMap<Object>) temp;
-      String name = ((String) level.getVal(0)).toUpperCase();
-      vBarGraphData.setName(name);
-
-      Collection<NameValueData> vNameValues = new ArrayList<NameValueData>();
-      vBarGraphData.setDataCount(vNameValues);
-      ArrayList<Object> levelBuckets = (ArrayList<Object>) ((NamedList<Object>) level.get(innerField)).get("buckets");
-      for (Object temp1 : levelBuckets) {
-        SimpleOrderedMap<Object> countValue = (SimpleOrderedMap<Object>) temp1;
-        String value = DateUtil.convertDateWithMillisecondsToSolrDate((Date) countValue.getVal(0));
-
-        String count = "" + countValue.getVal(1);
-        NameValueData vNameValue = new NameValueData();
-        vNameValue.setName(value);
-        vNameValue.setValue(count);
-        vNameValues.add(vNameValue);
-      }
-      histogramData.add(vBarGraphData);
-    }
-  }
-
   @SuppressWarnings({"unchecked"})
   public Response exportUserTableToTextFile(UserExportSearchCriteria searchCriteria) {
     String jsonUserQuery =
@@ -417,6 +324,7 @@ public class AuditLogsManager extends ManagerBase<SolrAuditLogData, AuditLogResp
     SolrUtil.setRowCount(solrQuery, 0);
 
     String dataFormat = searchCriteria.getFormat();
+
     FileOutputStream fis = null;
     try {
       QueryResponse queryResponse = auditSolrDao.process(solrQuery);
@@ -458,15 +366,7 @@ public class AuditLogsManager extends ManagerBase<SolrAuditLogData, AuditLogResp
             data += addBlank(userName);
 
           Collection<NameValueData> vnameValueList = graphData.getDataCount();
-          int count = 0;
-          String blank = "";
-          for (NameValueData vNameValue : vnameValueList) {
-            data += blank + vNameValue.getName() + " " + vNameValue.getValue() + "\n";
-            if (count == 0)
-              blank = addBlank(blank);
-            count++;
-
-          }
+          data = appendNameValueData(data, vnameValueList);
           while (largeUserName.length() > 0) {
             data += largeUserName.substring(0, 45) + "\n";
           }
@@ -490,14 +390,7 @@ public class AuditLogsManager extends ManagerBase<SolrAuditLogData, AuditLogResp
           //resourceName = resourceName.replaceAll("(.{45})", resourceName.substring(0, 45)+"\n");
           data += addBlank(resourceName);
           Collection<NameValueData> vnameValueList = graphData.getDataCount();
-          int count = 0;
-          String blank = "";
-          for (NameValueData vNameValue : vnameValueList) {
-            data += blank + vNameValue.getName() + " " + vNameValue.getValue() + "\n";
-            if (count == 0)
-              blank = addBlank(blank);
-            count++;
-          }
+          data = appendNameValueData(data, vnameValueList);
           String tempLargeResourceName = largeResourceName;
           while (largeResourceName.length() > 45) {
             largeResourceName = tempLargeResourceName.substring(0, 45);
@@ -539,6 +432,45 @@ public class AuditLogsManager extends ManagerBase<SolrAuditLogData, AuditLogResp
     }
   }
 
+  private BarGraphDataListResponse getGraphResponse(BarGraphDataListResponse dataList, SolrQuery solrQuery,
+                                                    List<BarGraphData> histogramData, String jsonHistogramQuery) {
+    try {
+      SolrUtil.setJSONFacet(solrQuery, jsonHistogramQuery);
+      SolrUtil.setRowCount(solrQuery, 0);
+      QueryResponse response = auditSolrDao.process(solrQuery);
+      if (response == null) {
+        return dataList;
+      }
+      SimpleOrderedMap<Object> jsonFacetResponse = (SimpleOrderedMap<Object>) response.getResponse().get("facets");
+
+      if (jsonFacetResponse == null || jsonFacetResponse.toString().equals("{count=0}")) {
+        return dataList;
+      }
+
+      auditSolrDao.extractValuesFromBuckets(jsonFacetResponse, "x", "y", histogramData);
+
+      dataList.setGraphData(histogramData);
+      return dataList;
+
+    } catch (SolrServerException | SolrException | IOException e) {
+      logger.error(e);
+      throw RESTErrorUtil.createRESTException(MessageEnums.SOLR_ERROR.getMessage().getMessage(), MessageEnums.ERROR_SYSTEM);
+
+    }
+  }
+
+  private String appendNameValueData(String data, Collection<NameValueData> vnameValueList) {
+    int count = 0;
+    String blank = "";
+    for (NameValueData vNameValue : vnameValueList) {
+      data += blank + vNameValue.getName() + " " + vNameValue.getValue() + "\n";
+      if (count == 0)
+        blank = addBlank(blank);
+      count++;
+    }
+    return data;
+  }
+
   private String addBlank(String field) {
     int blanks = 50;
     int strSize = field.length();

http://git-wip-us.apache.org/repos/asf/ambari/blob/6fa4abfe/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/manager/LogFileManager.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/manager/LogFileManager.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/manager/LogFileManager.java
deleted file mode 100644
index 405eaef..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/manager/LogFileManager.java
+++ /dev/null
@@ -1,155 +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.manager;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.ambari.logsearch.common.LogSearchConstants;
-import org.apache.ambari.logsearch.common.MessageEnums;
-import org.apache.ambari.logsearch.model.response.LogFileData;
-import org.apache.ambari.logsearch.model.response.LogFileDataListResponse;
-import org.apache.ambari.logsearch.model.response.LogListResponse;
-import org.apache.ambari.logsearch.model.response.ServiceLogData;
-import org.apache.ambari.logsearch.model.response.ServiceLogResponse;
-import org.apache.ambari.logsearch.query.model.SearchCriteria;
-import org.apache.ambari.logsearch.dao.AuditSolrDao;
-import org.apache.ambari.logsearch.dao.ServiceLogsSolrDao;
-import org.apache.ambari.logsearch.dao.SolrDaoBase;
-import org.apache.ambari.logsearch.util.RESTErrorUtil;
-import org.apache.ambari.logsearch.util.SolrUtil;
-import org.apache.commons.io.FilenameUtils;
-import org.apache.commons.lang.StringUtils;
-import org.apache.log4j.Logger;
-import org.apache.solr.client.solrj.SolrQuery;
-import org.apache.solr.client.solrj.SolrServerException;
-import org.apache.solr.client.solrj.response.FacetField;
-import org.apache.solr.client.solrj.response.FacetField.Count;
-import org.apache.solr.client.solrj.response.QueryResponse;
-import org.apache.solr.common.SolrException;
-import org.springframework.stereotype.Component;
-
-import javax.inject.Inject;
-
-
-@Component
-public class LogFileManager extends ManagerBase<ServiceLogData, ServiceLogResponse> {
-
-  private static final Logger logger = Logger.getLogger(LogFileManager.class);
-
-  @Inject
-  private ServiceLogsSolrDao serviceLogsSolrDao;
-  @Inject
-  private AuditSolrDao auditSolrDao;
-
-  public LogFileDataListResponse searchLogFiles(SearchCriteria searchCriteria) {
-    LogFileDataListResponse logFileList = new LogFileDataListResponse();
-    List<LogFileData> logFiles = new ArrayList<LogFileData>();
-    String componentName = (String) searchCriteria.getParamValue("component");
-    String host = (String) searchCriteria.getParamValue("host");
-    int minCount = 1;// to remove zero count facet
-    SolrQuery solrQuery = new SolrQuery();
-    SolrUtil.setMainQuery(solrQuery, null);
-    SolrUtil.setFacetFieldWithMincount(solrQuery, LogSearchConstants.SOLR_PATH, minCount);
-    // adding filter
-    queryGenerator.setSingleIncludeFilter(solrQuery, LogSearchConstants.SOLR_COMPONENT, componentName);
-    queryGenerator.setSingleIncludeFilter(solrQuery, LogSearchConstants.SOLR_HOST, host);
-    try {
-      String logType = (String) searchCriteria.getParamValue("logType");
-      if (StringUtils.isBlank(logType)) {
-        logType = LogType.SERVICE.name();// default is service Log
-      }
-      SolrDaoBase daoMgr = null;
-      if (logType.equalsIgnoreCase(LogType.SERVICE.name())) {
-        daoMgr = serviceLogsSolrDao;
-      } else if (logType.equalsIgnoreCase(LogType.AUDIT.name())) {
-        daoMgr = auditSolrDao;
-      } else {
-        throw RESTErrorUtil.createRESTException(logType + " is not a valid logType", MessageEnums.INVALID_INPUT_DATA);
-      }
-      QueryResponse queryResponse = daoMgr.process(solrQuery);
-      if (queryResponse.getFacetField(LogSearchConstants.SOLR_PATH) != null) {
-        FacetField queryFacetField = queryResponse.getFacetField(LogSearchConstants.SOLR_PATH);
-        if (queryFacetField != null) {
-          List<Count> countList = queryFacetField.getValues();
-          for (Count count : countList) {
-            LogFileData vLogFile = new LogFileData();
-            String filePath = count.getName();
-            String fileName = FilenameUtils.getName(filePath);
-            vLogFile.setPath(filePath);
-            vLogFile.setName(fileName);
-            logFiles.add(vLogFile);
-          }
-        }
-      }
-    } catch (SolrException | SolrServerException | IOException e) {
-      logger.error("Error in solr query  :" + e.getLocalizedMessage() + "\n Query :" + solrQuery.toQueryString(), e.getCause());
-      throw RESTErrorUtil.createRESTException(MessageEnums.SOLR_ERROR.getMessage().getMessage(), MessageEnums.ERROR_SYSTEM);
-    }
-    logFileList.setLogFiles(logFiles);
-
-    return logFileList;
-  }
-
-  public LogListResponse getLogFileTail(SearchCriteria searchCriteria) {
-    String host = (String) searchCriteria.getParamValue("host");
-    String logFile = (String) searchCriteria.getParamValue("name");
-    String component = (String) searchCriteria.getParamValue("component");
-    String tailSize = (String) searchCriteria.getParamValue("tailSize");
-    if (StringUtils.isBlank(host)) {
-      throw RESTErrorUtil.createRESTException("missing Host Name", MessageEnums.ERROR_SYSTEM);
-    }
-    tailSize = (StringUtils.isBlank(tailSize)) ? "10" : tailSize;
-    SolrQuery logFileTailQuery = new SolrQuery();
-    try {
-      int tail = Integer.parseInt(tailSize);
-      tail = tail > 100 ? 100 : tail;
-      SolrUtil.setMainQuery(logFileTailQuery, null);
-      queryGenerator.setSingleIncludeFilter(logFileTailQuery, LogSearchConstants.SOLR_HOST, host);
-      if (!StringUtils.isBlank(logFile)) {
-        queryGenerator.setSingleIncludeFilter(logFileTailQuery, LogSearchConstants.SOLR_PATH, SolrUtil.makeSolrSearchString(logFile));
-      } else if (!StringUtils.isBlank(component)) {
-        queryGenerator.setSingleIncludeFilter(logFileTailQuery, LogSearchConstants.SOLR_COMPONENT, component);
-      } else {
-        throw RESTErrorUtil.createRESTException("component or logfile parameter must be present", MessageEnums.ERROR_SYSTEM);
-      }
-
-      SolrUtil.setRowCount(logFileTailQuery, tail);
-      queryGenerator.setSortOrderDefaultServiceLog(logFileTailQuery, new SearchCriteria());
-      return getLogAsPaginationProvided(logFileTailQuery, serviceLogsSolrDao);
-
-    } catch (NumberFormatException ne) {
-
-      throw RESTErrorUtil.createRESTException(ne.getMessage(),
-        MessageEnums.ERROR_SYSTEM);
-
-    }
-  }
-
-  @Override
-  protected List<ServiceLogData> convertToSolrBeans(QueryResponse response) {
-    throw new UnsupportedOperationException();
-  }
-
-  @Override
-  protected ServiceLogResponse createLogSearchResponse() {
-    throw new UnsupportedOperationException();
-  }
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/6fa4abfe/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/manager/PublicManager.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/manager/PublicManager.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/manager/PublicManager.java
index 3ac2be6..82817d6 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/manager/PublicManager.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/manager/PublicManager.java
@@ -22,7 +22,7 @@ package org.apache.ambari.logsearch.manager;
 import java.util.ArrayList;
 import java.util.List;
 
-import org.apache.ambari.logsearch.conf.AuthConfig;
+import org.apache.ambari.logsearch.conf.AuthPropsConfig;
 import org.apache.ambari.logsearch.model.response.NameValueData;
 import org.apache.ambari.logsearch.model.response.NameValueDataListResponse;
 import org.springframework.stereotype.Component;
@@ -33,14 +33,14 @@ import javax.inject.Inject;
 public class PublicManager extends JsonManagerBase {
 
   @Inject
-  private AuthConfig authConfig;
+  private AuthPropsConfig authPropsConfig;
 
   public String getGeneralConfig() {
     NameValueDataListResponse nameValueList = new NameValueDataListResponse();
     List<NameValueData> nameValues = new ArrayList<>();
     NameValueData nameValue = new NameValueData();
     nameValue.setName("simpleAuth");
-    nameValue.setValue("" + authConfig.isAuthSimpleEnabled());
+    nameValue.setValue("" + authPropsConfig.isAuthSimpleEnabled());
     nameValues.add(nameValue);
     nameValueList.setvNameValues(nameValues);
     return convertObjToString(nameValueList);


[25/58] [abbrv] ambari git commit: AMBARI-18246. Clean up Log Feeder (Miklos Gergely via oleewere)

Posted by ol...@apache.org.
http://git-wip-us.apache.org/repos/asf/ambari/blob/1b07a6dd/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/input/reader/LogsearchReaderFactory.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/input/reader/LogsearchReaderFactory.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/input/reader/LogsearchReaderFactory.java
index c57c028..5fc2e14 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/input/reader/LogsearchReaderFactory.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/input/reader/LogsearchReaderFactory.java
@@ -27,17 +27,15 @@ import org.apache.log4j.Logger;
 
 public enum LogsearchReaderFactory {
   INSTANCE;
-  private static Logger logger = Logger
-    .getLogger(LogsearchReaderFactory.class);
+  private static final Logger LOG = Logger.getLogger(LogsearchReaderFactory.class);
 
   public Reader getReader(File file) throws FileNotFoundException {
-    logger.debug("Inside reader factory for file:" + file);
+    LOG.debug("Inside reader factory for file:" + file);
     if (GZIPReader.isValidFile(file.getAbsolutePath())) {
-      logger.info("Reading file " + file + " as gzip file");
+      LOG.info("Reading file " + file + " as gzip file");
       return new GZIPReader(file.getAbsolutePath());
     } else {
       return new FileReader(file);
     }
   }
-
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/1b07a6dd/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/logconfig/FetchConfigFromSolr.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/logconfig/FetchConfigFromSolr.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/logconfig/FetchConfigFromSolr.java
deleted file mode 100644
index ae0cfc0..0000000
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/logconfig/FetchConfigFromSolr.java
+++ /dev/null
@@ -1,194 +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.logfeeder.logconfig;
-
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.TimeZone;
-
-import org.apache.ambari.logfeeder.util.LogFeederUtil;
-import org.apache.ambari.logfeeder.util.SolrUtil;
-import org.apache.ambari.logfeeder.view.VLogfeederFilter;
-import org.apache.ambari.logfeeder.view.VLogfeederFilterWrapper;
-import org.apache.log4j.Logger;
-
-public class FetchConfigFromSolr extends Thread {
-  private static Logger logger = Logger.getLogger(FetchConfigFromSolr.class);
-  private static VLogfeederFilterWrapper logfeederFilterWrapper = null;
-  private static int solrConfigInterval = 5;// 5 sec;
-  private static long delay;
-  private static String endTimeDateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSS";//2016-04-05T04:30:00.000Z
-  private static String sysTimeZone = "GMT";
-
-  FetchConfigFromSolr(boolean isDaemon) {
-    this.setName(this.getClass().getSimpleName());
-    this.setDaemon(isDaemon);
-  }
-
-  @Override
-  public void run() {
-    String zkConnectString = LogFeederUtil.getStringProperty("logfeeder.solr.zk_connect_string");
-    String solrUrl = LogFeederUtil.getStringProperty("logfeeder.solr.url");
-    if ((zkConnectString == null || zkConnectString.trim().length() == 0 )
-        && (solrUrl == null || solrUrl.trim().length() == 0)) {
-      logger.warn("Neither Solr ZK Connect String nor solr Uril for UserConfig/History is set." +
-          "Won't look for level configuration from Solr.");
-      return;
-    }
-    solrConfigInterval = LogFeederUtil.getIntProperty("logfeeder.solr.config.interval", solrConfigInterval);
-    delay = 1000 * solrConfigInterval;
-    do {
-      logger.debug("Updating config from solr after every " + solrConfigInterval + " sec.");
-      pullConfigFromSolr();
-      try {
-        Thread.sleep(delay);
-      } catch (InterruptedException e) {
-        logger.error(e.getLocalizedMessage(), e.getCause());
-      }
-    } while (true);
-  }
-
-  private synchronized void pullConfigFromSolr() {
-    SolrUtil solrUtil = SolrUtil.getInstance();
-    if(solrUtil!=null){
-      HashMap<String, Object> configDocMap = solrUtil.getConfigDoc();
-      if (configDocMap != null) {
-        String configJson = (String) configDocMap.get(LogFeederConstants.VALUES);
-        if (configJson != null) {
-          logfeederFilterWrapper = LogFeederUtil.getGson().fromJson(configJson, VLogfeederFilterWrapper.class);
-        }
-      }
-    }
-  }
-
-  private static boolean isFilterExpired(VLogfeederFilter logfeederFilter) {
-    boolean isFilterExpired = false;// default is false
-    if (logfeederFilter != null) {
-      Date filterEndDate = parseFilterExpireDate(logfeederFilter);
-      if (filterEndDate != null) {
-        Date currentDate = getCurrentDate();
-        if (currentDate.compareTo(filterEndDate) >= 0) {
-          logger.debug("Filter for  Component :" + logfeederFilter.getLabel() + " and Hosts :"
-            + listToStr(logfeederFilter.getHosts()) + "Filter is expired because of filter endTime : "
-            + dateToStr(filterEndDate) + " is older than currentTime :" + dateToStr(currentDate));
-          isFilterExpired = true;
-        }
-      }
-    }
-    return isFilterExpired;
-  }
-
-  private static String dateToStr(Date date) {
-    if (date == null) {
-      return "";
-    }
-    SimpleDateFormat formatter = new SimpleDateFormat(endTimeDateFormat);
-    TimeZone timeZone = TimeZone.getTimeZone(sysTimeZone);
-    formatter.setTimeZone(timeZone);
-    return formatter.format(date);
-  }
-
-  private static Date parseFilterExpireDate(VLogfeederFilter vLogfeederFilter) {
-    String expiryTime = vLogfeederFilter.getExpiryTime();
-    if (expiryTime != null && !expiryTime.isEmpty()) {
-      SimpleDateFormat formatter = new SimpleDateFormat(endTimeDateFormat);
-      TimeZone timeZone = TimeZone.getTimeZone(sysTimeZone);
-      formatter.setTimeZone(timeZone);
-      try {
-        return formatter.parse(expiryTime);
-      } catch (ParseException e) {
-        logger.error("Filter have invalid ExpiryTime : " + expiryTime + " for component :" + vLogfeederFilter.getLabel()
-          + " and hosts :" + listToStr(vLogfeederFilter.getHosts()));
-      }
-    }
-    return null;
-  }
-
-  public static List<String> getAllowedLevels(String hostName, VLogfeederFilter componentFilter) {
-    String componentName = componentFilter.getLabel();
-    List<String> hosts = componentFilter.getHosts();
-    List<String> defaultLevels = componentFilter.getDefaultLevels();
-    List<String> overrideLevels = componentFilter.getOverrideLevels();
-    String expiryTime=componentFilter.getExpiryTime();
-    //check is user override or not
-    if ((expiryTime != null && !expiryTime.isEmpty())
-        || (overrideLevels != null && !overrideLevels.isEmpty())
-        || (hosts != null && !hosts.isEmpty())) {
-      if (hosts == null || hosts.isEmpty()) {
-        // hosts list is empty or null consider it apply on all hosts
-        hosts.add(LogFeederConstants.ALL);
-      }
-      if (LogFeederUtil.isListContains(hosts, hostName, false)) {
-        if (isFilterExpired(componentFilter)) {
-          logger.debug("Filter for component " + componentName + " and host :"
-              + hostName + " is expired at " + componentFilter.getExpiryTime());
-          return defaultLevels;
-        } else {
-          return overrideLevels;
-        }
-      }
-    }
-    return defaultLevels;
-  }
-
-  public static boolean isFilterAvailable() {
-    return logfeederFilterWrapper != null;
-  }
-  
-  public static VLogfeederFilter findComponentFilter(String componentName) {
-    if (logfeederFilterWrapper != null) {
-      HashMap<String, VLogfeederFilter> filter = logfeederFilterWrapper.getFilter();
-      if (filter != null) {
-        VLogfeederFilter componentFilter = filter.get(componentName);
-        if (componentFilter != null) {
-          return componentFilter;
-        }
-      }
-    }
-    logger.trace("Filter is not there for component :" + componentName);
-    return null;
-  }
-
-
-  public static Date getCurrentDate() {
-    TimeZone.setDefault(TimeZone.getTimeZone(sysTimeZone));
-    Date date = new Date();
-    return date;
-  }
-
-  public static String listToStr(List<String> strList) {
-    StringBuilder out = new StringBuilder("[");
-    if (strList != null) {
-      int counter = 0;
-      for (Object o : strList) {
-        if (counter > 0) {
-          out.append(",");
-        }
-        out.append(o.toString());
-        counter++;
-      }
-    }
-    out.append("]");
-    return out.toString();
-  }
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/1b07a6dd/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/logconfig/FilterLogData.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/logconfig/FilterLogData.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/logconfig/FilterLogData.java
new file mode 100644
index 0000000..801a289
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/logconfig/FilterLogData.java
@@ -0,0 +1,83 @@
+/*
+ * 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.logfeeder.logconfig;
+
+import java.util.List;
+import java.util.Map;
+
+import org.apache.ambari.logfeeder.common.LogFeederConstants;
+import org.apache.ambari.logfeeder.util.LogFeederUtil;
+import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.collections.MapUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.log4j.Logger;
+
+/**
+ * Read configuration from solr and filter the log
+ */
+public enum FilterLogData {
+  INSTANCE;
+  
+  private static final Logger LOG = Logger.getLogger(FilterLogData.class);
+  
+  private static final boolean DEFAULT_VALUE = true;
+
+  public boolean isAllowed(String jsonBlock) {
+    if (StringUtils.isEmpty(jsonBlock)) {
+      return DEFAULT_VALUE;
+    }
+    Map<String, Object> jsonObj = LogFeederUtil.toJSONObject(jsonBlock);
+    return isAllowed(jsonObj);
+  }
+
+  public boolean isAllowed(Map<String, Object> jsonObj) {
+    boolean isAllowed = applyFilter(jsonObj);
+    if (!isAllowed) {
+      LOG.trace("Filter block the content :" + LogFeederUtil.getGson().toJson(jsonObj));
+    }
+    return isAllowed;
+  }
+  
+
+  private boolean applyFilter(Map<String, Object> jsonObj) {
+    if (MapUtils.isEmpty(jsonObj)) {
+      LOG.warn("Output jsonobj is empty");
+      return DEFAULT_VALUE;
+    }
+    
+    String hostName = (String) jsonObj.get(LogFeederConstants.SOLR_HOST);
+    String componentName = (String) jsonObj.get(LogFeederConstants.SOLR_COMPONENT);
+    String level = (String) jsonObj.get(LogFeederConstants.SOLR_LEVEL);
+    if (StringUtils.isNotBlank(hostName) && StringUtils.isNotBlank(componentName) && StringUtils.isNotBlank(level)) {
+      LogFeederFilter componentFilter = LogConfigHandler.findComponentFilter(componentName);
+      if (componentFilter == null) {
+        return DEFAULT_VALUE;
+      }
+      List<String> allowedLevels = LogConfigHandler.getAllowedLevels(hostName, componentFilter);
+      if (CollectionUtils.isEmpty(allowedLevels)) {
+        allowedLevels.add(LogFeederConstants.ALL);
+      }
+      return LogFeederUtil.isListContains(allowedLevels, level, false);
+    }
+    else {
+      return DEFAULT_VALUE;
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/1b07a6dd/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/logconfig/LogConfigFetcher.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/logconfig/LogConfigFetcher.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/logconfig/LogConfigFetcher.java
new file mode 100644
index 0000000..12c744c
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/logconfig/LogConfigFetcher.java
@@ -0,0 +1,168 @@
+/*
+ * 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.logfeeder.logconfig;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.ambari.logfeeder.common.LogFeederConstants;
+import org.apache.ambari.logfeeder.util.LogFeederUtil;
+import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.log4j.Level;
+import org.apache.log4j.Logger;
+import org.apache.solr.client.solrj.SolrClient;
+import org.apache.solr.client.solrj.SolrQuery;
+import org.apache.solr.client.solrj.SolrServerException;
+import org.apache.solr.client.solrj.SolrRequest.METHOD;
+import org.apache.solr.client.solrj.impl.CloudSolrClient;
+import org.apache.solr.client.solrj.impl.HttpSolrClient;
+import org.apache.solr.client.solrj.request.CollectionAdminRequest;
+import org.apache.solr.client.solrj.response.CollectionAdminResponse;
+import org.apache.solr.client.solrj.response.QueryResponse;
+import org.apache.solr.common.SolrDocument;
+import org.apache.solr.common.SolrDocumentList;
+import org.apache.solr.common.SolrException;
+
+public class LogConfigFetcher {
+  private static final Logger LOG = Logger.getLogger(LogConfigFetcher.class);
+  
+  private static LogConfigFetcher instance;
+  public synchronized static LogConfigFetcher getInstance() {
+    if (instance == null) {
+      try {
+        instance = new LogConfigFetcher();
+      } catch (Exception e) {
+        String logMessageKey = LogConfigFetcher.class.getSimpleName() + "_SOLR_UTIL";
+              LogFeederUtil.logErrorMessageByInterval(logMessageKey, "Error constructing solrUtil", e, LOG, Level.WARN);
+      }
+    }
+    return instance;
+  }
+
+  private SolrClient solrClient;
+
+  private String solrDetail = "";
+
+  public LogConfigFetcher() throws Exception {
+    String url = LogFeederUtil.getStringProperty("logfeeder.solr.url");
+    String zkConnectString = LogFeederUtil.getStringProperty("logfeeder.solr.zk_connect_string");
+    String collection = LogFeederUtil.getStringProperty("logfeeder.solr.core.config.name", "history");
+    connectToSolr(url, zkConnectString, collection);
+  }
+
+  private SolrClient connectToSolr(String url, String zkConnectString, String collection) throws Exception {
+    solrDetail = "zkConnectString=" + zkConnectString + ", collection=" + collection + ", url=" + url;
+
+    LOG.info("connectToSolr() " + solrDetail);
+    if (StringUtils.isEmpty(collection)) {
+      throw new Exception("For solr, collection name is mandatory. " + solrDetail);
+    }
+    
+    if (StringUtils.isEmpty(zkConnectString) && StringUtils.isBlank(url))
+      throw new Exception("Both zkConnectString and URL are empty. zkConnectString=" + zkConnectString + ", collection=" +
+          collection + ", url=" + url);
+    
+    if (StringUtils.isNotEmpty(zkConnectString)) {
+      solrDetail = "zkConnectString=" + zkConnectString + ", collection=" + collection;
+      LOG.info("Using zookeepr. " + solrDetail);
+      CloudSolrClient solrClouldClient = new CloudSolrClient(zkConnectString);
+      solrClouldClient.setDefaultCollection(collection);
+      solrClient = solrClouldClient;
+      checkSolrStatus(3 * 60 * 1000);
+    } else {
+      solrDetail = "collection=" + collection + ", url=" + url;
+      String collectionURL = url + "/" + collection;
+      LOG.info("Connecting to  solr : " + collectionURL);
+      solrClient = new HttpSolrClient(collectionURL);
+    }
+    return solrClient;
+  }
+
+  private boolean checkSolrStatus(int waitDurationMS) {
+    boolean status = false;
+    try {
+      long beginTimeMS = System.currentTimeMillis();
+      long waitIntervalMS = 2000;
+      int pingCount = 0;
+      while (true) {
+        pingCount++;
+        CollectionAdminResponse response = null;
+        try {
+          CollectionAdminRequest.List colListReq = new CollectionAdminRequest.List();
+          response = colListReq.process(solrClient);
+        } catch (Exception ex) {
+          LOG.error("Con't connect to Solr. solrDetail=" + solrDetail, ex);
+        }
+        if (response != null && response.getStatus() == 0) {
+          LOG.info("Solr getCollections() is success. solr=" + solrDetail);
+          status = true;
+          break;
+        }
+        if (System.currentTimeMillis() - beginTimeMS > waitDurationMS) {
+          LOG.error("Solr is not reachable even after " + (System.currentTimeMillis() - beginTimeMS)
+            + " ms. If you are using alias, then you might have to restart LogSearch after Solr is up and running. solr="
+            + solrDetail + ", response=" + response);
+          break;
+        } else {
+          LOG.warn("Solr is not reachable yet. getCollections() attempt count=" + pingCount + ". Will sleep for " +
+              waitIntervalMS + " ms and try again." + " solr=" + solrDetail + ", response=" + response);
+        }
+        Thread.sleep(waitIntervalMS);
+      }
+    } catch (Throwable t) {
+      LOG.error("Seems Solr is not up. solrDetail=" + solrDetail, t);
+    }
+    return status;
+  }
+
+  public Map<String, Object> getConfigDoc() {
+    HashMap<String, Object> configMap = new HashMap<String, Object>();
+    SolrQuery solrQuery = new SolrQuery();
+    solrQuery.setQuery("*:*");
+    String fq = LogFeederConstants.ROW_TYPE + ":" + LogFeederConstants.LOGFEEDER_FILTER_NAME;
+    solrQuery.setFilterQueries(fq);
+    try {
+      QueryResponse response = process(solrQuery);
+      if (response != null) {
+        SolrDocumentList documentList = response.getResults();
+        if (CollectionUtils.isNotEmpty(documentList)) {
+          SolrDocument configDoc = documentList.get(0);
+          String configJson = LogFeederUtil.getGson().toJson(configDoc);
+          configMap = (HashMap<String, Object>) LogFeederUtil.toJSONObject(configJson);
+        }
+      }
+    } catch (Exception e) {
+      String logMessageKey = this.getClass().getSimpleName() + "_FETCH_FILTER_CONFIG_ERROR";
+      LogFeederUtil.logErrorMessageByInterval(logMessageKey, "Error getting filter config from solr", e, LOG, Level.ERROR);
+    }
+    return configMap;
+  }
+
+  private QueryResponse process(SolrQuery solrQuery) throws SolrServerException, IOException, SolrException {
+    if (solrClient != null) {
+      QueryResponse queryResponse = solrClient.query(solrQuery, METHOD.POST);
+      return queryResponse;
+    } else {
+      LOG.error("solrClient can't be null");
+      return null;
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/1b07a6dd/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/logconfig/LogConfigHandler.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/logconfig/LogConfigHandler.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/logconfig/LogConfigHandler.java
new file mode 100644
index 0000000..4f52b0b
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/logconfig/LogConfigHandler.java
@@ -0,0 +1,189 @@
+/*
+ * 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.logfeeder.logconfig;
+
+import java.text.DateFormat;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.TimeZone;
+
+import org.apache.ambari.logfeeder.common.LogFeederConstants;
+import org.apache.ambari.logfeeder.util.LogFeederUtil;
+import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.lang.StringUtils;
+import org.apache.log4j.Logger;
+
+public class LogConfigHandler extends Thread {
+  private static final Logger LOG = Logger.getLogger(LogConfigHandler.class);
+  
+  private static final int DEFAULT_SOLR_CONFIG_INTERVAL = 5;
+  private static final String DATE_FORMAT = "yyyy-MM-dd'T'HH:mm:ss.SSS";
+  private static final String TIMEZONE = "GMT";
+  
+  static {
+    TimeZone.setDefault(TimeZone.getTimeZone(TIMEZONE));
+  }
+  
+  private static ThreadLocal<DateFormat> formatter = new ThreadLocal<DateFormat>() {
+    protected DateFormat initialValue() {
+      SimpleDateFormat dateFormat = new SimpleDateFormat(DATE_FORMAT);
+      dateFormat.setTimeZone(TimeZone.getTimeZone(TIMEZONE));
+      return dateFormat;
+    }
+  };
+  
+  private static LogFeederFilterWrapper logFeederFilterWrapper;
+
+  private static boolean running = false;
+
+  public static void handleConfig() {
+    boolean filterEnable = LogFeederUtil.getBooleanProperty("logfeeder.log.filter.enable", false);
+    if (!filterEnable) {
+      LOG.info("Logfeeder filter Scheduler is disabled.");
+      return;
+    }
+    if (!running) {
+      new LogConfigHandler().start();
+      running = true;
+      LOG.info("Logfeeder Filter Thread started!");
+    } else {
+      LOG.warn("Logfeeder Filter Thread is already running.");
+    }
+  }
+  
+  private LogConfigHandler() {
+    setName(getClass().getSimpleName());
+    setDaemon(true);
+  }
+
+  @Override
+  public void run() {
+    String zkConnectString = LogFeederUtil.getStringProperty("logfeeder.solr.zk_connect_string");
+    String solrUrl = LogFeederUtil.getStringProperty("logfeeder.solr.url");
+    if (StringUtils.isBlank(zkConnectString) && StringUtils.isBlank(solrUrl)) {
+      LOG.warn("Neither Solr ZK Connect String nor solr Url for UserConfig/History is set." +
+          "Won't look for level configuration from Solr.");
+      return;
+    }
+    
+    int solrConfigInterval = LogFeederUtil.getIntProperty("logfeeder.solr.config.interval", DEFAULT_SOLR_CONFIG_INTERVAL);
+    do {
+      LOG.debug("Updating config from solr after every " + solrConfigInterval + " sec.");
+      fetchConfig();
+      try {
+        Thread.sleep(1000 * solrConfigInterval);
+      } catch (InterruptedException e) {
+        LOG.error(e.getLocalizedMessage(), e.getCause());
+      }
+    } while (true);
+  }
+
+  private synchronized void fetchConfig() {
+    LogConfigFetcher fetcher = LogConfigFetcher.getInstance();
+    if (fetcher != null) {
+      Map<String, Object> configDocMap = fetcher.getConfigDoc();
+      String configJson = (String) configDocMap.get(LogFeederConstants.VALUES);
+      if (configJson != null) {
+        logFeederFilterWrapper = LogFeederUtil.getGson().fromJson(configJson, LogFeederFilterWrapper.class);
+      }
+    }
+  }
+
+  public static boolean isFilterAvailable() {
+    return logFeederFilterWrapper != null;
+  }
+
+  public static List<String> getAllowedLevels(String hostName, LogFeederFilter componentFilter) {
+    String componentName = componentFilter.getLabel();
+    List<String> hosts = componentFilter.getHosts();
+    List<String> defaultLevels = componentFilter.getDefaultLevels();
+    List<String> overrideLevels = componentFilter.getOverrideLevels();
+    String expiryTime = componentFilter.getExpiryTime();
+    
+    // check is user override or not
+    if (StringUtils.isNotEmpty(expiryTime) || CollectionUtils.isNotEmpty(overrideLevels) || CollectionUtils.isNotEmpty(hosts)) {
+      if (CollectionUtils.isEmpty(hosts)) { // hosts list is empty or null consider it apply on all hosts
+        hosts.add(LogFeederConstants.ALL);
+      }
+      
+      if (LogFeederUtil.isListContains(hosts, hostName, false)) {
+        if (isFilterExpired(componentFilter)) {
+          LOG.debug("Filter for component " + componentName + " and host :" + hostName + " is expired at " +
+              componentFilter.getExpiryTime());
+          return defaultLevels;
+        } else {
+          return overrideLevels;
+        }
+      }
+    }
+    return defaultLevels;
+  }
+
+  private static boolean isFilterExpired(LogFeederFilter logfeederFilter) {
+    if (logfeederFilter == null)
+      return false;
+    
+    Date filterEndDate = parseFilterExpireDate(logfeederFilter);
+    if (filterEndDate == null) {
+      return false;
+    }
+    
+    Date currentDate = new Date();
+    if (!currentDate.before(filterEndDate)) {
+      LOG.debug("Filter for  Component :" + logfeederFilter.getLabel() + " and Hosts : [" +
+          StringUtils.join(logfeederFilter.getHosts(), ',') + "] is expired because of filter endTime : " +
+          formatter.get().format(filterEndDate) + " is older than currentTime :" + formatter.get().format(currentDate));
+      return true;
+    } else {
+      return false;
+    }
+  }
+
+  private static Date parseFilterExpireDate(LogFeederFilter vLogfeederFilter) {
+    String expiryTime = vLogfeederFilter.getExpiryTime();
+    if (StringUtils.isNotEmpty(expiryTime)) {
+      try {
+        return formatter.get().parse(expiryTime);
+      } catch (ParseException e) {
+        LOG.error("Filter have invalid ExpiryTime : " + expiryTime + " for component :" + vLogfeederFilter.getLabel()
+          + " and hosts : [" + StringUtils.join(vLogfeederFilter.getHosts(), ',') + "]");
+      }
+    }
+    return null;
+  }
+  
+  public static LogFeederFilter findComponentFilter(String componentName) {
+    if (logFeederFilterWrapper != null) {
+      HashMap<String, LogFeederFilter> filter = logFeederFilterWrapper.getFilter();
+      if (filter != null) {
+        LogFeederFilter componentFilter = filter.get(componentName);
+        if (componentFilter != null) {
+          return componentFilter;
+        }
+      }
+    }
+    LOG.trace("Filter is not there for component :" + componentName);
+    return null;
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/1b07a6dd/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/logconfig/LogFeederConstants.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/logconfig/LogFeederConstants.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/logconfig/LogFeederConstants.java
deleted file mode 100644
index 09673a0..0000000
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/logconfig/LogFeederConstants.java
+++ /dev/null
@@ -1,34 +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.logfeeder.logconfig;
-
-public class LogFeederConstants {
-
-  public static final String ALL = "all";
-  public static final String LOGFEEDER_FILTER_NAME = "log_feeder_config";
-  public static final String LOG_LEVEL_UNKNOWN = "UNKNOWN";
-  // solr fields
-  public static final String SOLR_LEVEL = "level";
-  public static final String SOLR_COMPONENT = "type";
-  public static final String SOLR_HOST = "host";
-
-  // UserConfig Constants History
-  public static final String VALUES = "jsons";
-  public static final String ROW_TYPE = "rowtype";
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/1b07a6dd/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/logconfig/LogFeederFilter.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/logconfig/LogFeederFilter.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/logconfig/LogFeederFilter.java
new file mode 100644
index 0000000..60c8ae8
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/logconfig/LogFeederFilter.java
@@ -0,0 +1,90 @@
+/*
+ * 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.logfeeder.logconfig;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlRootElement;
+
+import org.codehaus.jackson.annotate.JsonAutoDetect;
+import org.codehaus.jackson.annotate.JsonAutoDetect.Visibility;
+import org.codehaus.jackson.map.annotate.JsonSerialize;
+
+@JsonAutoDetect(getterVisibility = Visibility.NONE, setterVisibility = Visibility.NONE, fieldVisibility = Visibility.ANY)
+@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
+@XmlRootElement
+@XmlAccessorType(XmlAccessType.FIELD)
+public class LogFeederFilter {
+
+  private String label;
+  private List<String> hosts;
+  private List<String> defaultLevels;
+  private List<String> overrideLevels;
+  private String expiryTime;
+
+  public LogFeederFilter() {
+    hosts = new ArrayList<String>();
+    defaultLevels = new ArrayList<String>();
+    overrideLevels = new ArrayList<String>();
+  }
+
+  public String getLabel() {
+    return label;
+  }
+
+  public void setLabel(String label) {
+    this.label = label;
+  }
+
+  public List<String> getHosts() {
+    return hosts;
+  }
+
+  public void setHosts(List<String> hosts) {
+    this.hosts = hosts;
+  }
+
+  public List<String> getDefaultLevels() {
+    return defaultLevels;
+  }
+
+  public void setDefaultLevels(List<String> defaultLevels) {
+    this.defaultLevels = defaultLevels;
+  }
+
+  public List<String> getOverrideLevels() {
+    return overrideLevels;
+  }
+
+  public void setOverrideLevels(List<String> overrideLevels) {
+    this.overrideLevels = overrideLevels;
+  }
+
+  public String getExpiryTime() {
+    return expiryTime;
+  }
+
+  public void setExpiryTime(String expiryTime) {
+    this.expiryTime = expiryTime;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/1b07a6dd/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/logconfig/LogFeederFilterWrapper.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/logconfig/LogFeederFilterWrapper.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/logconfig/LogFeederFilterWrapper.java
new file mode 100644
index 0000000..9199cd3
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/logconfig/LogFeederFilterWrapper.java
@@ -0,0 +1,55 @@
+/*
+ * 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.logfeeder.logconfig;
+
+import java.util.HashMap;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlRootElement;
+
+import org.codehaus.jackson.annotate.JsonAutoDetect;
+import org.codehaus.jackson.annotate.JsonAutoDetect.Visibility;
+import org.codehaus.jackson.map.annotate.JsonSerialize;
+
+@JsonAutoDetect(getterVisibility = Visibility.NONE, setterVisibility = Visibility.NONE, fieldVisibility = Visibility.ANY)
+@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
+@XmlRootElement
+@XmlAccessorType(XmlAccessType.FIELD)
+public class LogFeederFilterWrapper {
+
+  private HashMap<String, LogFeederFilter> filter;
+  private String id;
+
+  public HashMap<String, LogFeederFilter> getFilter() {
+    return filter;
+  }
+
+  public void setFilter(HashMap<String, LogFeederFilter> filter) {
+    this.filter = filter;
+  }
+
+  public String getId() {
+    return id;
+  }
+
+  public void setId(String id) {
+    this.id = id;
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/1b07a6dd/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/logconfig/LogfeederScheduler.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/logconfig/LogfeederScheduler.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/logconfig/LogfeederScheduler.java
deleted file mode 100644
index bc807193..0000000
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/logconfig/LogfeederScheduler.java
+++ /dev/null
@@ -1,59 +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.logfeeder.logconfig;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.ambari.logfeeder.util.LogFeederUtil;
-import org.apache.log4j.Logger;
-
-public enum LogfeederScheduler {
-
-  INSTANCE;
-
-  private Logger logger = Logger.getLogger(LogfeederScheduler.class);
-
-  private static boolean running = false;
-
-  public synchronized void start() {
-    boolean filterEnable = LogFeederUtil.getBooleanProperty("logfeeder.log.filter.enable", false);
-    if (!filterEnable) {
-      logger.info("Logfeeder  filter Scheduler is disabled.");
-      return;
-    }
-    if (!running) {
-      for (Thread thread : getThreadList()) {
-        thread.start();
-      }
-      running = true;
-      logger.info("Logfeeder Scheduler started!");
-    } else {
-      logger.warn("Logfeeder Scheduler is already running.");
-    }
-  }
-
-  private List<Thread> getThreadList() {
-    List<Thread> tasks = new ArrayList<Thread>();
-    Thread configMonitor = new FetchConfigFromSolr(true);
-    tasks.add(configMonitor);
-    return tasks;
-  }
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/1b07a6dd/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/logconfig/filter/ApplyLogFilter.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/logconfig/filter/ApplyLogFilter.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/logconfig/filter/ApplyLogFilter.java
deleted file mode 100644
index b5e4eb3..0000000
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/logconfig/filter/ApplyLogFilter.java
+++ /dev/null
@@ -1,62 +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.logfeeder.logconfig.filter;
-
-import java.util.List;
-import java.util.Map;
-
-import org.apache.ambari.logfeeder.logconfig.FetchConfigFromSolr;
-import org.apache.ambari.logfeeder.logconfig.LogFeederConstants;
-import org.apache.ambari.logfeeder.util.LogFeederUtil;
-import org.apache.ambari.logfeeder.view.VLogfeederFilter;
-import org.apache.log4j.Logger;
-
-class ApplyLogFilter extends DefaultDataFilter {
-
-  private static Logger logger = Logger.getLogger(ApplyLogFilter.class);
-
-  @Override
-  public boolean applyFilter(Map<String, Object> jsonObj, boolean defaultValue) {
-    if (isEmpty(jsonObj)) {
-      logger.warn("Output jsonobj is empty");
-      return defaultValue;
-    }
-    String hostName = (String) jsonObj.get(LogFeederConstants.SOLR_HOST);
-    if (isNotEmpty(hostName)) {
-      String componentName = (String) jsonObj.get(LogFeederConstants.SOLR_COMPONENT);
-      if (isNotEmpty(componentName)) {
-        String level = (String) jsonObj.get(LogFeederConstants.SOLR_LEVEL);
-        if (isNotEmpty(level)) {
-          VLogfeederFilter componentFilter = FetchConfigFromSolr.findComponentFilter(componentName);
-          if (componentFilter == null) {
-            return defaultValue;
-          }
-          List<String> allowedLevels = FetchConfigFromSolr.getAllowedLevels(
-              hostName, componentFilter);
-          if (allowedLevels == null || allowedLevels.isEmpty()) {
-            allowedLevels.add(LogFeederConstants.ALL);
-          }
-          return LogFeederUtil.isListContains(allowedLevels, level, false);
-        }
-      }
-    }
-    return defaultValue;
-  }
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/1b07a6dd/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/logconfig/filter/DefaultDataFilter.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/logconfig/filter/DefaultDataFilter.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/logconfig/filter/DefaultDataFilter.java
deleted file mode 100644
index 04d2ca4..0000000
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/logconfig/filter/DefaultDataFilter.java
+++ /dev/null
@@ -1,49 +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.logfeeder.logconfig.filter;
-
-import java.util.Map;
-
-/**
- * Default filter to allow everything
- */
-class DefaultDataFilter {
-  public boolean applyFilter(Map<String, Object> outputJsonObj, boolean defaultValue) {
-    return defaultValue;
-  }
-
-  protected boolean isEmpty(Map<String, Object> map) {
-    if (map == null || map.isEmpty()) {
-      return true;
-    }
-    return false;
-  }
-
-  protected boolean isEmpty(String str) {
-    if (str == null || str.trim().isEmpty()) {
-      return true;
-    }
-    return false;
-  }
-
-  protected boolean isNotEmpty(String str) {
-    return !isEmpty(str);
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/1b07a6dd/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/logconfig/filter/FilterLogData.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/logconfig/filter/FilterLogData.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/logconfig/filter/FilterLogData.java
deleted file mode 100644
index 3a8eae9..0000000
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/logconfig/filter/FilterLogData.java
+++ /dev/null
@@ -1,53 +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.logfeeder.logconfig.filter;
-
-import java.util.Map;
-
-import org.apache.ambari.logfeeder.logconfig.filter.ApplyLogFilter;
-import org.apache.ambari.logfeeder.util.LogFeederUtil;
-import org.apache.log4j.Logger;
-
-/**
- * Read configuration from solr and filter the log
- */
-public enum FilterLogData {
-  INSTANCE;
-  private ApplyLogFilter applyLogFilter = new ApplyLogFilter();
-  private static Logger logger = Logger.getLogger(FilterLogData.class);
-  // by default allow every log
-  boolean defaultValue = true;
-
-  public boolean isAllowed(String jsonBlock) {
-    if (jsonBlock == null || jsonBlock.isEmpty()) {
-      return defaultValue;
-    }
-    Map<String, Object> jsonObj = LogFeederUtil.toJSONObject(jsonBlock);
-    return isAllowed(jsonObj);
-  }
-
-  public boolean isAllowed(Map<String, Object> jsonObj) {
-    boolean isAllowed = applyLogFilter.applyFilter(jsonObj, defaultValue);
-    if (!isAllowed) {
-      logger.trace("Filter block the content :" + LogFeederUtil.getGson().toJson(jsonObj));
-    }
-    return isAllowed;
-  }
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/1b07a6dd/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/mapper/Mapper.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/mapper/Mapper.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/mapper/Mapper.java
index 906dd25..96709c0 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/mapper/Mapper.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/mapper/Mapper.java
@@ -26,22 +26,18 @@ public abstract class Mapper {
   protected String fieldName;
   private String mapClassCode;
 
-  public boolean init(String inputDesc, String fieldName,
-                      String mapClassCode, Object mapConfigs) {
+  public abstract boolean init(String inputDesc, String fieldName, String mapClassCode, Object mapConfigs);
+
+  protected void init(String inputDesc, String fieldName, String mapClassCode) {
     this.inputDesc = inputDesc;
     this.fieldName = fieldName;
     this.mapClassCode = mapClassCode;
-    return true;
   }
 
-  public Object apply(Map<String, Object> jsonObj, Object value) {
-    return value;
-  }
+  public abstract Object apply(Map<String, Object> jsonObj, Object value);
 
   @Override
   public String toString() {
-    return "mapClass=" + mapClassCode + ", input=" + inputDesc
-      + ", fieldName=" + fieldName;
+    return "mapClass=" + mapClassCode + ", input=" + inputDesc + ", fieldName=" + fieldName;
   }
-
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/1b07a6dd/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/mapper/MapperDate.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/mapper/MapperDate.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/mapper/MapperDate.java
index 6dbf8be..eb3ae01 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/mapper/MapperDate.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/mapper/MapperDate.java
@@ -31,31 +31,29 @@ import org.apache.log4j.Level;
 import org.apache.log4j.Logger;
 
 public class MapperDate extends Mapper {
-  private static final Logger logger = Logger.getLogger(MapperDate.class);
+  private static final Logger LOG = Logger.getLogger(MapperDate.class);
 
   private SimpleDateFormat targetDateFormatter = null;
   private boolean isEpoch = false;
   private SimpleDateFormat srcDateFormatter=null;
 
   @Override
-  public boolean init(String inputDesc, String fieldName,
-                      String mapClassCode, Object mapConfigs) {
-    super.init(inputDesc, fieldName, mapClassCode, mapConfigs);
+  public boolean init(String inputDesc, String fieldName, String mapClassCode, Object mapConfigs) {
+    init(inputDesc, fieldName, mapClassCode);
     if (!(mapConfigs instanceof Map)) {
-      logger.fatal("Can't initialize object. mapConfigs class is not of type Map. "
-        + mapConfigs.getClass().getName()
-        + ", map="
-        + this.toString());
+      LOG.fatal("Can't initialize object. mapConfigs class is not of type Map. " + mapConfigs.getClass().getName() +
+        ", map=" + this);
       return false;
     }
+    
     @SuppressWarnings("unchecked")
     Map<String, Object> mapObjects = (Map<String, Object>) mapConfigs;
     String targetDateFormat = (String) mapObjects.get("target_date_pattern");
     String srcDateFormat = (String) mapObjects.get("src_date_pattern");
     if (StringUtils.isEmpty(targetDateFormat)) {
-      logger.fatal("Date format for map is empty. " + this.toString());
+      LOG.fatal("Date format for map is empty. " + this);
     } else {
-      logger.info("Date mapper format is " + targetDateFormat);
+      LOG.info("Date mapper format is " + targetDateFormat);
 
       if (targetDateFormat.equalsIgnoreCase("epoch")) {
         isEpoch = true;
@@ -68,8 +66,7 @@ public class MapperDate extends Mapper {
           }
           return true;
         } catch (Throwable ex) {
-          logger.fatal("Error creating date format. format="
-            + targetDateFormat + ". " + this.toString());
+          LOG.fatal("Error creating date format. format=" + targetDateFormat + ". " + this.toString());
         }
       } 
     }
@@ -84,7 +81,7 @@ public class MapperDate extends Mapper {
           long ms = Long.parseLong(value.toString()) * 1000;
           value = new Date(ms);
         } else if (targetDateFormatter != null) {
-          if(srcDateFormatter!=null){
+          if (srcDateFormatter != null) {
             Date srcDate = srcDateFormatter.parse(value.toString());
             //set year in src_date when src_date does not have year component
             if (!srcDateFormatter.toPattern().contains("yy")) {
@@ -108,12 +105,9 @@ public class MapperDate extends Mapper {
         }
         jsonObj.put(fieldName, value);
       } catch (Throwable t) {
-        LogFeederUtil.logErrorMessageByInterval(this.getClass()
-            .getSimpleName() + ":apply",
-          "Error applying date transformation. isEpoch="
-            + isEpoch + ", targetateFormat=" + (targetDateFormatter!=null ?targetDateFormatter.toPattern():"")
-            + ", value=" + value + ". " + this.toString(),
-          t, logger, Level.ERROR);
+        LogFeederUtil.logErrorMessageByInterval(this.getClass().getSimpleName() + ":apply", "Error applying date transformation." +
+            " isEpoch=" + isEpoch + ", targetateFormat=" + (targetDateFormatter!=null ?targetDateFormatter.toPattern():"")
+            + ", value=" + value + ". " + this.toString(), t, LOG, Level.ERROR);
       }
     }
     return value;

http://git-wip-us.apache.org/repos/asf/ambari/blob/1b07a6dd/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/mapper/MapperFieldName.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/mapper/MapperFieldName.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/mapper/MapperFieldName.java
index c692a9d..9b6e83c 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/mapper/MapperFieldName.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/mapper/MapperFieldName.java
@@ -30,24 +30,23 @@ import org.apache.log4j.Logger;
  * Overrides the value for the field
  */
 public class MapperFieldName extends Mapper {
-  private static final Logger logger = Logger.getLogger(MapperFieldName.class);
+  private static final Logger LOG = Logger.getLogger(MapperFieldName.class);
 
   private String newValue = null;
 
   @Override
-  public boolean init(String inputDesc, String fieldName,
-      String mapClassCode, Object mapConfigs) {
-    super.init(inputDesc, fieldName, mapClassCode, mapConfigs);
+  public boolean init(String inputDesc, String fieldName, String mapClassCode, Object mapConfigs) {
+    init(inputDesc, fieldName, mapClassCode);
     if (!(mapConfigs instanceof Map)) {
-      logger.fatal("Can't initialize object. mapConfigs class is not of type Map. "
-          + mapConfigs.getClass().getName());
+      LOG.fatal("Can't initialize object. mapConfigs class is not of type Map. " + mapConfigs.getClass().getName());
       return false;
     }
+    
     @SuppressWarnings("unchecked")
     Map<String, Object> mapObjects = (Map<String, Object>) mapConfigs;
     newValue = (String) mapObjects.get("new_fieldname");
     if (StringUtils.isEmpty(newValue)) {
-      logger.fatal("Map field value is empty.");
+      LOG.fatal("Map field value is empty.");
       return false;
     }
     return true;
@@ -59,12 +58,9 @@ public class MapperFieldName extends Mapper {
       jsonObj.remove(fieldName);
       jsonObj.put(newValue, value);
     } else {
-      LogFeederUtil.logErrorMessageByInterval(this.getClass()
-          .getSimpleName() + ":apply",
-          "New fieldName is null, so transformation is not applied. "
-              + this.toString(), null, logger, Level.ERROR);
+      LogFeederUtil.logErrorMessageByInterval(this.getClass().getSimpleName() + ":apply",
+          "New fieldName is null, so transformation is not applied. " + this.toString(), null, LOG, Level.ERROR);
     }
     return value;
   }
-
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/1b07a6dd/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/mapper/MapperFieldValue.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/mapper/MapperFieldValue.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/mapper/MapperFieldValue.java
index e618261..87cda65 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/mapper/MapperFieldValue.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/mapper/MapperFieldValue.java
@@ -30,25 +30,25 @@ import org.apache.log4j.Logger;
  * Overrides the value for the field
  */
 public class MapperFieldValue extends Mapper {
-  private Logger logger = Logger.getLogger(MapperFieldValue.class);
+  private static final Logger LOG = Logger.getLogger(MapperFieldValue.class);
+  
   private String prevValue = null;
   private String newValue = null;
 
   @Override
-  public boolean init(String inputDesc, String fieldName,
-      String mapClassCode, Object mapConfigs) {
-    super.init(inputDesc, fieldName, mapClassCode, mapConfigs);
+  public boolean init(String inputDesc, String fieldName, String mapClassCode, Object mapConfigs) {
+    init(inputDesc, fieldName, mapClassCode);
     if (!(mapConfigs instanceof Map)) {
-      logger.fatal("Can't initialize object. mapConfigs class is not of type Map. "
-          + mapConfigs.getClass().getName());
+      LOG.fatal("Can't initialize object. mapConfigs class is not of type Map. " + mapConfigs.getClass().getName());
       return false;
     }
+    
     @SuppressWarnings("unchecked")
     Map<String, Object> mapObjects = (Map<String, Object>) mapConfigs;
     prevValue = (String) mapObjects.get("pre_value");
     newValue = (String) mapObjects.get("post_value");
     if (StringUtils.isEmpty(newValue)) {
-      logger.fatal("Map field value is empty.");
+      LOG.fatal("Map field value is empty.");
       return false;
     }
     return true;
@@ -56,20 +56,15 @@ public class MapperFieldValue extends Mapper {
 
   @Override
   public Object apply(Map<String, Object> jsonObj, Object value) {
-    if (newValue != null) {
-      if (prevValue != null) {
-        if (prevValue.equalsIgnoreCase(value.toString())) {
-          value = newValue;
-          jsonObj.put(fieldName, value);
-        }
+    if (newValue != null && prevValue != null) {
+      if (prevValue.equalsIgnoreCase(value.toString())) {
+        value = newValue;
+        jsonObj.put(fieldName, value);
       }
     } else {
-      LogFeederUtil.logErrorMessageByInterval(
-          this.getClass().getSimpleName() + ":apply",
-          "New value is null, so transformation is not applied. "
-              + this.toString(), null, logger, Level.ERROR);
+      LogFeederUtil.logErrorMessageByInterval(this.getClass().getSimpleName() + ":apply",
+          "New value is null, so transformation is not applied. " + this.toString(), null, LOG, Level.ERROR);
     }
     return value;
   }
-
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/1b07a6dd/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/metrics/LogFeederAMSClient.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/metrics/LogFeederAMSClient.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/metrics/LogFeederAMSClient.java
index c99a091..0766514 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/metrics/LogFeederAMSClient.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/metrics/LogFeederAMSClient.java
@@ -20,25 +20,25 @@
 package org.apache.ambari.logfeeder.metrics;
 
 import org.apache.ambari.logfeeder.util.LogFeederUtil;
+import org.apache.commons.lang3.StringUtils;
 import org.apache.hadoop.metrics2.sink.timeline.AbstractTimelineMetricsSink;
 import org.apache.hadoop.metrics2.sink.timeline.TimelineMetrics;
 import org.apache.log4j.Logger;
 
 public class LogFeederAMSClient extends AbstractTimelineMetricsSink {
-  private static final Logger logger = Logger.getLogger(LogFeederAMSClient.class);
+  private static final Logger LOG = Logger.getLogger(LogFeederAMSClient.class);
 
   private String collectorHosts = null;
 
   public LogFeederAMSClient() {
-    collectorHosts = LogFeederUtil
-      .getStringProperty("logfeeder.metrics.collector.hosts");
-    if (collectorHosts != null && collectorHosts.trim().length() == 0) {
+    collectorHosts = LogFeederUtil.getStringProperty("logfeeder.metrics.collector.hosts");
+    if (StringUtils.isBlank(collectorHosts)) {
       collectorHosts = null;
     }
     if (collectorHosts != null) {
       collectorHosts = collectorHosts.trim();
     }
-    logger.info("AMS collector URL=" + collectorHosts);
+    LOG.info("AMS collector URL=" + collectorHosts);
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/ambari/blob/1b07a6dd/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/metrics/MetricCount.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/metrics/MetricCount.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/metrics/MetricCount.java
deleted file mode 100644
index abb84c7..0000000
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/metrics/MetricCount.java
+++ /dev/null
@@ -1,31 +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.logfeeder.metrics;
-
-public class MetricCount {
-  public String metricsName = null;
-  public boolean isPointInTime = false;
-
-  public long count = 0;
-  public long prevLogCount = 0;
-  public long prevLogMS = System.currentTimeMillis();
-  public long prevPublishCount = 0;
-  public int publishCount = 0; // Count of published metrics. Used for first time sending metrics
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/1b07a6dd/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/metrics/MetricData.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/metrics/MetricData.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/metrics/MetricData.java
new file mode 100644
index 0000000..e7f5d37
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/metrics/MetricData.java
@@ -0,0 +1,46 @@
+/*
+ * 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.logfeeder.metrics;
+
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+
+public class MetricData {
+  public final String metricsName;
+  public final boolean isPointInTime;
+
+  public MetricData(String metricsName, boolean isPointInTime) {
+    this.metricsName = metricsName;
+    this.isPointInTime = isPointInTime;
+  }
+  
+  public long value = 0;
+  public long prevPublishValue = 0;
+  
+  public long prevLogValue = 0;
+  public long prevLogTime = System.currentTimeMillis();
+  
+  public int publishCount = 0; // Number of times the metric was published so far
+  
+  @Override
+  public String toString() {
+    return ToStringBuilder.reflectionToString(this, ToStringStyle.SHORT_PREFIX_STYLE);
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/1b07a6dd/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/metrics/MetricsManager.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/metrics/MetricsManager.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/metrics/MetricsManager.java
new file mode 100644
index 0000000..a679a33
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/metrics/MetricsManager.java
@@ -0,0 +1,178 @@
+/*
+ * 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.logfeeder.metrics;
+
+import java.net.InetAddress;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.TreeMap;
+
+import org.apache.ambari.logfeeder.util.LogFeederUtil;
+import org.apache.hadoop.metrics2.sink.timeline.TimelineMetric;
+import org.apache.hadoop.metrics2.sink.timeline.TimelineMetrics;
+import org.apache.log4j.Logger;
+
+public class MetricsManager {
+  private static final Logger LOG = Logger.getLogger(MetricsManager.class);
+
+  private boolean isMetricsEnabled = false;
+  private String nodeHostName = null;
+  private String appId = "logfeeder";
+
+  private long lastPublishTimeMS = 0; // Let's do the first publish immediately
+  private long lastFailedPublishTimeMS = System.currentTimeMillis(); // Reset the clock
+
+  private int publishIntervalMS = 60 * 1000;
+  private int maxMetricsBuffer = 60 * 60 * 1000; // If AMS is down, we should not keep the metrics in memory forever
+  private HashMap<String, TimelineMetric> metricsMap = new HashMap<String, TimelineMetric>();
+  private LogFeederAMSClient amsClient = null;
+
+  public void init() {
+    LOG.info("Initializing MetricsManager()");
+    amsClient = new LogFeederAMSClient();
+
+    if (amsClient.getCollectorUri(null) != null) {
+      findNodeHostName();
+      if (nodeHostName == null) {
+        isMetricsEnabled = false;
+        LOG.error("Failed getting hostname for node. Disabling publishing LogFeeder metrics");
+      } else {
+        isMetricsEnabled = true;
+        LOG.info("LogFeeder Metrics is enabled. Metrics host=" + amsClient.getCollectorUri(null));
+      }
+    } else {
+      LOG.info("LogFeeder Metrics publish is disabled");
+    }
+  }
+
+  private void findNodeHostName() {
+    nodeHostName = LogFeederUtil.getStringProperty("node.hostname");
+    if (nodeHostName == null) {
+      try {
+        nodeHostName = InetAddress.getLocalHost().getHostName();
+      } catch (Throwable e) {
+        LOG.warn("Error getting hostname using InetAddress.getLocalHost().getHostName()", e);
+      }
+    }
+    if (nodeHostName == null) {
+      try {
+        nodeHostName = InetAddress.getLocalHost().getCanonicalHostName();
+      } catch (Throwable e) {
+        LOG.warn("Error getting hostname using InetAddress.getLocalHost().getCanonicalHostName()", e);
+      }
+      if (nodeHostName == null) {
+        isMetricsEnabled = false;
+        logger.error("Failed getting hostname for node. Disabling publishing LogFeeder metrics");
+      } else {
+        isMetricsEnabled = true;
+        logger.info("LogFeeder Metrics is enabled. Metrics host="
+          + amsClient.getCollectorUri(null));
+      }
+    } else {
+      logger.info("LogFeeder Metrics publish is disabled");
+    }
+  }
+
+  public boolean isMetricsEnabled() {
+    return isMetricsEnabled;
+  }
+
+  public synchronized void useMetrics(List<MetricData> metricsList) {
+    if (!isMetricsEnabled) {
+      return;
+    }
+    LOG.info("useMetrics() metrics.size=" + metricsList.size());
+    long currMS = System.currentTimeMillis();
+
+    gatherMetrics(metricsList, currMS);
+    publishMetrics(currMS);
+  }
+
+  private void gatherMetrics(List<MetricData> metricsList, long currMS) {
+    Long currMSLong = new Long(currMS);
+    for (MetricData metric : metricsList) {
+      if (metric.metricsName == null) {
+        LOG.debug("metric.metricsName is null");
+        continue;
+      }
+      long currCount = metric.value;
+      if (!metric.isPointInTime && metric.publishCount > 0 && currCount <= metric.prevPublishValue) {
+        LOG.debug("Nothing changed. " + metric.metricsName + ", currCount=" + currCount + ", prevPublishCount=" +
+            metric.prevPublishValue);
+        continue;
+      }
+      metric.publishCount++;
+
+      LOG.debug("Ensuring metrics=" + metric.metricsName);
+      TimelineMetric timelineMetric = metricsMap.get(metric.metricsName);
+      if (timelineMetric == null) {
+        LOG.debug("Creating new metric obbject for " + metric.metricsName);
+        timelineMetric = new TimelineMetric();
+        timelineMetric.setMetricName(metric.metricsName);
+        timelineMetric.setHostName(nodeHostName);
+        timelineMetric.setAppId(appId);
+        timelineMetric.setStartTime(currMS);
+        timelineMetric.setType("Long");
+        timelineMetric.setMetricValues(new TreeMap<Long, Double>());
+
+        metricsMap.put(metric.metricsName, timelineMetric);
+      }
+
+      LOG.debug("Adding metrics=" + metric.metricsName);
+      if (metric.isPointInTime) {
+        timelineMetric.getMetricValues().put(currMSLong, new Double(currCount));
+      } else {
+        Double value = timelineMetric.getMetricValues().get(currMSLong);
+        if (value == null) {
+          value = new Double(0);
+        }
+        value += (currCount - metric.prevPublishValue);
+        timelineMetric.getMetricValues().put(currMSLong, value);
+        metric.prevPublishValue = currCount;
+      }
+    }
+  }
+
+  private void publishMetrics(long currMS) {
+    if (!metricsMap.isEmpty() && currMS - lastPublishTimeMS > publishIntervalMS) {
+      try {
+        TimelineMetrics timelineMetrics = new TimelineMetrics();
+        timelineMetrics.setMetrics(new ArrayList<TimelineMetric>(metricsMap.values()));
+        amsClient.emitMetrics(timelineMetrics);
+
+        LOG.info("Published " + timelineMetrics.getMetrics().size() + " metrics to AMS");
+        metricsMap.clear();
+        lastPublishTimeMS = currMS;
+      } catch (Throwable t) {
+        LOG.warn("Error sending metrics to AMS.", t);
+        if (currMS - lastFailedPublishTimeMS > maxMetricsBuffer) {
+          LOG.error("AMS was not sent for last " + maxMetricsBuffer / 1000 +
+              " seconds. Purging it and will start rebuilding it again");
+          metricsMap.clear();
+          lastFailedPublishTimeMS = currMS;
+        }
+      }
+    } else {
+      LOG.info("Not publishing metrics. metrics.size()=" + metricsMap.size() + ", lastPublished=" +
+          (currMS - lastPublishTimeMS) / 1000 + " seconds ago, intervalConfigured=" + publishIntervalMS / 1000);
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/1b07a6dd/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/metrics/MetricsMgr.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/metrics/MetricsMgr.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/metrics/MetricsMgr.java
deleted file mode 100644
index eff9d0d..0000000
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/metrics/MetricsMgr.java
+++ /dev/null
@@ -1,178 +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.logfeeder.metrics;
-
-import java.net.InetAddress;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.TreeMap;
-
-import org.apache.ambari.logfeeder.util.LogFeederUtil;
-import org.apache.hadoop.metrics2.sink.timeline.TimelineMetric;
-import org.apache.hadoop.metrics2.sink.timeline.TimelineMetrics;
-import org.apache.log4j.Logger;
-
-public class MetricsMgr {
-  private static final Logger logger = Logger.getLogger(MetricsMgr.class);
-
-  private boolean isMetricsEnabled = false;
-  private String nodeHostName = null;
-  private String appId = "logfeeder";
-
-  private long lastPublishTimeMS = 0; // Let's do the first publish immediately
-  private long lastFailedPublishTimeMS = System.currentTimeMillis(); // Reset the clock
-
-  private int publishIntervalMS = 60 * 1000;
-  private int maxMetricsBuffer = 60 * 60 * 1000; // If AMS is down, we should not keep
-  // the metrics in memory forever
-  private HashMap<String, TimelineMetric> metricsMap = new HashMap<String, TimelineMetric>();
-  private LogFeederAMSClient amsClient = null;
-
-  public void init() {
-    logger.info("Initializing MetricsMgr()");
-    amsClient = new LogFeederAMSClient();
-
-    if (amsClient.getCollectorUri() != null) {
-      nodeHostName = LogFeederUtil.getStringProperty("node.hostname");
-      if (nodeHostName == null) {
-        try {
-          nodeHostName = InetAddress.getLocalHost().getHostName();
-        } catch (Throwable e) {
-          logger.warn(
-            "Error getting hostname using InetAddress.getLocalHost().getHostName()",
-            e);
-        }
-        if (nodeHostName == null) {
-          try {
-            nodeHostName = InetAddress.getLocalHost()
-              .getCanonicalHostName();
-          } catch (Throwable e) {
-            logger.warn(
-              "Error getting hostname using InetAddress.getLocalHost().getCanonicalHostName()",
-              e);
-          }
-        }
-      }
-      if (nodeHostName == null) {
-        isMetricsEnabled = false;
-        logger.error("Failed getting hostname for node. Disabling publishing LogFeeder metrics");
-      } else {
-        isMetricsEnabled = true;
-        logger.info("LogFeeder Metrics is enabled. Metrics host="
-          + amsClient.getCollectorUri());
-      }
-    } else {
-      logger.info("LogFeeder Metrics publish is disabled");
-    }
-  }
-
-  public boolean isMetricsEnabled() {
-    return isMetricsEnabled;
-  }
-
-  synchronized public void useMetrics(List<MetricCount> metricsList) {
-    if (!isMetricsEnabled) {
-      return;
-    }
-    logger.info("useMetrics() metrics.size=" + metricsList.size());
-    long currMS = System.currentTimeMillis();
-    Long currMSLong = new Long(currMS);
-    for (MetricCount metric : metricsList) {
-      if (metric.metricsName == null) {
-        logger.debug("metric.metricsName is null");
-        // Metrics is not meant to be published
-        continue;
-      }
-      long currCount = metric.count;
-      if (!metric.isPointInTime && metric.publishCount > 0
-        && currCount <= metric.prevPublishCount) {
-        // No new data added, so let's ignore it
-        logger.debug("Nothing changed. " + metric.metricsName
-          + ", currCount=" + currCount + ", prevPublishCount="
-          + metric.prevPublishCount);
-        continue;
-      }
-      metric.publishCount++;
-
-      TimelineMetric timelineMetric = metricsMap.get(metric.metricsName);
-      if (timelineMetric == null) {
-        logger.debug("Creating new metric obbject for "
-          + metric.metricsName);
-        // First time for this metric
-        timelineMetric = new TimelineMetric();
-        timelineMetric.setMetricName(metric.metricsName);
-        timelineMetric.setHostName(nodeHostName);
-        timelineMetric.setAppId(appId);
-        timelineMetric.setStartTime(currMS);
-        timelineMetric.setType("Long");
-        timelineMetric.setMetricValues(new TreeMap<Long, Double>());
-
-        metricsMap.put(metric.metricsName, timelineMetric);
-      }
-      logger.debug("Adding metrics=" + metric.metricsName);
-      if (metric.isPointInTime) {
-        timelineMetric.getMetricValues().put(currMSLong,
-          new Double(currCount));
-      } else {
-        Double value = timelineMetric.getMetricValues().get(currMSLong);
-        if (value == null) {
-          value = new Double(0);
-        }
-        value += (currCount - metric.prevPublishCount);
-        timelineMetric.getMetricValues().put(currMSLong, value);
-        metric.prevPublishCount = currCount;
-      }
-    }
-
-    if (metricsMap.size() > 0
-      && currMS - lastPublishTimeMS > publishIntervalMS) {
-      try {
-        // Time to publish
-        TimelineMetrics timelineMetrics = new TimelineMetrics();
-        List<TimelineMetric> timeLineMetricList = new ArrayList<TimelineMetric>();
-        timeLineMetricList.addAll(metricsMap.values());
-        timelineMetrics.setMetrics(timeLineMetricList);
-        amsClient.emitMetrics(timelineMetrics);
-        logger.info("Published " + timeLineMetricList.size()
-          + " metrics to AMS");
-        metricsMap.clear();
-        timeLineMetricList.clear();
-        lastPublishTimeMS = currMS;
-      } catch (Throwable t) {
-        logger.warn("Error sending metrics to AMS.", t);
-        if (currMS - lastFailedPublishTimeMS > maxMetricsBuffer) {
-          logger.error("AMS was not sent for last "
-            + maxMetricsBuffer
-            / 1000
-            + " seconds. Purging it and will start rebuilding it again");
-          metricsMap.clear();
-          lastFailedPublishTimeMS = currMS;
-        }
-      }
-    } else {
-      logger.info("Not publishing metrics. metrics.size()="
-        + metricsMap.size() + ", lastPublished="
-        + (currMS - lastPublishTimeMS) / 1000
-        + " seconds ago, intervalConfigured=" + publishIntervalMS
-        / 1000);
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/1b07a6dd/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/Output.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/Output.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/Output.java
index 6f84251..bc6a553 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/Output.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/Output.java
@@ -26,16 +26,19 @@ import java.util.Map.Entry;
 
 import org.apache.ambari.logfeeder.common.ConfigBlock;
 import org.apache.ambari.logfeeder.input.InputMarker;
-import org.apache.ambari.logfeeder.metrics.MetricCount;
+import org.apache.ambari.logfeeder.metrics.MetricData;
 import org.apache.ambari.logfeeder.util.LogFeederUtil;
 import org.apache.log4j.Logger;
 
 public abstract class Output extends ConfigBlock {
-  private static final Logger logger = Logger.getLogger(Output.class);
+  private static final Logger LOG = Logger.getLogger(Output.class);
 
   private String destination = null;
 
-  protected MetricCount writeBytesMetric = new MetricCount();
+  protected MetricData writeBytesMetric = new MetricData(getWriteBytesMetricName(), false);
+  protected String getWriteBytesMetricName() {
+    return null;
+  }
 
   @Override
   public String getShortDescription() {
@@ -67,7 +70,7 @@ public abstract class Output extends ConfigBlock {
    * Extend this method to clean up
    */
   public void close() {
-    logger.info("Calling base close()." + getShortDescription());
+    LOG.info("Calling base close()." + getShortDescription());
     isClosed = true;
   }
 
@@ -91,7 +94,7 @@ public abstract class Output extends ConfigBlock {
   }
 
   @Override
-  public void addMetricsContainers(List<MetricCount> metricsList) {
+  public void addMetricsContainers(List<MetricData> metricsList) {
     super.addMetricsContainers(metricsList);
     metricsList.add(writeBytesMetric);
   }

http://git-wip-us.apache.org/repos/asf/ambari/blob/1b07a6dd/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/OutputData.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/OutputData.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/OutputData.java
index 4a408f9..c46086e 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/OutputData.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/OutputData.java
@@ -27,18 +27,16 @@ import org.apache.ambari.logfeeder.input.InputMarker;
  * This contains the output json object and InputMarker.
  */
 public class OutputData {
-  Map<String, Object> jsonObj;
-  InputMarker inputMarker;
+  public final Map<String, Object> jsonObj;
+  public final InputMarker inputMarker;
 
   public OutputData(Map<String, Object> jsonObj, InputMarker inputMarker) {
-    super();
     this.jsonObj = jsonObj;
     this.inputMarker = inputMarker;
   }
 
   @Override
   public String toString() {
-    return "OutputData [jsonObj=" + jsonObj + ", inputMarker="
-      + inputMarker + "]";
+    return "OutputData [jsonObj=" + jsonObj + ", inputMarker=" + inputMarker + "]";
   }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/1b07a6dd/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/OutputDevNull.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/OutputDevNull.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/OutputDevNull.java
index 2d41a0b..fa4e17b 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/OutputDevNull.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/OutputDevNull.java
@@ -28,16 +28,15 @@ import org.apache.log4j.Logger;
  */
 public class OutputDevNull extends Output {
 
-  private static Logger logger = Logger.getLogger(OutputDevNull.class);
+  private static final Logger LOG = Logger.getLogger(OutputDevNull.class);
 
   @Override
   public void write(String block, InputMarker inputMarker){
-    logger.trace("Ignore log block: " + block);
+    LOG.trace("Ignore log block: " + block);
   }
 
   @Override
   public void copyFile(File inputFile, InputMarker inputMarker) {
-    throw new UnsupportedOperationException(
-        "copyFile method is not yet supported for output=dev_null");
+    throw new UnsupportedOperationException("copyFile method is not yet supported for output=dev_null");
   }
 }


[31/58] [abbrv] ambari git commit: AMBARI-18310. Refactor logsearch portal side code - Part 2 (oleewere)

Posted by ol...@apache.org.
AMBARI-18310. Refactor logsearch portal side code - Part 2 (oleewere)

Change-Id: Icd40f5893085a296803fb339419d13f99acfa04a


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

Branch: refs/heads/branch-2.5
Commit: 3d62b004701bd0a0dc392224643a9930828bc090
Parents: 51946d9
Author: oleewere <ol...@gmail.com>
Authored: Wed Sep 7 21:56:39 2016 +0200
Committer: oleewere <ol...@gmail.com>
Committed: Sat Nov 5 14:46:44 2016 +0100

----------------------------------------------------------------------
 ambari-logsearch/ambari-logsearch-it/pom.xml    |   5 +
 .../logsearch/steps/LogSearchApiSteps.java      |  95 +++++++++
 .../ambari/logsearch/steps/SolrSteps.java       |  13 +-
 .../logsearch/story/LogSearchApiQueryStory.java |  22 +++
 .../ambari/logsearch/story/LogSearchStory.java  |   4 +-
 .../story/log_search_api_query_story.story      |  17 ++
 .../story/logfeeder_parsing_story.story         |  16 +-
 .../service-log-level-counts-values.json        |  33 ++++
 .../test-output/service-log-schema.json         |  18 ++
 .../ambari/logfeeder/output/OutputSolr.java     |   9 +-
 .../ambari-logsearch-portal/pom.xml             |   6 +
 .../org/apache/ambari/logsearch/LogSearch.java  |  38 +++-
 .../logsearch/common/ExternalServerClient.java  |  16 +-
 .../logsearch/conf/ApplicationConfig.java       |  41 +---
 .../ambari/logsearch/conf/AuthConfig.java       |  12 +-
 .../ambari/logsearch/conf/SecurityConfig.java   | 112 +++++++++++
 .../ambari/logsearch/dao/SolrDaoBase.java       |   1 -
 .../apache/ambari/logsearch/dao/UserDao.java    |  13 +-
 .../logsearch/manager/AuditLogsManager.java     |  44 +++--
 .../ambari/logsearch/manager/PublicManager.java |   6 +-
 .../logsearch/manager/ServiceLogsManager.java   | 142 ++++---------
 .../logsearch/model/response/AuditLogData.java  |   4 +-
 .../ambari/logsearch/query/QueryGeneration.java |  48 +++--
 .../query/SearchCriteriaConstants.java          |  78 ++++++++
 .../AbstractCommonAuditLogRequestConverter.java |  16 +-
 .../AbstractCommonSearchRequestConverter.java   |  10 +-
 ...bstractCommonServiceLogRequestConverter.java |  39 ++--
 .../query/converter/AbstractConverterAware.java |  47 +++++
 .../converter/AnyGraphRequestConverter.java     |  12 +-
 .../AuditBarGraphRequestConverter.java          |   2 +-
 .../converter/AuditLogRequestConverter.java     |   2 +-
 .../BaseServiceLogRequestConverter.java         |   7 +-
 .../FieldAuditLogRequestConverter.java          |   2 +-
 .../FieldBarGraphRequestConverter.java          |   4 +-
 .../converter/LogFileRequestConverter.java      |   6 +-
 .../converter/LogFileTailRequestConverter.java  |   8 +-
 .../ServiceAnyGraphRequestConverter.java        |  12 +-
 .../ServiceExtremeDatesRequestConverter.java    |   3 +-
 .../converter/ServiceGraphRequestConverter.java |   6 +-
 .../ServiceLogExportRequestConverter.java       |   9 +-
 .../ServiceLogFileRequestConverter.java         |   4 +-
 .../converter/ServiceLogRequestConverter.java   |  14 +-
 .../ServiceLogTruncatedRequestConverter.java    |  10 +-
 .../converter/SimpleQueryRequestConverter.java  |  11 +-
 .../converter/UserConfigRequestConverter.java   |  10 +-
 .../converter/UserExportRequestConverter.java   |   3 +-
 .../query/model/AnyGraphSearchCriteria.java     |  56 +++++-
 .../model/AuditBarGraphSearchCriteria.java      |  12 +-
 .../query/model/AuditLogSearchCriteria.java     |  12 +-
 .../query/model/CommonSearchCriteria.java       |  93 +++++----
 .../model/CommonServiceLogSearchCriteria.java   |  96 +++++++++
 .../model/FieldAuditBarGraphSearchCriteria.java |  11 +-
 .../model/FieldAuditLogSearchCriteria.java      |  11 +-
 .../query/model/LogFileSearchCriteria.java      |  29 ++-
 .../query/model/LogFileTailSearchCriteria.java  |  13 +-
 .../logsearch/query/model/SearchCriteria.java   |  60 +++---
 .../model/ServiceAnyGraphSearchCriteria.java    |  37 +++-
 .../model/ServiceExtremeDatesCriteria.java      |  11 +-
 .../query/model/ServiceGraphSearchCriteria.java |  11 +-
 .../model/ServiceLogExportSearchCriteria.java   |  19 +-
 .../model/ServiceLogFileSearchCriteria.java     |  21 +-
 .../query/model/ServiceLogSearchCriteria.java   |  44 ++++-
 .../ServiceLogTruncatedSearchCriteria.java      |  27 ++-
 .../query/model/UserConfigSearchCriteria.java   |  27 ++-
 .../query/model/UserExportSearchCriteria.java   |  10 +-
 .../logsearch/rest/AuditLogsResource.java       |   2 +-
 .../logsearch/rest/ServiceLogsResource.java     |   7 +-
 .../logsearch/solr/metrics/SolrJmxAdapter.java  | 134 -------------
 .../solr/metrics/SolrMetricsLoader.java         | 198 -------------------
 .../logsearch/solr/model/SolrAuditLogData.java  |   6 +-
 .../LogsearchLogoutSuccessHandler.java          |   2 +-
 .../LogsearchAuthenticationEntryPoint.java      |   2 +-
 .../LogsearchKRBAuthenticationFilter.java       |   1 +
 ...LogsearchSecurityContextFormationFilter.java |   1 +
 ...rchUsernamePasswordAuthenticationFilter.java |   2 +
 .../web/listeners/SpringEventListener.java      |  32 ---
 ...LogsearchAbstractAuthenticationProvider.java |  10 -
 .../LogsearchAuthenticationProvider.java        |  13 +-
 ...rchExternalServerAuthenticationProvider.java |  12 +-
 .../LogsearchFileAuthenticationProvider.java    |  11 +-
 .../LogsearchLdapAuthenticationProvider.java    |  22 ++-
 .../LogsearchLdapBindAuthenticator.java         |  64 +-----
 .../LogsearchSimpleAuthenticationProvider.java  |  13 +-
 .../src/main/resources/log4j.xml                |   6 +-
 .../META-INF/security-applicationContext.xml    |  83 --------
 .../src/main/webapp/WEB-INF/web.xml             |  62 ------
 .../test-config/logfeeder/logfeeder.properties  |   3 +-
 .../shipper-conf/input.config-hdfs.json         | 172 ++++++++++++++++
 .../docker/test-logs/hdfs-audit/hdfs-audit.log  |   4 +
 89 files changed, 1410 insertions(+), 1082 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/3d62b004/ambari-logsearch/ambari-logsearch-it/pom.xml
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-it/pom.xml b/ambari-logsearch/ambari-logsearch-it/pom.xml
index f9a62cd..1355a27 100644
--- a/ambari-logsearch/ambari-logsearch-it/pom.xml
+++ b/ambari-logsearch/ambari-logsearch-it/pom.xml
@@ -82,6 +82,11 @@
       <artifactId>slf4j-log4j12</artifactId>
       <version>1.7.10</version>
     </dependency>
+    <dependency>
+      <groupId>com.flipkart.zjsonpatch</groupId>
+      <artifactId>zjsonpatch</artifactId>
+      <version>0.2.4</version>
+    </dependency>
   </dependencies>
 
   <build>

http://git-wip-us.apache.org/repos/asf/ambari/blob/3d62b004/ambari-logsearch/ambari-logsearch-it/src/test/java/org/apache/ambari/logsearch/steps/LogSearchApiSteps.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-it/src/test/java/org/apache/ambari/logsearch/steps/LogSearchApiSteps.java b/ambari-logsearch/ambari-logsearch-it/src/test/java/org/apache/ambari/logsearch/steps/LogSearchApiSteps.java
new file mode 100644
index 0000000..bcfc4db
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-it/src/test/java/org/apache/ambari/logsearch/steps/LogSearchApiSteps.java
@@ -0,0 +1,95 @@
+/*
+ * 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.steps;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.flipkart.zjsonpatch.JsonDiff;
+import com.google.common.io.Resources;
+import org.apache.ambari.logsearch.domain.StoryDataRegistry;
+import org.glassfish.jersey.client.JerseyClient;
+import org.glassfish.jersey.client.JerseyClientBuilder;
+import org.glassfish.jersey.client.authentication.HttpAuthenticationFeature;
+import org.jbehave.core.annotations.Named;
+import org.jbehave.core.annotations.Then;
+import org.jbehave.core.annotations.When;
+import org.junit.Assert;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.ws.rs.client.Invocation;
+import javax.ws.rs.client.WebTarget;
+import javax.ws.rs.core.MediaType;
+import java.io.File;
+import java.io.IOException;
+import java.net.URISyntaxException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+public class LogSearchApiSteps {
+
+  private static Logger LOG = LoggerFactory.getLogger(LogSearchApiSteps.class);
+
+  private String response;
+
+  @When("LogSearch api query sent: <apiQuery>")
+  public void sendApiQuery(@Named("apiQuery") String apiQuery) {
+    JerseyClient jerseyClient = JerseyClientBuilder.createClient();
+    HttpAuthenticationFeature authFeature = HttpAuthenticationFeature.basicBuilder()
+      .credentials("admin", "admin")
+      .build();
+    jerseyClient.register(authFeature);
+
+    String logsearchUrl = String.format("http://%s:%d%s",
+      StoryDataRegistry.INSTANCE.getDockerHost(),
+      StoryDataRegistry.INSTANCE.getLogsearchPort(),
+      apiQuery);
+
+    LOG.info("Url: {}", logsearchUrl);
+
+    WebTarget target = jerseyClient.target(logsearchUrl);
+    Invocation.Builder invocationBuilder =  target.request(MediaType.APPLICATION_JSON_TYPE);
+    response = invocationBuilder.get().readEntity(String.class);
+  }
+
+
+  @Then("The api query result is <jsonResult>")
+  public void verifyRestApiCall(@Named("jsonResult") String jsonResult) throws IOException, URISyntaxException {
+    ObjectMapper mapper = new ObjectMapper();
+    Path jsonFilePath = new File(Resources.getResource("test-output/" + jsonResult).toURI()).toPath();
+    String jsonExpected = new String(Files.readAllBytes(jsonFilePath));
+
+    JsonNode expected = mapper.readTree(jsonExpected);
+    JsonNode result = mapper.readTree(response);
+    JsonNode patch = JsonDiff.asJson(expected, result);
+    List<Object> diffObjects = mapper.convertValue(patch, List.class);
+    assertDiffs(diffObjects, expected);
+
+  }
+
+  private void assertDiffs(List<Object> diffObjects, JsonNode expected) {
+    for (Object diffObj : diffObjects) {
+      String path = ((Map<String, String>) diffObj).get("path");
+      Assert.assertTrue(expected.at(path).isMissingNode());
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/3d62b004/ambari-logsearch/ambari-logsearch-it/src/test/java/org/apache/ambari/logsearch/steps/SolrSteps.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-it/src/test/java/org/apache/ambari/logsearch/steps/SolrSteps.java b/ambari-logsearch/ambari-logsearch-it/src/test/java/org/apache/ambari/logsearch/steps/SolrSteps.java
index e1e5b99..7c72ca7 100644
--- a/ambari-logsearch/ambari-logsearch-it/src/test/java/org/apache/ambari/logsearch/steps/SolrSteps.java
+++ b/ambari-logsearch/ambari-logsearch-it/src/test/java/org/apache/ambari/logsearch/steps/SolrSteps.java
@@ -22,25 +22,24 @@ import org.apache.ambari.logsearch.domain.StoryDataRegistry;
 import org.apache.solr.client.solrj.SolrClient;
 import org.apache.solr.client.solrj.SolrQuery;
 import org.apache.solr.client.solrj.SolrServerException;
-import org.apache.solr.client.solrj.impl.CloudSolrClient;
-import org.apache.solr.client.solrj.impl.HttpSolrClient;
 import org.apache.solr.client.solrj.response.QueryResponse;
 import org.apache.solr.common.SolrDocumentList;
-import org.jbehave.core.annotations.Given;
+import org.jbehave.core.annotations.Named;
 import org.jbehave.core.annotations.Then;
-import org.jbehave.core.annotations.When;
-import org.jbehave.core.model.Story;
 import org.junit.Assert;
 
 import java.io.IOException;
 
 public class SolrSteps {
 
-  @Then("the number of $component docs is: $docSize")
-  public void numberOfDocsForComponent(String component, int docSize) throws IOException, SolrServerException {
+  @Then("the number of <component> docs is: <docSize>")
+  public void numberOfDocsForComponent(@Named("component") String component, @Named("docSize") int docSize)
+    throws IOException, SolrServerException, InterruptedException {
     SolrClient solrClient = StoryDataRegistry.INSTANCE.getCloudSolrClient();
     SolrQuery solrQuery = new SolrQuery();
     solrQuery.setQuery(String.format("type:%s", component));
+    solrQuery.setStart(0);
+    solrQuery.setRows(20);
     QueryResponse queryResponse = solrClient.query(StoryDataRegistry.INSTANCE.getServiceLogsCollection(), solrQuery);
     SolrDocumentList list = queryResponse.getResults();
     Assert.assertEquals(docSize, list.size());

http://git-wip-us.apache.org/repos/asf/ambari/blob/3d62b004/ambari-logsearch/ambari-logsearch-it/src/test/java/org/apache/ambari/logsearch/story/LogSearchApiQueryStory.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-it/src/test/java/org/apache/ambari/logsearch/story/LogSearchApiQueryStory.java b/ambari-logsearch/ambari-logsearch-it/src/test/java/org/apache/ambari/logsearch/story/LogSearchApiQueryStory.java
new file mode 100644
index 0000000..45455bf
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-it/src/test/java/org/apache/ambari/logsearch/story/LogSearchApiQueryStory.java
@@ -0,0 +1,22 @@
+/*
+ * 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.story;
+
+public class LogSearchApiQueryStory extends LogSearchStory {
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/3d62b004/ambari-logsearch/ambari-logsearch-it/src/test/java/org/apache/ambari/logsearch/story/LogSearchStory.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-it/src/test/java/org/apache/ambari/logsearch/story/LogSearchStory.java b/ambari-logsearch/ambari-logsearch-it/src/test/java/org/apache/ambari/logsearch/story/LogSearchStory.java
index f85eb08..ce6b9cb 100644
--- a/ambari-logsearch/ambari-logsearch-it/src/test/java/org/apache/ambari/logsearch/story/LogSearchStory.java
+++ b/ambari-logsearch/ambari-logsearch-it/src/test/java/org/apache/ambari/logsearch/story/LogSearchStory.java
@@ -18,6 +18,7 @@
  */
 package org.apache.ambari.logsearch.story;
 
+import org.apache.ambari.logsearch.steps.LogSearchApiSteps;
 import org.apache.ambari.logsearch.steps.SolrSteps;
 import org.apache.ambari.logsearch.steps.LogSearchDockerSteps;
 import org.jbehave.core.configuration.Configuration;
@@ -47,7 +48,8 @@ abstract public class LogSearchStory extends JUnitStory {
   public InjectableStepsFactory stepsFactory() {
     return new InstanceStepsFactory(configuration(),
       new LogSearchDockerSteps(),
-      new SolrSteps());
+      new SolrSteps(),
+      new LogSearchApiSteps());
   }
 
   @Test

http://git-wip-us.apache.org/repos/asf/ambari/blob/3d62b004/ambari-logsearch/ambari-logsearch-it/src/test/resources/org/apache/ambari/logsearch/story/log_search_api_query_story.story
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-it/src/test/resources/org/apache/ambari/logsearch/story/log_search_api_query_story.story b/ambari-logsearch/ambari-logsearch-it/src/test/resources/org/apache/ambari/logsearch/story/log_search_api_query_story.story
new file mode 100644
index 0000000..5abe8b4
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-it/src/test/resources/org/apache/ambari/logsearch/story/log_search_api_query_story.story
@@ -0,0 +1,17 @@
+Meta:
+
+Narrative:
+As a user
+I want to perform queries against Log Search api
+So that I can validate the json outputs
+
+Scenario: scenario description
+
+Given logsearch docker container
+When LogSearch api query sent: <apiQuery>
+Then The api query result is <jsonResult>
+
+Examples:
+|apiQuery|jsonResult|
+|/api/v1/service/logs/schema/fields|service-log-schema.json|
+|/api/v1/service/logs/levels/counts/namevalues?page=0&pageSize=25&startIndex=0&q=*%3A*|service-log-level-counts-values.json|
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/3d62b004/ambari-logsearch/ambari-logsearch-it/src/test/resources/org/apache/ambari/logsearch/story/logfeeder_parsing_story.story
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-it/src/test/resources/org/apache/ambari/logsearch/story/logfeeder_parsing_story.story b/ambari-logsearch/ambari-logsearch-it/src/test/resources/org/apache/ambari/logsearch/story/logfeeder_parsing_story.story
index a40d04a..388e624 100644
--- a/ambari-logsearch/ambari-logsearch-it/src/test/resources/org/apache/ambari/logsearch/story/logfeeder_parsing_story.story
+++ b/ambari-logsearch/ambari-logsearch-it/src/test/resources/org/apache/ambari/logsearch/story/logfeeder_parsing_story.story
@@ -5,14 +5,16 @@ As a user
 I want to start logsearch/logfeeder/solr components in a docker container with test logs
 So that I can parse and store the logs into Solr
 
-Scenario: Logsearch logs are stored into Solr.
+Scenario: Number of logs for components
 
 Given logsearch docker container
 When logfeeder started (parse logs & send data to solr)
-Then the number of logsearch_app docs is: 1
+Then the number of <component> docs is: <docSize>
 
-Scenario: Zookeeper logs are stored into Solr.
-
-Given logsearch docker container
-When logfeeder started (parse logs & send data to solr)
-Then the number of zookeeper docs is: 3
+Examples:
+|component|docSize|
+|logsearch_app|1|
+|zookeeper|3|
+|hst_agent|4|
+|secure_log|11|
+|system_message|17|

http://git-wip-us.apache.org/repos/asf/ambari/blob/3d62b004/ambari-logsearch/ambari-logsearch-it/src/test/resources/test-output/service-log-level-counts-values.json
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-it/src/test/resources/test-output/service-log-level-counts-values.json b/ambari-logsearch/ambari-logsearch-it/src/test/resources/test-output/service-log-level-counts-values.json
new file mode 100644
index 0000000..0ef05e8
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-it/src/test/resources/test-output/service-log-level-counts-values.json
@@ -0,0 +1,33 @@
+{
+  "vNameValues": [
+    {
+      "name": "FATAL",
+      "value": "0"
+    },
+    {
+      "name": "ERROR",
+      "value": "0"
+    },
+    {
+      "name": "WARN",
+      "value": "3"
+    },
+    {
+      "name": "INFO",
+      "value": "4"
+    },
+    {
+      "name": "DEBUG",
+      "value": "1"
+    },
+    {
+      "name": "TRACE",
+      "value": "0"
+    },
+    {
+      "name": "UNKNOWN",
+      "value": "28"
+    }
+  ],
+  "listSize": 7
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/3d62b004/ambari-logsearch/ambari-logsearch-it/src/test/resources/test-output/service-log-schema.json
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-it/src/test/resources/test-output/service-log-schema.json b/ambari-logsearch/ambari-logsearch-it/src/test/resources/test-output/service-log-schema.json
new file mode 100644
index 0000000..9efa58b
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-it/src/test/resources/test-output/service-log-schema.json
@@ -0,0 +1,18 @@
+{
+  "log_message": "Log Message",
+  "bundle_id": "Bundle Id",
+  "case_id": "Case Id",
+  "cluster": "Cluster",
+  "event_count": "Event Count",
+  "file": "File",
+  "host": "Host",
+  "id": "Id",
+  "ip": "IP",
+  "level": "Level",
+  "logfile_line_number": "Logfile Line Number",
+  "logger_name": "Logger Name",
+  "method": "method",
+  "path": "Path",
+  "text": "Text",
+  "type": "Type"
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/3d62b004/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/OutputSolr.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/OutputSolr.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/OutputSolr.java
index 47f139d..53cb6c0 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/OutputSolr.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/OutputSolr.java
@@ -77,17 +77,17 @@ public class OutputSolr extends Output {
 
   private BlockingQueue<OutputData> outgoingBuffer = null;
   private List<SolrWorkerThread> workerThreadList = new ArrayList<>();
-  
+
   @Override
   protected String getStatMetricName() {
     return "output.solr.write_logs";
   }
-  
+
   @Override
   protected String getWriteBytesMetricName() {
     return "output.solr.write_bytes";
   }
-  
+
   @Override
   public void init() throws Exception {
     super.init();
@@ -263,6 +263,9 @@ public class OutputSolr extends Output {
   private void useActualDateIfNeeded(Map<String, Object> jsonObj) {
     if (skipLogtime) {
       jsonObj.put("logtime", DateUtil.getActualDateStr());
+      if (jsonObj.get("evtTime") != null) {
+        jsonObj.put("evtTime", DateUtil.getActualDateStr());
+      }
     }
   }
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/3d62b004/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 7b3b174..486a0ba 100755
--- a/ambari-logsearch/ambari-logsearch-portal/pom.xml
+++ b/ambari-logsearch/ambari-logsearch-portal/pom.xml
@@ -36,6 +36,7 @@
     <jersey.version>2.23.2</jersey.version>
     <jetty-version>9.2.11.v20150529</jetty-version>
     <swagger.version>1.5.8</swagger.version>
+    <spring-data-solr.version>2.0.2.RELEASE</spring-data-solr.version>
   </properties>
   <profiles>
     <!-- Dev Profile Start -->
@@ -751,5 +752,10 @@
       <artifactId>swagger-ui</artifactId>
       <version>2.1.0</version>
     </dependency>
+    <dependency>
+      <groupId>org.springframework.data</groupId>
+      <artifactId>spring-data-solr</artifactId>
+      <version>${spring-data-solr.version}</version>
+    </dependency>
   </dependencies>
 </project>

http://git-wip-us.apache.org/repos/asf/ambari/blob/3d62b004/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/LogSearch.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/LogSearch.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/LogSearch.java
index 27b943a..75d8be3 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/LogSearch.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/LogSearch.java
@@ -24,11 +24,11 @@ import java.net.ServerSocket;
 import java.net.URI;
 import java.net.URISyntaxException;
 import java.net.URL;
+import java.util.EnumSet;
 
-import org.apache.ambari.logsearch.common.ConfigHelper;
 import org.apache.ambari.logsearch.common.ManageStartEndTime;
 import org.apache.ambari.logsearch.common.PropertiesHelper;
-import org.apache.ambari.logsearch.solr.metrics.SolrMetricsLoader;
+import org.apache.ambari.logsearch.conf.ApplicationConfig;
 import org.apache.commons.lang.StringUtils;
 import org.apache.log4j.Logger;
 import org.eclipse.jetty.server.Connector;
@@ -40,10 +40,18 @@ import org.eclipse.jetty.server.ServerConnector;
 import org.eclipse.jetty.server.SslConnectionFactory;
 import org.eclipse.jetty.server.handler.HandlerList;
 import org.eclipse.jetty.server.handler.ResourceHandler;
+import org.eclipse.jetty.servlet.FilterHolder;
 import org.eclipse.jetty.servlet.ServletContextHandler;
+import org.eclipse.jetty.servlet.ServletHolder;
 import org.eclipse.jetty.util.resource.Resource;
 import org.eclipse.jetty.util.ssl.SslContextFactory;
 import org.eclipse.jetty.webapp.WebAppContext;
+import org.springframework.web.context.ContextLoaderListener;
+import org.springframework.web.context.request.RequestContextListener;
+import org.springframework.web.context.support.AnnotationConfigWebApplicationContext;
+import org.springframework.web.filter.DelegatingFilterProxy;
+
+import javax.servlet.DispatcherType;
 
 public class LogSearch {
   private static final Logger logger = Logger.getLogger(LogSearch.class);
@@ -65,6 +73,7 @@ public class LogSearch {
   
   private static final String WEB_RESOURCE_FOLDER = "webapps/app";
   private static final String ROOT_CONTEXT = "/";
+  private static final Integer SESSION_TIMEOUT = 30;
 
  
   public static void main(String[] argv) {
@@ -75,7 +84,6 @@ public class LogSearch {
     } catch (Throwable e) {
       logger.error("Error running logsearch server", e);
     }
-    SolrMetricsLoader.startSolrMetricsLoaderTasks();
   }
   
   public void run(String[] argv) throws Exception {
@@ -150,6 +158,21 @@ public class LogSearch {
     context.setBaseResource(Resource.newResource(webResourceBase));
     context.setContextPath(ROOT_CONTEXT);
     context.setParentLoaderPriority(true);
+
+    // Configure Spring
+    context.addEventListener(new ContextLoaderListener());
+    context.addEventListener(new RequestContextListener());
+    context.addFilter(new FilterHolder(new DelegatingFilterProxy("springSecurityFilterChain")), "/*", EnumSet.allOf(DispatcherType.class));
+    context.setInitParameter("contextClass", AnnotationConfigWebApplicationContext.class.getName());
+    context.setInitParameter("contextConfigLocation", ApplicationConfig.class.getName());
+
+    // Configure Jersey
+    ServletHolder jerseyServlet = context.addServlet(org.glassfish.jersey.servlet.ServletContainer.class, "/api/v1/*");
+    jerseyServlet.setInitOrder(1);
+    jerseyServlet.setInitParameter("jersey.config.server.provider.packages","org.apache.ambari.logsearch.rest,io.swagger.jaxrs.listing");
+
+    context.getSessionHandler().getSessionManager().setMaxInactiveInterval(SESSION_TIMEOUT);
+
     return context;
   }
 
@@ -167,18 +190,19 @@ public class LogSearch {
   private URI findWebResourceBase() {
     URL fileCompleteUrl = Thread.currentThread().getContextClassLoader()
         .getResource(WEB_RESOURCE_FOLDER);
+    String errorMessage = "Web Resource Folder " + WEB_RESOURCE_FOLDER+ " not found in classpath";
     if (fileCompleteUrl != null) {
       try {
         return fileCompleteUrl.toURI().normalize();
       } catch (URISyntaxException e) {
-        logger.error("Web Resource Folder " + WEB_RESOURCE_FOLDER+ " not found in classpath", e);
+        logger.error(errorMessage, e);
         System.exit(1);
       }
-    }else{
-      logger.error("Web Resource Folder " + WEB_RESOURCE_FOLDER+ " not found in classpath");
+    } else {
+      logger.error(errorMessage);
       System.exit(1);
     }
-    return null;
+    throw new IllegalStateException(errorMessage);
   }
 
   private void checkPort(int port) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/3d62b004/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 edc78d1..2590dfe 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
@@ -21,7 +21,6 @@ package org.apache.ambari.logsearch.common;
 import java.util.List;
 import java.util.Map;
 
-import javax.annotation.PostConstruct;
 import javax.inject.Inject;
 import javax.ws.rs.client.Invocation;
 import javax.ws.rs.client.WebTarget;
@@ -29,7 +28,6 @@ import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.MultivaluedMap;
 
 import org.apache.ambari.logsearch.conf.AuthConfig;
-import org.apache.ambari.logsearch.web.security.LogsearchAbstractAuthenticationProvider;
 import org.apache.commons.lang.StringUtils;
 import org.apache.log4j.Logger;
 import org.glassfish.jersey.client.JerseyClient;
@@ -55,23 +53,18 @@ public class ExternalServerClient {
   @Inject
   private AuthConfig authConfig;
 
-  private boolean enableLog = false;// default
-
   /**
    * Send GET request to an external server
    */
-  @SuppressWarnings({ "unchecked", "rawtypes" })
   public Object sendGETRequest(String url, Class klass, MultivaluedMap<String, String> queryParam,
                                String username, String password)
       throws Exception {
     url = authConfig.getExternalAuthHostUrl() + url;
     JerseyClient client = localJerseyClient.get();
-    HttpAuthenticationFeature authFeature = HttpAuthenticationFeature.basicBuilder().build();
-
+    HttpAuthenticationFeature authFeature = HttpAuthenticationFeature.basicBuilder()
+      .credentials(username, password)
+      .build();
     client.register(authFeature);
-    if (enableLog) {
-      client.register(LoggingFilter.class);
-    }
 
     WebTarget target = client.target(url);
     LOG.debug("URL: " + url);
@@ -80,9 +73,6 @@ public class ExternalServerClient {
       LOG.debug(
         String.format("Query parameter: name - %s  ; value - %s ;" + entry.getKey(), StringUtils.join(entry.getValue(),',')));
     }
-    target
-      .property(HttpAuthenticationFeature.HTTP_AUTHENTICATION_BASIC_USERNAME, username)
-      .property(HttpAuthenticationFeature.HTTP_AUTHENTICATION_BASIC_PASSWORD, password);
     Invocation.Builder invocationBuilder =  target.request(MediaType.APPLICATION_JSON_TYPE);
     try {
       return invocationBuilder.get().readEntity(klass);

http://git-wip-us.apache.org/repos/asf/ambari/blob/3d62b004/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/ApplicationConfig.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/ApplicationConfig.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/ApplicationConfig.java
index 72ea942..b279a83 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/ApplicationConfig.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/ApplicationConfig.java
@@ -18,38 +18,16 @@
  */
 package org.apache.ambari.logsearch.conf;
 
-import org.apache.ambari.logsearch.query.converter.AnyGraphRequestConverter;
-import org.apache.ambari.logsearch.query.converter.AuditBarGraphRequestConverter;
-import org.apache.ambari.logsearch.query.converter.AuditLogRequestConverter;
-import org.apache.ambari.logsearch.query.converter.BaseAuditLogRequestConverter;
-import org.apache.ambari.logsearch.query.converter.BaseServiceLogRequestConverter;
-import org.apache.ambari.logsearch.query.converter.FieldAuditLogRequestConverter;
-import org.apache.ambari.logsearch.query.converter.FieldBarGraphRequestConverter;
-import org.apache.ambari.logsearch.query.converter.ServiceAnyGraphRequestConverter;
-import org.apache.ambari.logsearch.query.converter.ServiceExtremeDatesRequestConverter;
-import org.apache.ambari.logsearch.query.converter.ServiceGraphRequestConverter;
-import org.apache.ambari.logsearch.query.converter.ServiceLogExportRequestConverter;
-import org.apache.ambari.logsearch.query.converter.ServiceLogFileRequestConverter;
-import org.apache.ambari.logsearch.query.converter.ServiceLogRequestConverter;
-import org.apache.ambari.logsearch.query.converter.ServiceLogTruncatedRequestConverter;
-import org.apache.ambari.logsearch.query.converter.SimpleQueryRequestConverter;
-import org.apache.ambari.logsearch.query.converter.UserExportRequestConverter;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.ComponentScan;
 import org.springframework.context.annotation.Configuration;
-import org.springframework.context.annotation.ImportResource;
 import org.springframework.context.annotation.PropertySource;
 import org.springframework.context.support.ConversionServiceFactoryBean;
 import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
-import org.springframework.core.convert.converter.Converter;
-
-import java.util.HashSet;
-import java.util.Set;
 
 @Configuration
 @ComponentScan("org.apache.ambari.logsearch")
 @PropertySource(value = {"classpath:default.properties", "classpath:logsearch.properties"})
-@ImportResource("META-INF/security-applicationContext.xml")
 public class ApplicationConfig {
 
   @Bean
@@ -60,24 +38,7 @@ public class ApplicationConfig {
   @Bean(name="conversionService")
   public ConversionServiceFactoryBean conversionServiceFactoryBean() {
     ConversionServiceFactoryBean conversionServiceFactoryBean = new ConversionServiceFactoryBean();
-    Set<Converter> converters = new HashSet<>();
-    converters.add(new AnyGraphRequestConverter());
-    converters.add(new AuditBarGraphRequestConverter());
-    converters.add(new AuditLogRequestConverter());
-    converters.add(new BaseAuditLogRequestConverter());
-    converters.add(new BaseServiceLogRequestConverter());
-    converters.add(new FieldAuditLogRequestConverter());
-    converters.add(new FieldBarGraphRequestConverter());
-    converters.add(new SimpleQueryRequestConverter());
-    converters.add(new UserExportRequestConverter());
-    converters.add(new ServiceAnyGraphRequestConverter());
-    converters.add(new ServiceExtremeDatesRequestConverter());
-    converters.add(new ServiceGraphRequestConverter());
-    converters.add(new ServiceLogExportRequestConverter());
-    converters.add(new ServiceLogFileRequestConverter());
-    converters.add(new ServiceLogRequestConverter());
-    converters.add(new ServiceLogTruncatedRequestConverter());
-    conversionServiceFactoryBean.setConverters(converters);
+    conversionServiceFactoryBean.afterPropertiesSet();
     return conversionServiceFactoryBean;
   }
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/3d62b004/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/AuthConfig.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/AuthConfig.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/AuthConfig.java
index 3398a83..46d07bd 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/AuthConfig.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/AuthConfig.java
@@ -30,9 +30,11 @@ public class AuthConfig {
   boolean authLdapEnabled;
   @Value("${logsearch.auth.simple.enable:false}")
   boolean authSimpleEnabled;
+  @Value("${logsearch.auth.external_auth.enable:false}")
+  boolean authExternalEnabled;
   @Value("${logsearch.auth.external_auth.host_url:'http://ip:port'}")
   private String externalAuthHostUrl;
-  @Value("${logsearch.auth.login_url:/api/v1/users/$USERNAME/privileges?fields=*}")
+  @Value("${logsearch.auth.external_auth.login_url:/api/v1/users/$USERNAME/privileges?fields=*}")
   private String externalAuthLoginUrl;
   @Value("${logsearch.login.credentials.file:user_pass.json}")
   private String credentialsFile;
@@ -84,4 +86,12 @@ public class AuthConfig {
   public void setExternalAuthLoginUrl(String externalAuthLoginUrl) {
     this.externalAuthLoginUrl = externalAuthLoginUrl;
   }
+
+  public boolean isAuthExternalEnabled() {
+    return authExternalEnabled;
+  }
+
+  public void setAuthExternalEnabled(boolean authExternalEnabled) {
+    this.authExternalEnabled = authExternalEnabled;
+  }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/3d62b004/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/SecurityConfig.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/SecurityConfig.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/SecurityConfig.java
new file mode 100644
index 0000000..d3db110
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/SecurityConfig.java
@@ -0,0 +1,112 @@
+/*
+ * 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.conf;
+
+import org.apache.ambari.logsearch.web.authenticate.LogsearchAuthFailureHandler;
+import org.apache.ambari.logsearch.web.authenticate.LogsearchAuthSuccessHandler;
+import org.apache.ambari.logsearch.web.authenticate.LogsearchLogoutSuccessHandler;
+import org.apache.ambari.logsearch.web.filters.LogsearchAuthenticationEntryPoint;
+import org.apache.ambari.logsearch.web.filters.LogsearchKRBAuthenticationFilter;
+import org.apache.ambari.logsearch.web.filters.LogsearchSecurityContextFormationFilter;
+import org.apache.ambari.logsearch.web.filters.LogsearchUsernamePasswordAuthenticationFilter;
+import org.apache.ambari.logsearch.web.security.LogsearchAuthenticationProvider;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.security.config.annotation.web.builders.HttpSecurity;
+import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
+import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
+import org.springframework.security.config.http.SessionCreationPolicy;
+import org.springframework.security.web.access.intercept.FilterSecurityInterceptor;
+import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
+
+@Configuration
+@EnableWebSecurity
+public class SecurityConfig extends WebSecurityConfigurerAdapter {
+
+  @Override
+  protected void configure(HttpSecurity http) throws Exception {
+    http
+      .csrf().disable()
+      .sessionManagement()
+         .sessionFixation()
+         .newSession()
+         .sessionCreationPolicy(SessionCreationPolicy.ALWAYS)
+      .and()
+      .authorizeRequests()
+        .antMatchers("/login.html").permitAll()
+        .antMatchers("/styles/**").permitAll()
+        .antMatchers("/fonts/**").permitAll()
+        .antMatchers("/fonts/**").permitAll()
+        .antMatchers("/scripts/**").permitAll()
+        .antMatchers("/libs/**").permitAll()
+        .antMatchers("/images/**").permitAll()
+        .antMatchers("/templates/**").permitAll()
+        .antMatchers("/favicon.ico").permitAll()
+        .antMatchers("/api/v1/public/**").permitAll()
+        .antMatchers("/api/v1/swagger.json").permitAll()
+        .antMatchers("/**").authenticated()
+      .and()
+      .authenticationProvider(logsearchAuthenticationProvider())
+        .formLogin()
+        .loginPage("/login.html")
+      .and()
+      .httpBasic()
+        .authenticationEntryPoint(logsearchAuthenticationEntryPoint())
+      .and()
+      .addFilterBefore(logsearchUsernamePasswordAuthenticationFilter(), UsernamePasswordAuthenticationFilter.class)
+      .addFilterBefore(new LogsearchKRBAuthenticationFilter(), UsernamePasswordAuthenticationFilter.class)
+      .addFilterAfter(securityContextFormationFilter(), FilterSecurityInterceptor.class)
+      .logout()
+        .logoutUrl("/logout.html")
+        .deleteCookies("JSESSIONID")
+        .logoutSuccessHandler(new LogsearchLogoutSuccessHandler());
+  }
+
+  @Bean
+  public LogsearchSecurityContextFormationFilter securityContextFormationFilter() {
+    return new LogsearchSecurityContextFormationFilter();
+  }
+
+  @Bean
+  public LogsearchKRBAuthenticationFilter logsearchKRBAuthenticationFilter() {
+    return new LogsearchKRBAuthenticationFilter();
+  }
+
+  @Bean
+  public LogsearchAuthenticationProvider logsearchAuthenticationProvider() {
+    return new LogsearchAuthenticationProvider();
+  }
+
+  @Bean
+  public LogsearchAuthenticationEntryPoint logsearchAuthenticationEntryPoint() {
+    LogsearchAuthenticationEntryPoint entryPoint = new LogsearchAuthenticationEntryPoint("/login.html");
+    entryPoint.setForceHttps(false);
+    return entryPoint;
+  }
+
+  @Bean
+  public LogsearchUsernamePasswordAuthenticationFilter logsearchUsernamePasswordAuthenticationFilter() throws Exception {
+    LogsearchUsernamePasswordAuthenticationFilter filter = new LogsearchUsernamePasswordAuthenticationFilter();
+    filter.setAuthenticationSuccessHandler(new LogsearchAuthSuccessHandler());
+    filter.setAuthenticationFailureHandler(new LogsearchAuthFailureHandler());
+    filter.setAuthenticationManager(authenticationManagerBean());
+    return filter;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/3d62b004/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/SolrDaoBase.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/SolrDaoBase.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/SolrDaoBase.java
index b325171..ac7f56f 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/SolrDaoBase.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/SolrDaoBase.java
@@ -29,7 +29,6 @@ import java.util.List;
 import org.apache.ambari.logsearch.common.ConfigHelper;
 import org.apache.ambari.logsearch.common.LogSearchContext;
 import org.apache.ambari.logsearch.common.MessageEnums;
-import org.apache.ambari.logsearch.common.PropertiesHelper;
 import org.apache.ambari.logsearch.conf.SolrKerberosConfig;
 import org.apache.ambari.logsearch.conf.SolrUserConfig;
 import org.apache.ambari.logsearch.manager.ManagerBase.LogType;

http://git-wip-us.apache.org/repos/asf/ambari/blob/3d62b004/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/UserDao.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/UserDao.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/UserDao.java
index a04dee4..4ca9df6 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/UserDao.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/UserDao.java
@@ -52,9 +52,6 @@ public class UserDao {
   private static final String NAME = "name";
 
   @Inject
-  private LogsearchFileAuthenticationProvider fileAuthenticationProvider;
-
-  @Inject
   private AuthConfig authConfig;
 
   private ArrayList<HashMap<String, String>> userList = null;
@@ -62,7 +59,7 @@ public class UserDao {
   @SuppressWarnings("unchecked")
   @PostConstruct
   public void initialization() {
-    if (fileAuthenticationProvider.isEnable()) {
+    if (authConfig.isAuthFileEnabled()) {
       try {
         String userPassJsonFileName = authConfig.getCredentialsFile();
         logger.info("USER PASS JSON  file NAME:" + userPassJsonFileName);
@@ -151,12 +148,4 @@ public class UserDao {
     }
     return isUpdated;
   }
-  
-  public String encryptPassword(String username, String password) {
-    if (!StringUtils.isEmpty(username)) {
-      username = username.toLowerCase();
-    }
-    String saltEncodedpasswd = CommonUtil.encryptPassword(password, username);
-    return saltEncodedpasswd;
-  }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/3d62b004/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 7affc5a..c64cf71 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
@@ -49,6 +49,12 @@ import org.apache.ambari.logsearch.model.response.LogData;
 import org.apache.ambari.logsearch.model.response.LogSearchResponse;
 import org.apache.ambari.logsearch.model.response.NameValueData;
 import org.apache.ambari.logsearch.model.response.NameValueDataListResponse;
+import org.apache.ambari.logsearch.query.model.AnyGraphSearchCriteria;
+import org.apache.ambari.logsearch.query.model.AuditBarGraphSearchCriteria;
+import org.apache.ambari.logsearch.query.model.CommonSearchCriteria;
+import org.apache.ambari.logsearch.query.model.FieldAuditBarGraphSearchCriteria;
+import org.apache.ambari.logsearch.query.model.FieldAuditLogSearchCriteria;
+import org.apache.ambari.logsearch.query.model.UserExportSearchCriteria;
 import org.apache.ambari.logsearch.solr.model.SolrAuditLogData;
 import org.apache.ambari.logsearch.solr.model.SolrComponentTypeLogData;
 import org.apache.ambari.logsearch.util.BizUtil;
@@ -82,7 +88,7 @@ public class AuditLogsManager extends ManagerBase<SolrAuditLogData, AuditLogResp
   private SolrAuditLogConfig solrAuditLogConfig;
 
   public AuditLogResponse getLogs(AuditLogSearchCriteria searchCriteria) {
-    Boolean isLastPage = (Boolean) searchCriteria.getParamValue("isLastPage");
+    Boolean isLastPage = searchCriteria.isLastPage();
     if (isLastPage) {
       SolrQuery lastPageQuery = queryGenerator.commonAuditFilterQuery(searchCriteria);
       LogSearchResponse logResponse = getLastPage(searchCriteria, LogSearchConstants.AUDIT_EVTTIME, auditSolrDao, lastPageQuery);
@@ -95,7 +101,7 @@ public class AuditLogsManager extends ManagerBase<SolrAuditLogData, AuditLogResp
     return getLogAsPaginationProvided(solrQuery, auditSolrDao);
   }
 
-  private List<LogData> getComponents(SearchCriteria searchCriteria) {
+  private List<LogData> getComponents(CommonSearchCriteria searchCriteria) {
     SolrQuery solrQuery = queryGenerator.commonAuditFilterQuery(searchCriteria);
     List<LogData> docList = new ArrayList<>();
     try {
@@ -133,7 +139,7 @@ public class AuditLogsManager extends ManagerBase<SolrAuditLogData, AuditLogResp
     }
   }
 
-  public GroupListResponse getAuditComponents(SearchCriteria searchCriteria) {
+  public GroupListResponse getAuditComponents(CommonSearchCriteria searchCriteria) {
     GroupListResponse componentResponse = new GroupListResponse();
     List<LogData> docList = getComponents(searchCriteria);
     componentResponse.setGroupList(docList);
@@ -141,13 +147,13 @@ public class AuditLogsManager extends ManagerBase<SolrAuditLogData, AuditLogResp
   }
 
   @SuppressWarnings("unchecked")
-  public BarGraphDataListResponse getAuditBarGraphData(SearchCriteria searchCriteria) {
+  public BarGraphDataListResponse getAuditBarGraphData(AuditBarGraphSearchCriteria searchCriteria) {
     BarGraphDataListResponse dataList = new BarGraphDataListResponse();
     SolrQuery solrQuery = queryGenerator.commonAuditFilterQuery(searchCriteria);
 
-    String from = getFrom((String) searchCriteria.getParamValue("startTime"));
-    String to = getTo((String) searchCriteria.getParamValue("endTime"));
-    String unit = getUnit((String) searchCriteria.getParamValue("unit"));
+    String from = getFrom(searchCriteria.getStartTime());
+    String to = getTo(searchCriteria.getEndTime());
+    String unit = getUnit(searchCriteria.getUnit());
 
     List<BarGraphData> histogramData = new ArrayList<BarGraphData>();
     String jsonHistogramQuery = queryGenerator.buildJSONFacetTermTimeRangeQuery(LogSearchConstants.AUDIT_COMPONENT,
@@ -225,7 +231,7 @@ public class AuditLogsManager extends ManagerBase<SolrAuditLogData, AuditLogResp
     }
   }
 
-  public BarGraphDataListResponse topTenUsers(SearchCriteria searchCriteria) {
+  public BarGraphDataListResponse topTenUsers(FieldAuditBarGraphSearchCriteria searchCriteria) {
 
     String jsonUserQuery =
       "{Users:{type:terms, field:reqUser, facet:{ Repo:{ type:terms, field:repo, facet:{eventCount:\"sum(event_count)\"}}}}}";
@@ -262,7 +268,7 @@ public class AuditLogsManager extends ManagerBase<SolrAuditLogData, AuditLogResp
     }
   }
 
-  public BarGraphDataListResponse topTenResources(SearchCriteria searchCriteria) {
+  public BarGraphDataListResponse topTenResources(FieldAuditLogSearchCriteria searchCriteria) {
 
     String jsonUserQuery =
       "{Users:{type:terms,field:resource,facet:{Repo:{type:terms,field:repo,facet:{eventCount:\"sum(event_count)\"}}}}}";
@@ -294,11 +300,11 @@ public class AuditLogsManager extends ManagerBase<SolrAuditLogData, AuditLogResp
   }
 
   @SuppressWarnings("unchecked")
-  public BarGraphDataListResponse getRequestUserLineGraph(SearchCriteria searchCriteria) {
+  public BarGraphDataListResponse getRequestUserLineGraph(FieldAuditBarGraphSearchCriteria searchCriteria) {
 
-    String from = getFrom((String) searchCriteria.getParamValue("startTime"));
-    String to = getTo((String) searchCriteria.getParamValue("endTime"));
-    String unit = getUnit((String) searchCriteria.getParamValue("unit"));
+    String from = getFrom(searchCriteria.getStartTime());
+    String to = getTo(searchCriteria.getEndTime());
+    String unit = getUnit(searchCriteria.getUnit());
 
     SolrQuery solrQuery = queryGenerator.commonAuditFilterQuery(searchCriteria);
 
@@ -355,7 +361,7 @@ public class AuditLogsManager extends ManagerBase<SolrAuditLogData, AuditLogResp
 
   }
 
-  public BarGraphDataListResponse getAnyGraphData(SearchCriteria searchCriteria) {
+  public BarGraphDataListResponse getAnyGraphData(AnyGraphSearchCriteria searchCriteria) {
     searchCriteria.addParam("fieldTime", LogSearchConstants.AUDIT_EVTTIME);
     SolrQuery solrQuery = queryGenerator.commonAuditFilterQuery(searchCriteria);
     BarGraphDataListResponse result = graphDataGenerator.getAnyGraphData(searchCriteria, auditSolrDao, solrQuery);
@@ -396,13 +402,13 @@ public class AuditLogsManager extends ManagerBase<SolrAuditLogData, AuditLogResp
   }
 
   @SuppressWarnings({"unchecked"})
-  public Response exportUserTableToTextFile(SearchCriteria searchCriteria) {
+  public Response exportUserTableToTextFile(UserExportSearchCriteria searchCriteria) {
     String jsonUserQuery =
       "{ Users: { type: terms, field: reqUser, facet:  {Repo: {  type: terms, field: repo, facet: {  eventCount: \"sum(event_count)\"}}}},x:{ type: terms,field: resource, facet: {y: {  type: terms, field: repo,facet: {  eventCount: \"sum(event_count)\"}}}}}";
 
     SolrQuery solrQuery = queryGenerator.commonAuditFilterQuery(searchCriteria);
-    String startTime = (String) searchCriteria.getParamValue("startTime");
-    String endTime = (String) searchCriteria.getParamValue("endTime");
+    String startTime = searchCriteria.getStartTime();
+    String endTime = searchCriteria.getEndTime();
 
     startTime = startTime == null ? "" : startTime;
     endTime = endTime == null ? "" : "_" + endTime;
@@ -410,7 +416,7 @@ public class AuditLogsManager extends ManagerBase<SolrAuditLogData, AuditLogResp
     SolrUtil.setJSONFacet(solrQuery, jsonUserQuery);
     SolrUtil.setRowCount(solrQuery, 0);
 
-    String dataFormat = (String) searchCriteria.getParamValue("format");
+    String dataFormat = searchCriteria.getFormat();
     FileOutputStream fis = null;
     try {
       QueryResponse queryResponse = auditSolrDao.process(solrQuery);
@@ -543,7 +549,7 @@ public class AuditLogsManager extends ManagerBase<SolrAuditLogData, AuditLogResp
     return fieldWithBlank;
   }
 
-  public BarGraphDataListResponse getServiceLoad(SearchCriteria searchCriteria) {
+  public BarGraphDataListResponse getServiceLoad(CommonSearchCriteria searchCriteria) {
     BarGraphDataListResponse dataList = new BarGraphDataListResponse();
     Collection<BarGraphData> vaDatas = new ArrayList<BarGraphData>();
     dataList.setGraphData(vaDatas);

http://git-wip-us.apache.org/repos/asf/ambari/blob/3d62b004/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/manager/PublicManager.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/manager/PublicManager.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/manager/PublicManager.java
index 23f62aa..3ac2be6 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/manager/PublicManager.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/manager/PublicManager.java
@@ -22,9 +22,9 @@ package org.apache.ambari.logsearch.manager;
 import java.util.ArrayList;
 import java.util.List;
 
+import org.apache.ambari.logsearch.conf.AuthConfig;
 import org.apache.ambari.logsearch.model.response.NameValueData;
 import org.apache.ambari.logsearch.model.response.NameValueDataListResponse;
-import org.apache.ambari.logsearch.web.security.LogsearchSimpleAuthenticationProvider;
 import org.springframework.stereotype.Component;
 
 import javax.inject.Inject;
@@ -33,14 +33,14 @@ import javax.inject.Inject;
 public class PublicManager extends JsonManagerBase {
 
   @Inject
-  private LogsearchSimpleAuthenticationProvider simpleAuthenticationProvider;
+  private AuthConfig authConfig;
 
   public String getGeneralConfig() {
     NameValueDataListResponse nameValueList = new NameValueDataListResponse();
     List<NameValueData> nameValues = new ArrayList<>();
     NameValueData nameValue = new NameValueData();
     nameValue.setName("simpleAuth");
-    nameValue.setValue("" + simpleAuthenticationProvider.isEnable());
+    nameValue.setValue("" + authConfig.isAuthSimpleEnabled());
     nameValues.add(nameValue);
     nameValueList.setvNameValues(nameValues);
     return convertObjToString(nameValueList);

http://git-wip-us.apache.org/repos/asf/ambari/blob/3d62b004/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 c4d14a9..02309fc 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
@@ -43,7 +43,6 @@ import javax.ws.rs.core.Response;
 import org.apache.ambari.logsearch.common.ConfigHelper;
 import org.apache.ambari.logsearch.common.LogSearchConstants;
 import org.apache.ambari.logsearch.common.MessageEnums;
-import org.apache.ambari.logsearch.common.PropertiesHelper;
 import org.apache.ambari.logsearch.conf.SolrServiceLogConfig;
 import org.apache.ambari.logsearch.dao.ServiceLogsSolrDao;
 import org.apache.ambari.logsearch.graph.GraphDataGenerator;
@@ -64,6 +63,13 @@ import org.apache.ambari.logsearch.model.response.NodeListResponse;
 import org.apache.ambari.logsearch.model.response.ServiceLogData;
 import org.apache.ambari.logsearch.model.response.ServiceLogResponse;
 import org.apache.ambari.logsearch.query.QueryGenerationBase;
+import org.apache.ambari.logsearch.query.model.CommonServiceLogSearchCriteria;
+import org.apache.ambari.logsearch.query.model.ServiceAnyGraphSearchCriteria;
+import org.apache.ambari.logsearch.query.model.ServiceGraphSearchCriteria;
+import org.apache.ambari.logsearch.query.model.ServiceLogExportSearchCriteria;
+import org.apache.ambari.logsearch.query.model.ServiceLogFileSearchCriteria;
+import org.apache.ambari.logsearch.query.model.ServiceLogSearchCriteria;
+import org.apache.ambari.logsearch.query.model.ServiceLogTruncatedSearchCriteria;
 import org.apache.ambari.logsearch.solr.model.SolrComponentTypeLogData;
 import org.apache.ambari.logsearch.solr.model.SolrHostLogData;
 import org.apache.ambari.logsearch.solr.model.SolrServiceLogData;
@@ -83,7 +89,6 @@ 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.SolrDocument;
 import org.apache.solr.common.SolrDocumentList;
 import org.apache.solr.common.SolrException;
@@ -114,10 +119,10 @@ public class ServiceLogsManager extends ManagerBase<SolrServiceLogData, ServiceL
   @Inject
   private SolrServiceLogConfig solrServiceLogConfig;
 
-  public ServiceLogResponse searchLogs(SearchCriteria searchCriteria) {
-    String keyword = (String) searchCriteria.getParamValue("keyword");
-    String logId = (String) searchCriteria.getParamValue("sourceLogId");
-    Boolean isLastPage = (Boolean) searchCriteria.getParamValue("isLastPage");
+  public ServiceLogResponse searchLogs(ServiceLogSearchCriteria searchCriteria) {
+    String keyword = searchCriteria.getKeyword();
+    String logId = searchCriteria.getSourceLogId();
+    Boolean isLastPage = searchCriteria.isLastPage();
 
     if (!StringUtils.isBlank(keyword)) {
       try {
@@ -203,7 +208,7 @@ public class ServiceLogsManager extends ManagerBase<SolrServiceLogData, ServiceL
     return getFields(LogSearchConstants.SOLR_COMPONENT, SolrComponentTypeLogData.class);
   }
 
-  public GraphDataListResponse getAggregatedInfo(SearchCriteria searchCriteria) {
+  public GraphDataListResponse getAggregatedInfo(CommonServiceLogSearchCriteria searchCriteria) {
     SolrQuery solrQuery = queryGenerator.commonServiceFilterQuery(searchCriteria);
     String hierarchy = "host,type,level";
     GraphDataListResponse graphInfo = new GraphDataListResponse();
@@ -401,7 +406,7 @@ public class ServiceLogsManager extends ManagerBase<SolrServiceLogData, ServiceL
     return extensionTree;
   }
 
-  public NodeListResponse getTreeExtension(SearchCriteria searchCriteria) {
+  public NodeListResponse getTreeExtension(ServiceLogFileSearchCriteria searchCriteria) {
     SolrQuery solrQuery = queryGenerator.commonServiceFilterQuery(searchCriteria);
     solrQuery.setParam("event", "/getTreeExtension");
 
@@ -464,7 +469,7 @@ public class ServiceLogsManager extends ManagerBase<SolrServiceLogData, ServiceL
     return list;
   }
 
-  public NodeListResponse getHostListByComponent(SearchCriteria searchCriteria) {
+  public NodeListResponse getHostListByComponent(ServiceLogFileSearchCriteria searchCriteria) {
     SolrQuery solrQuery = queryGenerator.commonServiceFilterQuery(searchCriteria);
     solrQuery.setParam("event", "/service/hosts/components");
 
@@ -524,7 +529,7 @@ public class ServiceLogsManager extends ManagerBase<SolrServiceLogData, ServiceL
     }
   }
 
-  public NameValueDataListResponse getLogsLevelCount(SearchCriteria sc) {
+  public NameValueDataListResponse getLogsLevelCount(ServiceLogFileSearchCriteria sc) {
     NameValueDataListResponse nameValueList = new NameValueDataListResponse();
     SolrQuery query = queryGenerator.commonServiceFilterQuery(sc);
     query.setParam("event", "/service/logs/levels/counts/namevalues");
@@ -584,11 +589,11 @@ public class ServiceLogsManager extends ManagerBase<SolrServiceLogData, ServiceL
     return list;
   }
 
-  public LogListResponse getPageByKeyword(SearchCriteria searchCriteria)
+  public LogListResponse getPageByKeyword(ServiceLogSearchCriteria searchCriteria)
     throws SolrServerException {
     String defaultChoice = "0";
 
-    String key = (String) searchCriteria.getParamValue("keyword");
+    String key = (String) searchCriteria.getKeyword();
     if(StringUtils.isBlank(key)){
       throw RESTErrorUtil.createRESTException("Keyword was not given",
           MessageEnums.DATA_NOT_FOUND);
@@ -603,7 +608,7 @@ public class ServiceLogsManager extends ManagerBase<SolrServiceLogData, ServiceL
     keyword = "*" + keyword + "*";
 
 
-    String keyType = (String) searchCriteria.getParamValue("keywordType");
+    String keyType = (String) searchCriteria.getKeywordType();
     QueryResponse queryResponse = null;
 
     if (!defaultChoice.equals(keyType)) {
@@ -689,9 +694,8 @@ public class ServiceLogsManager extends ManagerBase<SolrServiceLogData, ServiceL
         }
 
         // Keyword Sequence Number Calculation
-        String endTime = (String) searchCriteria.getParamValue("to");
-        String startTime = (String) searchCriteria
-          .getParamValue("from");
+        String endTime = searchCriteria.getTo();
+        String startTime = searchCriteria.getFrom();
         SolrQuery logTimeThroughRangeQuery = queryGenerator
           .commonServiceFilterQuery(searchCriteria);
         logTimeThroughRangeQuery.remove("start");
@@ -809,8 +813,7 @@ public class ServiceLogsManager extends ManagerBase<SolrServiceLogData, ServiceL
         rangeLogQuery.remove("rows");
         logIdQuery.setStart(start);
         logIdQuery.setRows(searchCriteria.getMaxRows());
-        LogListResponse logResponse = getLogAsPaginationProvided(logIdQuery, serviceLogsSolrDao);
-        return logResponse;
+        return getLogAsPaginationProvided(logIdQuery, serviceLogsSolrDao);
 
       } catch (Exception e) {
         //do nothing
@@ -899,9 +902,8 @@ public class ServiceLogsManager extends ManagerBase<SolrServiceLogData, ServiceL
 
 
         // Keyword LogTime Calculation
-        String endTime = (String) searchCriteria.getParamValue("to");
-        String startTime = (String) searchCriteria
-          .getParamValue("from");
+        String endTime = (String) searchCriteria.getTo();
+        String startTime = searchCriteria.getFrom();
         SolrQuery logTimeThroughRangeQuery = queryGenerator
           .commonServiceFilterQuery(searchCriteria);
         logTimeThroughRangeQuery.remove("start");
@@ -1034,7 +1036,7 @@ public class ServiceLogsManager extends ManagerBase<SolrServiceLogData, ServiceL
         MessageEnums.ERROR_SYSTEM);
   }
 
-  private LogSearchResponse getPageByLogId(SearchCriteria searchCriteria) {
+  private LogSearchResponse getPageByLogId(ServiceLogSearchCriteria searchCriteria) {
     LogSearchResponse logResponse = new ServiceLogResponse();
     String endLogTime = (String) searchCriteria.getParamValue("to");
     if(StringUtils.isBlank(endLogTime)){
@@ -1135,68 +1137,14 @@ public class ServiceLogsManager extends ManagerBase<SolrServiceLogData, ServiceL
   }
 
   @SuppressWarnings("unchecked")
-  public List<NameValueData> getHistogramCounts(SolrQuery solrQuery,
-                                             String from, String to, String unit) {
-    List<NameValueData> logsCounts = new ArrayList<>();
-    try {
-
-      SolrUtil.setFacetRange(solrQuery, LogSearchConstants.LOGTIME,
-        from, to, unit);
-
-      List<RangeFacet.Count> logLevelCounts = null;
-
-      QueryResponse response = serviceLogsSolrDao.process(solrQuery);
-      if(response == null){
-        return logsCounts;
-      }
-      @SuppressWarnings("rawtypes")
-      List<RangeFacet> rangeFacetList = response.getFacetRanges();
-      if (rangeFacetList == null) {
-        return logsCounts;
-
-      }
-
-      @SuppressWarnings("rawtypes")
-      RangeFacet rangeFacet=rangeFacetList.get(0);
-      if (rangeFacet == null) {
-        return logsCounts;
-      }
-      logLevelCounts = rangeFacet.getCounts();
-
-      if(logLevelCounts == null){
-        return logsCounts;
-      }
-      for (RangeFacet.Count logCount : logLevelCounts) {
-        NameValueData nameValue = new NameValueData();
-        nameValue.setName(logCount.getValue());
-        nameValue.setValue("" + logCount.getCount());
-        logsCounts.add(nameValue);
-      }
-    } catch (SolrException | SolrServerException | IOException e) {
-      logger.error("Error during solrQuery=" + solrQuery, e);
-    }
-    return logsCounts;
-  }
-
-  public List<Count> getFacetCountsByDate(SolrQuery solrQuery,
-                                          String facetField) throws SolrServerException, IOException,
-    SolrException {
-
-    QueryResponse response = serviceLogsSolrDao.process(solrQuery);
-
-    FacetField field = response.getFacetDate(facetField);
-    return field.getValues();
-  }
-
-  @SuppressWarnings("unchecked")
-  public BarGraphDataListResponse getHistogramData(SearchCriteria searchCriteria) {
+  public BarGraphDataListResponse getHistogramData(ServiceGraphSearchCriteria searchCriteria) {
     String deafalutValue = "0";
     BarGraphDataListResponse dataList = new BarGraphDataListResponse();
     SolrQuery solrQuery = queryGenerator.commonServiceFilterQuery(searchCriteria);
     solrQuery.set("event", "/audit/logs/histogram");
-    String from = getFrom((String) searchCriteria.getParamValue("from"));
-    String to = getTo((String) searchCriteria.getParamValue("to"));
-    String unit = getUnit((String) searchCriteria.getParamValue("unit"));
+    String from = getFrom(searchCriteria.getFrom());
+    String to = getTo(searchCriteria.getTo());
+    String unit = getUnit(searchCriteria.getUnit());
 
     List<BarGraphData> histogramData = new ArrayList<>();
 
@@ -1267,16 +1215,6 @@ public class ServiceLogsManager extends ManagerBase<SolrServiceLogData, ServiceL
     }
   }
 
-  public void arrangeLevel(String level,
-                           List<BarGraphData> histogramDataLocal,
-                           List<BarGraphData> histogramData) {
-    for (BarGraphData histData : histogramData) {
-      if (histData != null && level.equals(histData.getName())) {
-        histogramDataLocal.add(histData);
-      }
-    }
-  }
-
   public String cancelFindRequestByDate(String uniqueId) {
     if (StringUtils.isEmpty(uniqueId)) {
       logger.error("Unique id is Empty");
@@ -1305,13 +1243,13 @@ public class ServiceLogsManager extends ManagerBase<SolrServiceLogData, ServiceL
     return true;
   }
 
-  public Response exportToTextFile(SearchCriteria searchCriteria) {
+  public Response exportToTextFile(ServiceLogExportSearchCriteria searchCriteria) {
     String defaultFormat = "text";
     SolrQuery solrQuery = queryGenerator.commonServiceFilterQuery(searchCriteria);
-    String from = (String) searchCriteria.getParamValue("from");
-    String to = (String) searchCriteria.getParamValue("to");
-    String utcOffset = (String) searchCriteria.getParamValue("utcOffset");
-    String format = (String) searchCriteria.getParamValue("format");
+    String from = searchCriteria.getFrom();
+    String to = searchCriteria.getTo();
+    String utcOffset = searchCriteria.getUtcOffset();
+    String format = searchCriteria.getFormat();
 
     format = defaultFormat.equalsIgnoreCase(format) && format != null ? ".txt"
         : ".json";
@@ -1449,7 +1387,7 @@ public class ServiceLogsManager extends ManagerBase<SolrServiceLogData, ServiceL
     }
   }
 
-  public NodeListResponse getComponentListWithLevelCounts(SearchCriteria searchCriteria) {
+  public NodeListResponse getComponentListWithLevelCounts(ServiceLogFileSearchCriteria searchCriteria) {
     SolrQuery solrQuery = queryGenerator.commonServiceFilterQuery(searchCriteria);
     solrQuery.setParam("event", "/service/logs/components/levels/counts");
 
@@ -1670,7 +1608,7 @@ public class ServiceLogsManager extends ManagerBase<SolrServiceLogData, ServiceL
     }
   }
 
-  public BarGraphDataListResponse getAnyGraphData(SearchCriteria searchCriteria) {
+  public BarGraphDataListResponse getAnyGraphData(ServiceAnyGraphSearchCriteria searchCriteria) {
     searchCriteria.addParam("fieldTime", LogSearchConstants.LOGTIME);
     SolrQuery solrQuery = queryGenerator.commonServiceFilterQuery(searchCriteria);
     BarGraphDataListResponse result = graphDataGenerator.getAnyGraphData(searchCriteria, serviceLogsSolrDao, solrQuery);
@@ -1681,7 +1619,7 @@ public class ServiceLogsManager extends ManagerBase<SolrServiceLogData, ServiceL
 
   }
 
-  public ServiceLogResponse getAfterBeforeLogs(SearchCriteria searchCriteria) {
+  public ServiceLogResponse getAfterBeforeLogs(ServiceLogTruncatedSearchCriteria searchCriteria) {
     ServiceLogResponse logResponse = new ServiceLogResponse();
     List<SolrServiceLogData> docList = null;
     String id = (String) searchCriteria
@@ -1692,11 +1630,11 @@ public class ServiceLogsManager extends ManagerBase<SolrServiceLogData, ServiceL
     }
     String maxRows = "";
 
-    maxRows = (String) searchCriteria.getParamValue("numberRows");
+    maxRows = searchCriteria.getNumberRows();
     if (StringUtils.isBlank(maxRows)){
       maxRows = ""+maxRows;
     }
-    String scrollType = (String) searchCriteria.getParamValue("scrollType");
+    String scrollType = searchCriteria.getScrollType();
     if(StringUtils.isBlank(scrollType)){
       scrollType = "";
     }
@@ -1803,7 +1741,7 @@ public class ServiceLogsManager extends ManagerBase<SolrServiceLogData, ServiceL
     searchCriteria.addParam(LogSearchConstants.SORT, sortOrder);
     queryGenerator.setMultipleSortOrder(solrQuery, searchCriteria);
 
-    return (ServiceLogResponse) getLogAsPaginationProvided(solrQuery, serviceLogsSolrDao);
+    return getLogAsPaginationProvided(solrQuery, serviceLogsSolrDao);
   }
 
   private ServiceLogResponse whenScrollDown(SearchCriteria searchCriteria,
@@ -1835,7 +1773,7 @@ public class ServiceLogsManager extends ManagerBase<SolrServiceLogData, ServiceL
     searchCriteria.addParam(LogSearchConstants.SORT, sortOrder);
     queryGenerator.setMultipleSortOrder(solrQuery, searchCriteria);
 
-    return (ServiceLogResponse) getLogAsPaginationProvided(solrQuery, serviceLogsSolrDao);
+    return getLogAsPaginationProvided(solrQuery, serviceLogsSolrDao);
   }
 
   @Scheduled(cron = "${logsearch.solr.warming.cron}")

http://git-wip-us.apache.org/repos/asf/ambari/blob/3d62b004/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/AuditLogData.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/AuditLogData.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/AuditLogData.java
index 6df56a1..41eca1e 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/AuditLogData.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/AuditLogData.java
@@ -98,9 +98,9 @@ public interface AuditLogData extends CommonLogData {
   void setRepo(String repo);
 
   @JsonProperty("repoType")
-  String getRepoType();
+  Integer getRepoType();
 
-  void setRepoType(String repoType);
+  void setRepoType(Integer repoType);
 
   @JsonProperty("reqData")
   String getRequestData();

http://git-wip-us.apache.org/repos/asf/ambari/blob/3d62b004/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/QueryGeneration.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/QueryGeneration.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/QueryGeneration.java
index 10224bc..9ea29c2 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/QueryGeneration.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/QueryGeneration.java
@@ -30,6 +30,9 @@ import org.apache.ambari.logsearch.common.LogSearchConstants;
 import org.apache.ambari.logsearch.common.PropertiesHelper;
 import org.apache.ambari.logsearch.conf.SolrAuditLogConfig;
 import org.apache.ambari.logsearch.conf.SolrServiceLogConfig;
+import org.apache.ambari.logsearch.query.model.AuditLogSearchCriteria;
+import org.apache.ambari.logsearch.query.model.CommonSearchCriteria;
+import org.apache.ambari.logsearch.query.model.CommonServiceLogSearchCriteria;
 import org.apache.ambari.logsearch.query.model.SearchCriteria;
 import org.apache.ambari.logsearch.dao.SolrDaoBase;
 import org.apache.ambari.logsearch.manager.ManagerBase.LogType;
@@ -59,32 +62,33 @@ public class QueryGeneration extends QueryGenerationBase {
   @Inject
   private SolrAuditLogConfig solrAuditLogConfig;
 
-  public SolrQuery commonServiceFilterQuery(SearchCriteria searchCriteria) {
+  public SolrQuery commonServiceFilterQuery(CommonServiceLogSearchCriteria searchCriteria) {
     LogType logType = LogType.SERVICE;
     SolrQuery solrQuery = new SolrQuery();
-    String treeParams = (String) searchCriteria.getParamValue("treeParams");
-    String givenQuery = (String) searchCriteria.getParamValue("q");
-    String level = (String) searchCriteria.getParamValue("level");
-    String startTime = (String) searchCriteria.getParamValue("from");
-    String endTime = (String) searchCriteria.getParamValue("to");
-    String iMessage = (String) searchCriteria.getParamValue("iMessage");
-    String eMessage = (String) searchCriteria.getParamValue("eMessage");
+    String advQuery = (String) searchCriteria.getParamValue("advanceSearch"); // TODO: check these are used from the UI or not
     String gEmessage = (String) searchCriteria.getParamValue("gEMessage");
-    String selectedComp = (String) searchCriteria.getParamValue("selectComp");
-    String bundleId = (String) searchCriteria.getParamValue(LogSearchConstants.BUNDLE_ID);
     String globalExcludeComp = (String) searchCriteria.getParamValue("gMustNot");
     String unselectedComp = (String) searchCriteria.getParamValue("unselectComp");
-    String urlHostName = (String) searchCriteria.getParamValue("host_name");
-    String urlComponentName = (String) searchCriteria.getParamValue("component_name");
-    String file_name = (String) searchCriteria.getParamValue("file_name");
-    String advQuery = (String) searchCriteria.getParamValue("advanceSearch");
+
+    String treeParams = searchCriteria.getTreeParams();
+    String givenQuery = (String) searchCriteria.getParamValue("q");
+    String level = searchCriteria.getLevel();
+    String startTime = searchCriteria.getFrom();
+    String endTime = searchCriteria.getTo();
+    String iMessage = searchCriteria.getIncludeMessage();
+    String eMessage = searchCriteria.getExcludeMessage();
+    String selectedComp = searchCriteria.getSelectComp();
+    String bundleId = searchCriteria.getBundleId();
+    String urlHostName = searchCriteria.getHostName();
+    String urlComponentName = searchCriteria.getComponentName();
+    String file_name = searchCriteria.getFileName();
     // build advance query
     if (!StringUtils.isBlank(advQuery)) {
       String advQueryParameters[] = advQuery.split(Pattern.quote("}{"));
       SolrQuery advSolrQuery = new SolrQuery();
       for (String queryParam : advQueryParameters) {
         String params[] = queryParam.split(Pattern.quote("="));
-        if (params != null && params.length > 1)
+        if (params.length > 1)
           advSolrQuery.setParam(params[0], params[1]);
       }
       setFilterClauseWithFieldName(advSolrQuery, level, LogSearchConstants.SOLR_LEVEL, "", Condition.OR);
@@ -226,18 +230,20 @@ public class QueryGeneration extends QueryGenerationBase {
     }
   }
 
-  public SolrQuery commonAuditFilterQuery(SearchCriteria searchCriteria) {
+  public SolrQuery commonAuditFilterQuery(CommonSearchCriteria searchCriteria) {
     LogType logType = LogType.AUDIT;
     SolrQuery solrQuery = new SolrQuery();
     solrQuery.setQuery("*:*");
-    String startTime = (String) searchCriteria.getParamValue("startTime");
-    String endTime = (String) searchCriteria.getParamValue("endTime");
-    String selectedComp = (String) searchCriteria.getParamValue("includeString");
+
+    String globalExcludeComp = (String) searchCriteria.getParamValue("gMustNot"); // TODO: check this are used from UI or not
+    String unselectedComp = (String) searchCriteria.getParamValue("unselectComp");
+
+    String startTime = searchCriteria.getStartTime();
+    String endTime = searchCriteria.getEndTime();
+    String selectedComp = searchCriteria.getMustBe();
     setFilterClauseWithFieldName(solrQuery, selectedComp, LogSearchConstants.AUDIT_COMPONENT, LogSearchConstants.NO_OPERATOR, Condition.OR);
-    String globalExcludeComp = (String) searchCriteria.getParamValue("gMustNot");
     setUserSpecificFilter(searchCriteria, solrQuery, LogSearchConstants.INCLUDE_QUERY, LogSearchConstants.INCLUDE_QUERY, logType);
     setUserSpecificFilter(searchCriteria, solrQuery, LogSearchConstants.EXCLUDE_QUERY, LogSearchConstants.EXCLUDE_QUERY, logType);
-    String unselectedComp = (String) searchCriteria.getParamValue("unselectComp");
     setFilterClauseWithFieldName(solrQuery, globalExcludeComp, LogSearchConstants.AUDIT_COMPONENT, LogSearchConstants.MINUS_OPERATOR, Condition.AND);
     setFilterClauseWithFieldName(solrQuery, unselectedComp, LogSearchConstants.AUDIT_COMPONENT, LogSearchConstants.MINUS_OPERATOR, Condition.AND);
     setSingleRangeFilter(solrQuery, LogSearchConstants.AUDIT_EVTTIME, startTime, endTime);

http://git-wip-us.apache.org/repos/asf/ambari/blob/3d62b004/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/SearchCriteriaConstants.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/SearchCriteriaConstants.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/SearchCriteriaConstants.java
new file mode 100644
index 0000000..c67d3cd
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/SearchCriteriaConstants.java
@@ -0,0 +1,78 @@
+/*
+ * 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.query;
+
+public class SearchCriteriaConstants {
+
+  private SearchCriteriaConstants() {
+  }
+
+  public static final String PARAM_FIELD = "field";
+  public static final String PARAM_UNIT = "unit";
+  public static final String PARAM_INCLUDE_MESSAGE = "iMessage";
+  public static final String PARAM_EXCLUDE_MESSAGE = "eMessage";
+  public static final String PARAM_MUST_BE_STRING = "includeString";
+  public static final String PARAM_MUST_NOT_STRING = "unselectComp";
+  public static final String PARAM_EXCLUDE_QUERY = "excludeQuery";
+  public static final String PARAM_INCLUDE_QUERY = "includeQuery";
+  public static final String PARAM_START_TIME = "startTime";
+  public static final String PARAM_END_TIME = "endTime";
+
+  public static final String PARAM_IS_LAST_PAGE = "isLastPage";
+
+  public static final String PARAM_GLOBAL_START_TIME = "globalStartTime";
+  public static final String PARAM_GLOBAL_END_TIME = "globalEndTime";
+
+  public static final String PARAM_X_AXIS = "xAxis";
+  public static final String PARAM_Y_AXIS = "yAxis";
+  public static final String PARAM_STACK_BY = "stackBy";
+  public static final String PARAM_FROM = "from";
+  public static final String PARAM_TO = "to";
+
+  public static final String PARAM_LOG_FILE_COMPONENT = "component";
+  public static final String PARAM_LOG_FILE_HOST = "host";
+  public static final String PARAM_LOG_FILE_TYPE = "logType";
+  public static final String PARAM_LOG_TAIL_SIZE = "tailSize";
+
+  public static final String PARAM_COMPONENT_NAME = "component_name";
+  public static final String PARAM_HOST_NAME = "host_name";
+  public static final String PARAM_FILE_NAME = "file_name";
+  public static final String PARAM_BUNDLE_ID = "bundle_id";
+  public static final String PARAM_SELECT_COMP = "selectComp";
+  public static final String PARAM_LEVEL = "level";
+  public static final String PARAM_TREE_PARAMS = "treeParams";
+
+  public static final String PARAM_HOST_LOG_FILE = "hostLogFile";
+  public static final String PARAM_COMPONENT_LOG_FILE = "compLogFile";
+  public static final String PARAM_ID = "id";
+  public static final String PARAM_SCROLL_TYPE = "scrollType";
+  public static final String PARAM_NUMBER_ROWS = "numberRows";
+
+  public static final String PARAM_FORMAT = "format";
+  public static final String PARAM_UTC_OFFSET = "utcOffset";
+  public static final String PARAM_KEYWORD = "keyword";
+  public static final String PARAM_SOURCE_LOG_ID = "sourceLogId";
+  public static final String PARAM_KEYWORD_TYPE = "keywordType";
+  public static final String PARAM_TOKEN = "token";
+
+  public static final String PARAM_USER_NAME = "username";
+  public static final String PARAM_FILTER_NAME = "filtername";
+  public static final String PARAM_ROW_TYPE = "rowtype";
+
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/3d62b004/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AbstractCommonAuditLogRequestConverter.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AbstractCommonAuditLogRequestConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AbstractCommonAuditLogRequestConverter.java
index 798bd47..e25eb51 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AbstractCommonAuditLogRequestConverter.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AbstractCommonAuditLogRequestConverter.java
@@ -32,15 +32,15 @@ public abstract class AbstractCommonAuditLogRequestConverter<SOURCE extends Base
     RESULT criteria = createCriteria(request);
     criteria.addParam("q", request.getQuery());
     criteria.addParam("columnQuery", StringEscapeUtils.unescapeXml(request.getColumnQuery()));
-    criteria.addParam("iMessage", StringEscapeUtils.unescapeXml(request.getiMessage()));
     criteria.addParam("gEMessage", StringEscapeUtils.unescapeXml(request.getgEMessage()));
-    criteria.addParam("eMessage", StringEscapeUtils.unescapeXml(request.getgEMessage()));
-    criteria.addParam("includeString", request.getMustBe());
-    criteria.addParam("unselectComp", request.getMustNot());
-    criteria.addParam("excludeQuery", StringEscapeUtils.unescapeXml(request.getExcludeQuery()));
-    criteria.addParam("includeQuery", StringEscapeUtils.unescapeXml(request.getIncludeQuery()));
-    criteria.addParam("startTime", request.getFrom());
-    criteria.addParam("endTime", request.getTo());
+    criteria.setIncludeMessage(StringEscapeUtils.unescapeXml(request.getiMessage()));
+    criteria.setExcludeMessage(StringEscapeUtils.unescapeXml(request.getgEMessage()));
+    criteria.setMustBe(request.getMustBe());
+    criteria.setMustNot(request.getMustNot());
+    criteria.setExcludeQuery(StringEscapeUtils.unescapeXml(request.getExcludeQuery()));
+    criteria.setIncludeQuery(StringEscapeUtils.unescapeXml(request.getIncludeQuery()));
+    criteria.setStartTime(request.getFrom());
+    criteria.setEndTime(request.getTo());
     return criteria;
   }
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/3d62b004/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AbstractCommonSearchRequestConverter.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AbstractCommonSearchRequestConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AbstractCommonSearchRequestConverter.java
index 3fd07e2..ea2c28a 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AbstractCommonSearchRequestConverter.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/query/converter/AbstractCommonSearchRequestConverter.java
@@ -21,10 +21,12 @@ package org.apache.ambari.logsearch.query.converter;
 import org.apache.ambari.logsearch.model.request.impl.CommonSearchRequest;
 import org.apache.ambari.logsearch.query.model.CommonSearchCriteria;
 import org.apache.commons.lang.StringUtils;
-import org.springframework.core.convert.converter.Converter;
+
+import static org.apache.ambari.logsearch.query.SearchCriteriaConstants.PARAM_GLOBAL_END_TIME;
+import static org.apache.ambari.logsearch.query.SearchCriteriaConstants.PARAM_GLOBAL_START_TIME;
 
 public abstract class AbstractCommonSearchRequestConverter<SOURCE extends CommonSearchRequest, RESULT extends CommonSearchCriteria>
-  implements Converter<SOURCE, RESULT> {
+  extends AbstractConverterAware<SOURCE, RESULT> {
 
   @Override
   public RESULT convert(SOURCE source) {
@@ -43,11 +45,11 @@ public abstract class AbstractCommonSearchRequestConverter<SOURCE extends Common
     criteria.setSortType(request.getSortType());
     if (StringUtils.isNotEmpty(request.getStartTime())){
       criteria.setGlobalStartTime(request.getStartTime());
-      criteria.getUrlParamMap().put("globalStartTime", request.getStartTime());
+      criteria.getUrlParamMap().put(PARAM_GLOBAL_START_TIME, request.getStartTime());
     }
     if (StringUtils.isNotEmpty(request.getEndTime())){
       criteria.setGlobalEndTime(request.getEndTime());
-      criteria.getUrlParamMap().put("globalEndTime", request.getEndTime());
+      criteria.getUrlParamMap().put(PARAM_GLOBAL_END_TIME, request.getEndTime());
     }
   }
 }


[42/58] [abbrv] ambari git commit: AMBARI-18310. Logsearch - Refactor solr query layer (oleewere)

Posted by ol...@apache.org.
http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/ServiceLogComponentLevelRequestQueryConverter.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/ServiceLogComponentLevelRequestQueryConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/ServiceLogComponentLevelRequestQueryConverter.java
new file mode 100644
index 0000000..cefc029
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/ServiceLogComponentLevelRequestQueryConverter.java
@@ -0,0 +1,66 @@
+/*
+ * 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 com.google.common.base.Splitter;
+import org.apache.ambari.logsearch.common.LogType;
+import org.apache.ambari.logsearch.model.request.impl.ServiceLogComponentLevelRequest;
+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 javax.inject.Named;
+import java.util.List;
+
+import static org.apache.ambari.logsearch.solr.SolrConstants.ServiceLogConstants.COMPONENT;
+import static org.apache.ambari.logsearch.solr.SolrConstants.ServiceLogConstants.LEVEL;
+import static org.apache.ambari.logsearch.solr.SolrConstants.ServiceLogConstants.LOGTIME;
+
+@Named
+public class ServiceLogComponentLevelRequestQueryConverter extends AbstractLogRequestFacetQueryConverter<ServiceLogComponentLevelRequest> {
+
+  @Override
+  public FacetOptions.FacetSort getFacetSort() {
+    return FacetOptions.FacetSort.INDEX;
+  }
+
+  @Override
+  public String getDateTimeField() {
+    return LOGTIME;
+  }
+
+  @Override
+  public void appendFacetQuery(SimpleFacetQuery facetQuery, ServiceLogComponentLevelRequest request) {
+    List<String> levels = Splitter.on(",").splitToList(request.getLevel()); // TODO: add @Valid on request object to make sure not throw exception if levels are missing
+    SimpleFilterQuery filterQuery = new SimpleFilterQuery();
+    filterQuery.addCriteria(new Criteria(LEVEL).in(levels));
+    facetQuery.addFilterQuery(filterQuery);
+  }
+
+  @Override
+  public void appendFacetOptions(FacetOptions facetOptions, ServiceLogComponentLevelRequest request) {
+    facetOptions.addFacetOnPivot(COMPONENT, LEVEL);
+  }
+
+  @Override
+  public LogType getLogType() {
+    return LogType.SERVICE;
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/ServiceLogComponentRequestFacetQueryConverter.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/ServiceLogComponentRequestFacetQueryConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/ServiceLogComponentRequestFacetQueryConverter.java
new file mode 100644
index 0000000..afdac70
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/ServiceLogComponentRequestFacetQueryConverter.java
@@ -0,0 +1,68 @@
+/*
+ * 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 com.google.common.base.Splitter;
+import org.apache.ambari.logsearch.common.LogType;
+import org.apache.ambari.logsearch.model.request.impl.ServiceLogComponentHostRequest;
+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 javax.inject.Named;
+import java.util.List;
+
+import static org.apache.ambari.logsearch.solr.SolrConstants.ServiceLogConstants.COMPONENT;
+import static org.apache.ambari.logsearch.solr.SolrConstants.ServiceLogConstants.HOST;
+import static org.apache.ambari.logsearch.solr.SolrConstants.ServiceLogConstants.LEVEL;
+import static org.apache.ambari.logsearch.solr.SolrConstants.ServiceLogConstants.LOGTIME;
+
+@Named
+public class ServiceLogComponentRequestFacetQueryConverter extends AbstractLogRequestFacetQueryConverter<ServiceLogComponentHostRequest> {
+
+  @Override
+  public FacetOptions.FacetSort getFacetSort() {
+    return FacetOptions.FacetSort.INDEX;
+  }
+
+  @Override
+  public String getDateTimeField() {
+    return LOGTIME;
+  }
+
+  @Override
+  public LogType getLogType() {
+    return LogType.SERVICE;
+  }
+
+  @Override
+  public void appendFacetQuery(SimpleFacetQuery facetQuery, ServiceLogComponentHostRequest request) {
+    List<String> levels = Splitter.on(",").splitToList(request.getLevel());
+    SimpleFilterQuery filterQuery = new SimpleFilterQuery();
+    filterQuery.addCriteria(new Criteria(LEVEL).in(levels));
+    facetQuery.addFilterQuery(filterQuery);
+  }
+
+  @Override
+  public void appendFacetOptions(FacetOptions facetOptions, ServiceLogComponentHostRequest request) {
+    facetOptions.addFacetOnPivot(COMPONENT, HOST, LEVEL);
+    facetOptions.addFacetOnPivot(COMPONENT, LEVEL);
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/ServiceLogLevelCountRequestQueryConverter.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/ServiceLogLevelCountRequestQueryConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/ServiceLogLevelCountRequestQueryConverter.java
new file mode 100644
index 0000000..18fd204
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/ServiceLogLevelCountRequestQueryConverter.java
@@ -0,0 +1,52 @@
+/*
+ * 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.ServiceLogLevelCountRequest;
+import org.springframework.data.solr.core.query.FacetOptions;
+
+import javax.inject.Named;
+
+import static org.apache.ambari.logsearch.solr.SolrConstants.ServiceLogConstants.LOGTIME;
+import static org.apache.ambari.logsearch.solr.SolrConstants.ServiceLogConstants.LEVEL;
+
+@Named
+public class ServiceLogLevelCountRequestQueryConverter extends AbstractLogRequestFacetQueryConverter<ServiceLogLevelCountRequest> {
+
+  @Override
+  public FacetOptions.FacetSort getFacetSort() {
+    return FacetOptions.FacetSort.COUNT;
+  }
+
+  @Override
+  public String getDateTimeField() {
+    return LOGTIME;
+  }
+
+  @Override
+  public void appendFacetOptions(FacetOptions facetOptions, ServiceLogLevelCountRequest request) {
+    facetOptions.addFacetOnField(LEVEL);
+  }
+
+  @Override
+  public LogType getLogType() {
+    return LogType.SERVICE;
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/ServiceLogLevelDateRangeRequestQueryConverter.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/ServiceLogLevelDateRangeRequestQueryConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/ServiceLogLevelDateRangeRequestQueryConverter.java
new file mode 100644
index 0000000..2ff528d
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/ServiceLogLevelDateRangeRequestQueryConverter.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 com.google.common.base.Splitter;
+import org.apache.ambari.logsearch.common.LogType;
+import org.apache.ambari.logsearch.model.request.impl.ServiceGraphRequest;
+import org.apache.commons.lang.StringUtils;
+import org.apache.solr.client.solrj.SolrQuery;
+
+import javax.inject.Named;
+
+import java.util.List;
+
+import static org.apache.ambari.logsearch.solr.SolrConstants.ServiceLogConstants.LEVEL;
+import static org.apache.ambari.logsearch.solr.SolrConstants.ServiceLogConstants.LOGTIME;
+
+@Named
+public class ServiceLogLevelDateRangeRequestQueryConverter extends AbstractDateRangeFacetQueryConverter<ServiceGraphRequest>{
+
+  @Override
+  public String getDateFieldName() {
+    return LOGTIME;
+  }
+
+  @Override
+  public String getTypeFieldName() {
+    return LEVEL;
+  }
+
+  @Override
+  public SolrQuery convert(ServiceGraphRequest request) {
+    SolrQuery solrQuery = super.convert(request);
+    if (StringUtils.isNotEmpty(request.getLevel())) {
+      List<String> levels = Splitter.on(",").splitToList(request.getLevel());
+      solrQuery.addFilterQuery(String.format("%s:(%s)", LEVEL, StringUtils.join(levels, " OR ")));
+    }
+    return solrQuery;
+  }
+
+  @Override
+  public LogType getLogType() {
+    return LogType.SERVICE;
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/ServiceLogTreeRequestFacetQueryConverter.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/ServiceLogTreeRequestFacetQueryConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/ServiceLogTreeRequestFacetQueryConverter.java
new file mode 100644
index 0000000..f9cdb0b
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/ServiceLogTreeRequestFacetQueryConverter.java
@@ -0,0 +1,69 @@
+/*
+ * 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 com.google.common.base.Splitter;
+import org.apache.ambari.logsearch.common.LogType;
+import org.apache.ambari.logsearch.model.request.impl.ServiceLogHostComponentRequest;
+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 javax.inject.Named;
+
+import java.util.List;
+
+import static org.apache.ambari.logsearch.solr.SolrConstants.ServiceLogConstants.COMPONENT;
+import static org.apache.ambari.logsearch.solr.SolrConstants.ServiceLogConstants.HOST;
+import static org.apache.ambari.logsearch.solr.SolrConstants.ServiceLogConstants.LEVEL;
+import static org.apache.ambari.logsearch.solr.SolrConstants.ServiceLogConstants.LOGTIME;
+
+@Named
+public class ServiceLogTreeRequestFacetQueryConverter extends AbstractLogRequestFacetQueryConverter<ServiceLogHostComponentRequest>{
+
+  @Override
+  public FacetOptions.FacetSort getFacetSort() {
+    return FacetOptions.FacetSort.INDEX;
+  }
+
+  @Override
+  public String getDateTimeField() {
+    return LOGTIME;
+  }
+
+  @Override
+  public LogType getLogType() {
+    return LogType.SERVICE;
+  }
+
+  @Override
+  public void appendFacetQuery(SimpleFacetQuery facetQuery, ServiceLogHostComponentRequest request) {
+    List<String> levels = Splitter.on(",").splitToList(request.getLevel());
+    SimpleFilterQuery filterQuery = new SimpleFilterQuery();
+    filterQuery.addCriteria(new Criteria(LEVEL).in(levels));
+    facetQuery.addFilterQuery(filterQuery);
+  }
+
+  @Override
+  public void appendFacetOptions(FacetOptions facetOptions, ServiceLogHostComponentRequest request) {
+    facetOptions.addFacetOnPivot(HOST, COMPONENT, LEVEL);
+    facetOptions.addFacetOnPivot(HOST, LEVEL);
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/ServiceLogTruncatedRequestQueryConverter.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/ServiceLogTruncatedRequestQueryConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/ServiceLogTruncatedRequestQueryConverter.java
new file mode 100644
index 0000000..d0273ac
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/ServiceLogTruncatedRequestQueryConverter.java
@@ -0,0 +1,95 @@
+/*
+ * 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.LogSearchConstants;
+import org.apache.ambari.logsearch.common.LogType;
+import org.apache.ambari.logsearch.model.request.impl.ServiceLogTruncatedRequest;
+import org.springframework.data.domain.Sort;
+import org.springframework.data.solr.core.query.SimpleQuery;
+
+import static org.apache.ambari.logsearch.solr.SolrConstants.CommonLogConstants.SEQUENCE_ID;
+import static org.apache.ambari.logsearch.solr.SolrConstants.ServiceLogConstants.COMPONENT;
+import static org.apache.ambari.logsearch.solr.SolrConstants.ServiceLogConstants.HOST;
+import static org.apache.ambari.logsearch.solr.SolrConstants.ServiceLogConstants.LOGTIME;
+
+public class ServiceLogTruncatedRequestQueryConverter extends AbstractServiceLogRequestQueryConverter<ServiceLogTruncatedRequest, SimpleQuery>{
+
+  private String sequenceId;
+
+  private String logTime;
+
+  @Override
+  public SimpleQuery extendLogQuery(ServiceLogTruncatedRequest request, SimpleQuery query) {
+    addEqualsFilterQuery(query, COMPONENT, request.getComponentName());
+    addEqualsFilterQuery(query, HOST, request.getHostName());
+    String scrollType = request.getScrollType();
+    if (LogSearchConstants.SCROLL_TYPE_BEFORE.equals(scrollType)) {
+      Integer secuenceIdNum = Integer.parseInt(getSequenceId()) - 1;
+      addRangeFilter(query, LOGTIME, null, getLogTime());
+      addRangeFilter(query, SEQUENCE_ID, null, secuenceIdNum.toString());
+    } else if (LogSearchConstants.SCROLL_TYPE_AFTER.equals(scrollType)) {
+      Integer secuenceIdNum = Integer.parseInt(getSequenceId()) + 1;
+      addRangeFilter(query, LOGTIME, getLogTime(), null);
+      addRangeFilter(query, SEQUENCE_ID, secuenceIdNum.toString(), null);
+    }
+    query.setRows(request.getNumberRows());
+    return query;
+  }
+
+  @Override
+  public Sort sort(ServiceLogTruncatedRequest request) {
+    String scrollType = request.getScrollType();
+    Sort.Direction direction;
+    if (LogSearchConstants.SCROLL_TYPE_AFTER.equals(scrollType)) {
+      direction = Sort.Direction.ASC;
+    } else {
+      direction = Sort.Direction.DESC;
+    }
+    Sort.Order logtimeSortOrder = new Sort.Order(direction, LOGTIME);
+    Sort.Order secuqnceIdSortOrder = new Sort.Order(direction, SEQUENCE_ID);
+    return new Sort(logtimeSortOrder, secuqnceIdSortOrder);
+  }
+
+  @Override
+  public SimpleQuery createQuery() {
+    return new SimpleQuery();
+  }
+
+  @Override
+  public LogType getLogType() {
+    return LogType.SERVICE;
+  }
+
+  public String getSequenceId() {
+    return sequenceId;
+  }
+
+  public void setSequenceId(String sequenceId) {
+    this.sequenceId = sequenceId;
+  }
+
+  public String getLogTime() {
+    return logTime;
+  }
+
+  public void setLogTime(String logTime) {
+    this.logTime = logTime;
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/StringFieldFacetQueryConverter.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/StringFieldFacetQueryConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/StringFieldFacetQueryConverter.java
new file mode 100644
index 0000000..faff0be
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/StringFieldFacetQueryConverter.java
@@ -0,0 +1,44 @@
+/*
+ * 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.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.SimpleStringCriteria;
+
+import javax.inject.Named;
+
+@Named
+public class StringFieldFacetQueryConverter extends AbstractConverterAware<String, SimpleFacetQuery> {
+
+  @Override
+  public SimpleFacetQuery convert(String fieldName) {
+    Criteria criteria = new SimpleStringCriteria("*:*");
+    SimpleFacetQuery facetQuery = new SimpleFacetQuery();
+    facetQuery.addCriteria(criteria);
+    facetQuery.setRows(0);
+    FacetOptions facetOptions = new FacetOptions();
+    facetOptions.setFacetMinCount(1);
+    facetOptions.addFacetOnField(fieldName);
+    facetOptions.setFacetLimit(-1);
+    facetQuery.setFacetOptions(facetOptions);
+    return facetQuery;
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/UserConfigRequestQueryConverter.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/UserConfigRequestQueryConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/UserConfigRequestQueryConverter.java
new file mode 100644
index 0000000..082f45c
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/UserConfigRequestQueryConverter.java
@@ -0,0 +1,71 @@
+/*
+ * 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.UserConfigRequest;
+import org.apache.ambari.logsearch.util.SolrUtil;
+import org.apache.commons.lang.StringUtils;
+import org.apache.solr.client.solrj.SolrQuery;
+
+import javax.inject.Named;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import static org.apache.ambari.logsearch.solr.SolrConstants.UserConfigConstants.FILTER_NAME;
+import static org.apache.ambari.logsearch.solr.SolrConstants.UserConfigConstants.ROW_TYPE;
+import static org.apache.ambari.logsearch.solr.SolrConstants.UserConfigConstants.SHARE_NAME_LIST;
+import static org.apache.ambari.logsearch.solr.SolrConstants.UserConfigConstants.USER_NAME;
+
+@Named
+public class UserConfigRequestQueryConverter extends AbstractConverterAware<UserConfigRequest, SolrQuery> {
+
+  @Override
+  public SolrQuery convert(UserConfigRequest userConfigRequest) {
+    SolrQuery userConfigQuery = new SolrQuery();
+    userConfigQuery.setQuery("*:*");
+
+    int startIndex = StringUtils.isNotEmpty(userConfigRequest.getStartIndex()) && StringUtils.isNumeric(userConfigRequest.getStartIndex())
+      ? Integer.parseInt(userConfigRequest.getStartIndex()) : 0;
+    int maxRows = StringUtils.isNotEmpty(userConfigRequest.getPageSize()) && StringUtils.isNumeric(userConfigRequest.getStartIndex())
+      ? Integer.parseInt(userConfigRequest.getStartIndex()) : 10;
+
+    SolrQuery.ORDER order = userConfigRequest.getSortType() != null && SolrQuery.ORDER.desc.equals(SolrQuery.ORDER.valueOf(userConfigRequest.getSortType()))
+      ? SolrQuery.ORDER.desc : SolrQuery.ORDER.asc;
+    String sortBy = StringUtils.isNotEmpty(userConfigRequest.getSortBy()) ? userConfigRequest.getSortBy(): FILTER_NAME;
+    String filterName = StringUtils.isBlank(userConfigRequest.getFilterName()) ? "*" : "*" + userConfigRequest.getFilterName() + "*";
+
+    userConfigQuery.addFilterQuery(String.format("%s:%s",
+      ROW_TYPE, userConfigRequest.getRowType()));
+    userConfigQuery.addFilterQuery(String.format("%s:%s OR %s:%s",
+      USER_NAME, userConfigRequest.getUserId(),
+      SHARE_NAME_LIST, userConfigRequest.getUserId()));
+    userConfigQuery.addFilterQuery(String.format("%s:%s",
+      FILTER_NAME, SolrUtil.makeSearcableString(filterName)));
+    userConfigQuery.setStart(startIndex);
+    userConfigQuery.setRows(maxRows);
+
+    SolrQuery.SortClause sortOrder = SolrQuery.SortClause.create(sortBy, order);
+    List<SolrQuery.SortClause> sort = new ArrayList<>();
+    sort.add(sortOrder);
+    userConfigQuery.setSorts(sort);
+
+    return userConfigQuery;
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/UserExportRequestQueryConverter.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/UserExportRequestQueryConverter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/UserExportRequestQueryConverter.java
new file mode 100644
index 0000000..6b7c00e
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/UserExportRequestQueryConverter.java
@@ -0,0 +1,55 @@
+/*
+ * 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.UserExportRequest;
+import org.springframework.data.solr.core.query.FacetOptions;
+
+import javax.inject.Named;
+
+import static org.apache.ambari.logsearch.solr.SolrConstants.AuditLogConstants.AUDIT_COMPONENT;
+import static org.apache.ambari.logsearch.solr.SolrConstants.AuditLogConstants.AUDIT_EVTTIME;
+import static org.apache.ambari.logsearch.solr.SolrConstants.AuditLogConstants.AUDIT_REQUEST_USER;
+import static org.apache.ambari.logsearch.solr.SolrConstants.AuditLogConstants.AUDIT_RESOURCE;
+
+@Named
+public class UserExportRequestQueryConverter extends AbstractLogRequestFacetQueryConverter<UserExportRequest> {
+
+  @Override
+  public void appendFacetOptions(FacetOptions facetOptions, UserExportRequest request) {
+    facetOptions.addFacetOnPivot(AUDIT_REQUEST_USER, AUDIT_COMPONENT);
+    facetOptions.addFacetOnPivot(AUDIT_RESOURCE, AUDIT_COMPONENT);
+  }
+
+  @Override
+  public FacetOptions.FacetSort getFacetSort() {
+    return FacetOptions.FacetSort.COUNT;
+  }
+
+  @Override
+  public String getDateTimeField() {
+    return AUDIT_EVTTIME;
+  }
+
+  @Override
+  public LogType getLogType() {
+    return LogType.AUDIT;
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/AuditSolrDao.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/AuditSolrDao.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/AuditSolrDao.java
index 8d6a4da..959d6f4 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/AuditSolrDao.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/AuditSolrDao.java
@@ -21,17 +21,15 @@ package org.apache.ambari.logsearch.dao;
 
 import javax.annotation.PostConstruct;
 import javax.inject.Inject;
+import javax.inject.Named;
 
+import org.apache.ambari.logsearch.common.LogType;
 import org.apache.ambari.logsearch.conf.SolrAuditLogPropsConfig;
-import org.apache.ambari.logsearch.manager.ManagerBase.LogType;
 import org.apache.commons.lang.StringUtils;
 import org.apache.log4j.Logger;
-import org.apache.solr.client.solrj.impl.CloudSolrClient;
-import org.springframework.beans.factory.annotation.Qualifier;
 import org.springframework.data.solr.core.SolrTemplate;
-import org.springframework.stereotype.Component;
 
-@Component
+@Named
 public class AuditSolrDao extends SolrDaoBase {
 
   private static final Logger LOG = Logger.getLogger(AuditSolrDao.class);
@@ -40,7 +38,7 @@ public class AuditSolrDao extends SolrDaoBase {
   private SolrAuditLogPropsConfig solrAuditLogPropsConfig;
 
   @Inject
-  @Qualifier("auditSolrTemplate")
+  @Named("auditSolrTemplate")
   private SolrTemplate auditSolrTemplate;
 
   @Inject
@@ -50,6 +48,7 @@ public class AuditSolrDao extends SolrDaoBase {
   private SolrCollectionDao solrCollectionDao;
 
   @Inject
+  @Named("auditSolrFieldDao")
   private SolrSchemaFieldDao solrSchemaFieldDao;
 
   public AuditSolrDao() {
@@ -57,8 +56,8 @@ public class AuditSolrDao extends SolrDaoBase {
   }
 
   @Override
-  public CloudSolrClient getSolrClient() {
-    return (CloudSolrClient) auditSolrTemplate.getSolrClient();
+  public SolrTemplate getSolrTemplate() {
+    return auditSolrTemplate;
   }
 
   @PostConstruct
@@ -71,13 +70,17 @@ public class AuditSolrDao extends SolrDaoBase {
       boolean createAlias = (aliasNameIn != null && !StringUtils.isBlank(rangerAuditCollection));
       solrCollectionDao.setupCollections(getSolrClient(), solrAuditLogPropsConfig);
       if (createAlias) {
-        solrAliasDao.setupAlias(solrSchemaFieldDao, getSolrClient(), solrAuditLogPropsConfig, this);
+        solrAliasDao.setupAlias(solrSchemaFieldDao, getSolrClient(), solrAuditLogPropsConfig);
       } else {
-        solrSchemaFieldDao.populateSchemaFields(getSolrClient(), solrAuditLogPropsConfig, this);
+        solrSchemaFieldDao.populateSchemaFields(getSolrClient(), solrAuditLogPropsConfig);
       }
     } catch (Exception e) {
       LOG.error("Error while connecting to Solr for audit logs : solrUrl=" + solrAuditLogPropsConfig.getSolrUrl() + ", zkConnectString=" +
           solrAuditLogPropsConfig.getZkConnectString() + ", collection=" + solrAuditLogPropsConfig.getCollection(), e);
     }
   }
+
+  public SolrSchemaFieldDao getSolrSchemaFieldDao() {
+    return solrSchemaFieldDao;
+  }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/ServiceLogsSolrDao.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/ServiceLogsSolrDao.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/ServiceLogsSolrDao.java
index a6f5acf..0e1d57c 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/ServiceLogsSolrDao.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/ServiceLogsSolrDao.java
@@ -21,16 +21,14 @@ package org.apache.ambari.logsearch.dao;
 
 import javax.annotation.PostConstruct;
 import javax.inject.Inject;
+import javax.inject.Named;
 
+import org.apache.ambari.logsearch.common.LogType;
 import org.apache.ambari.logsearch.conf.SolrServiceLogPropsConfig;
-import org.apache.ambari.logsearch.manager.ManagerBase.LogType;
 import org.apache.log4j.Logger;
-import org.apache.solr.client.solrj.impl.CloudSolrClient;
-import org.springframework.beans.factory.annotation.Qualifier;
 import org.springframework.data.solr.core.SolrTemplate;
-import org.springframework.stereotype.Component;
 
-@Component
+@Named
 public class ServiceLogsSolrDao extends SolrDaoBase {
 
   private static final Logger LOG = Logger.getLogger(ServiceLogsSolrDao.class);
@@ -42,10 +40,11 @@ public class ServiceLogsSolrDao extends SolrDaoBase {
   private SolrServiceLogPropsConfig solrServiceLogPropsConfig;
 
   @Inject
-  @Qualifier("serviceSolrTemplate")
+  @Named("serviceSolrTemplate")
   private SolrTemplate serviceSolrTemplate;
 
   @Inject
+  @Named("serviceSolrFieldDao")
   private SolrSchemaFieldDao solrSchemaFieldDao;
 
   public ServiceLogsSolrDao() {
@@ -53,8 +52,8 @@ public class ServiceLogsSolrDao extends SolrDaoBase {
   }
 
   @Override
-  public CloudSolrClient getSolrClient() {
-    return (CloudSolrClient) serviceSolrTemplate.getSolrClient();
+  public SolrTemplate getSolrTemplate() {
+    return serviceSolrTemplate;
   }
 
   @PostConstruct
@@ -63,11 +62,15 @@ public class ServiceLogsSolrDao extends SolrDaoBase {
     try {
       solrCollectionDao.checkSolrStatus(getSolrClient());
       solrCollectionDao.setupCollections(getSolrClient(), solrServiceLogPropsConfig);
-      solrSchemaFieldDao.populateSchemaFields(getSolrClient(), solrServiceLogPropsConfig, this);
+      solrSchemaFieldDao.populateSchemaFields(getSolrClient(), solrServiceLogPropsConfig);
     } catch (Exception e) {
       LOG.error("error while connecting to Solr for service logs : solrUrl=" + solrServiceLogPropsConfig.getSolrUrl()
         + ", zkConnectString=" + solrServiceLogPropsConfig.getZkConnectString()
         + ", collection=" + solrServiceLogPropsConfig.getCollection(), e);
     }
   }
+
+  public SolrSchemaFieldDao getSolrSchemaFieldDao() {
+    return solrSchemaFieldDao;
+  }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/SolrAliasDao.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/SolrAliasDao.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/SolrAliasDao.java
index 81471d3..6389446 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/SolrAliasDao.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/SolrAliasDao.java
@@ -26,16 +26,16 @@ import org.apache.solr.client.solrj.request.CollectionAdminRequest;
 import org.apache.solr.client.solrj.response.CollectionAdminResponse;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.springframework.stereotype.Component;
 
 import javax.inject.Inject;
+import javax.inject.Named;
 import java.io.IOException;
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.HashMap;
 import java.util.List;
 
-@Component
+@Named
 public class SolrAliasDao {
 
   private static final Logger LOG = LoggerFactory.getLogger(SolrAliasDao.class);
@@ -46,7 +46,7 @@ public class SolrAliasDao {
   private SolrCollectionDao solrCollectionDao;
 
   protected void setupAlias(final SolrSchemaFieldDao solrSchemaFieldDao, final CloudSolrClient solrClient,
-                            final SolrAuditLogPropsConfig solrPropsConfig, final SolrDaoBase solrDaoBase) throws Exception {
+                            final SolrAuditLogPropsConfig solrPropsConfig) throws Exception {
     final Collection<String> collectionListIn = Arrays.asList(solrPropsConfig.getCollection(), solrPropsConfig.getRangerCollection().trim());
 
     if (solrPropsConfig.getAliasNameIn() == null || collectionListIn.size() == 0 || solrClient == null) {
@@ -71,7 +71,7 @@ public class SolrAliasDao {
               if (count == collectionListIn.size()) {
                 LOG.info("Setup for alias " + solrPropsConfig.getAliasNameIn() + " is successful. Exiting setup retry thread. " +
                   "Collections=" + collectionListIn);
-                solrSchemaFieldDao.populateSchemaFields(solrClient, solrPropsConfig, solrDaoBase);
+                solrSchemaFieldDao.populateSchemaFields(solrClient, solrPropsConfig);
                 break;
               }
             } else {

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/SolrCollectionDao.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/SolrCollectionDao.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/SolrCollectionDao.java
index ed93b4d..1cbac31 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/SolrCollectionDao.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/SolrCollectionDao.java
@@ -30,15 +30,15 @@ import org.apache.solr.common.cloud.Slice;
 import org.apache.solr.common.cloud.ZkStateReader;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.springframework.stereotype.Component;
 
+import javax.inject.Named;
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashSet;
 import java.util.List;
 
-@Component
+@Named
 public class SolrCollectionDao {
 
   private static final Logger LOG = LoggerFactory.getLogger(SolrCollectionDao.class);

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/SolrDaoBase.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/SolrDaoBase.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/SolrDaoBase.java
index 8381948..d9a9464 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/SolrDaoBase.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/SolrDaoBase.java
@@ -19,88 +19,91 @@
 
 package org.apache.ambari.logsearch.dao;
 
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
 import org.apache.ambari.logsearch.common.LogSearchContext;
+import org.apache.ambari.logsearch.common.LogType;
 import org.apache.ambari.logsearch.common.MessageEnums;
-import org.apache.ambari.logsearch.manager.ManagerBase.LogType;
-import org.apache.ambari.logsearch.model.response.BarGraphData;
-import org.apache.ambari.logsearch.model.response.NameValueData;
-import org.apache.ambari.logsearch.util.DateUtil;
 import org.apache.ambari.logsearch.util.RESTErrorUtil;
 import org.apache.log4j.Logger;
+import org.apache.solr.client.solrj.SolrClient;
 import org.apache.solr.client.solrj.SolrQuery;
 import org.apache.solr.client.solrj.SolrRequest.METHOD;
 import org.apache.solr.client.solrj.SolrServerException;
 import org.apache.solr.client.solrj.impl.CloudSolrClient;
 import org.apache.solr.client.solrj.response.QueryResponse;
-import org.apache.solr.common.util.NamedList;
-import org.apache.solr.common.util.SimpleOrderedMap;
+import org.springframework.data.solr.core.DefaultQueryParser;
+import org.springframework.data.solr.core.SolrCallback;
+import org.springframework.data.solr.core.SolrTemplate;
+import org.springframework.data.solr.core.query.SolrDataQuery;
+
+import java.io.IOException;
 
 public abstract class SolrDaoBase {
 
+  private static final Logger LOG = Logger.getLogger(SolrDaoBase.class);
   private static final Logger LOG_PERFORMANCE = Logger.getLogger("org.apache.ambari.logsearch.performance");
 
-  public Map<String, String> schemaFieldNameMap = new HashMap<>();
-  public Map<String, String> schemaFieldTypeMap = new HashMap<>();
-
   private LogType logType;
   
   protected SolrDaoBase(LogType logType) {
     this.logType = logType;
   }
 
-  public QueryResponse process(SolrQuery solrQuery) throws SolrServerException, IOException {
+  public QueryResponse process(SolrQuery solrQuery, String event) {
     if (getSolrClient() != null) {
-      String event = solrQuery.get("event");
+      event = event == null ? solrQuery.get("event") : event;
       solrQuery.remove("event");
-      QueryResponse queryResponse = getSolrClient().query(solrQuery, METHOD.POST);
-      if (event != null && !"/audit/logs/live/count".equalsIgnoreCase(event)) {
-        LOG_PERFORMANCE.info("\n Username :- " + LogSearchContext.getCurrentUsername() + " Event :- " + event + " SolrQuery :- " +
+      try {
+        QueryResponse queryResponse = getSolrClient().query(solrQuery, METHOD.POST);
+        if (event != null) {
+          LOG_PERFORMANCE.info("\n Username :- " + LogSearchContext.getCurrentUsername() + " Event :- " + event + " SolrQuery :- " +
             solrQuery + "\nQuery Time Execution :- " + queryResponse.getQTime() + " Total Time Elapsed is :- " +
             queryResponse.getElapsedTime());
+        }
+        return queryResponse;
+      } catch (Exception e){
+        LOG.error("Error during solrQuery=" + e);
+        throw RESTErrorUtil.createRESTException(MessageEnums.SOLR_ERROR.getMessage().getMessage(), MessageEnums.ERROR_SYSTEM);
       }
-      return queryResponse;
     } else {
       throw RESTErrorUtil.createRESTException("Solr configuration improper for " + logType.getLabel() +" logs",
           MessageEnums.ERROR_SYSTEM);
     }
   }
 
-  @SuppressWarnings("unchecked")
-  public void extractValuesFromBuckets(SimpleOrderedMap<Object> jsonFacetResponse, String outerField, String innerField,
-                                        List<BarGraphData> histogramData) {
-    NamedList<Object> stack = (NamedList<Object>) jsonFacetResponse.get(outerField);
-    ArrayList<Object> stackBuckets = (ArrayList<Object>) stack.get("buckets");
-    for (Object temp : stackBuckets) {
-      BarGraphData vBarGraphData = new BarGraphData();
-
-      SimpleOrderedMap<Object> level = (SimpleOrderedMap<Object>) temp;
-      String name = ((String) level.getVal(0)).toUpperCase();
-      vBarGraphData.setName(name);
+  public QueryResponse process(SolrQuery solrQuery) {
+    return process(solrQuery, null);
+  }
 
-      Collection<NameValueData> vNameValues = new ArrayList<>();
-      vBarGraphData.setDataCount(vNameValues);
-      ArrayList<Object> levelBuckets = (ArrayList<Object>) ((NamedList<Object>) level.get(innerField)).get("buckets");
-      for (Object temp1 : levelBuckets) {
-        SimpleOrderedMap<Object> countValue = (SimpleOrderedMap<Object>) temp1;
-        String value = DateUtil.convertDateWithMillisecondsToSolrDate((Date) countValue.getVal(0));
+  public QueryResponse process(SolrDataQuery solrDataQuery) {
+    return process(new DefaultQueryParser().doConstructSolrQuery(solrDataQuery));
+  }
 
-        String count = "" + countValue.getVal(1);
-        NameValueData vNameValue = new NameValueData();
-        vNameValue.setName(value);
-        vNameValue.setValue(count);
-        vNameValues.add(vNameValue);
+  public long count(final SolrDataQuery solrDataQuery) {
+    return getSolrTemplate().execute(new SolrCallback<Long>() {
+      @Override
+      public Long doInSolr(SolrClient solrClient) throws SolrServerException, IOException {
+        SolrQuery solrQuery = new DefaultQueryParser().doConstructSolrQuery(solrDataQuery);
+        solrQuery.setStart(0);
+        solrQuery.setRows(0);
+        QueryResponse queryResponse = solrClient.query(solrQuery);
+        long count = solrClient.query(solrQuery).getResults().getNumFound();
+        LOG_PERFORMANCE.info("\n Username :- " + LogSearchContext.getCurrentUsername() + " Count SolrQuery :- " +
+          solrQuery + "\nQuery Time Execution :- " + queryResponse.getQTime() + " Total Time Elapsed is :- " +
+          queryResponse.getElapsedTime() + " Count result :- " + count);
+        return count;
       }
-      histogramData.add(vBarGraphData);
-    }
+    });
+  }
+
+  public QueryResponse process(SolrDataQuery solrDataQuery, String event) {
+    return process(new DefaultQueryParser().doConstructSolrQuery(solrDataQuery), event);
   }
 
-  public abstract CloudSolrClient getSolrClient();
+  public CloudSolrClient getSolrClient() {
+    return (CloudSolrClient) getSolrTemplate().getSolrClient();
+  }
+
+  public abstract SolrTemplate getSolrTemplate();
+
+  public abstract SolrSchemaFieldDao getSolrSchemaFieldDao();
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/SolrSchemaFieldDao.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/SolrSchemaFieldDao.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/SolrSchemaFieldDao.java
index b6764d0..f16dc41 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/SolrSchemaFieldDao.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/SolrSchemaFieldDao.java
@@ -33,16 +33,12 @@ import org.codehaus.jettison.json.JSONArray;
 import org.codehaus.jettison.json.JSONObject;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.springframework.context.annotation.Scope;
-import org.springframework.stereotype.Component;
 
 import javax.inject.Inject;
 import java.io.IOException;
 import java.util.HashMap;
 import java.util.Map;
 
-@Component
-@Scope(value = "prototype")
 public class SolrSchemaFieldDao {
 
   private static final Logger LOG = LoggerFactory.getLogger(SolrSchemaFieldDao.class);
@@ -52,11 +48,13 @@ public class SolrSchemaFieldDao {
 
   private boolean populateFieldsThreadActive = false;
 
+  private Map<String, String> schemaFieldNameMap = new HashMap<>();
+  private Map<String, String> schemaFieldTypeMap = new HashMap<>();
+
   @Inject
   private SolrUserPropsConfig solrUserPropsConfig;
 
-  public void populateSchemaFields(final CloudSolrClient solrClient, final SolrPropsConfig solrPropsConfig,
-                                   final SolrDaoBase solrDao) {
+  public void populateSchemaFields(final CloudSolrClient solrClient, final SolrPropsConfig solrPropsConfig) {
     if (!populateFieldsThreadActive) {
       populateFieldsThreadActive = true;
       LOG.info("Creating thread to populated fields for collection=" + solrPropsConfig.getCollection());
@@ -69,7 +67,7 @@ public class SolrSchemaFieldDao {
             try {
               Thread.sleep(SETUP_RETRY_SECOND * 1000);
               retryCount++;
-              boolean _result = _populateSchemaFields(solrClient, solrPropsConfig, solrDao);
+              boolean _result = _populateSchemaFields(solrClient, solrPropsConfig);
               if (_result) {
                 LOG.info("Populate fields for collection " + solrPropsConfig.getCollection() + " is success, Update it after " +
                   SETUP_UPDATE_SECOND + " sec");
@@ -94,7 +92,7 @@ public class SolrSchemaFieldDao {
   /**
    * Called from the thread. Don't call this directly
    */
-  private boolean _populateSchemaFields(CloudSolrClient solrClient, SolrPropsConfig solrPropsConfig, SolrDaoBase solrDao) {
+  private boolean _populateSchemaFields(CloudSolrClient solrClient, SolrPropsConfig solrPropsConfig) {
     SolrRequest<SchemaResponse> request = new SchemaRequest();
     request.setMethod(SolrRequest.METHOD.GET);
     request.setPath("/schema");
@@ -109,7 +107,7 @@ public class SolrSchemaFieldDao {
       }
 
       if (namedList != null) {
-        extractSchemaFieldsName(namedList.toString(), solrDao.schemaFieldNameMap, solrDao.schemaFieldTypeMap);
+        extractSchemaFieldsName(namedList.toString(), schemaFieldNameMap, schemaFieldTypeMap);
         return true;
       }
     }
@@ -156,4 +154,12 @@ public class SolrSchemaFieldDao {
       LOG.error(e + "Credentials not specified in logsearch.properties " + MessageEnums.ERROR_SYSTEM);
     }
   }
+
+  public Map<String, String> getSchemaFieldTypeMap() {
+    return schemaFieldTypeMap;
+  }
+
+  public Map<String, String> getSchemaFieldNameMap() {
+    return schemaFieldNameMap;
+  }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/UserConfigSolrDao.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/UserConfigSolrDao.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/UserConfigSolrDao.java
index 88c4577..a6ea77c 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/UserConfigSolrDao.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/UserConfigSolrDao.java
@@ -28,14 +28,15 @@ import java.util.List;
 import java.util.Scanner;
 import javax.annotation.PostConstruct;
 import javax.inject.Inject;
+import javax.inject.Named;
 
+import org.apache.ambari.logsearch.common.LogSearchConstants;
 import org.apache.ambari.logsearch.common.LogSearchContext;
+import org.apache.ambari.logsearch.common.LogType;
 import org.apache.ambari.logsearch.conf.SolrUserPropsConfig;
-import org.apache.ambari.logsearch.view.VLogfeederFilterWrapper;
-import org.apache.ambari.logsearch.common.LogSearchConstants;
+import org.apache.ambari.logsearch.model.common.LogFeederDataMap;
 import org.apache.solr.client.solrj.SolrQuery;
 import org.apache.solr.client.solrj.SolrServerException;
-import org.apache.solr.client.solrj.impl.CloudSolrClient;
 import org.apache.solr.client.solrj.response.QueryResponse;
 import org.apache.solr.client.solrj.response.UpdateResponse;
 import org.apache.solr.common.SolrDocument;
@@ -47,15 +48,18 @@ import org.codehaus.jettison.json.JSONException;
 import org.codehaus.jettison.json.JSONObject;
 import com.google.gson.JsonParseException;
 
-import org.apache.ambari.logsearch.manager.ManagerBase.LogType;
 import org.apache.ambari.logsearch.util.JSONUtil;
 import org.apache.log4j.Logger;
-import org.springframework.beans.factory.annotation.Qualifier;
 import org.springframework.data.solr.core.SolrTemplate;
-import org.springframework.stereotype.Component;
 import org.springframework.util.CollectionUtils;
 
-@Component
+import static org.apache.ambari.logsearch.solr.SolrConstants.UserConfigConstants.ID;
+import static org.apache.ambari.logsearch.solr.SolrConstants.UserConfigConstants.USER_NAME;
+import static org.apache.ambari.logsearch.solr.SolrConstants.UserConfigConstants.VALUES;
+import static org.apache.ambari.logsearch.solr.SolrConstants.UserConfigConstants.FILTER_NAME;
+import static org.apache.ambari.logsearch.solr.SolrConstants.UserConfigConstants.ROW_TYPE;
+
+@Named
 public class UserConfigSolrDao extends SolrDaoBase {
 
   private static final Logger LOG = Logger.getLogger(UserConfigSolrDao.class);
@@ -69,10 +73,11 @@ public class UserConfigSolrDao extends SolrDaoBase {
   private SolrCollectionDao solrCollectionDao;
 
   @Inject
+  @Named("serviceSolrFieldDao")
   private SolrSchemaFieldDao solrSchemaFieldDao;
 
   @Inject
-  @Qualifier("userConfigSolrTemplate")
+  @Named("userConfigSolrTemplate")
   private SolrTemplate userConfigSolrTemplate;
 
   public UserConfigSolrDao() {
@@ -80,11 +85,10 @@ public class UserConfigSolrDao extends SolrDaoBase {
   }
 
   @Override
-  public CloudSolrClient getSolrClient() {
-    return (CloudSolrClient) userConfigSolrTemplate.getSolrClient();
+  public SolrTemplate getSolrTemplate() {
+    return userConfigSolrTemplate;
   }
 
-
   @PostConstruct
   public void postConstructor() {
     String solrUrl = solrUserConfig.getSolrUrl();
@@ -94,7 +98,7 @@ public class UserConfigSolrDao extends SolrDaoBase {
     try {
       solrCollectionDao.checkSolrStatus(getSolrClient());
       solrCollectionDao.setupCollections(getSolrClient(), solrUserConfig);
-      solrSchemaFieldDao.populateSchemaFields(getSolrClient(), solrUserConfig, this);
+      solrSchemaFieldDao.populateSchemaFields(getSolrClient(), solrUserConfig);
       intializeLogFeederFilter();
 
     } catch (Exception e) {
@@ -111,15 +115,15 @@ public class UserConfigSolrDao extends SolrDaoBase {
     }
   }
 
-  public void saveUserFilter(VLogfeederFilterWrapper logfeederFilterWrapper) throws SolrException, SolrServerException, IOException {
+  public void saveUserFilter(LogFeederDataMap logfeederFilterWrapper) throws SolrException, SolrServerException, IOException {
     String filterName = LogSearchConstants.LOGFEEDER_FILTER_NAME;
     String json = JSONUtil.objToJson(logfeederFilterWrapper);
     SolrInputDocument configDocument = new SolrInputDocument();
-    configDocument.addField(LogSearchConstants.ID, logfeederFilterWrapper.getId());
-    configDocument.addField(LogSearchConstants.ROW_TYPE, filterName);
-    configDocument.addField(LogSearchConstants.VALUES, json);
-    configDocument.addField(LogSearchConstants.USER_NAME, filterName);
-    configDocument.addField(LogSearchConstants.FILTER_NAME, filterName);
+    configDocument.addField(ID, logfeederFilterWrapper.getId());
+    configDocument.addField(ROW_TYPE, filterName);
+    configDocument.addField(VALUES, json);
+    configDocument.addField(USER_NAME, filterName);
+    configDocument.addField(FILTER_NAME, filterName);
     addDocs(configDocument);
   }
 
@@ -144,23 +148,23 @@ public class UserConfigSolrDao extends SolrDaoBase {
   }
 
 	@SuppressWarnings("unchecked")
-  public VLogfeederFilterWrapper getUserFilter() throws SolrServerException, IOException {
+  public LogFeederDataMap getUserFilter() throws SolrServerException, IOException {
 
     SolrQuery solrQuery = new SolrQuery();
     solrQuery.setQuery("*:*");
-    String fq = LogSearchConstants.ROW_TYPE + ":" + LogSearchConstants.LOGFEEDER_FILTER_NAME;
+    String fq = ROW_TYPE + ":" + LogSearchConstants.LOGFEEDER_FILTER_NAME;
     solrQuery.setFilterQueries(fq);
 
     QueryResponse response = process(solrQuery);
     SolrDocumentList documentList = response.getResults();
-    VLogfeederFilterWrapper logfeederFilterWrapper = null;
+    LogFeederDataMap logfeederDataMap = null;
     if (!CollectionUtils.isEmpty(documentList)) {
       SolrDocument configDoc = documentList.get(0);
       String configJson = JSONUtil.objToJson(configDoc);
       HashMap<String, Object> configMap = JSONUtil.jsonToMapObject(configJson);
-      String json = (String) configMap.get(LogSearchConstants.VALUES);
-      logfeederFilterWrapper = (VLogfeederFilterWrapper) JSONUtil.jsonToObj(json, VLogfeederFilterWrapper.class);
-      logfeederFilterWrapper.setId("" + configDoc.get(LogSearchConstants.ID));
+      String json = (String) configMap.get(VALUES);
+      logfeederDataMap = (LogFeederDataMap) JSONUtil.jsonToObj(json, LogFeederDataMap.class);
+      logfeederDataMap.setId("" + configDoc.get(ID));
 
     } else {
       List<String> logfeederDefaultLevels = solrUserConfig.getLogLevels();
@@ -189,16 +193,21 @@ public class UserConfigSolrDao extends SolrDaoBase {
           }
         }
         jsonValue.put("filter", componentList);
-        logfeederFilterWrapper = (VLogfeederFilterWrapper) JSONUtil.jsonToObj(jsonValue.toString(), VLogfeederFilterWrapper.class);
-        logfeederFilterWrapper.setId(""+new Date().getTime());
-        saveUserFilter(logfeederFilterWrapper);
+        logfeederDataMap = (LogFeederDataMap) JSONUtil.jsonToObj(jsonValue.toString(), LogFeederDataMap.class);
+        logfeederDataMap.setId(""+new Date().getTime());
+        saveUserFilter(logfeederDataMap);
 
       } catch (JsonParseException | JSONException je) {
         LOG.error("Error parsing JSON. key=" + key + ", componentArray=" + componentArray, je);
-        logfeederFilterWrapper = new VLogfeederFilterWrapper();
+        logfeederDataMap = new LogFeederDataMap();
       }
     }
-    return logfeederFilterWrapper;
+    return logfeederDataMap;
+  }
+
+  @Override
+  public SolrSchemaFieldDao getSolrSchemaFieldDao() {
+    return solrSchemaFieldDao;
   }
 
   private String getHadoopServiceConfigJSON() {

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/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 0df2ca3..e6f5103 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
@@ -44,6 +44,7 @@ public class DocConstants {
     public static final String IS_LAST_PAGE_D = "Show last page (true/false)";
     public static final String FIELD_D = "Get values for particular field";
     public static final String FORMAT_D = "File Export format, can be 'txt' or 'json'";
+    public static final String TOP = "Number that defines how many top element you would like to see.";
   }
 
   public class AuditOperationDescriptions {
@@ -51,11 +52,7 @@ public class DocConstants {
     public static final String GET_AUDIT_LOGS_OD = "Get the list of logs details";
     public static final String GET_AUDIT_COMPONENTS_OD = "Get the list of audit components currently active or having data in Solr";
     public static final String GET_AUDIT_LINE_GRAPH_DATA_OD = "Get the data required for line graph";
-    public static final String GET_TOP_AUDIT_USERS_OD = "Get the top audit users having maximum access";
-    public static final String GET_TOP_AUDIT_RESOURCES_OD = "Get the top audit resources having maximum access";
-    public static final String GET_LIVE_LOGS_COUNT_OD = "not required";
-    public static final String GET_REQUEST_USER_LINE_GRAPH_OD = "not required";
-    public static final String GET_ANY_GRAPH_DATA_OD = "Get the data generic enough to use for graph plots";
+    public static final String GET_TOP_AUDIT_RESOURCES_OD = "Get the top audit resource count (grouped by type)";
     public static final String EXPORT_USER_TALBE_TO_TEXT_FILE_OD = "Export the tables shown on Audit tab";
     public static final String GET_SERVICE_LOAD_OD = "The graph for showing the top users accessing the services";
   }
@@ -64,7 +61,6 @@ public class DocConstants {
     public static final String LEVEL_D = "filter for log level";
     public static final String BUNDLE_ID = "filter for host";
     public static final String FILE_NAME_D = "File name filter which is supported from browser url";
-    public static final String DATE_RANGE_LABEL_D = "Date range label (e.g.: Today)";
     public static final String HOST_NAME_D = "Host name filter which is supported from browser url";
     public static final String COMPONENT_NAME_D = "Component name filter which is supported from browser url";
     public static final String FIND_D = "Finding particular text on subsequent pages in case of table view with pagination";
@@ -72,7 +68,6 @@ public class DocConstants {
     public static final String KEYWORD_TYPE_D = "Serching the find param value in previous or next in paginated table";
     public static final String TOKEN_D = "unique number used along with FIND_D. The request can be canceled using this token";
     public static final String SOURCE_LOG_ID_D = "fetch the record set having that log Id";
-    public static final String G_MUST_NOT_D = "not required";
     public static final String NUMBER_ROWS_D = "Getting rows after particular log entry - used in 'Preview' option";
     public static final String SCROLL_TYPE_D = "Used in 'Preview' feature for getting records 'after' or 'before'";
     public static final String UTC_OFFSET_D = "timezone offset";
@@ -86,18 +81,15 @@ public class DocConstants {
     public static final String GET_LOG_LEVELS_COUNT_OD = "Get Log levels with their counts";
     public static final String GET_COMPONENTS_COUNT_OD = "Get components with their counts";
     public static final String GET_HOSTS_COUNT_OD = "Get hosts with their counts";
-    public static final String GET_TREE_EXTENSION_OD = "Get host and compoenets hierarchy";
+    public static final String GET_TREE_EXTENSION_OD = "Get host and compoenets hierarchy with log counts";
     public static final String GET_HISTOGRAM_DATA_OD = "Get data for histogram";
-    public static final String CANCEL_FIND_REQUEST_OD = "Cancel the FIND_D param request using TOKEN_D";
     public static final String EXPORT_TO_TEXT_FILE_OD = "Export the table data in file";
     public static final String GET_COMPONENT_LIST_WITH_LEVEL_COUNT_OD = "Get components with log level distribution count";
-    public static final String GET_EXTREME_DATES_FOR_BUNDLE_ID_OD = "Get the start and end time of particular bundle_id";
-    public static final String GET_SERVICE_LOGS_FIELD_NAME_OD = "Get service logs schema fields name (Human readable)";
-    public static final String GET_ANY_GRAPH_DATA_OD = "Get the data generic enough to use for graph plots";
-    public static final String GET_AFTER_BEFORE_LOGS_OD = "Preview feature data";
+    public static final String GET_ANY_GRAPH_COUNT_DATA_OD = "Get the data generic enough to use for graph plots (yAzis is always count)";
     public static final String GET_HOST_LIST_BY_COMPONENT_OD = "Get host list of components";
     public static final String GET_SERVICE_LOGS_SCHEMA_FIELD_NAME_OD = "Get service logs schema fields";
     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 class PublicOperationDescriptions {


[36/58] [abbrv] ambari git commit: AMBARI-18310. Logsearch - Refactor solr query layer (oleewere)

Posted by ol...@apache.org.
http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/util/DownloadUtil.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/util/DownloadUtil.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/util/DownloadUtil.java
new file mode 100644
index 0000000..debe131
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/util/DownloadUtil.java
@@ -0,0 +1,176 @@
+/*
+ * 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.util;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+
+import com.google.common.base.Splitter;
+import org.apache.ambari.logsearch.common.LogSearchConstants;
+import org.apache.ambari.logsearch.model.request.impl.ServiceLogExportRequest;
+import org.apache.ambari.logsearch.model.response.BarGraphData;
+import org.apache.ambari.logsearch.model.response.BarGraphDataListResponse;
+import org.apache.ambari.logsearch.model.response.NameValueData;
+import org.apache.ambari.logsearch.model.response.TemplateData;
+import org.apache.commons.lang.StringUtils;
+import org.apache.solr.common.SolrDocument;
+import org.apache.solr.common.SolrDocumentList;
+
+import static org.apache.ambari.logsearch.solr.SolrConstants.ServiceLogConstants.LINE_NUMBER;
+import static org.apache.ambari.logsearch.solr.SolrConstants.ServiceLogConstants.LOGTIME;
+import static org.apache.ambari.logsearch.solr.SolrConstants.ServiceLogConstants.LOG_MESSAGE;
+import static org.apache.ambari.logsearch.solr.SolrConstants.ServiceLogConstants.LEVEL;
+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.LOGGER_NAME;
+import static org.apache.ambari.logsearch.solr.SolrConstants.ServiceLogConstants.THREAD_NAME;
+import static org.apache.ambari.logsearch.solr.SolrConstants.CommonLogConstants.FILE;
+
+
+public class DownloadUtil {
+
+  private DownloadUtil() {
+    throw new UnsupportedOperationException();
+  }
+
+  public static void fillModelsForLogFile(SolrDocumentList docList, Map<String, Object> models, ServiceLogExportRequest request,
+                                          String format, String from, String to) {
+    long numLogs = docList.getNumFound();
+    List<String> hosts = new ArrayList<>();
+    List<String> components = new ArrayList<>();
+    List<String> levels = new ArrayList<>();
+    List<TemplateData> logData = new ArrayList<>();
+    for (SolrDocument doc : docList) {
+      if (doc != null) {
+        String hostname = (String) doc.getFieldValue(HOST);
+        String comp = (String) doc.getFieldValue(COMPONENT);
+        String level = (String) doc.getFieldValue(LEVEL);
+
+        if (!hosts.contains(hostname)) {
+          hosts.add(hostname);
+        }
+
+        if (!components.contains(comp)) {
+          components.add(comp);
+        }
+
+        if (!levels.contains(level)) {
+          levels.add(level);
+        }
+
+        StringBuffer textToWrite = new StringBuffer();
+
+        if (doc.getFieldValue(LOGTIME) != null) {
+          textToWrite.append(doc.getFieldValue(LOGTIME).toString() + " ");
+        }
+        if (doc.getFieldValue(LEVEL) != null) {
+          textToWrite.append(doc.getFieldValue(LEVEL).toString()).append(" ");
+        }
+        if (doc.getFieldValue(THREAD_NAME) != null) {
+          textToWrite.append(doc.getFieldValue(THREAD_NAME).toString().trim()).append(" ");
+        }
+        if (doc.getFieldValue(LOGGER_NAME) != null) {
+          textToWrite.append(doc.getFieldValue(LOGGER_NAME).toString().trim()).append(" ");
+        }
+        if (doc.getFieldValue(FILE) != null && doc.getFieldValue(LINE_NUMBER) != null) {
+          textToWrite
+            .append(doc.getFieldValue(FILE).toString())
+            .append(":")
+            .append(doc.getFieldValue(LINE_NUMBER).toString())
+            .append(" ");
+        }
+        if (doc.getFieldValue(LOG_MESSAGE) != null) {
+          textToWrite.append("- ")
+            .append(doc.getFieldValue(LOG_MESSAGE).toString());
+        }
+        logData.add(new TemplateData((textToWrite.toString())));
+      }
+    }
+    models.put("numberOfLogs", numLogs);
+    models.put("logs", logData);
+    models.put("hosts", "[ " + StringUtils.join(hosts, " ; ") + " ]");
+    models.put("components", "[ " + StringUtils.join(components, " ; ") + " ]");
+    models.put("format", format);
+    models.put("from", from);
+    models.put("levels", StringUtils.join(levels, ", "));
+    models.put("to", to);
+    String includeString = request.getiMessage();
+    if (StringUtils.isBlank(includeString)) {
+      includeString = "\"\"";
+    } else {
+      List<String> include = Splitter.on(request.getiMessage()).splitToList(LogSearchConstants.I_E_SEPRATOR);
+      includeString = "\"" + StringUtils.join(include, "\", \"") + "\"";
+    }
+    models.put("iString", includeString);
+
+    String excludeString = request.geteMessage();
+    if (StringUtils.isBlank(excludeString)) {
+      excludeString = "\"\"";
+    } else {
+      List<String> exclude = Splitter.on(request.getiMessage()).splitToList(LogSearchConstants.I_E_SEPRATOR);
+      excludeString = "\"" + StringUtils.join(exclude, "\", \"") + "\"";
+    }
+    models.put("eString", excludeString);
+  }
+
+  public static void fillUserResourcesModel(Map<String, Object> models, BarGraphDataListResponse vBarUserDataList, BarGraphDataListResponse vBarResourceDataList) {
+    List<TemplateData> usersDataList = new ArrayList<>();
+    List<TemplateData> resourceDataList = new ArrayList<>();
+    Collection<BarGraphData> tableUserData = vBarUserDataList.getGraphData();
+    for (BarGraphData graphData : tableUserData) {
+      String userName = graphData.getName().length() > 45 ? graphData.getName().substring(0, 45) : graphData.getName();
+      Collection<NameValueData> vnameValueList = graphData.getDataCount();
+      usersDataList.add(new TemplateData(appendNameValueData(addBlank(userName), vnameValueList)));
+    }
+    Collection<BarGraphData> tableResourceData = vBarResourceDataList.getGraphData();
+    for (BarGraphData graphData : tableResourceData) {
+      String resourceName = graphData.getName().length() > 45 ? graphData.getName().substring(0, 45) : graphData.getName();
+      Collection<NameValueData> vnameValueList = graphData.getDataCount();
+      resourceDataList.add(new TemplateData(appendNameValueData(addBlank(resourceName), vnameValueList)));
+    }
+    models.put("users", usersDataList);
+    models.put("resources", resourceDataList);
+    models.put("usersSummary", vBarUserDataList.getGraphData().size());
+    models.put("resourcesSummary", vBarResourceDataList.getGraphData().size());
+  }
+
+  private static String appendNameValueData(String data, Collection<NameValueData> vnameValueList) {
+    int count = 0;
+    String blank = "";
+    for (NameValueData vNameValue : vnameValueList) {
+      data += blank + vNameValue.getName() + " " + vNameValue.getValue();
+      if (count == 0)
+        blank = addBlank(blank);
+      count++;
+    }
+    return data;
+  }
+
+  private static String addBlank(String field) {
+    int blanks = 50;
+    int strSize = field.length();
+    String fieldWithBlank = field;
+    for (int i = 0; i < blanks - strSize; i++) {
+      fieldWithBlank += " ";
+    }
+    return fieldWithBlank;
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/util/FileUtil.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/util/FileUtil.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/util/FileUtil.java
index 505b74d..f7330fa 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/util/FileUtil.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/util/FileUtil.java
@@ -19,19 +19,9 @@
 
 package org.apache.ambari.logsearch.util;
 
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-
 import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
 import java.net.URL;
-import java.util.List;
-import java.util.Set;
 
-import org.apache.ambari.logsearch.common.MessageEnums;
-import org.apache.ambari.logsearch.view.VHost;
-import org.apache.ambari.logsearch.view.VSummary;
 import org.apache.log4j.Logger;
 
 public class FileUtil {
@@ -40,80 +30,6 @@ public class FileUtil {
   private FileUtil() {
     throw new UnsupportedOperationException();
   }
-  
-  public static Response saveToFile(String text, String fileName, VSummary vsummary) {
-    String mainExportedFile = "";
-    FileOutputStream fis = null;
-    try {
-      mainExportedFile = mainExportedFile + "**********************Summary**********************\n";
-      mainExportedFile = mainExportedFile + "Number of Logs : " + vsummary.getNumberLogs() + "\n";
-      mainExportedFile = mainExportedFile + "From           : " + vsummary.getFrom() + "\n";
-      mainExportedFile = mainExportedFile + "To             : " + vsummary.getTo() + "\n";
-
-      List<VHost> hosts = vsummary.getHosts();
-      String blankCharacterForHost = String.format("%-8s", "");
-      int numberHost = 0;
-      for (VHost host : hosts) {
-        numberHost += 1;
-        String h = host.getName();
-        String c = "";
-        Set<String> comp = host.getComponents();
-        boolean zonetar = true;
-        if (comp != null) {
-          for (String component : comp) {
-            if (zonetar) {
-              c = component;
-              zonetar = false;
-            } else {
-              c = c + ", " + component;
-            }
-          }
-        }
-        if (numberHost > 9){
-          blankCharacterForHost = String.format("%-7s", blankCharacterForHost);
-        }else if (numberHost > 99){
-          blankCharacterForHost = String.format("%-6s", blankCharacterForHost);
-        }else if (numberHost > 999){
-          blankCharacterForHost = String.format("%-5s", blankCharacterForHost);
-        }else if (numberHost > 9999){
-          blankCharacterForHost = String.format("%-4s", blankCharacterForHost);
-        }else if (numberHost > 99999){
-          blankCharacterForHost = String.format("%-3s", blankCharacterForHost);
-        }
-        if (numberHost == 1) {
-          mainExportedFile = mainExportedFile + "Host" + blankCharacterForHost + "   : " + h + " [" + c + "] " + "\n";
-        } else if (numberHost > 1) {
-          mainExportedFile = mainExportedFile + "Host_" + numberHost + blankCharacterForHost + " : " + h + " [" + c + "] " + "\n";
-        }
-
-      }
-      mainExportedFile = mainExportedFile + "Levels"+String.format("%-9s", blankCharacterForHost)+": " + vsummary.getLevels() + "\n";
-      mainExportedFile = mainExportedFile + "Format"+String.format("%-9s", blankCharacterForHost)+": " + vsummary.getFormat() + "\n";
-      mainExportedFile = mainExportedFile + "\n";
-
-      mainExportedFile = mainExportedFile + "Included String: [" + vsummary.getIncludeString() + "]\n\n";
-      mainExportedFile = mainExportedFile + "Excluded String: [" + vsummary.getExcludeString() + "]\n\n";
-      mainExportedFile = mainExportedFile + "************************Logs***********************" + "\n";
-      mainExportedFile = mainExportedFile + text + "\n";
-      File file = File.createTempFile(fileName, vsummary.getFormat());
-      fis = new FileOutputStream(file);
-      fis.write(mainExportedFile.getBytes());
-      return Response
-        .ok(file, MediaType.APPLICATION_OCTET_STREAM)
-        .header("Content-Disposition", "attachment;filename=" + fileName + vsummary.getFormat())
-        .build();
-    } catch (Exception e) {
-      logger.error(e.getMessage());
-      throw RESTErrorUtil.createRESTException(e.getMessage(), MessageEnums.ERROR_SYSTEM);
-    } finally {
-      if (fis != null) {
-        try {
-          fis.close();
-        } catch (IOException e) {
-        }
-      }
-    }
-  }
 
   public static File getFileFromClasspath(String filename) {
     URL fileCompleteUrl = Thread.currentThread().getContextClassLoader().getResource(filename);

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/util/RESTErrorUtil.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/util/RESTErrorUtil.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/util/RESTErrorUtil.java
index 88fb0d5..532428b 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/util/RESTErrorUtil.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/util/RESTErrorUtil.java
@@ -26,8 +26,8 @@ import javax.ws.rs.WebApplicationException;
 import javax.ws.rs.core.Response;
 
 import org.apache.ambari.logsearch.common.MessageEnums;
-import org.apache.ambari.logsearch.view.VMessage;
-import org.apache.ambari.logsearch.view.VResponse;
+import org.apache.ambari.logsearch.common.MessageData;
+import org.apache.ambari.logsearch.common.VResponse;
 import org.apache.log4j.Logger;
 
 public class RESTErrorUtil {
@@ -42,7 +42,7 @@ public class RESTErrorUtil {
   }
 
   public static WebApplicationException createRESTException(String errorMessage, MessageEnums messageEnum) {
-    List<VMessage> messageList = new ArrayList<VMessage>();
+    List<MessageData> messageList = new ArrayList<MessageData>();
     messageList.add(messageEnum.getMessage());
 
     VResponse response = new VResponse();

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/util/SolrUtil.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/util/SolrUtil.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/util/SolrUtil.java
index 33262f3..51a0dda 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/util/SolrUtil.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/util/SolrUtil.java
@@ -19,146 +19,45 @@
 
 package org.apache.ambari.logsearch.util;
 
-import java.util.Collection;
 import java.util.HashMap;
-import java.util.Locale;
+import java.util.Map;
 
 import org.apache.ambari.logsearch.common.LogSearchConstants;
-import org.apache.ambari.logsearch.dao.SolrDaoBase;
+import org.apache.lucene.analysis.core.KeywordTokenizerFactory;
+import org.apache.lucene.analysis.path.PathHierarchyTokenizerFactory;
+import org.apache.lucene.analysis.standard.StandardTokenizerFactory;
 import org.apache.solr.client.solrj.SolrQuery;
 import org.apache.solr.schema.TrieDoubleField;
 import org.apache.solr.schema.TrieFloatField;
 import org.apache.solr.schema.TrieIntField;
 import org.apache.solr.schema.TrieLongField;
-import org.apache.commons.lang.ArrayUtils;
 import org.apache.commons.lang.StringUtils;
-import org.springframework.util.CollectionUtils;
 
 public class SolrUtil {
   private SolrUtil() {
     throw new UnsupportedOperationException();
   }
-  
-  public static String setField(String fieldName, String value) {
-    if (value == null || value.trim().length() == 0) {
-      return "";
-    }
-    return fieldName + ":" + value.trim().toLowerCase(Locale.ENGLISH);
-  }
-
-  public static String inList(String fieldName, int[] values) {
-    if (ArrayUtils.isEmpty(values)) {
-      return "";
-    }
-    String expr = "";
-    // Add the filter queries
-    for (int i : values) {
-      expr += i + " ";
-    }
-    if (values.length == 0) {
-      return fieldName + ":" + expr;
-    } else {
-      return fieldName + ":(" + expr + ")";
-    }
-  }
-
-  public static String inList(Collection<Long> values) {
-    if (CollectionUtils.isEmpty(values)) {
-      return "";
-    }
-    String expr = "";
-    for (Long value : values) {
-      expr += value.toString() + " ";
-    }
-
-    if (values.isEmpty()) {
-      return expr.trim();
-    } else {
-      return "(" + expr.trim() + ")";
-    }
-
-  }
-
-  public static String orList(String fieldName, String[] valueList, String wildCard) {
-    if (ArrayUtils.isEmpty(valueList)) {
-      return "";
-    }
-    
-    if (StringUtils.isBlank(wildCard)) {
-      wildCard = "";
-    }
-    
-    StringBuilder expr = new StringBuilder();
-    int count = -1;
-    for (String value : valueList) {
-      count++;
-      if (count > 0) {
-        expr.append(" OR ");
-      }
-      
-      expr.append( fieldName + ":"+ wildCard + value + wildCard);
-
-    }
-    if (valueList.length == 0) {
-      return expr.toString();
-    } else {
-      return "(" + expr + ")";
-    }
-
-  }
-
-  public static String andList(String fieldName, String[] valueList, String wildCard) {
-    if (ArrayUtils.isEmpty(valueList)) {
-      return "";
-    }
-    
-    if (StringUtils.isBlank(wildCard)) {
-      wildCard = "";
-    }
-    
-    StringBuilder expr = new StringBuilder();
-    int count = -1;
-    for (String value : valueList) {
-      count++;
-      if (count > 0) {
-        expr.append(" AND ");
-      }
-      
-      expr.append( fieldName + ":"+ wildCard + value + wildCard);
-
-    }
-    if (valueList.length == 0) {
-      return expr.toString();
-    } else {
-      return "(" + expr + ")";
-    }
-
-  }
 
   /**
    * Copied from Solr ClientUtils.escapeQueryChars and removed escaping *
    */
   public static String escapeQueryChars(String s) {
     StringBuilder sb = new StringBuilder();
-    int prev = 0;
     if (s != null) {
       for (int i = 0; i < s.length(); i++) {
         char c = s.charAt(i);
-        int ic = (int)c;
-        if( ic == 10 ) {
-          if( prev != 13) {
-            //Let's insert \r
-            sb.append('\\');
-            sb.append((char)13);
-          }
+        int ic = (int) c;
+        if (ic == 10) {
+          sb.append('\\');
+          sb.append((char) 13);
         }
         // Note: Remove || c == '*'
         // These characters are part of the query syntax and must be escaped
         if (c == '\\' || c == '+' || c == '-' || c == '!' || c == '('
-            || c == ')' || c == ':' || c == '^' || c == '[' || c == ']'
-            || c == '\"' || c == '{' || c == '}' || c == '~' || c == '?'
-            || c == '|' || c == '&' || c == ';' || c == '/'
-            || Character.isWhitespace(c)) {
+          || c == ')' || c == ':' || c == '^' || c == '[' || c == ']'
+          || c == '\"' || c == '{' || c == '}' || c == '~' || c == '?'
+          || c == '|' || c == '&' || c == ';' || c == '/'
+          || Character.isWhitespace(c)) {
           sb.append('\\');
         }
         sb.append(c);
@@ -167,25 +66,6 @@ public class SolrUtil {
     return sb.toString();
   }
 
-  private static String escapeForWhiteSpaceTokenizer(String search) {
-    if (search == null) {
-      return null;
-    }
-    String newString = search.trim();
-    String newSearch = escapeQueryChars(newString);
-    boolean isSingleWord = true;
-    for (int i = 0; i < search.length(); i++) {
-      if (Character.isWhitespace(search.charAt(i))) {
-        isSingleWord = false;
-      }
-    }
-    if (!isSingleWord) {
-      newSearch = "\"" + newSearch + "\"";
-    }
-
-    return newSearch;
-  }
-
   public static String escapeForStandardTokenizer(String search) {
     if (search == null) {
       return null;
@@ -206,7 +86,7 @@ public class SolrUtil {
   }
 
   private static String escapeForKeyTokenizer(String search) {
-    if (search.startsWith("*") && search.endsWith("*") && !StringUtils.isBlank(search)) {
+    if (search.startsWith("*") && search.endsWith("*") && StringUtils.isNotBlank(search)) {
       // Remove the * from both the sides
       if (search.length() > 1) {
         search = search.substring(1, search.length() - 1);
@@ -224,16 +104,14 @@ public class SolrUtil {
    * This is a special case scenario to handle log_message for wild card
    * scenarios
    */
-  public static String escapeForLogMessage(String field, String search) {
+  public static String escapeForLogMessage(String search) {
     if (search.startsWith("*") && search.endsWith("*")) {
-      field = LogSearchConstants.SOLR_KEY_LOG_MESSAGE;
       search = escapeForKeyTokenizer(search);
     } else {
       // Use whitespace index
-      field = LogSearchConstants.SOLR_LOG_MESSAGE;
-      search = escapeForWhiteSpaceTokenizer(search);
+      search = escapeForStandardTokenizer(search);
     }
-    return field + ":" + search;
+    return search;
   }
 
   public static String makeSolrSearchString(String search) {
@@ -270,11 +148,11 @@ public class SolrUtil {
   }
   
 
-  public static boolean isSolrFieldNumber(String fieldType,SolrDaoBase solrDaoBase) {
+  public static boolean isSolrFieldNumber(String fieldType, Map<String, String> schemaFieldsMap) {
     if (StringUtils.isBlank(fieldType)) {
       return false;
     } else {
-      HashMap<String, Object> typeInfoMap = getFieldTypeInfoMap(fieldType,solrDaoBase);
+      HashMap<String, Object> typeInfoMap = getFieldTypeInfoMap(fieldType, schemaFieldsMap);
       if (typeInfoMap == null || typeInfoMap.isEmpty()) {
         return false;
       }
@@ -294,15 +172,66 @@ public class SolrUtil {
       return false;
     }
   }
+
+  public static String putWildCardByType(String str, String key, Map<String, String> schemaFieldsMap) {
+    String fieldType = schemaFieldsMap.get(key);
+    if (StringUtils.isNotBlank(fieldType)) {
+      if (isSolrFieldNumber(fieldType, schemaFieldsMap)) {
+        String value = putEscapeCharacterForNumber(str, fieldType, schemaFieldsMap);
+        if (StringUtils.isNotBlank(value)) {
+          return value;
+        } else {
+          return null;
+        }
+      } else if (checkTokenizer(fieldType, StandardTokenizerFactory.class, schemaFieldsMap)) {
+        return escapeForStandardTokenizer(str);
+      } else if (checkTokenizer(fieldType, KeywordTokenizerFactory.class, schemaFieldsMap)|| "string".equalsIgnoreCase(fieldType)) {
+        return makeSolrSearchStringWithoutAsterisk(str);
+      } else if (checkTokenizer(fieldType, PathHierarchyTokenizerFactory.class, schemaFieldsMap)) {
+        return str;
+      }
+    }
+    return str;
+  }
+
+  private static String putEscapeCharacterForNumber(String str,String fieldType, Map<String, String> schemaFieldsMap) {
+    if (StringUtils.isNotEmpty(str)) {
+      str = str.replace("*", "");
+    }
+    String escapeCharSting = parseInputValueAsPerFieldType(str,fieldType, schemaFieldsMap);
+    if (escapeCharSting == null || escapeCharSting.isEmpty()) {
+      return null;
+    }
+    escapeCharSting = escapeCharSting.replace("-", "\\-");
+    return escapeCharSting;
+  }
+
+  private static String parseInputValueAsPerFieldType(String str,String fieldType, Map<String, String> schemaFieldsMap) {
+    try {
+      HashMap<String, Object> fieldTypeInfoMap = SolrUtil.getFieldTypeInfoMap(fieldType, schemaFieldsMap);
+      String className = (String) fieldTypeInfoMap.get("class");
+      if (className.equalsIgnoreCase(TrieDoubleField.class.getSimpleName())) {
+        return "" + Double.parseDouble(str);
+      } else if (className.equalsIgnoreCase(TrieFloatField.class.getSimpleName())) {
+        return "" + Float.parseFloat(str);
+      } else if (className.equalsIgnoreCase(TrieLongField.class.getSimpleName())) {
+        return "" + Long.parseLong(str);
+      } else {
+        return "" + Integer.parseInt(str);
+      }
+    } catch (Exception e) {
+      return null;
+    }
+  }
   
-  public static HashMap<String, Object> getFieldTypeInfoMap(String fieldType,SolrDaoBase solrDaoBase) {
-    String fieldTypeMetaData = solrDaoBase.schemaFieldTypeMap.get(fieldType);
+  public static HashMap<String, Object> getFieldTypeInfoMap(String fieldType, Map<String, String> schemaFieldsTypeMap) {
+    String fieldTypeMetaData = schemaFieldsTypeMap.get(fieldType);
     HashMap<String, Object> fieldTypeMap = JSONUtil.jsonToMapObject(fieldTypeMetaData);
     if (fieldTypeMap == null) {
-      return new HashMap<String, Object>();
+      return new HashMap<>();
     }
     String classname = (String) fieldTypeMap.get("class");
-    if (!StringUtils.isBlank(classname)) {
+    if (StringUtils.isNotBlank(classname)) {
       classname = classname.replace("solr.", "");
       fieldTypeMap.put("class", classname);
     }
@@ -310,8 +239,7 @@ public class SolrUtil {
   }
   
   //=============================================================================================================
-  
-  //Solr Facet Methods
+
   public static void setFacetField(SolrQuery solrQuery, String facetField) {
     solrQuery.setFacet(true);
     setRowCount(solrQuery, 0);
@@ -319,13 +247,6 @@ public class SolrUtil {
     setFacetLimit(solrQuery, -1);
   }
 
-  public static void setJSONFacet(SolrQuery solrQuery, String jsonQuery) {
-    solrQuery.setFacet(true);
-    setRowCount(solrQuery, 0);
-    solrQuery.set(LogSearchConstants.FACET_JSON_FIELD, jsonQuery);
-    setFacetLimit(solrQuery, -1);
-  }
-
   public static void setFacetSort(SolrQuery solrQuery, String sortType) {
     solrQuery.setFacet(true);
     solrQuery.setFacetSort(sortType);
@@ -339,60 +260,10 @@ public class SolrUtil {
     setFacetLimit(solrQuery, -1);
   }
 
-  public static void setFacetDate(SolrQuery solrQuery, String facetField, String from, String to, String unit) {
-    solrQuery.setFacet(true);
-    setRowCount(solrQuery, 0);
-    solrQuery.set(LogSearchConstants.FACET_DATE, facetField);
-    solrQuery.set(LogSearchConstants.FACET_DATE_START, from);
-    solrQuery.set(LogSearchConstants.FACET_DATE_END, to);
-    solrQuery.set(LogSearchConstants.FACET_DATE_GAP, unit);
-    solrQuery.set(LogSearchConstants.FACET_MINCOUNT, 0);
-    setFacetLimit(solrQuery, -1);
-  }
-
-  public static void setFacetRange(SolrQuery solrQuery, String facetField, String from, String to, String unit) {
-    solrQuery.setFacet(true);
-    setRowCount(solrQuery, 0);
-    solrQuery.set(LogSearchConstants.FACET_RANGE, facetField);
-    solrQuery.set(LogSearchConstants.FACET_RANGE_START, from);
-    solrQuery.set(LogSearchConstants.FACET_RANGE_END, to);
-    solrQuery.set(LogSearchConstants.FACET_RANGE_GAP, unit);
-    solrQuery.set(LogSearchConstants.FACET_MINCOUNT, 0);
-    setFacetLimit(solrQuery, -1);
-  }
-
   public static void setFacetLimit(SolrQuery solrQuery, int limit) {
     solrQuery.set("facet.limit", limit);
   }
 
-  //Solr Group Mehtods
-  public static void setGroupField(SolrQuery solrQuery, String groupField, int rows) {
-    solrQuery.set(LogSearchConstants.FACET_GROUP, true);
-    solrQuery.set(LogSearchConstants.FACET_GROUP_FIELD, groupField);
-    solrQuery.set(LogSearchConstants.FACET_GROUP_MAIN, true);
-    setRowCount(solrQuery, rows);
-  }
-
-  //Main Query
-  public static void setMainQuery(SolrQuery solrQuery, String query) {
-    String defalultQuery = "*:*";
-    if (StringUtils.isBlank(query)){
-      solrQuery.setQuery(defalultQuery);
-    }else{
-      solrQuery.setQuery(query);
-    }
-  }
-
-  public static void setStart(SolrQuery solrQuery, int start) {
-    int defaultStart = 0;
-    if (start > defaultStart) {
-      solrQuery.setStart(start);
-    } else {
-      solrQuery.setStart(defaultStart);
-    }
-  }
-
-  //Set Number of Rows
   public static void setRowCount(SolrQuery solrQuery, int rows) {
     if (rows > 0) {
       solrQuery.setRows(rows);
@@ -402,17 +273,23 @@ public class SolrUtil {
     }
   }
 
-  //Solr Facet Methods
-  public static void setFacetFieldWithMincount(SolrQuery solrQuery, String facetField, int minCount) {
-    solrQuery.setFacet(true);
-    setRowCount(solrQuery, 0);
-    solrQuery.set(LogSearchConstants.FACET_FIELD, facetField);
-    solrQuery.set(LogSearchConstants.FACET_MINCOUNT, minCount);
-    setFacetLimit(solrQuery, -1);
-  }
-  
-  public static void setFl(SolrQuery solrQuery,String field){
-    solrQuery.set(LogSearchConstants.FL, field);
+  private static boolean checkTokenizer(String fieldType, Class tokenizerFactoryClass, Map<String, String> schemaFieldsMap) {
+    HashMap<String, Object> fieldTypeMap = SolrUtil.getFieldTypeInfoMap(fieldType ,schemaFieldsMap);
+    HashMap<String, Object> analyzer = (HashMap<String, Object>) fieldTypeMap.get("analyzer");
+    if (analyzer != null) {
+      HashMap<String, Object> tokenizerMap = (HashMap<String, Object>) analyzer.get("tokenizer");
+      if (tokenizerMap != null) {
+        String tokenizerClass = (String) tokenizerMap.get("class");
+        if (!StringUtils.isEmpty(tokenizerClass)) {
+          tokenizerClass =tokenizerClass.replace("solr.", "");
+          if (tokenizerClass.equalsIgnoreCase(tokenizerFactoryClass
+            .getSimpleName())) {
+            return true;
+          }
+        }
+      }
+    }
+    return false;
   }
   
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VHost.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VHost.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VHost.java
deleted file mode 100644
index da2fbdd..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VHost.java
+++ /dev/null
@@ -1,44 +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.view;
-
-import java.util.Set;
-
-public class VHost {
-  protected String name;
-  protected Set<String> components;
-
-  public String getName() {
-    return name;
-  }
-
-  public void setName(String name) {
-    this.name = name;
-  }
-
-  public Set<String> getComponents() {
-    return components;
-  }
-
-  public void setComponents(Set<String> components) {
-    this.components = components;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VList.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VList.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VList.java
deleted file mode 100644
index 97226d2..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VList.java
+++ /dev/null
@@ -1,243 +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.view;
-
-import java.util.List;
-
-import javax.xml.bind.annotation.XmlRootElement;
-
-@XmlRootElement
-public abstract class VList implements java.io.Serializable {
-  private static final long serialVersionUID = 1L;
-
-  /**
-   * Start index for the result
-   */
-  protected int startIndex;
-  /**
-   * Page size used for the result
-   */
-  protected int pageSize;
-  /**
-   * Total records in the database for the given search conditions
-   */
-  protected long totalCount;
-  /**
-   * Number of rows returned for the search condition
-   */
-  protected int resultSize;
-  /**
-   * // * Sort type. Either desc or asc //
-   */
-  protected String sortType;
-  // /**
-  // * Comma seperated list of the fields for sorting
-  // */
-  protected String sortBy;
-
-  protected long queryTimeMS = System.currentTimeMillis();
-
-  /**
-   * Default constructor. This will set all the attributes to default value.
-   */
-  public VList() {
-  }
-
-  /**
-   * Initialize with existing list
-   * 
-   * @param size
-   */
-  public VList(@SuppressWarnings("rawtypes") List objectList) {
-    int size = 0;
-    if (objectList != null) {
-      size = objectList.size();
-    }
-
-    startIndex = 0;
-    pageSize = size;
-    totalCount = size;
-    resultSize = size;
-    sortType = null;
-    sortBy = null;
-  }
-
-  abstract public int getListSize();
-
-  abstract public List<?> getList();
-
-  /**
-   * This method sets the value to the member attribute <b>startIndex</b>. You
-   * cannot set null to the attribute.
-   * 
-   * @param startIndex
-   *            Value to set member attribute <b>startIndex</b>
-   */
-  public void setStartIndex(int startIndex) {
-    this.startIndex = startIndex;
-  }
-
-  /**
-   * Returns the value for the member attribute <b>startIndex</b>
-   * 
-   * @return int - value of member attribute <b>startIndex</b>.
-   */
-  public int getStartIndex() {
-    return startIndex;
-  }
-
-  /**
-   * This method sets the value to the member attribute <b>pageSize</b>. You
-   * cannot set null to the attribute.
-   * 
-   * @param pageSize
-   *            Value to set member attribute <b>pageSize</b>
-   */
-  public void setPageSize(int pageSize) {
-    this.pageSize = pageSize;
-  }
-
-  /**
-   * Returns the value for the member attribute <b>pageSize</b>
-   * 
-   * @return int - value of member attribute <b>pageSize</b>.
-   */
-  public int getPageSize() {
-    return pageSize;
-  }
-
-  /**
-   * This method sets the value to the member attribute <b>totalCount</b>. You
-   * cannot set null to the attribute.
-   * 
-   * @param totalCount
-   *            Value to set member attribute <b>totalCount</b>
-   */
-  public void setTotalCount(long totalCount) {
-    this.totalCount = totalCount;
-  }
-
-  /**
-   * Returns the value for the member attribute <b>totalCount</b>
-   * 
-   * @return long - value of member attribute <b>totalCount</b>.
-   */
-  public long getTotalCount() {
-    return totalCount;
-  }
-
-  /**
-   * This method sets the value to the member attribute <b>resultSize</b>. You
-   * cannot set null to the attribute.
-   * 
-   * @param resultSize
-   *            Value to set member attribute <b>resultSize</b>
-   */
-  public void setResultSize(int resultSize) {
-    this.resultSize = resultSize;
-  }
-
-  /**
-   * Returns the value for the member attribute <b>resultSize</b>
-   * 
-   * @return int - value of member attribute <b>resultSize</b>.
-   */
-  public int getResultSize() {
-    return getListSize();
-  }
-
-  /**
-   * This method sets the value to the member attribute <b>sortType</b>. You
-   * cannot set null to the attribute.
-   * 
-   * @param sortType
-   *            Value to set member attribute <b>sortType</b>
-   */
-  public void setSortType(String sortType) {
-    this.sortType = sortType;
-  }
-
-  /**
-   * Returns the value for the member attribute <b>sortType</b>
-   *
-   * @return String - value of member attribute <b>sortType</b>.
-   */
-  public String getSortType() {
-    return sortType;
-  }
-
-  /**
-   * This method sets the value to the member attribute <b>sortBy</b>. You
-   * cannot set null to the attribute.
-   *
-   * @param sortBy
-   *            Value to set member attribute <b>sortBy</b>
-   */
-  public void setSortBy(String sortBy) {
-    this.sortBy = sortBy;
-  }
-
-  /**
-   * Returns the value for the member attribute <b>sortBy</b>
-   *
-   * @return String - value of member attribute <b>sortBy</b>.
-   */
-  public String getSortBy() {
-    return sortBy;
-  }
-
-  /**
-   * This method sets the value to the member attribute <b>sortBy</b>. You
-   * cannot set null to the attribute.
-   *
-   * @param sortBy
-   *            Value to set member attribute <b>sortBy</b>
-   */
-
-  /**
-   * @return the queryTimeMS
-   */
-  public long getQueryTimeMS() {
-    return queryTimeMS;
-  }
-
-  /**
-   * @param queryTimeMS
-   *            the queryTimeMS to set
-   */
-  public void setQueryTimeMS(long queryTimeMS) {
-    this.queryTimeMS = queryTimeMS;
-  }
-
-  /*
-   * (non-Javadoc)
-   * 
-   * @see java.lang.Object#toString()
-   */
-  @Override
-  public String toString() {
-    return "VList [startIndex=" + startIndex + ", pageSize=" + pageSize
-        + ", totalCount=" + totalCount + ", resultSize=" + resultSize
-        + ","
-        // + " sortType=" + sortType + ", "
-        + "sortBy=" + sortBy + ", queryTimeMS=" + queryTimeMS + "]";
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VLogfeederFilter.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VLogfeederFilter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VLogfeederFilter.java
deleted file mode 100644
index 1836c4a..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VLogfeederFilter.java
+++ /dev/null
@@ -1,91 +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.view;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlRootElement;
-
-import org.codehaus.jackson.annotate.JsonAutoDetect;
-import org.codehaus.jackson.annotate.JsonAutoDetect.Visibility;
-import org.codehaus.jackson.map.annotate.JsonSerialize;
-
-@JsonAutoDetect(getterVisibility = Visibility.NONE, setterVisibility = Visibility.NONE, fieldVisibility = Visibility.ANY)
-@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
-@XmlRootElement
-@XmlAccessorType(XmlAccessType.FIELD)
-public class VLogfeederFilter {
-
-  private String label;
-  private List<String> hosts;
-  private List<String> defaultLevels;
-  private List<String> overrideLevels;
-  private String expiryTime;
-
-  public VLogfeederFilter() {
-    hosts = new ArrayList<String>();
-    defaultLevels = new ArrayList<String>();
-    overrideLevels = new ArrayList<String>();
-  }
-
-  public String getLabel() {
-    return label;
-  }
-
-  public void setLabel(String label) {
-    this.label = label;
-  }
-
-  public List<String> getHosts() {
-    return hosts;
-  }
-
-  public void setHosts(List<String> hosts) {
-    this.hosts = hosts;
-  }
-
-  public List<String> getDefaultLevels() {
-    return defaultLevels;
-  }
-
-  public void setDefaultLevels(List<String> defaultLevels) {
-    this.defaultLevels = defaultLevels;
-  }
-
-  public List<String> getOverrideLevels() {
-    return overrideLevels;
-  }
-
-  public void setOverrideLevels(List<String> overrideLevels) {
-    this.overrideLevels = overrideLevels;
-  }
-
-  public String getExpiryTime() {
-    return expiryTime;
-  }
-
-  public void setExpiryTime(String expiryTime) {
-    this.expiryTime = expiryTime;
-  }
-
-
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VLogfeederFilterWrapper.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VLogfeederFilterWrapper.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VLogfeederFilterWrapper.java
deleted file mode 100644
index 727de69..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VLogfeederFilterWrapper.java
+++ /dev/null
@@ -1,55 +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.view;
-
-import java.util.HashMap;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlRootElement;
-
-import org.codehaus.jackson.annotate.JsonAutoDetect;
-import org.codehaus.jackson.annotate.JsonAutoDetect.Visibility;
-import org.codehaus.jackson.map.annotate.JsonSerialize;
-
-@JsonAutoDetect(getterVisibility = Visibility.NONE, setterVisibility = Visibility.NONE, fieldVisibility = Visibility.ANY)
-@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
-@XmlRootElement
-@XmlAccessorType(XmlAccessType.FIELD)
-public class VLogfeederFilterWrapper {
-
-  private HashMap<String, VLogfeederFilter> filter;
-  private String id;
-
-  public HashMap<String, VLogfeederFilter> getFilter() {
-    return filter;
-  }
-
-  public void setFilter(HashMap<String, VLogfeederFilter> filter) {
-    this.filter = filter;
-  }
-
-  public String getId() {
-    return id;
-  }
-
-  public void setId(String id) {
-    this.id = id;
-  }
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VMessage.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VMessage.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VMessage.java
deleted file mode 100644
index bc52981..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VMessage.java
+++ /dev/null
@@ -1,165 +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.view;
-
-import javax.xml.bind.annotation.XmlRootElement;
-
-@XmlRootElement
-public class VMessage implements java.io.Serializable {
-  private static final long serialVersionUID = 1L;
-
-  /**
-   * Message key
-   */
-  protected String name;
-  /**
-   * Resource bundle key
-   */
-  protected String rbKey;
-  /**
-   * Message description. Use rbKey for doing localized lookup
-   */
-  protected String message;
-  /**
-   * Id of the object to which this message is related to
-   */
-  protected Long objectId;
-  /**
-   * Name of the field or attribute to which this message is related to
-   */
-  protected String fieldName;
-
-  /**
-   * This method sets the value to the member attribute <b>name</b>. You
-   * cannot set null to the attribute.
-   * 
-   * @param name
-   *            Value to set member attribute <b>name</b>
-   */
-  public void setName(String name) {
-    this.name = name;
-  }
-
-  /**
-   * Returns the value for the member attribute <b>name</b>
-   * 
-   * @return String - value of member attribute <b>name</b>.
-   */
-  public String getName() {
-    return this.name;
-  }
-
-  /**
-   * This method sets the value to the member attribute <b>rbKey</b>. You
-   * cannot set null to the attribute.
-   * 
-   * @param rbKey
-   *            Value to set member attribute <b>rbKey</b>
-   */
-  public void setRbKey(String rbKey) {
-    this.rbKey = rbKey;
-  }
-
-  /**
-   * Returns the value for the member attribute <b>rbKey</b>
-   * 
-   * @return String - value of member attribute <b>rbKey</b>.
-   */
-  public String getRbKey() {
-    return this.rbKey;
-  }
-
-  /**
-   * This method sets the value to the member attribute <b>message</b>. You
-   * cannot set null to the attribute.
-   * 
-   * @param message
-   *            Value to set member attribute <b>message</b>
-   */
-  public void setMessage(String message) {
-    this.message = message;
-  }
-
-  /**
-   * Returns the value for the member attribute <b>message</b>
-   * 
-   * @return String - value of member attribute <b>message</b>.
-   */
-  public String getMessage() {
-    return this.message;
-  }
-
-  /**
-   * This method sets the value to the member attribute <b>objectId</b>. You
-   * cannot set null to the attribute.
-   * 
-   * @param objectId
-   *            Value to set member attribute <b>objectId</b>
-   */
-  public void setObjectId(Long objectId) {
-    this.objectId = objectId;
-  }
-
-  /**
-   * Returns the value for the member attribute <b>objectId</b>
-   * 
-   * @return Long - value of member attribute <b>objectId</b>.
-   */
-  public Long getObjectId() {
-    return this.objectId;
-  }
-
-  /**
-   * This method sets the value to the member attribute <b>fieldName</b>. You
-   * cannot set null to the attribute.
-   * 
-   * @param fieldName
-   *            Value to set member attribute <b>fieldName</b>
-   */
-  public void setFieldName(String fieldName) {
-    this.fieldName = fieldName;
-  }
-
-  /**
-   * Returns the value for the member attribute <b>fieldName</b>
-   * 
-   * @return String - value of member attribute <b>fieldName</b>.
-   */
-  public String getFieldName() {
-    return this.fieldName;
-  }
-
-  /**
-   * This return the bean content in string format
-   * 
-   * @return formatedStr
-   */
-  public String toString() {
-    String str = "VMessage={";
-    str += super.toString();
-    str += "name={" + name + "} ";
-    str += "rbKey={" + rbKey + "} ";
-    str += "message={" + message + "} ";
-    str += "objectId={" + objectId + "} ";
-    str += "fieldName={" + fieldName + "} ";
-    str += "}";
-    return str;
-  }
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VResponse.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VResponse.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VResponse.java
deleted file mode 100644
index b35c29b..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VResponse.java
+++ /dev/null
@@ -1,164 +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.view;
-
-import java.util.List;
-
-import javax.xml.bind.annotation.XmlRootElement;
-
-@XmlRootElement
-public class VResponse implements
-    java.io.Serializable {
-  private static final long serialVersionUID = 1L;
-
-  /**
-   * Enum values for ResponseStatus
-   */
-  /**
-   * STATUS_SUCCESS is an element of enum ResponseStatus. Its value is
-   * "STATUS_SUCCESS".
-   */
-  public static final int STATUS_SUCCESS = 0;
-  /**
-   * STATUS_ERROR is an element of enum ResponseStatus. Its value is
-   * "STATUS_ERROR".
-   */
-  public static final int STATUS_ERROR = 1;
-  /**
-   * STATUS_VALIDATION is an element of enum ResponseStatus. Its value is
-   * "STATUS_VALIDATION".
-   */
-  public static final int STATUS_VALIDATION = 2;
-  /**
-   * STATUS_WARN is an element of enum ResponseStatus. Its value is
-   * "STATUS_WARN".
-   */
-  public static final int STATUS_WARN = 3;
-  /**
-   * STATUS_INFO is an element of enum ResponseStatus. Its value is
-   * "STATUS_INFO".
-   */
-  public static final int STATUS_INFO = 4;
-  /**
-   * STATUS_PARTIAL_SUCCESS is an element of enum ResponseStatus. Its value is
-   * "STATUS_PARTIAL_SUCCESS".
-   */
-  public static final int STATUS_PARTIAL_SUCCESS = 5;
-
-  /**
-   * Max value for enum ResponseStatus_MAX
-   */
-  public static final int ResponseStatus_MAX = 5;
-
-  /**
-   * Status code This attribute is of type enum Response::ResponseStatus
-   */
-  protected int statusCode;
-  /**
-   * Message description
-   */
-  protected String msgDesc;
-  /**
-   * List of messages
-   */
-  protected List<VMessage> messageList;
-
-  /**
-   * Default constructor. This will set all the attributes to default value.
-   */
-  public VResponse() {
-    statusCode = 0;
-  }
-
-  /**
-   * This method sets the value to the member attribute <b>statusCode</b>. You
-   * cannot set null to the attribute.
-   * 
-   * @param statusCode
-   *            Value to set member attribute <b>statusCode</b>
-   */
-  public void setStatusCode(int statusCode) {
-    this.statusCode = statusCode;
-  }
-
-  /**
-   * Returns the value for the member attribute <b>statusCode</b>
-   * 
-   * @return int - value of member attribute <b>statusCode</b>.
-   */
-  public int getStatusCode() {
-    return this.statusCode;
-  }
-
-  /**
-   * This method sets the value to the member attribute <b>msgDesc</b>. You
-   * cannot set null to the attribute.
-   * 
-   * @param msgDesc
-   *            Value to set member attribute <b>msgDesc</b>
-   */
-  public void setMsgDesc(String msgDesc) {
-    this.msgDesc = msgDesc;
-  }
-
-  /**
-   * Returns the value for the member attribute <b>msgDesc</b>
-   * 
-   * @return String - value of member attribute <b>msgDesc</b>.
-   */
-  public String getMsgDesc() {
-    return this.msgDesc;
-  }
-
-  /**
-   * This method sets the value to the member attribute <b>messageList</b>.
-   * You cannot set null to the attribute.
-   * 
-   * @param messageList
-   *            Value to set member attribute <b>messageList</b>
-   */
-  public void setMessageList(List<VMessage> messageList) {
-    this.messageList = messageList;
-  }
-
-  /**
-   * Returns the value for the member attribute <b>messageList</b>
-   * 
-   * @return List<VMessage> - value of member attribute <b>messageList</b>.
-   */
-  public List<VMessage> getMessageList() {
-    return this.messageList;
-  }
-
-  /**
-   * This return the bean content in string format
-   * 
-   * @return formatedStr
-   */
-  public String toString() {
-    String str = "VResponse={";
-    str += super.toString();
-    str += "statusCode={" + statusCode + "} ";
-    str += "msgDesc={" + msgDesc + "} ";
-    str += "messageList={" + messageList + "} ";
-    str += "}";
-    return str;
-  }
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VSummary.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VSummary.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VSummary.java
deleted file mode 100644
index 9aa696c..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VSummary.java
+++ /dev/null
@@ -1,103 +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.view;
-
-import java.util.List;
-
-public class VSummary {
-
-  protected List<VHost> hosts;
-  protected String levels;
-  protected String format;
-  protected String numberLogs;
-  protected String from;
-  protected String to;
-  protected String includeString;
-  protected String excludeString;
-  
-  public VSummary(){
-    includeString = "-";
-    excludeString = "-";
-  }
-
-  public String getIncludeString() {
-    return includeString;
-  }
-
-  public void setIncludeString(String includeString) {
-    this.includeString = includeString;
-  }
-
-  public String getExcludeString() {
-    return excludeString;
-  }
-
-  public void setExcludeString(String excludeString) {
-    this.excludeString = excludeString;
-  }
-
-  public String getFrom() {
-    return from;
-  }
-
-  public void setFrom(String from) {
-    this.from = from;
-  }
-
-  public String getTo() {
-    return to;
-  }
-
-  public void setTo(String to) {
-    this.to = to;
-  }
-
-  public List<VHost> getHosts() {
-    return hosts;
-  }
-
-  public void setHosts(List<VHost> hosts) {
-    this.hosts = hosts;
-  }
-
-  public String getLevels() {
-    return levels;
-  }
-
-  public void setLevels(String levels) {
-    this.levels = levels;
-  }
-
-  public String getFormat() {
-    return format;
-  }
-
-  public void setFormat(String format) {
-    this.format = format;
-  }
-
-  public String getNumberLogs() {
-    return numberLogs;
-  }
-
-  public void setNumberLogs(String numberLogs) {
-    this.numberLogs = numberLogs;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VUserConfig.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VUserConfig.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VUserConfig.java
deleted file mode 100644
index 6487f91..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VUserConfig.java
+++ /dev/null
@@ -1,104 +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.view;
-
-import java.util.Date;
-import java.util.List;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlRootElement;
-
-@XmlRootElement
-@XmlAccessorType(XmlAccessType.FIELD)
-public class VUserConfig {
-
-  protected String id;
-  protected String userName;
-  protected String filtername;
-  protected String values;
-  
-  List<String> shareNameList;
-  String rowType;
-  
-  boolean isOverwrite;
-  
-  public VUserConfig(){
-    setId(""+new Date().getTime());
-    isOverwrite=false;
-  }
-
-  public String getId() {
-    return id;
-  }
-
-  public void setId(String id) {
-    this.id = id;
-  }
-
-  public String getUserName() {
-    return userName;
-  }
-
-  public void setUserName(String userName) {
-    this.userName = userName;
-  }
-
-  public String getFiltername() {
-    return filtername;
-  }
-
-  public void setFiltername(String filtername) {
-    this.filtername = filtername;
-  }
-
-  public String getValues() {
-    return values;
-  }
-
-  public void setValues(String values) {
-    this.values = values;
-  }
-
-
-  public List<String> getShareNameList() {
-    return shareNameList;
-  }
-
-  public void setShareNameList(List<String> shareNameList) {
-    this.shareNameList = shareNameList;
-  }
-
-  public String getRowType() {
-    return rowType;
-  }
-
-  public void setRowType(String rowType) {
-    this.rowType = rowType;
-  }
-
-  public boolean isOverwrite() {
-    return isOverwrite;
-  }
-
-  public void setOverwrite(boolean isOverwrite) {
-    this.isOverwrite = isOverwrite;
-  }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VUserConfigList.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VUserConfigList.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VUserConfigList.java
deleted file mode 100644
index f6d1662..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/view/VUserConfigList.java
+++ /dev/null
@@ -1,70 +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.view;
-
-import java.util.Collection;
-import java.util.List;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlRootElement;
-
-import org.codehaus.jackson.annotate.JsonAutoDetect;
-import org.codehaus.jackson.annotate.JsonAutoDetect.Visibility;
-import org.codehaus.jackson.map.annotate.JsonSerialize;
-
-@JsonAutoDetect(getterVisibility = Visibility.NONE, setterVisibility = Visibility.NONE, fieldVisibility = Visibility.ANY)
-@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
-@XmlRootElement
-@XmlAccessorType(XmlAccessType.FIELD)
-public class VUserConfigList extends VList {
-  /**
-   * 
-   */
-  private static final long serialVersionUID = 1L;
-  protected String name;
-  protected Collection<VUserConfig> userConfigList;
-
-  public String getName() {
-    return name;
-  }
-
-  public void setName(String name) {
-    this.name = name;
-  }
-
-  public Collection<VUserConfig> getUserConfigList() {
-    return userConfigList;
-  }
-
-  public void setUserConfigList(Collection<VUserConfig> historyList) {
-    this.userConfigList = historyList;
-  }
-
-  @Override
-  public int getListSize() {
-    return userConfigList.size();
-  }
-
-  @Override
-  public List<VUserConfig> getList() {
-    return (List<VUserConfig>) userConfigList;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/filters/LogsearchKRBAuthenticationFilter.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/filters/LogsearchKRBAuthenticationFilter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/filters/LogsearchKRBAuthenticationFilter.java
index 8cd435b..29fd5b2 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/filters/LogsearchKRBAuthenticationFilter.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/filters/LogsearchKRBAuthenticationFilter.java
@@ -61,7 +61,6 @@ import org.apache.hadoop.security.authentication.server.KerberosAuthenticationHa
 import org.apache.hadoop.security.authentication.server.PseudoAuthenticationHandler;
 import org.apache.hadoop.security.authentication.util.KerberosName;
 import org.springframework.security.web.authentication.WebAuthenticationDetails;
-import org.springframework.stereotype.Component;
 
 public class LogsearchKRBAuthenticationFilter extends LogsearchKrbFilter {
   private static final Logger logger = LoggerFactory.getLogger(LogsearchKRBAuthenticationFilter.class);

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchAuthenticationProvider.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchAuthenticationProvider.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchAuthenticationProvider.java
index 05104b4..d37e545 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchAuthenticationProvider.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchAuthenticationProvider.java
@@ -27,11 +27,11 @@ import org.springframework.security.authentication.UsernamePasswordAuthenticatio
 import org.springframework.security.core.Authentication;
 import org.springframework.security.core.AuthenticationException;
 import org.springframework.security.web.authentication.WebAuthenticationDetails;
-import org.springframework.stereotype.Component;
 
 import javax.inject.Inject;
+import javax.inject.Named;
 
-@Component
+@Named
 public class LogsearchAuthenticationProvider extends
   LogsearchAbstractAuthenticationProvider {
   private static final Logger logger = Logger

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchExternalServerAuthenticationProvider.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchExternalServerAuthenticationProvider.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchExternalServerAuthenticationProvider.java
index a89b5dd..7e146ac 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchExternalServerAuthenticationProvider.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchExternalServerAuthenticationProvider.java
@@ -22,6 +22,7 @@ import java.util.ArrayList;
 import java.util.List;
 
 import javax.inject.Inject;
+import javax.inject.Named;
 
 import org.apache.ambari.logsearch.common.ExternalServerClient;
 import org.apache.ambari.logsearch.common.PropertiesHelper;
@@ -34,14 +35,13 @@ import org.springframework.security.authentication.BadCredentialsException;
 import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
 import org.springframework.security.core.Authentication;
 import org.springframework.security.core.AuthenticationException;
-import org.springframework.stereotype.Component;
 
 /**
  * 
  * Authentication provider to authenticate user from external-server using REST
  * call
  */
-@Component
+@Named
 public class LogsearchExternalServerAuthenticationProvider extends
     LogsearchAbstractAuthenticationProvider {
 
@@ -152,10 +152,9 @@ public class LogsearchExternalServerAuthenticationProvider extends
    */
   @SuppressWarnings("static-access")
   private boolean isAllowedRole(String responseJson) {
-    String allowedRoleList[] = PropertiesHelper
-        .getPropertyStringList(ALLOWED_ROLE_PROP);
+    String allowedRoleList[] = PropertiesHelper.getPropertyStringList(ALLOWED_ROLE_PROP);
 
-    List<String> values = new ArrayList<String>();
+    List<String> values = new ArrayList<>();
     JSONUtil.getValuesOfKey(responseJson,
         PRIVILEGE_INFO.PERMISSION_NAME.toString(), values);
     if (values.isEmpty())

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchFileAuthenticationProvider.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchFileAuthenticationProvider.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchFileAuthenticationProvider.java
index dc70b82..51b3547 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchFileAuthenticationProvider.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchFileAuthenticationProvider.java
@@ -32,11 +32,11 @@ import org.springframework.security.core.AuthenticationException;
 import org.springframework.security.core.GrantedAuthority;
 import org.springframework.security.core.userdetails.UserDetails;
 import org.springframework.security.core.userdetails.UserDetailsService;
-import org.springframework.stereotype.Component;
 
 import javax.inject.Inject;
+import javax.inject.Named;
 
-@Component
+@Named
 public class LogsearchFileAuthenticationProvider extends LogsearchAbstractAuthenticationProvider {
 
   private static Logger logger = Logger.getLogger(LogsearchFileAuthenticationProvider.class);

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchLdapAuthenticationProvider.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchLdapAuthenticationProvider.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchLdapAuthenticationProvider.java
index 52dd66e..ed4d7ef 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchLdapAuthenticationProvider.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchLdapAuthenticationProvider.java
@@ -30,12 +30,12 @@ import org.springframework.security.core.AuthenticationException;
 import org.springframework.security.core.userdetails.UsernameNotFoundException;
 import org.springframework.security.ldap.authentication.LdapAuthenticationProvider;
 import org.springframework.security.ldap.search.FilterBasedLdapUserSearch;
-import org.springframework.stereotype.Component;
 
 import javax.annotation.PostConstruct;
 import javax.inject.Inject;
+import javax.inject.Named;
 
-@Component
+@Named
 public class LogsearchLdapAuthenticationProvider extends
   LogsearchAbstractAuthenticationProvider {
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchSimpleAuthenticationProvider.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchSimpleAuthenticationProvider.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchSimpleAuthenticationProvider.java
index 17d099b..400361b 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchSimpleAuthenticationProvider.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchSimpleAuthenticationProvider.java
@@ -27,11 +27,11 @@ import org.springframework.security.authentication.BadCredentialsException;
 import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
 import org.springframework.security.core.Authentication;
 import org.springframework.security.core.AuthenticationException;
-import org.springframework.stereotype.Component;
 
 import javax.inject.Inject;
+import javax.inject.Named;
 
-@Component
+@Named
 public class LogsearchSimpleAuthenticationProvider extends LogsearchAbstractAuthenticationProvider {
 
   private static Logger logger = Logger.getLogger(LogsearchSimpleAuthenticationProvider.class);

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/resources/default.properties
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/resources/default.properties b/ambari-logsearch/ambari-logsearch-portal/src/main/resources/default.properties
index 9a44761..c98a482 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/resources/default.properties
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/resources/default.properties
@@ -24,4 +24,3 @@ logsearch.logfeeder.include.default.level=FATAL,ERROR,WARN,INFO,DEBUG,TRACE
 #login config
 logsearch.login.credentials.file=user_pass.json
 logsearch.login.ldap.config=logsearch-admin-site.xml
-logsearch.solr.warming.cron=0 0/10 * * * ?

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/resources/templates/audit_log_txt.ftl
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/resources/templates/audit_log_txt.ftl b/ambari-logsearch/ambari-logsearch-portal/src/main/resources/templates/audit_log_txt.ftl
new file mode 100644
index 0000000..587e366
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/resources/templates/audit_log_txt.ftl
@@ -0,0 +1,42 @@
+<#--
+  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.
+-->
+--------------------------------SUMMARY-----------------------------------
+Users  = ${usersSummary}
+Resources  = ${resourcesSummary}
+
+
+
+
+Users                                             Components/Access
+--------------------------------------------------------------------------
+<#if users??>
+  <#list users as user>
+${user.data}
+  </#list>
+</#if>
+
+
+
+
+
+Resources                                         Components/Access
+--------------------------------------------------------------------------
+<#if resources??>
+  <#list resources as resource>
+${resource.data}
+  </#list>
+</#if>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/resources/templates/service_log_txt.ftl
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/resources/templates/service_log_txt.ftl b/ambari-logsearch/ambari-logsearch-portal/src/main/resources/templates/service_log_txt.ftl
new file mode 100644
index 0000000..8a5e19d
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/resources/templates/service_log_txt.ftl
@@ -0,0 +1,36 @@
+<#--
+  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.
+-->
+**********************Summary**********************
+Number of Logs : ${numberOfLogs}
+From           : ${from}
+To             : ${to}
+Host           : ${hosts}
+Component      : ${components}
+Levels         : ${levels}
+Format         : ${format}
+
+Included String: [${iString}]
+
+Excluded String: [${eString}]
+
+************************Logs***********************
+2016-09-26 11:49:19,723 WARN MainThread lock.py:60 - Releasing the lock.
+<#if logs??>
+  <#list logs as log>
+${log.data}
+  </#list>
+</#if>

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/collection_bases/VLogListBase.js
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/collection_bases/VLogListBase.js b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/collection_bases/VLogListBase.js
index 08a8271..5fc4bac 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/collection_bases/VLogListBase.js
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/collection_bases/VLogListBase.js
@@ -89,7 +89,7 @@ define(['require',
 
       return this.constructor.nonCrudOperation.call(this, url, 'GET', options);
 		},
-		getTruncatedLogs : function(token, options){
+    getTruncatedLogs : function(token, options){
 			var url = Globals.baseURL  + 'service/logs/truncated';
 			
 			options = _.extend({

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/utils/ViewUtils.js
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/utils/ViewUtils.js b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/utils/ViewUtils.js
index 4c23290..6d587cd 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/utils/ViewUtils.js
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/utils/ViewUtils.js
@@ -57,7 +57,7 @@ define(['require',
     if (params.bundle_id && !params.start_time && !params.end_time) {
       var collection = new VNameValueList();
 
-      collection.url = Globals.baseURL + "service/logs/solr/boundarydates";
+      collection.url = Globals.baseURL + "service/logs/boundarydates";
       collection.modelAttrName = "vNameValues";
       _.extend(collection.queryParams, {
         "bundle_id": params.bundle_id

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/audit/AuditAggregatedView.js
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/audit/AuditAggregatedView.js b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/audit/AuditAggregatedView.js
index ef6dce5..0822051 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/audit/AuditAggregatedView.js
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/audit/AuditAggregatedView.js
@@ -98,7 +98,7 @@ define(['require',
                     pageSize: 9999
                 }
 			});
-			this.topUsers.url = Globals.baseURL + "audit/logs/users";
+			this.topUsers.url = Globals.baseURL + "audit/logs/resources/10";
 			this.topUsers.modelAttrName = "graphData";
 			this.topResources = new VNameValueList([],{
 				state: {
@@ -106,7 +106,7 @@ define(['require',
                     pageSize: 9999
                 }
 			});
-			this.topResources.url = Globals.baseURL + "audit/logs/resources";
+			this.topResources.url = Globals.baseURL + "audit/logs/resources/10";
 			this.topResources.modelAttrName = "graphData";		
 			//initialize colors
 			this.colors = (new d3.scale.category20c().range().slice().reverse()).concat(new d3.scale.category20b().range().slice().reverse());
@@ -408,7 +408,7 @@ define(['require',
 			obj.utcOffset = moment().utcOffset();
 			obj.startIndex =  this.topUsers.state.currentPage * this.topUsers.state.pageSize;
 			var params = $.param(_.extend({},this.topUsers.queryParams,obj));
-			var url = "api/v1/audit/logs/users/export?"+ params;
+			var url = "api/v1/audit/logs/export?"+ params;
 			window.open(url);
 			this.onDialogClosed();
 		}

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/audit/AuditTabLayoutView.js
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/audit/AuditTabLayoutView.js b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/audit/AuditTabLayoutView.js
index 4e09e88..371edd2 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/audit/AuditTabLayoutView.js
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/audit/AuditTabLayoutView.js
@@ -193,7 +193,7 @@ define(['require',
               var obj = ViewUtils.replaceColumnNamesWithKeys(searchCollection, Globals.invertedAuditLogMappings, true);
               return {
                 includeQuery: JSON.stringify(obj),
-                query: query
+                iMessage: query
               }
             }
           }));
@@ -207,7 +207,7 @@ define(['require',
               var obj = ViewUtils.replaceColumnNamesWithKeys(searchCollection, Globals.invertedAuditLogMappings, true);
               return {
                 excludeQuery: JSON.stringify(obj),
-                query: query
+                eMessage: query
               }
             }
           }));

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/dashboard/ComponentListView.js
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/dashboard/ComponentListView.js b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/dashboard/ComponentListView.js
index 2d3b289..029c25d 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/dashboard/ComponentListView.js
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/dashboard/ComponentListView.js
@@ -181,7 +181,7 @@ define(['require',
 					this.lastComponentLI = $el.data("name");
 					this.ui.componentsList.find("li").removeClass("active");
 					$el.addClass("active");
-					this.fetchComponentsHost(_.extend({componentName:$el.data("name")},this.searchParams));
+					this.fetchComponentsHost(_.extend({component_name:$el.data("name")},this.searchParams));
 				},
 				onNewTabIconClick : function(e){
 					var $el = $(e.currentTarget),host,component,that=this;

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/dashboard/LogLevelBoxView.js
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/dashboard/LogLevelBoxView.js b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/dashboard/LogLevelBoxView.js
index 0e7f1b8..eb73fb8 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/dashboard/LogLevelBoxView.js
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/dashboard/LogLevelBoxView.js
@@ -62,7 +62,7 @@ define(['require',
 		initialize: function(options) {
 			_.extend(this, _.pick(options,'vent','globalVent','params'));
 			this.logLevelList = new VLogLevelList();
-			this.logLevelList.url = Globals.baseURL + "service/logs/levels/counts/namevalues";
+			this.logLevelList.url = Globals.baseURL + "service/logs/levels/counts";
 			this.logLevelList.modelAttrName = "vNameValues";
 			this.bindEvents();
 		},

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/filter/CreateLogfeederFilterView.js
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/filter/CreateLogfeederFilterView.js b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/filter/CreateLogfeederFilterView.js
index 2c7f0aa..9bdf0fa 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/filter/CreateLogfeederFilterView.js
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/filter/CreateLogfeederFilterView.js
@@ -211,10 +211,10 @@ define(['require',
             onEditHost : function(e){
             	var $el = $(e.currentTarget);
             	$el.hide();
-            	if($el.data("type") == "host_name"){
-            		this.showHostSelect2($el.data("component_name"));
+            	if($el.data("type") == "host"){
+            		this.showHostSelect2($el.data("component"));
                 }else{
-            		this.showExpiry($el.data("component_name"));
+            		this.showExpiry($el.data("component"));
                 }
             },
             hideHostSelect2 : function(forComponent){


[29/58] [abbrv] ambari git commit: AMBARI-18310. Refactor logsearch portal side code - Part 2 (oleewere)

Posted by ol...@apache.org.
http://git-wip-us.apache.org/repos/asf/ambari/blob/3d62b004/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/metrics/SolrMetricsLoader.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/metrics/SolrMetricsLoader.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/metrics/SolrMetricsLoader.java
deleted file mode 100644
index 53e2ca2..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/metrics/SolrMetricsLoader.java
+++ /dev/null
@@ -1,198 +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.solr.metrics;
-
-import java.io.IOException;
-import java.util.Collection;
-import java.util.Map;
-import java.util.Timer;
-import java.util.TimerTask;
-import java.util.TreeMap;
-
-import javax.management.MalformedObjectNameException;
-
-import org.apache.ambari.logsearch.common.PropertiesHelper;
-import org.apache.ambari.logsearch.solr.AmbariSolrCloudClient;
-import org.apache.ambari.logsearch.solr.AmbariSolrCloudClientBuilder;
-import org.apache.commons.lang.StringUtils;
-import org.apache.hadoop.metrics2.sink.timeline.TimelineMetric;
-import org.apache.hadoop.metrics2.sink.timeline.TimelineMetrics;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class SolrMetricsLoader extends TimerTask {
-  private static final Logger LOG = LoggerFactory.getLogger(SolrMetricsLoader.class);
-
-  private static final int RETRY = 3;
-  private static final int MAX_METRIC_SIZE= 1000;
-
-  private final String solrHost;
-  private final SolrJmxAdapter solrJmxAdapter;
-  private final SolrAmsClient solrAmsClient;
-  
-  private final TimelineMetrics metrics = new TimelineMetrics();
-
-  public SolrMetricsLoader(String solrHost, int solrJmxPort, String collectorHost) throws IOException {
-    this.solrHost = solrHost;
-    this.solrJmxAdapter = new SolrJmxAdapter(solrHost, solrJmxPort);
-    this.solrAmsClient = new SolrAmsClient(collectorHost);
-
-    solrJmxAdapter.connect();
-  }
-
-  @Override
-  public void run() {
-    LOG.info("Loading Solr Metrics for the host " + solrHost);
-
-    addCpuUsageMetric();
-    addHeapMemoryUsageMetric();
-    addIndexSizeMetric();
-
-    emitMetrics();
-    removeOverTheLimitMetrics();
-  }
-
-  private void addCpuUsageMetric() {
-    Exception lastException = null;
-    for (int retries = 0; retries < RETRY; retries++) {
-      try {
-        double processCpuLoad = solrJmxAdapter.getProcessCpuLoad();
-        addMetric("logsearch.solr.cpu.usage", "Float", processCpuLoad);
-        return;
-      } catch (MalformedObjectNameException e) {
-        lastException = e;
-        try {
-          solrJmxAdapter.reConnect();
-        } catch (IOException e1) {
-        }
-      }
-    }
-
-    LOG.info("Could not load solr cpu usage metric, last exception:", lastException);
-  }
-
-  private void addHeapMemoryUsageMetric() {
-    Exception lastException = null;
-    for (int retries = 0; retries < RETRY; retries++) {
-      try {
-        Map<String, Long> memoryData = solrJmxAdapter.getMemoryData();
-        addMetric("jvm.JvmMetrics.MemHeapUsedM", "Long", memoryData.get("heapMemoryUsed").doubleValue() / 1024 / 1024);
-        addMetric("jvm.JvmMetrics.MemHeapCommittedM", "Long", memoryData.get("heapMemoryCommitted").doubleValue() / 1024 / 1024);
-        addMetric("jvm.JvmMetrics.MemHeapMaxM", "Long", memoryData.get("heapMemoryMax").doubleValue() / 1024 / 1024);
-        addMetric("jvm.JvmMetrics.MemNonHeapUsedM", "Long", memoryData.get("nonHeapMemoryUsed").doubleValue() / 1024 / 1024);
-        addMetric("jvm.JvmMetrics.MemNonHeapCommittedM", "Long", memoryData.get("nonHeapMemoryCommitted").doubleValue() / 1024 / 1024);
-        addMetric("jvm.JvmMetrics.MemNonHeapMaxM", "Long", memoryData.get("nonHeapMemoryMax").doubleValue() / 1024 / 1024);
-        return;
-      } catch (MalformedObjectNameException e) {
-        lastException = e;
-        try {
-          solrJmxAdapter.reConnect();
-        } catch (IOException e1) {
-        }
-      }
-    }
-
-    LOG.info("Could not load solr heap memory usage metric, last exception:", lastException);
-  }
-
-  private void addIndexSizeMetric() {
-    Exception lastException = null;
-    for (int retries = 0; retries < RETRY; retries++) {
-      try {
-        double indexSize = solrJmxAdapter.getIndexSize();
-        addMetric("logsearch.solr.index.size", "Long", indexSize / 1024 / 1024 / 1024);
-        return;
-      } catch (Exception e) {
-        lastException = e;
-        try {
-          solrJmxAdapter.reConnect();
-        } catch (IOException e1) {
-        }
-      }
-    }
-
-    LOG.info("Could not load solr index size metric, last exception:", lastException);
-  }
-
-  private void addMetric(String metricName, String type, Double value) {
-    Long currMS = System.currentTimeMillis();
-
-    TimelineMetric metric = new TimelineMetric();
-    metric.setMetricName(metricName);
-    metric.setHostName(solrHost);
-    metric.setAppId("infra-solr");
-    metric.setStartTime(currMS);
-    metric.setType(type);
-    metric.setTimestamp(currMS);
-    metric.getMetricValues().put(currMS, value);
-
-    metrics.addOrMergeTimelineMetric(metric);
-  }
-
-  private void emitMetrics() {
-    Exception lastException = null;
-    for (int retries = 0; retries < RETRY; retries++) {
-      try {
-        if (solrAmsClient.emitMetrics(metrics)) {
-          metrics.getMetrics().clear();
-          return;
-        }
-      } catch (Exception e) {
-        lastException = e;
-      }
-    }
-
-    LOG.info("Could not emit metrics, last exception:", lastException);
-  }
-
-  private void removeOverTheLimitMetrics() {
-    for (TimelineMetric metric : metrics.getMetrics()) {
-      TreeMap<Long, Double> metricValues = metric.getMetricValues();
-      while (metricValues.size() > MAX_METRIC_SIZE) {
-        metricValues.remove(metricValues.firstKey());
-      }
-    }
-  }
-
-  public static void startSolrMetricsLoaderTasks() {
-    try {
-      String collectorHosts = PropertiesHelper.getProperty("logsearch.solr.metrics.collector.hosts");
-      if (StringUtils.isEmpty(collectorHosts)) {
-        LOG.warn("No Ambari Metrics service is available, no Solr metrics will be loaded!");
-        return;
-      }
-
-      int solrJmxPort = PropertiesHelper.getIntProperty("logsearch.solr.jmx.port");
-
-      String zkConnectString = PropertiesHelper.getProperty("logsearch.solr.zk_connect_string");
-      AmbariSolrCloudClient ambariSolrCloudClient = new AmbariSolrCloudClientBuilder()
-          .withZkConnectString(zkConnectString)
-          .build();
-
-      Collection<String> solrHosts = ambariSolrCloudClient.getSolrHosts();
-      for (String solrHost : solrHosts) {
-        SolrMetricsLoader sml = new SolrMetricsLoader(solrHost, solrJmxPort, collectorHosts);
-        Timer timer = new Timer("Solr Metrics Loader - " + solrHost, true);
-        timer.scheduleAtFixedRate(sml, 0, 10000);
-      }
-    } catch (Exception e) {
-      LOG.warn("Could not start solr metric loader tasks", e);
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/3d62b004/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/model/SolrAuditLogData.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/model/SolrAuditLogData.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/model/SolrAuditLogData.java
index a3f59f7..0cf05a6 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/model/SolrAuditLogData.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/model/SolrAuditLogData.java
@@ -69,7 +69,7 @@ public class SolrAuditLogData extends SolrCommonLogData implements AuditLogData
   private String repo;
 
   @Field("repoType")
-  private String repoType;
+  private Integer repoType;
 
   @Field("reqData")
   private String requestData;
@@ -188,12 +188,12 @@ public class SolrAuditLogData extends SolrCommonLogData implements AuditLogData
   }
 
   @Override
-  public String getRepoType() {
+  public Integer getRepoType() {
     return repoType;
   }
 
   @Override
-  public void setRepoType(String repoType) {
+  public void setRepoType(Integer repoType) {
     this.repoType = repoType;
   }
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/3d62b004/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/authenticate/LogsearchLogoutSuccessHandler.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/authenticate/LogsearchLogoutSuccessHandler.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/authenticate/LogsearchLogoutSuccessHandler.java
index 5da1c97..c20e383 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/authenticate/LogsearchLogoutSuccessHandler.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/authenticate/LogsearchLogoutSuccessHandler.java
@@ -36,6 +36,6 @@ public class LogsearchLogoutSuccessHandler extends SimpleUrlLogoutSuccessHandler
     public void onLogoutSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication)
       throws IOException, ServletException {
       logger.debug("LogsearchLogoutSuccessHandler ::: onLogoutSuccess");
-      response.sendRedirect("/login.html");
+      response.sendRedirect("/index.html");
   }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/3d62b004/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/filters/LogsearchAuthenticationEntryPoint.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/filters/LogsearchAuthenticationEntryPoint.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/filters/LogsearchAuthenticationEntryPoint.java
index 1b24c06..1831697 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/filters/LogsearchAuthenticationEntryPoint.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/filters/LogsearchAuthenticationEntryPoint.java
@@ -28,7 +28,7 @@ import org.apache.log4j.Logger;
 import org.springframework.security.core.AuthenticationException;
 import org.springframework.security.web.authentication.LoginUrlAuthenticationEntryPoint;
 
-class LogsearchAuthenticationEntryPoint extends LoginUrlAuthenticationEntryPoint {
+public class LogsearchAuthenticationEntryPoint extends LoginUrlAuthenticationEntryPoint {
   private static final Logger logger = Logger.getLogger(LogsearchAuthenticationEntryPoint.class);
 
   public LogsearchAuthenticationEntryPoint(String loginFormUrl) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/3d62b004/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/filters/LogsearchKRBAuthenticationFilter.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/filters/LogsearchKRBAuthenticationFilter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/filters/LogsearchKRBAuthenticationFilter.java
index 29fd5b2..8cd435b 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/filters/LogsearchKRBAuthenticationFilter.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/filters/LogsearchKRBAuthenticationFilter.java
@@ -61,6 +61,7 @@ import org.apache.hadoop.security.authentication.server.KerberosAuthenticationHa
 import org.apache.hadoop.security.authentication.server.PseudoAuthenticationHandler;
 import org.apache.hadoop.security.authentication.util.KerberosName;
 import org.springframework.security.web.authentication.WebAuthenticationDetails;
+import org.springframework.stereotype.Component;
 
 public class LogsearchKRBAuthenticationFilter extends LogsearchKrbFilter {
   private static final Logger logger = LoggerFactory.getLogger(LogsearchKRBAuthenticationFilter.class);

http://git-wip-us.apache.org/repos/asf/ambari/blob/3d62b004/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/filters/LogsearchSecurityContextFormationFilter.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/filters/LogsearchSecurityContextFormationFilter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/filters/LogsearchSecurityContextFormationFilter.java
index a34fbd0..1320278 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/filters/LogsearchSecurityContextFormationFilter.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/filters/LogsearchSecurityContextFormationFilter.java
@@ -38,6 +38,7 @@ import org.apache.log4j.Logger;
 import org.springframework.security.authentication.AnonymousAuthenticationToken;
 import org.springframework.security.core.Authentication;
 import org.springframework.security.core.context.SecurityContextHolder;
+import org.springframework.stereotype.Component;
 import org.springframework.web.filter.GenericFilterBean;
 
 public class LogsearchSecurityContextFormationFilter extends GenericFilterBean {

http://git-wip-us.apache.org/repos/asf/ambari/blob/3d62b004/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/filters/LogsearchUsernamePasswordAuthenticationFilter.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/filters/LogsearchUsernamePasswordAuthenticationFilter.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/filters/LogsearchUsernamePasswordAuthenticationFilter.java
index 2c83001..85688a2 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/filters/LogsearchUsernamePasswordAuthenticationFilter.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/filters/LogsearchUsernamePasswordAuthenticationFilter.java
@@ -20,11 +20,13 @@ package org.apache.ambari.logsearch.web.filters;
 
 import java.io.IOException;
 
+import javax.inject.Inject;
 import javax.servlet.ServletException;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
 import org.apache.log4j.Logger;
+import org.springframework.security.authentication.AuthenticationManager;
 import org.springframework.security.core.AuthenticationException;
 import org.springframework.security.web.authentication.RememberMeServices;
 import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;

http://git-wip-us.apache.org/repos/asf/ambari/blob/3d62b004/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/listeners/SpringEventListener.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/listeners/SpringEventListener.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/listeners/SpringEventListener.java
deleted file mode 100644
index fc6a594..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/listeners/SpringEventListener.java
+++ /dev/null
@@ -1,32 +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.web.listeners;
-
-import org.apache.log4j.Logger;
-import org.springframework.context.ApplicationListener;
-import org.springframework.security.authentication.event.AbstractAuthenticationEvent;
-
-public class SpringEventListener implements ApplicationListener<AbstractAuthenticationEvent> {
-  private static final Logger logger = Logger.getLogger(SpringEventListener.class);
-
-  @Override
-  public void onApplicationEvent(AbstractAuthenticationEvent event) {
-    logger.trace(" Inside onApplicationEvent  SpringEventListener");
-  }
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/3d62b004/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchAbstractAuthenticationProvider.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchAbstractAuthenticationProvider.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchAbstractAuthenticationProvider.java
index 0c102c3..eab33a1 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchAbstractAuthenticationProvider.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchAbstractAuthenticationProvider.java
@@ -65,14 +65,4 @@ public abstract class LogsearchAbstractAuthenticationProvider implements Authent
     return isEnable;
   }
 
-  /**
-   * Check authentication provider is enable or disable
-   * 
-   * @return boolean
-   */
-  public boolean isEnable() {
-    // default is disabled
-    return false;
-  }
-
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/3d62b004/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchAuthenticationProvider.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchAuthenticationProvider.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchAuthenticationProvider.java
index 3534818..05104b4 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchAuthenticationProvider.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchAuthenticationProvider.java
@@ -26,7 +26,6 @@ import org.apache.log4j.Logger;
 import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
 import org.springframework.security.core.Authentication;
 import org.springframework.security.core.AuthenticationException;
-import org.springframework.security.core.userdetails.UserDetailsService;
 import org.springframework.security.web.authentication.WebAuthenticationDetails;
 import org.springframework.stereotype.Component;
 
@@ -41,19 +40,19 @@ public class LogsearchAuthenticationProvider extends
     .getLogger("org.apache.ambari.logsearch.audit");
 
   @Inject
-  UserDao userDao;
+  private UserDao userDao;
 
   @Inject
-  LogsearchLdapAuthenticationProvider ldapAuthenticationProvider;
+  private LogsearchLdapAuthenticationProvider ldapAuthenticationProvider;
 
   @Inject
-  LogsearchFileAuthenticationProvider fileAuthenticationProvider;
+  private LogsearchFileAuthenticationProvider fileAuthenticationProvider;
 
   @Inject
-  LogsearchSimpleAuthenticationProvider simpleAuthenticationProvider;
+  private LogsearchSimpleAuthenticationProvider simpleAuthenticationProvider;
 
   @Inject
-  LogsearchExternalServerAuthenticationProvider externalServerAuthenticationProvider;
+  private LogsearchExternalServerAuthenticationProvider externalServerAuthenticationProvider;
 
   @Override
   public Authentication authenticate(Authentication authentication)
@@ -128,7 +127,7 @@ public class LogsearchAuthenticationProvider extends
       authentication = fileAuthenticationProvider.authenticate(authentication);
     } else if (authMethod.equals(AUTH_METHOD.SIMPLE)) {
       authentication = simpleAuthenticationProvider.authenticate(authentication);
-    }else if (authMethod.equals(AUTH_METHOD.EXTERNAL_AUTH)) {
+    } else if (authMethod.equals(AUTH_METHOD.EXTERNAL_AUTH)) {
       authentication = externalServerAuthenticationProvider.authenticate(authentication);
     } else {
       logger.error("Invalid authentication method :" + authMethod.name());

http://git-wip-us.apache.org/repos/asf/ambari/blob/3d62b004/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchExternalServerAuthenticationProvider.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchExternalServerAuthenticationProvider.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchExternalServerAuthenticationProvider.java
index a06a381..d398bdc 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchExternalServerAuthenticationProvider.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchExternalServerAuthenticationProvider.java
@@ -21,7 +21,6 @@ package org.apache.ambari.logsearch.web.security;
 import java.util.ArrayList;
 import java.util.List;
 
-import javax.annotation.PostConstruct;
 import javax.inject.Inject;
 
 import org.apache.ambari.logsearch.common.ExternalServerClient;
@@ -114,7 +113,7 @@ public class LogsearchExternalServerAuthenticationProvider extends
   @Override
   public Authentication authenticate(Authentication authentication)
       throws AuthenticationException {
-    if (!this.isEnable()) {
+    if (!authConfig.isAuthExternalEnabled()) {
       LOG.debug("external server auth is disabled.");
       return authentication;
     }
@@ -173,13 +172,4 @@ public class LogsearchExternalServerAuthenticationProvider extends
     }
     return false;
   }
-
-  /**
-   * Return true/false based on EXTERNAL_AUTH authentication method is
-   * enabled/disabled return boolean
-   */
-  @Override
-  public boolean isEnable() {
-    return isEnable(AUTH_METHOD.EXTERNAL_AUTH);
-  }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/3d62b004/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchFileAuthenticationProvider.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchFileAuthenticationProvider.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchFileAuthenticationProvider.java
index 180de31..9662266 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchFileAuthenticationProvider.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchFileAuthenticationProvider.java
@@ -20,6 +20,7 @@ package org.apache.ambari.logsearch.web.security;
 
 import java.util.Collection;
 
+import org.apache.ambari.logsearch.conf.AuthConfig;
 import org.apache.ambari.logsearch.util.CommonUtil;
 import org.apache.commons.lang.StringEscapeUtils;
 import org.apache.commons.lang.StringUtils;
@@ -41,11 +42,14 @@ public class LogsearchFileAuthenticationProvider extends LogsearchAbstractAuthen
   private static Logger logger = Logger.getLogger(LogsearchFileAuthenticationProvider.class);
 
   @Inject
+  private AuthConfig authConfig;
+
+  @Inject
   private UserDetailsService userDetailsService;
 
   @Override
   public Authentication authenticate(Authentication authentication) throws AuthenticationException {
-    if (!this.isEnable()) {
+    if (!authConfig.isAuthFileEnabled()) {
       logger.debug("File auth is disabled.");
       return authentication;
     }
@@ -80,9 +84,4 @@ public class LogsearchFileAuthenticationProvider extends LogsearchAbstractAuthen
     authentication = new UsernamePasswordAuthenticationToken(username, encPassword, authorities);
     return authentication;
   }
-
-  @Override
-  public boolean isEnable() {
-    return isEnable(AUTH_METHOD.FILE);
-  }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/3d62b004/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchLdapAuthenticationProvider.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchLdapAuthenticationProvider.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchLdapAuthenticationProvider.java
index 742cd9b..f6c7df0 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchLdapAuthenticationProvider.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchLdapAuthenticationProvider.java
@@ -20,6 +20,7 @@ package org.apache.ambari.logsearch.web.security;
 
 import java.util.List;
 
+import org.apache.ambari.logsearch.conf.AuthConfig;
 import org.apache.log4j.Logger;
 import org.springframework.ldap.CommunicationException;
 import org.springframework.ldap.core.support.LdapContextSource;
@@ -31,6 +32,9 @@ import org.springframework.security.ldap.authentication.LdapAuthenticationProvid
 import org.springframework.security.ldap.search.FilterBasedLdapUserSearch;
 import org.springframework.stereotype.Component;
 
+import javax.annotation.PostConstruct;
+import javax.inject.Inject;
+
 @Component
 public class LogsearchLdapAuthenticationProvider extends
   LogsearchAbstractAuthenticationProvider {
@@ -42,9 +46,16 @@ public class LogsearchLdapAuthenticationProvider extends
   private static LdapAuthenticationProvider ldapAuthProvider = null;
   private String logStatement = "";
 
+  @Inject
+  private AuthConfig authConfig;
+
   public LogsearchLdapAuthenticationProvider() {
+  }
+
+  @PostConstruct
+  public void postConstruct() {
     logger.debug("Creating object of ldap auth provider ");
-    if (this.isEnable()) {
+    if (authConfig.isAuthLdapEnabled()) {
       ldapAuthProvider = loadLdapAuthenticationProvider();
     } else {
       logger.info("Ldap auth is disabled");
@@ -54,7 +65,7 @@ public class LogsearchLdapAuthenticationProvider extends
   @Override
   public Authentication authenticate(Authentication authentication)
     throws AuthenticationException {
-    if (!this.isEnable()) {
+    if (!authConfig.isAuthLdapEnabled()) {
       logger.debug("Ldap auth is disabled");
       return authentication;
     }
@@ -98,7 +109,7 @@ public class LogsearchLdapAuthenticationProvider extends
    *
    * @return corresponding LDAP authentication provider
    */
-  LdapAuthenticationProvider loadLdapAuthenticationProvider() {
+  private LdapAuthenticationProvider loadLdapAuthenticationProvider() {
     if (reloadLdapServerProperties()) {
       logger.info("LDAP Properties changed - rebuilding Context");
       LdapContextSource springSecurityContextSource = new LdapContextSource();
@@ -173,9 +184,4 @@ public class LogsearchLdapAuthenticationProvider extends
     return false;
   }
 
-  @Override
-  public boolean isEnable() {
-    return isEnable(AUTH_METHOD.LDAP);
-  }
-
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/3d62b004/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchLdapBindAuthenticator.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchLdapBindAuthenticator.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchLdapBindAuthenticator.java
index f9207b1..10f7507 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchLdapBindAuthenticator.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchLdapBindAuthenticator.java
@@ -40,69 +40,7 @@ public class LogsearchLdapBindAuthenticator extends BindAuthenticator {
 
   @Override
   public DirContextOperations authenticate(Authentication authentication) {
-
-    DirContextOperations user = super.authenticate(authentication);
-
-    return setAmbariAdminAttr(user);
-  }
-
-  /**
-   * Checks whether user is a member of ambari administrators group in LDAP.
-   * If yes, sets user's ambari_admin attribute to true
-   *
-   * @param user
-   * @return
-   */
-  private DirContextOperations setAmbariAdminAttr(DirContextOperations user) {
-    String baseDn = ldapServerProperties.getBaseDN().toLowerCase();
-    String groupBase = ldapServerProperties.getGroupBase().toLowerCase();
-    String groupObjectClass = ldapServerProperties.getGroupObjectClass();
-    String groupMembershipAttr = ldapServerProperties
-      .getGroupMembershipAttr();
-    String adminGroupMappingRules = ldapServerProperties
-      .getAdminGroupMappingRules();
-    final String groupNamingAttribute = ldapServerProperties
-      .getGroupNamingAttr();
-    String groupSearchFilter = ldapServerProperties.getGroupSearchFilter();
-
-    // If groupBase is set incorrectly or isn't set - search in BaseDn
-    int indexOfBaseDn = groupBase.indexOf(baseDn);
-    groupBase = indexOfBaseDn <= 0 ? "" : groupBase.substring(0,
-      indexOfBaseDn - 1);
-
-    StringBuilder filterBuilder = new StringBuilder();
-
-    filterBuilder.append("(&(");
-    filterBuilder.append(groupMembershipAttr);
-    filterBuilder.append("=");
-    filterBuilder.append(user.getNameInNamespace());// DN
-
-    if ((groupSearchFilter == null) || groupSearchFilter.equals("")) {
-      // If groupSearchFilter is not specified, build it from other
-      // authorization
-      // group properties
-      filterBuilder.append(")(objectclass=");
-      filterBuilder.append(groupObjectClass);
-      filterBuilder.append(")(|");
-      String[] adminGroupMappingRegexs = adminGroupMappingRules
-        .split(",");
-      for (String adminGroupMappingRegex : adminGroupMappingRegexs) {
-        filterBuilder.append("(");
-        filterBuilder.append(groupNamingAttribute);
-        filterBuilder.append("=");
-        filterBuilder.append(adminGroupMappingRegex);
-        filterBuilder.append(")");
-      }
-      filterBuilder.append(")");
-    } else {
-      filterBuilder.append(")");
-      filterBuilder.append(groupSearchFilter);
-    }
-    filterBuilder.append(")");
-
-    logger.info("filter=" + filterBuilder);
-    // TODO: Filter is not used anywhere
-    return user;
+    return super.authenticate(authentication);
   }
 
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/3d62b004/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchSimpleAuthenticationProvider.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchSimpleAuthenticationProvider.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchSimpleAuthenticationProvider.java
index ec2516c..5dc1c1f 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchSimpleAuthenticationProvider.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchSimpleAuthenticationProvider.java
@@ -18,6 +18,7 @@
  */
 package org.apache.ambari.logsearch.web.security;
 
+import org.apache.ambari.logsearch.conf.AuthConfig;
 import org.apache.ambari.logsearch.web.model.User;
 import org.apache.commons.lang.StringEscapeUtils;
 import org.apache.commons.lang.StringUtils;
@@ -28,14 +29,19 @@ import org.springframework.security.core.Authentication;
 import org.springframework.security.core.AuthenticationException;
 import org.springframework.stereotype.Component;
 
+import javax.inject.Inject;
+
 @Component
 public class LogsearchSimpleAuthenticationProvider extends LogsearchAbstractAuthenticationProvider {
 
   private static Logger logger = Logger.getLogger(LogsearchSimpleAuthenticationProvider.class);
 
+  @Inject
+  private AuthConfig authConfig;
+
   @Override
   public Authentication authenticate(Authentication authentication) throws AuthenticationException {
-    if (!this.isEnable()) {
+    if (!authConfig.isAuthSimpleEnabled()) {
       logger.debug("Simple auth is disabled");
       return authentication;
     }
@@ -64,9 +70,4 @@ public class LogsearchSimpleAuthenticationProvider extends LogsearchAbstractAuth
       return false;
     }
   }
-
-  @Override
-  public boolean isEnable() {
-    return this.isEnable(AUTH_METHOD.SIMPLE);
-  }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/3d62b004/ambari-logsearch/ambari-logsearch-portal/src/main/resources/log4j.xml
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/resources/log4j.xml b/ambari-logsearch/ambari-logsearch-portal/src/main/resources/log4j.xml
index ad96558..60b09cd 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/resources/log4j.xml
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/resources/log4j.xml
@@ -57,7 +57,7 @@
 
  <appender name="rolling_file_json"
   class="org.apache.ambari.logsearch.appender.LogsearchRollingFileAppender">
-  <param name="file" value="logs/logsearch-app.json" />
+  <param name="file" value="target/logs/logsearch-app.json" />
   <param name="Threshold" value="info" />
   <param name="append" value="true" />
   <param name="maxFileSize" value="10MB" />
@@ -67,7 +67,7 @@
 
   <appender name="audit_rolling_file_json"
     class="org.apache.ambari.logsearch.appender.LogsearchRollingFileAppender">
-    <param name="file" value="logs/logsearch-audit.json" />
+    <param name="file" value="target/logs/logsearch-audit.json" />
     <param name="Threshold" value="info" />
     <param name="append" value="true" />
     <param name="maxFileSize" value="10MB" />
@@ -77,7 +77,7 @@
 
   <appender name="performance_analyzer_json"
     class="org.apache.ambari.logsearch.appender.LogsearchRollingFileAppender">
-    <param name="file" value="logs/logsearch-performance.json" />
+    <param name="file" value="target/logs/logsearch-performance.json" />
     <param name="Threshold" value="info" />
     <param name="append" value="true" />
     <param name="maxFileSize" value="10MB" />

http://git-wip-us.apache.org/repos/asf/ambari/blob/3d62b004/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/META-INF/security-applicationContext.xml
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/META-INF/security-applicationContext.xml b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/META-INF/security-applicationContext.xml
deleted file mode 100644
index 9961cd0..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/META-INF/security-applicationContext.xml
+++ /dev/null
@@ -1,83 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  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.
--->
-<beans:beans xmlns="http://www.springframework.org/schema/security"
-xmlns:beans="http://www.springframework.org/schema/beans"
-xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-xmlns:security="http://www.springframework.org/schema/security"
-xsi:schemaLocation="http://www.springframework.org/schema/beans
-http://www.springframework.org/schema/beans/spring-beans-4.2.xsd
-http://www.springframework.org/schema/security
-http://www.springframework.org/schema/security/spring-security-4.0.xsd">
-  
-    <security:http pattern="/login.html" security="none" />
-    <security:http pattern="/styles/**" security="none" />
-    <security:http pattern="/fonts/**" security="none" />
-    <security:http pattern="/scripts/**" security="none" />
-    <security:http pattern="/libs/**" security="none" />
-    <security:http pattern="/images/**" security="none" />
-    <security:http pattern="/templates/**" security="none" />
-    <security:http pattern="/favicon.ico" security="none" />
-    <security:http pattern="/api/v1/public/**" security="none" />
-    <security:http pattern="/api/v1/swagger.json" security="none"/>
-    <security:http pattern="/api/v1/swagger.yaml" security="none"/>
-  	
-	<security:http disable-url-rewriting="true" use-expressions="true" create-session="always" entry-point-ref="authenticationProcessingFilterEntryPoint">
-		<csrf disabled="true"/> 
-		<security:session-management session-fixation-protection="newSession" />
-		<intercept-url pattern="/**" access="isAuthenticated()"/>       
-        <security:custom-filter ref="krbAuthenticationFilter" after="FIRST" />
-		<security:custom-filter position="FORM_LOGIN_FILTER" ref="logsearchUsernamePasswordAuthenticationFilter"/>
-		<security:custom-filter position="LAST" ref="userContextFormationFilter"/>
-		<security:logout delete-cookies="JSESSIONID" logout-url="/logout.html" success-handler-ref="logsearchLogoutSuccessHandler" />
-		<http-basic entry-point-ref="authenticationProcessingFilterEntryPoint"/>
-	</security:http>
-
-	<beans:bean id="userContextFormationFilter" class="org.apache.ambari.logsearch.web.filters.LogsearchSecurityContextFormationFilter"/>
-
-    <beans:bean id="krbAuthenticationFilter" class="org.apache.ambari.logsearch.web.filters.LogsearchKRBAuthenticationFilter"/>
-  
-	<beans:bean id="logsearchUsernamePasswordAuthenticationFilter" class="org.apache.ambari.logsearch.web.filters.LogsearchUsernamePasswordAuthenticationFilter">
-		<beans:property name="authenticationManager" ref="authenticationManager"/>
-		<beans:property name="authenticationSuccessHandler" ref="authSuccessHandler"/>
-		<beans:property name="authenticationFailureHandler"	ref="authFailureHandler"/>
-	</beans:bean>
-  
-	<beans:bean id="authenticationProcessingFilterEntryPoint" class="org.apache.ambari.logsearch.web.filters.LogsearchAuthenticationEntryPoint">
-		<beans:constructor-arg index="0" value="/login.html"/>
-		<beans:property name="forceHttps" value="false"/>
-	</beans:bean>
-
-	<beans:bean id="authSuccessHandler" class="org.apache.ambari.logsearch.web.authenticate.LogsearchAuthSuccessHandler">
-	</beans:bean>
-
-	<beans:bean id="authFailureHandler" class="org.apache.ambari.logsearch.web.authenticate.LogsearchAuthFailureHandler">
-	</beans:bean>
-
-	<beans:bean id="logsearchLogoutSuccessHandler" class="org.apache.ambari.logsearch.web.authenticate.LogsearchLogoutSuccessHandler">
-	</beans:bean>
-	
-	 <beans:bean id="logsearchAuthenticationProvider" class="org.apache.ambari.logsearch.web.security.LogsearchAuthenticationProvider" >
- 	</beans:bean>
-
-	<security:authentication-manager alias="authenticationManager">
-         <security:authentication-provider ref="logsearchAuthenticationProvider"/>
-	</security:authentication-manager>
-	
-	<beans:bean id="securityEventListener" class ="org.apache.ambari.logsearch.web.listeners.SpringEventListener"/>
-	
-</beans:beans>

http://git-wip-us.apache.org/repos/asf/ambari/blob/3d62b004/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/WEB-INF/web.xml
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/WEB-INF/web.xml b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/WEB-INF/web.xml
deleted file mode 100755
index 0f1beec..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/WEB-INF/web.xml
+++ /dev/null
@@ -1,62 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  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.
--->
-<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
-
-  <listener>
-    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
-  </listener>
-  <context-param>
-    <param-name>contextClass</param-name>
-    <param-value>
-      org.springframework.web.context.support.AnnotationConfigWebApplicationContext
-    </param-value>
-  </context-param>
-  <context-param>
-    <param-name>contextConfigLocation</param-name>
-    <param-value>org.apache.ambari.logsearch.conf.ApplicationConfig</param-value>
-  </context-param>
-
-	<listener>
-		<listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
-	</listener>
-	<filter>
-		<filter-name>springSecurityFilterChain</filter-name>
-		<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
-	</filter>
-
-	<filter-mapping>
-		<filter-name>springSecurityFilterChain</filter-name>
-		<url-pattern>/*</url-pattern>
-	</filter-mapping>
-  
-	<!-- Servlet mapping for REST -->
-	<servlet>
-		<servlet-name>REST service</servlet-name>
-		<servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class>
-		<init-param>
-			<param-name>jersey.config.server.provider.packages</param-name>
-			<param-value>org.apache.ambari.logsearch.rest,io.swagger.jaxrs.listing</param-value>
-		</init-param>
-		<load-on-startup>1</load-on-startup>
-	</servlet>
-	  <servlet-mapping>
-		<servlet-name>REST service</servlet-name>
-		<url-pattern>/api/v1/*</url-pattern>
-	</servlet-mapping>
-
-</web-app>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/3d62b004/ambari-logsearch/docker/test-config/logfeeder/logfeeder.properties
----------------------------------------------------------------------
diff --git a/ambari-logsearch/docker/test-config/logfeeder/logfeeder.properties b/ambari-logsearch/docker/test-config/logfeeder/logfeeder.properties
index b588a2d..f930ec9 100644
--- a/ambari-logsearch/docker/test-config/logfeeder/logfeeder.properties
+++ b/ambari-logsearch/docker/test-config/logfeeder/logfeeder.properties
@@ -21,7 +21,8 @@ logfeeder.config.files=shipper-conf/global.config.json,\
   shipper-conf/input.config-logsearch.json,\
   shipper-conf/input.config-hst.json,\
   shipper-conf/input.config-system_message.json,\
-  shipper-conf/input.config-secure_log.json
+  shipper-conf/input.config-secure_log.json,\
+  shipper-conf/input.config-hdfs.json
 logfeeder.log.filter.enable=true
 logfeeder.solr.config.interval=5
 logfeeder.solr.core.config.name=history

http://git-wip-us.apache.org/repos/asf/ambari/blob/3d62b004/ambari-logsearch/docker/test-config/logfeeder/shipper-conf/input.config-hdfs.json
----------------------------------------------------------------------
diff --git a/ambari-logsearch/docker/test-config/logfeeder/shipper-conf/input.config-hdfs.json b/ambari-logsearch/docker/test-config/logfeeder/shipper-conf/input.config-hdfs.json
new file mode 100644
index 0000000..d975b0d
--- /dev/null
+++ b/ambari-logsearch/docker/test-config/logfeeder/shipper-conf/input.config-hdfs.json
@@ -0,0 +1,172 @@
+{
+  "input": [
+    {
+      "type": "hdfs_audit",
+      "rowtype": "audit",
+      "is_enabled": "true",
+      "add_fields": {
+        "logType": "HDFSAudit",
+        "enforcer": "hadoop-acl",
+        "repoType": "1",
+        "repo": "hdfs"
+      },
+      "path": "/root/test-logs/hdfs-audit/hdfs-audit.log"
+    }
+  ],
+  "filter": [
+    {
+      "filter":"grok",
+      "conditions":{
+        "fields":{
+          "type":[
+            "hdfs_audit"
+          ]
+
+        }
+
+      },
+      "log4j_format":"%d{ISO8601} %-5p %c{2} (%F:%M(%L)) - %m%n",
+      "multiline_pattern":"^(%{TIMESTAMP_ISO8601:evtTime})",
+      "message_pattern":"(?m)^%{TIMESTAMP_ISO8601:evtTime}%{SPACE}%{LOGLEVEL:level}%{SPACE}%{JAVACLASS:logger_name}:%{SPACE}%{GREEDYDATA:log_message}",
+      "post_map_values":{
+        "evtTime":{
+          "map_date":{
+            "target_date_pattern":"yyyy-MM-dd HH:mm:ss,SSS"
+          }
+
+        }
+
+      }
+
+    },
+    {
+      "filter":"keyvalue",
+      "sort_order":1,
+      "conditions":{
+        "fields":{
+          "type":[
+            "hdfs_audit"
+          ]
+
+        }
+
+      },
+      "source_field":"log_message",
+      "value_split":"=",
+      "field_split":"\t",
+      "post_map_values":{
+        "src":{
+          "map_fieldname":{
+            "new_fieldname":"resource"
+          }
+
+        },
+        "ip":{
+          "map_fieldname":{
+            "new_fieldname":"cliIP"
+          }
+
+        },
+        "allowed":[
+          {
+            "map_fieldvalue":{
+              "pre_value":"true",
+              "post_value":"1"
+            }
+
+          },
+          {
+            "map_fieldvalue":{
+              "pre_value":"false",
+              "post_value":"0"
+            }
+
+          },
+          {
+            "map_fieldname":{
+              "new_fieldname":"result"
+            }
+
+          }
+
+        ],
+        "cmd":{
+          "map_fieldname":{
+            "new_fieldname":"action"
+          }
+
+        },
+        "proto":{
+          "map_fieldname":{
+            "new_fieldname":"cliType"
+          }
+
+        },
+        "callerContext":{
+          "map_fieldname":{
+            "new_fieldname":"req_caller_id"
+          }
+
+        }
+
+      }
+
+    },
+    {
+      "filter":"grok",
+      "sort_order":2,
+      "source_field":"ugi",
+      "remove_source_field":"false",
+      "conditions":{
+        "fields":{
+          "type":[
+            "hdfs_audit"
+          ]
+
+        }
+
+      },
+      "message_pattern":"%{USERNAME:p_user}.+auth:%{USERNAME:p_authType}.+via %{USERNAME:k_user}.+auth:%{USERNAME:k_authType}|%{USERNAME:user}.+auth:%{USERNAME:authType}|%{USERNAME:x_user}",
+      "post_map_values":{
+        "user":{
+          "map_fieldname":{
+            "new_fieldname":"reqUser"
+          }
+
+        },
+        "x_user":{
+          "map_fieldname":{
+            "new_fieldname":"reqUser"
+          }
+
+        },
+        "p_user":{
+          "map_fieldname":{
+            "new_fieldname":"reqUser"
+          }
+
+        },
+        "k_user":{
+          "map_fieldname":{
+            "new_fieldname":"proxyUsers"
+          }
+
+        },
+        "p_authType":{
+          "map_fieldname":{
+            "new_fieldname":"authType"
+          }
+
+        },
+        "k_authType":{
+          "map_fieldname":{
+            "new_fieldname":"proxyAuthType"
+          }
+
+        }
+
+      }
+
+    }
+  ]
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/3d62b004/ambari-logsearch/docker/test-logs/hdfs-audit/hdfs-audit.log
----------------------------------------------------------------------
diff --git a/ambari-logsearch/docker/test-logs/hdfs-audit/hdfs-audit.log b/ambari-logsearch/docker/test-logs/hdfs-audit/hdfs-audit.log
new file mode 100644
index 0000000..a646cc4
--- /dev/null
+++ b/ambari-logsearch/docker/test-logs/hdfs-audit/hdfs-audit.log
@@ -0,0 +1,4 @@
+2016-03-18 10:00:47,252 INFO FSNamesystem.audit: allowed=true	ugi=ambari-qa (auth:SIMPLE)	ip=/192.168.64.102	cmd=getfileinfo	src=/ats/active	dst=null	perm=null	proto=rpc	callerContext=HIVE_QUERY_ID:ambari-qa_20160317200111_223b3079-4a2d-431c-920f-6ba37ed63e9f
+2016-03-18 10:00:48,939 INFO FSNamesystem.audit: allowed=true	ugi=ambari-qa (auth:SIMPLE)	ip=/192.168.64.102	cmd=delete	src=/tmp/hive/ambari-qa/resource1	dst=null	perm=null	proto=rpc
+2016-03-18 10:00:49,242 INFO FSNamesystem.audit: allowed=true	ugi=ambari-qa (auth:SIMPLE)	ip=/192.168.64.102	cmd=getfileinfo	src=/tmp/hive/ambari-qa/resource2	dst=null	perm=null	proto=rpc
+2016-03-18 10:00:49,277 INFO FSNamesystem.audit: allowed=true	ugi=ambari-qa (auth:SIMPLE)	ip=/192.168.64.102	cmd=getfileinfo	src=/tmp/hive/ambari-qa/resource2	dst=null	perm=null	proto=rpc


[41/58] [abbrv] ambari git commit: AMBARI-18310. Logsearch - Refactor solr query layer (oleewere)

Posted by ol...@apache.org.
http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/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
index 287ff6c..85b5fda 100644
--- 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
@@ -19,324 +19,405 @@
 
 package org.apache.ambari.logsearch.graph;
 
-import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.List;
+import java.util.Map;
 
-import org.apache.ambari.logsearch.common.LogSearchConstants;
-import org.apache.ambari.logsearch.common.MessageEnums;
+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.query.model.SearchCriteria;
-import org.apache.ambari.logsearch.dao.SolrDaoBase;
-import org.apache.ambari.logsearch.query.QueryGeneration;
-import org.apache.ambari.logsearch.util.RESTErrorUtil;
-import org.apache.ambari.logsearch.util.SolrUtil;
+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.log4j.Logger;
-import org.apache.solr.client.solrj.SolrQuery;
-import org.apache.solr.client.solrj.SolrServerException;
 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.SolrException;
-import org.apache.solr.common.util.SimpleOrderedMap;
-import org.springframework.stereotype.Component;
+import org.apache.solr.common.util.NamedList;
 
-import javax.inject.Inject;
+import javax.inject.Named;
 
-@Component
-public class GraphDataGenerator extends GraphDataGeneratorBase {
+@Named
+public class GraphDataGenerator {
 
-  private static final Logger logger = Logger.getLogger(GraphDataGenerator.class);
+  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;
+  }
 
-  @Inject
-  private QueryGeneration queryGenerator;
+  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 getAnyGraphData(SearchCriteria searchCriteria, SolrDaoBase solrDaoBase, SolrQuery solrQuery) {
-    // X axis credentials
-    String xAxisField = (String) searchCriteria.getParamValue("xAxis");
-    String stackField = (String) searchCriteria.getParamValue("stackBy");
-    String from = (String) searchCriteria.getParamValue("from");
-    String to = (String) searchCriteria.getParamValue("to");
-    String unit = (String) searchCriteria.getParamValue("unit");
-    String typeXAxis = solrDaoBase.schemaFieldNameMap.get(xAxisField);
-    typeXAxis = (StringUtils.isBlank(typeXAxis)) ? "string" : typeXAxis;
+  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);
 
-    // Y axis credentials
-    String yAxisField = (String) searchCriteria.getParamValue("yAxis");
-    // add updated typeXAxis as a type parameter
-    searchCriteria.addParam("type", typeXAxis);
-    String fieldTime = (String) searchCriteria.getParamValue("fieldTime");
-    // decide graph type based on user request parameter
-    GraphType garphType = getGraphType(searchCriteria);
-    switch (garphType) {
-    case NORMAL_GRAPH:
-      return normalGraph(xAxisField, yAxisField, from, to, solrDaoBase, typeXAxis, fieldTime, solrQuery);
-    case RANGE_NON_STACK_GRAPH:
-      return rangeNonStackGraph(xAxisField, yAxisField, from, to, unit, solrDaoBase, typeXAxis, fieldTime, solrQuery);
-    case NON_RANGE_STACK_GRAPH:
-      return nonRangeStackGraph(xAxisField, yAxisField, stackField, from, to, solrDaoBase, typeXAxis, fieldTime, solrQuery);
-    case RANGE_STACK_GRAPH:
-      return rangeStackGraph(xAxisField, stackField, from, to, unit, solrDaoBase, solrQuery);
-    default:
-      logger.warn("Invalid graph type :" + garphType.name());
-      return null;
+    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;
   }
 
-  private GraphType getGraphType(SearchCriteria searchCriteria) {
-    // default graph type is unknown
-    GraphType graphType = GraphType.UNKNOWN;
-    // X axis credentials
-    String xAxisField = (String) searchCriteria.getParamValue("xAxis");
-    String stackField = (String) searchCriteria.getParamValue("stackBy");
-    String from = (String) searchCriteria.getParamValue("from");
-    String to = (String) searchCriteria.getParamValue("to");
-    String xType = (String) searchCriteria.getParamValue("type");
-    if (xType != null) {
-      // Y axis credentials
-      String yAxisField = (String) searchCriteria.getParamValue("yAxis");
-      if (StringUtils.isBlank(xAxisField) || StringUtils.isBlank(yAxisField)) {
-        graphType = GraphType.UNKNOWN;
-      } else if (StringUtils.isBlank(stackField) && !StringUtils.isBlank(to) && !StringUtils.isBlank(from)
-          && !(xType.contains("date") || xType.contains("time"))) {
-        graphType = GraphType.NORMAL_GRAPH;
-      } else if (StringUtils.isBlank(stackField) && !StringUtils.isBlank(to) && !StringUtils.isBlank(from)
-          && (xType.contains("date") || xType.contains("time"))) {
-        graphType = GraphType.RANGE_NON_STACK_GRAPH;
-      } else if (!StringUtils.isBlank(stackField) && !StringUtils.isBlank(to) && !StringUtils.isBlank(from)
-          && !(xType.contains("date") || xType.contains("time"))) {
-        graphType = GraphType.NON_RANGE_STACK_GRAPH;
-      } else if (!StringUtils.isBlank(stackField) && !StringUtils.isBlank(to) && !StringUtils.isBlank(from)
-          && (xType.contains("date") || xType.contains("time"))) {
-        graphType = GraphType.RANGE_STACK_GRAPH;
+  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);
+    barGraphData.setName(field);
+    barGraphData.setDataCount(nameValues);
+    response.setGraphData(Lists.newArrayList(barGraphData));
+    return response;
+  }
+
+  public NameValueDataListResponse getNameValueDataListResponseWithDefaults(QueryResponse response, String[] defaults) {
+    NameValueDataListResponse result = new NameValueDataListResponse();
+    result.setvNameValues(generateLevelCountData(response, defaults));
+    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);
       }
     }
-    return graphType;
+    response.setvNodeList(datatList);
+    return response;
   }
 
-  @SuppressWarnings("unchecked")
-  private BarGraphDataListResponse normalGraph(String xAxisField, String yAxisField, String from, String to, SolrDaoBase solrDaoBase,
-      String typeXAxis, String fieldTime, SolrQuery solrQuery) {
-    BarGraphDataListResponse dataList = new BarGraphDataListResponse();
-    Collection<BarGraphData> vBarGraphDatas = new ArrayList<BarGraphData>();
-    BarGraphData vBarGraphData = new BarGraphData();
-    Collection<NameValueData> vNameValues = new ArrayList<NameValueData>();
-    SolrUtil.setMainQuery(solrQuery, null);
-    queryGenerator.setSingleIncludeFilter(solrQuery, fieldTime, "[" + from + " TO " + to + "]");
-    if (typeXAxis.contains("string") || typeXAxis.contains("key_lower_case") || typeXAxis.contains("text")) {
-      SolrUtil.setFacetField(solrQuery, xAxisField);
-      try {
-        QueryResponse response = solrDaoBase.process(solrQuery);
-        if (response != null && response.getResults() != null) {
-          long count = response.getResults().getNumFound();
-          if (count > 0) {
-            FacetField facetField = response.getFacetField(xAxisField);
-            if (facetField != null) {
-              List<Count> countValues = facetField.getValues();
-              if (countValues != null) {
-                for (Count countValue : countValues) {
-                  if (countValue != null) {
-                    NameValueData vNameValue = new NameValueData();
-                    vNameValue.setName(countValue.getName());
-                    vNameValue.setValue("" + countValue.getCount());
-                    vNameValues.add(vNameValue);
-                  }
-                }
+  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.isBlank(name)) {
+            hostNode.setName(name);
+          }
+          if (!StringUtils.isBlank(value)) {
+            hostNode.setValue(value);
+          }
+          if (!StringUtils.isBlank(firstPriority)) {
+            hostNode.setType(firstPriority);
+          }
+
+          hostNode.setParent(true);
+          hostNode.setRoot(true);
+          PivotField hostPivot = null;
+          for (PivotField searchHost : secondHirarchicalPivotFields) {
+            if (!StringUtils.isBlank(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);
               }
-              vBarGraphData.setName(xAxisField);
-              vBarGraphDatas.add(vBarGraphData);
-              dataList.setGraphData(vBarGraphDatas);
             }
+            hostNode.setLogLevelCount(logLevelCount);
           }
-        }
-        if (xAxisField.equalsIgnoreCase(LogSearchConstants.SOLR_LEVEL)) {
-          Collection<NameValueData> sortedVNameValues = new ArrayList<NameValueData>();
-          for (String level : LogSearchConstants.SUPPORTED_LOG_LEVEL) {
-            NameValueData value = new NameValueData();
-            value.setName(level);
-            String val = "0";
-            for (NameValueData valueLevel : vNameValues) {
-              if (valueLevel.getName().equalsIgnoreCase(level)) {
-                val = valueLevel.getValue();
-                break;
+          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.isBlank(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);
               }
             }
-            value.setValue(val);
-            sortedVNameValues.add(value);
+            hostNode.setChilds(componentNodes);
           }
-          vBarGraphData.setDataCount(sortedVNameValues);
-        } else {
-          vBarGraphData.setDataCount(vNameValues);
-        }
-        return dataList;
-      } catch (SolrException | SolrServerException | IOException e) {
-        String query = solrQuery != null ? solrQuery.toQueryString() : "";
-        logger.error("Got exception for solr query :" + query, e.getCause());
-      }
-    } else {
-      SolrUtil.setRowCount(solrQuery, 0);
-      String yAxis = yAxisField.contains("count") ? "sum" : yAxisField;
-      String jsonQuery = queryGenerator.buildJSONFacetAggregatedFuncitonQuery(yAxis, xAxisField);
-      SolrUtil.setJSONFacet(solrQuery, jsonQuery);
-      try {
-        QueryResponse response = solrDaoBase.process(solrQuery);
-        SimpleOrderedMap<Object> jsonFacetResponse = (SimpleOrderedMap<Object>) response.getResponse().get("facets");
-        if (jsonFacetResponse.toString().equals("{count=0}")) {
-          return dataList;
+          extensionTree.add(hostNode);
         }
-        NameValueData value = new NameValueData();
-        String sum = (String) jsonFacetResponse.getVal(1);
-        value.setName(xAxisField);
-        value.setValue(sum != null ? sum.substring(0, sum.indexOf(".")) : "");
-        vNameValues.add(value);
-        vBarGraphData.setDataCount(vNameValues);
-        vBarGraphData.setName(xAxisField);
-        vBarGraphDatas.add(vBarGraphData);
-        dataList.setGraphData(vBarGraphDatas);
-        return dataList;
-      } catch (SolrException | SolrServerException | IOException e) {
-        String query = solrQuery != null ? solrQuery.toQueryString() : "";
-        logger.error("Got exception for solr query :" + query, e.getCause());
       }
     }
-    return null;
+
+    return extensionTree;
   }
 
-  @SuppressWarnings("unchecked")
-  private BarGraphDataListResponse nonRangeStackGraph(String xAxisField, String yAxisField, String stackField, String from, String to,
-      SolrDaoBase solrDaoBase, String typeXAxis, String fieldTime, SolrQuery solrQuery) {
-    BarGraphDataListResponse dataList = new BarGraphDataListResponse();
-    Collection<BarGraphData> vGraphData = new ArrayList<BarGraphData>();
-    String mainQuery = queryGenerator.buildInclusiveRangeFilterQuery(fieldTime, from, to);
-    SolrUtil.setMainQuery(solrQuery, mainQuery);
-    SolrUtil.setFacetSort(solrQuery, LogSearchConstants.FACET_INDEX);
-    String jsonQuery = "";
-    if (SolrUtil.isSolrFieldNumber(typeXAxis,solrDaoBase)) {
-      String function = (yAxisField.contains("count")) ? "sum" : yAxisField;
-      jsonQuery = queryGenerator.buidlJSONFacetRangeQueryForNumber(stackField, xAxisField, function);
-    } else {
-      jsonQuery = queryGenerator.buildJsonFacetTermsRangeQuery(stackField, xAxisField);
-    }
-    try {
-      SolrUtil.setJSONFacet(solrQuery, jsonQuery);
-      dataList.setGraphData(vGraphData);
-      QueryResponse response = solrDaoBase.process(solrQuery);
-      if (response == null) {
-        response = new QueryResponse();
-      }
-      Long count = response.getResults().getNumFound();
-      if (count <= 0) {
-        return dataList;
-      }
-      SimpleOrderedMap<Object> jsonFacetResponse = (SimpleOrderedMap<Object>) response.getResponse().get("facets");
-      if (jsonFacetResponse == null || jsonFacetResponse.toString().equals("{count=0}")) {
-        return dataList;
-      }
-      extractNonRangeStackValuesFromBucket(jsonFacetResponse, stackField, vGraphData, typeXAxis);
-      if (LogSearchConstants.SOLR_LEVEL.equalsIgnoreCase(stackField) && LogSearchConstants.SOLR_LEVEL.equalsIgnoreCase(xAxisField)) {
-        Collection<BarGraphData> levelVGraphData = dataList.getGraphData();
-        for (BarGraphData graphData : levelVGraphData) {
-          Collection<NameValueData> valueList = graphData.getDataCount();
-          Collection<NameValueData> valueListSorted = new ArrayList<NameValueData>();
-          for (String level : LogSearchConstants.SUPPORTED_LOG_LEVEL) {
-            String val = "0";
-            for (NameValueData value : valueList) {
-              if (value.getName().equalsIgnoreCase(level)) {
-                val = value.getValue();
-                break;
-              }
-            }
-            NameValueData v1 = new NameValueData();
-            v1.setName(level.toUpperCase());
-            v1.setValue(val);
-            valueListSorted.add(v1);
-          }
-          graphData.setDataCount(valueListSorted);
-        }
+  private List<NameValueData> generateLevelCountData(QueryResponse queryResponse, String[] defaults) {
+    List<NameValueData> nameValues = Lists.newLinkedList();
+    Map<String, NameValueData> linkedMap = Maps.newLinkedHashMap();
+    List<Count> counts = generateCount(queryResponse);
+    if (!CollectionUtils.isNotEmpty(counts)) {
+      return nameValues;
+    }
+    for (String defaultValue : defaults) {
+      NameValueData nameValue = new NameValueData();
+      nameValue.setName(defaultValue);
+      nameValue.setValue("0");
+      linkedMap.put(defaultValue, nameValue);
+    }
+    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);
       }
-      return dataList;
-    } catch (SolrException | IOException | SolrServerException e) {
-      String query = solrQuery != null ? solrQuery.toQueryString() : "";
-      logger.error("Got exception for solr query :" + query, e.getCause());
-      throw RESTErrorUtil.createRESTException(MessageEnums.DATA_NOT_FOUND.getMessage().getMessage(), MessageEnums.DATA_NOT_FOUND);
     }
+
+    for (Map.Entry<String, NameValueData> nameValueDataEntry : linkedMap.entrySet()) {
+      nameValues.add(nameValueDataEntry.getValue());
+    }
+    return nameValues;
   }
 
-  @SuppressWarnings("unchecked")
-  private BarGraphDataListResponse rangeNonStackGraph(String xAxisField, String yAxisField, String from, String to, String unit,
-      SolrDaoBase solrDaoBase, String typeXAxis, String fieldTime, SolrQuery solrQuery) {
-    BarGraphDataListResponse dataList = new BarGraphDataListResponse();
-    Collection<BarGraphData> vBarGraphDatas = new ArrayList<BarGraphData>();
-    BarGraphData vBarGraphData = new BarGraphData();
-    Collection<NameValueData> vNameValues = new ArrayList<NameValueData>();
-    SolrUtil.setMainQuery(solrQuery, null);
-    if (SolrUtil.isSolrFieldNumber(typeXAxis,solrDaoBase)) {
-      queryGenerator.setSingleRangeFilter(solrQuery, fieldTime, from, to);
-      return normalGraph(xAxisField, yAxisField, from, to, solrDaoBase, typeXAxis, fieldTime, solrQuery);
-    } else {
-      try {
-        SolrUtil.setFacetRange(solrQuery, xAxisField, from, to, unit);
-        QueryResponse response = solrDaoBase.process(solrQuery);
-        if (response != null) {
-          Long count = response.getResults().getNumFound();
-          if (count > 0) {
-            @SuppressWarnings("rawtypes")
-            List<RangeFacet> rangeFacet = response.getFacetRanges();
-            if (rangeFacet != null && rangeFacet.size() > 0) {
-              List<RangeFacet.Count> listCount = rangeFacet.get(0).getCounts();
-              if (listCount != null) {
-                for (RangeFacet.Count cnt : listCount) {
-                  NameValueData vNameValue = new NameValueData();
-                  vNameValue.setName(cnt.getValue());
-                  vNameValue.setValue("" + cnt.getCount());
-                  vNameValues.add(vNameValue);
-                }
-                vBarGraphData.setDataCount(vNameValues);
-                vBarGraphDatas.add(vBarGraphData);
-                vBarGraphData.setName(xAxisField);
-                dataList.setGraphData(vBarGraphDatas);
-              }
-            }
-          }
-        }
-        return dataList;
-      } catch (SolrException | SolrServerException | IOException e) {
-        logger.error("Got exception for solr query :" + solrQuery, e.getCause());
+  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);
       }
     }
-    return null;
+    collection.setvCounts(vCounts);
+    return collection;
   }
 
-  @SuppressWarnings("unchecked")
-  private BarGraphDataListResponse rangeStackGraph(String xAxisField, String stackField, String from, String to, String unit,
-      SolrDaoBase solrDaoBase, SolrQuery solrQuery) {
-    BarGraphDataListResponse dataList = new BarGraphDataListResponse();
-    List<BarGraphData> histogramData = new ArrayList<BarGraphData>();
-    SolrUtil.setMainQuery(solrQuery, null);
-    SolrUtil.setFacetSort(solrQuery, LogSearchConstants.FACET_INDEX);
-    String jsonHistogramQuery =
-        queryGenerator.buildJSONFacetTermTimeRangeQuery(stackField, xAxisField, from, to, unit).replace("\\", "");
-    try {
-      solrQuery.set("json.facet", jsonHistogramQuery);
-      SolrUtil.setRowCount(solrQuery, 0);
-      QueryResponse response = solrDaoBase.process(solrQuery);
-      if (response != null) {
-        SimpleOrderedMap<Object> jsonFacetResponse = (SimpleOrderedMap<Object>) response.getResponse().get("facets");
-        if (jsonFacetResponse == null || jsonFacetResponse.toString().equals("{count=0}")) {
-          return dataList;
+  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);
         }
-        extractRangeStackValuesFromBucket(jsonFacetResponse, "x", "y", histogramData);
-        dataList.setGraphData(histogramData);
       }
-      return dataList;
-    } catch (SolrException | IOException | SolrServerException e) {
-      logger.error("Got exception for solr query :" + solrQuery, e.getCause());
     }
-    return null;
+    return logList;
   }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/graph/GraphDataGeneratorBase.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/graph/GraphDataGeneratorBase.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/graph/GraphDataGeneratorBase.java
deleted file mode 100644
index c57e0e9..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/graph/GraphDataGeneratorBase.java
+++ /dev/null
@@ -1,169 +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.Date;
-import java.util.List;
-
-import org.apache.ambari.logsearch.manager.ManagerBase;
-import org.apache.ambari.logsearch.model.response.BarGraphData;
-import org.apache.ambari.logsearch.model.response.NameValueData;
-import org.apache.ambari.logsearch.util.DateUtil;
-import org.apache.commons.lang.StringUtils;
-import org.apache.solr.common.util.NamedList;
-import org.apache.solr.common.util.SimpleOrderedMap;
-
-class GraphDataGeneratorBase {
-
-  private static final String BUCKETS = "buckets";
-  
-  private static enum DataType {
-    LONG("long"),
-    DOUBLE("double"),
-    FLOAT("long"),
-    INT("long");
-    
-    private String type;
-    
-    DataType(String type) {
-      this.type = type;
-    }
-    
-    String getType() {
-      return type;
-    }
-  }
-
-  protected static enum GraphType {
-    UNKNOWN,
-    NORMAL_GRAPH,
-    RANGE_NON_STACK_GRAPH,
-    NON_RANGE_STACK_GRAPH,
-    RANGE_STACK_GRAPH;
-  }
-
-  @SuppressWarnings("unchecked")
-  protected void extractRangeStackValuesFromBucket(SimpleOrderedMap<Object> jsonFacetResponse, String outerField,
-      String innerField, List<BarGraphData> histogramData) {
-    if (jsonFacetResponse != null) {
-      NamedList<Object> stack = (NamedList<Object>) jsonFacetResponse.get(outerField);
-      if (stack != null) {
-        ArrayList<Object> stackBuckets = (ArrayList<Object>) stack.get(BUCKETS);
-        if (stackBuckets != null) {
-          for (Object stackBucket : stackBuckets) {
-            BarGraphData vBarGraphData = new BarGraphData();
-            SimpleOrderedMap<Object> level = (SimpleOrderedMap<Object>) stackBucket;
-            if (level != null) {
-              String name = level.getVal(0) != null ? level.getVal(0).toString().toUpperCase() : "";
-              vBarGraphData.setName(name);
-              Collection<NameValueData> vNameValues = new ArrayList<NameValueData>();
-              NamedList<Object> innerFiledValue = (NamedList<Object>) level.get(innerField);
-              if (innerFiledValue != null) {
-                ArrayList<Object> levelBuckets = (ArrayList<Object>) innerFiledValue.get(BUCKETS);
-                if (levelBuckets != null) {
-                  for (Object levelBucket : levelBuckets) {
-                    SimpleOrderedMap<Object> countValue = (SimpleOrderedMap<Object>) levelBucket;
-                    if (countValue != null) {
-                      String innerName = DateUtil.convertDateWithMillisecondsToSolrDate((Date) countValue.getVal(0));
-                      String innerValue = countValue.getVal(1) != null ? countValue.getVal(1).toString() : "";
-                      NameValueData vNameValue = new NameValueData();
-                      vNameValue.setName(innerName);
-                      vNameValue.setValue(innerValue);
-                      vNameValues.add(vNameValue);
-                    }
-                  }
-                }
-              }
-              vBarGraphData.setDataCount(vNameValues);
-            }
-            histogramData.add(vBarGraphData);
-          }
-        }
-      }
-    }
-  }
-
-  @SuppressWarnings("unchecked")
-  protected boolean extractNonRangeStackValuesFromBucket(SimpleOrderedMap<Object> jsonFacetResponse, String level,
-      Collection<BarGraphData> vGraphDatas, String typeXAxis) {
-    boolean zeroFlag = true;
-    if (jsonFacetResponse == null || jsonFacetResponse.get(level) == null
-        || jsonFacetResponse.get(level).toString().equals("{count=0}")) {
-      return false;
-    }
-    NamedList<Object> levelList = (NamedList<Object>) jsonFacetResponse.get(level);
-    if (levelList != null) {
-      ArrayList<Object> bucketList = (ArrayList<Object>) levelList.get(BUCKETS);
-      if (bucketList != null) {
-        for (int index = 0; index < bucketList.size(); index++) {
-          SimpleOrderedMap<Object> valueCount = (SimpleOrderedMap<Object>) bucketList.get(index);
-          if (valueCount != null && valueCount.size() > 2) {
-            BarGraphData vGraphData = new BarGraphData();
-            Collection<NameValueData> levelCounts = new ArrayList<NameValueData>();
-            String name = valueCount.getVal(0) != null ? valueCount.getVal(0).toString().trim() : "";
-            if (isTypeNumber(typeXAxis)) {
-              NameValueData nameValue = new NameValueData();
-              Double sumValue = (Double) valueCount.getVal(2);
-              String value = "0";// default is zero
-              if (sumValue != null) {
-                value = "" + sumValue.longValue();
-              }
-              nameValue.setName(name);
-              nameValue.setValue(value);
-              levelCounts.add(nameValue);
-            } else {
-              SimpleOrderedMap<Object> valueCountMap = (SimpleOrderedMap<Object>) valueCount.getVal(2);
-              if (valueCountMap != null) {
-                ArrayList<Object> buckets = (ArrayList<Object>) valueCountMap.get(BUCKETS);
-                if (buckets != null) {
-                  for (int innerIndex = 0; innerIndex < buckets.size(); innerIndex++) {
-                    SimpleOrderedMap<Object> innerValueCount = (SimpleOrderedMap<Object>) buckets.get(innerIndex);
-                    if (innerValueCount != null) {
-                      String innerName = innerValueCount.getVal(0) != null ? innerValueCount.getVal(0).toString().trim() : "";
-                      String innerValue = innerValueCount.getVal(1) != null ? innerValueCount.getVal(1).toString().trim() : "";
-                      NameValueData nameValue = new NameValueData();
-                      nameValue.setValue(innerValue);
-                      nameValue.setName(innerName);
-                      levelCounts.add(nameValue);
-                    }
-                  }
-                }
-              }
-            }
-            vGraphData.setName(name);
-            vGraphData.setDataCount(levelCounts);
-            vGraphDatas.add(vGraphData);
-          }
-        }
-      }
-    }
-    return zeroFlag;
-  }
-
-  protected boolean isTypeNumber(String typeXAxis) {
-    if (StringUtils.isBlank(typeXAxis)) {
-      return false;
-    } else {
-      return typeXAxis.contains(DataType.LONG.getType()) || typeXAxis.contains(DataType.INT.getType())
-          || typeXAxis.contains(DataType.FLOAT.getType()) || typeXAxis.contains(DataType.DOUBLE.getType());
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/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 52482c2..aded1d4 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
@@ -20,398 +20,148 @@
 package org.apache.ambari.logsearch.manager;
 
 import javax.inject.Inject;
+import javax.inject.Named;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
 
 import java.io.File;
 import java.io.FileOutputStream;
 import java.io.IOException;
-import java.text.ParseException;
+import java.io.StringWriter;
 import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Date;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
-import org.apache.ambari.logsearch.common.LogSearchConstants;
-import org.apache.ambari.logsearch.common.ManageStartEndTime;
+import freemarker.template.Configuration;
+import freemarker.template.Template;
+import freemarker.template.TemplateException;
 import org.apache.ambari.logsearch.common.MessageEnums;
-import org.apache.ambari.logsearch.conf.SolrAuditLogPropsConfig;
 import org.apache.ambari.logsearch.dao.AuditSolrDao;
 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;
+import org.apache.ambari.logsearch.model.request.impl.AuditServiceLoadRequest;
+import org.apache.ambari.logsearch.model.request.impl.FieldAuditLogRequest;
+import org.apache.ambari.logsearch.model.request.impl.UserExportRequest;
 import org.apache.ambari.logsearch.model.response.AuditLogResponse;
-import org.apache.ambari.logsearch.model.response.BarGraphData;
 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.model.response.LogSearchResponse;
-import org.apache.ambari.logsearch.model.response.NameValueData;
-import org.apache.ambari.logsearch.model.response.NameValueDataListResponse;
-import org.apache.ambari.logsearch.query.model.AnyGraphSearchCriteria;
-import org.apache.ambari.logsearch.query.model.AuditBarGraphSearchCriteria;
-import org.apache.ambari.logsearch.query.model.CommonSearchCriteria;
-import org.apache.ambari.logsearch.query.model.FieldAuditBarGraphSearchCriteria;
-import org.apache.ambari.logsearch.query.model.FieldAuditLogSearchCriteria;
-import org.apache.ambari.logsearch.query.model.UserExportSearchCriteria;
+import org.apache.ambari.logsearch.solr.SolrConstants;
 import org.apache.ambari.logsearch.solr.model.SolrAuditLogData;
 import org.apache.ambari.logsearch.solr.model.SolrComponentTypeLogData;
-import org.apache.ambari.logsearch.util.BizUtil;
-import org.apache.ambari.logsearch.util.DateUtil;
+import org.apache.ambari.logsearch.util.DownloadUtil;
 import org.apache.ambari.logsearch.util.RESTErrorUtil;
-import org.apache.ambari.logsearch.util.SolrUtil;
-import org.apache.ambari.logsearch.view.VResponse;
-import org.apache.ambari.logsearch.query.model.AuditLogSearchCriteria;
+import org.apache.ambari.logsearch.common.VResponse;
 import org.apache.log4j.Logger;
 import org.apache.solr.client.solrj.SolrQuery;
-import org.apache.solr.client.solrj.SolrServerException;
-import org.apache.solr.client.solrj.response.FacetField;
 import org.apache.solr.client.solrj.response.FacetField.Count;
 import org.apache.solr.client.solrj.response.QueryResponse;
-import org.apache.solr.client.solrj.response.RangeFacet;
-import org.apache.solr.common.SolrException;
-import org.apache.solr.common.util.NamedList;
-import org.apache.solr.common.util.SimpleOrderedMap;
-import org.springframework.stereotype.Component;
+import org.springframework.core.convert.ConversionService;
+import org.springframework.data.solr.core.query.SimpleFacetQuery;
+import org.springframework.data.solr.core.query.SimpleQuery;
 
-@Component
+import static org.apache.ambari.logsearch.solr.SolrConstants.AuditLogConstants.AUDIT_COMPONENT;
+
+@Named
 public class AuditLogsManager extends ManagerBase<SolrAuditLogData, AuditLogResponse> {
   private static final Logger logger = Logger.getLogger(AuditLogsManager.class);
 
+  private static final String AUDIT_LOG_TEMPLATE = "audit_log_txt.ftl";
+
   @Inject
   private AuditSolrDao auditSolrDao;
   @Inject
   private GraphDataGenerator graphDataGenerator;
   @Inject
-  private SolrAuditLogPropsConfig solrAuditLogPropsConfig;
+  private ConversionService conversionService;
+  @Inject
+  private Configuration freemarkerConfiguration;
 
-  public AuditLogResponse getLogs(AuditLogSearchCriteria searchCriteria) {
-    Boolean isLastPage = searchCriteria.isLastPage();
-    if (isLastPage) {
-      SolrQuery lastPageQuery = queryGenerator.commonAuditFilterQuery(searchCriteria);
-      LogSearchResponse logResponse = getLastPage(searchCriteria, LogSearchConstants.AUDIT_EVTTIME, auditSolrDao, lastPageQuery);
-      if (logResponse == null) {
-        logResponse = new AuditLogResponse();
-      }
-      return (AuditLogResponse) logResponse;
-    }
-    SolrQuery solrQuery = queryGenerator.commonAuditFilterQuery(searchCriteria);
-    return getLogAsPaginationProvided(solrQuery, auditSolrDao);
+  public AuditLogResponse getLogs(AuditLogRequest auditLogRequest) {
+    return getLogAsPaginationProvided(conversionService.convert(auditLogRequest, SimpleQuery.class), auditSolrDao, "/audit/logs");
   }
 
-  private List<LogData> getComponents(CommonSearchCriteria searchCriteria) {
-    SolrQuery solrQuery = queryGenerator.commonAuditFilterQuery(searchCriteria);
+  private List<LogData> getComponents(AuditComponentRequest request) {
+    SimpleFacetQuery facetQuery = conversionService.convert(request, SimpleFacetQuery.class);
     List<LogData> docList = new ArrayList<>();
-    try {
-      SolrUtil.setFacetField(solrQuery, LogSearchConstants.AUDIT_COMPONENT);
-      SolrUtil.setFacetSort(solrQuery, LogSearchConstants.FACET_INDEX);
-      List<FacetField> facetFields = null;
-      List<Count> componentsCount = new ArrayList<Count>();
-      FacetField facetField = null;
+    QueryResponse queryResponse = auditSolrDao.process(facetQuery);
+    List<Count> componentsCount = graphDataGenerator.generateCount(queryResponse);
 
-      QueryResponse queryResponse = auditSolrDao.process(solrQuery);
-      if (queryResponse == null) {
-        return docList;
-      }
-
-      facetFields = queryResponse.getFacetFields();
-      if (facetFields == null) {
-        return docList;
-      }
-      if (!facetFields.isEmpty()) {
-        facetField = facetFields.get(0);
-      }
-      if (facetField != null) {
-        componentsCount = facetField.getValues();
-      }
-
-      for (Count component : componentsCount) {
-        SolrComponentTypeLogData logData = new SolrComponentTypeLogData();
-        logData.setType(component.getName());
-        docList.add(logData);
-      }
-      return docList;
-    } catch (SolrException | SolrServerException | IOException e) {
-      logger.error("Error during solrQuery=" + solrQuery, e);
-      throw RESTErrorUtil.createRESTException(MessageEnums.SOLR_ERROR.getMessage().getMessage(), MessageEnums.ERROR_SYSTEM);
+    for (Count component : componentsCount) {
+      SolrComponentTypeLogData logData = new SolrComponentTypeLogData();
+      logData.setType(component.getName());
+      docList.add(logData);
     }
+    return docList;
   }
 
-  public GroupListResponse getAuditComponents(CommonSearchCriteria searchCriteria) {
+  public GroupListResponse getAuditComponents(AuditComponentRequest request) {
     GroupListResponse componentResponse = new GroupListResponse();
-    List<LogData> docList = getComponents(searchCriteria);
+    List<LogData> docList = getComponents(request);
     componentResponse.setGroupList(docList);
     return componentResponse;
   }
 
-  @SuppressWarnings("unchecked")
-  public BarGraphDataListResponse getAuditBarGraphData(AuditBarGraphSearchCriteria searchCriteria) {
-    BarGraphDataListResponse dataList = new BarGraphDataListResponse();
-    SolrQuery solrQuery = queryGenerator.commonAuditFilterQuery(searchCriteria);
-
-    String from = getFrom(searchCriteria.getStartTime());
-    String to = getTo(searchCriteria.getEndTime());
-    String unit = getUnit(searchCriteria.getUnit());
-
-    List<BarGraphData> histogramData = new ArrayList<BarGraphData>();
-    String jsonHistogramQuery = queryGenerator.buildJSONFacetTermTimeRangeQuery(LogSearchConstants.AUDIT_COMPONENT,
-      LogSearchConstants.AUDIT_EVTTIME, from, to, unit).replace("\\", "");
-
-    return getGraphResponse(dataList, solrQuery, histogramData, jsonHistogramQuery);
-  }
-
-  @SuppressWarnings({"unchecked", "rawtypes"})
-  public NameValueDataListResponse getLiveLogCounts() {
-    NameValueDataListResponse nameValueList = new NameValueDataListResponse();
-    SolrQuery solrQuery = new SolrQuery();
-    solrQuery.setParam("event", "/audit/logs/live/count");
-    try {
-      Date[] timeRange = ManageStartEndTime.getStartEndTime();
-      String startDate = DateUtil.convertGivenDateFormatToSolrDateFormat(timeRange[0]);
-      String endDate = DateUtil.convertGivenDateFormatToSolrDateFormat(timeRange[1]);
-
-      SolrUtil.setMainQuery(solrQuery, null);
-      SolrUtil.setFacetRange(solrQuery, LogSearchConstants.AUDIT_EVTTIME, startDate, endDate, "+2MINUTE");
-      List<RangeFacet.Count> listCount;
-
-      QueryResponse response = auditSolrDao.process(solrQuery);
-
-      List<RangeFacet> rangeFacet = response.getFacetRanges();
-      if (rangeFacet == null) {
-        return nameValueList;
-      }
-      RangeFacet range = rangeFacet.get(0);
-
-      if (range == null) {
-        return nameValueList;
-      }
-
-      listCount = range.getCounts();
-
-      List<NameValueData> nameValues = new ArrayList<>();
-      int count = 0;
-      for (RangeFacet.Count cnt : listCount) {
-        NameValueData nameValue = new NameValueData();
-        nameValue.setName("" + count);
-        nameValue.setValue("" + cnt.getCount());
-        nameValues.add(nameValue);
-        count++;
-      }
-      nameValueList.setvNameValues(nameValues);
-      return nameValueList;
-
-    } catch (SolrException | SolrServerException | ParseException
-      | IOException e) {
-      logger.error("Error during solrQuery=" + solrQuery, e);
-      throw RESTErrorUtil.createRESTException(MessageEnums.SOLR_ERROR.getMessage().getMessage(), MessageEnums.ERROR_SYSTEM);
-    }
-  }
-
-  public BarGraphDataListResponse topTenUsers(FieldAuditBarGraphSearchCriteria searchCriteria) {
-
-    String jsonUserQuery =
-      "{Users:{type:terms, field:reqUser, facet:{ Repo:{ type:terms, field:repo, facet:{eventCount:\"sum(event_count)\"}}}}}";
-    SolrQuery solrQuery = queryGenerator.commonAuditFilterQuery(searchCriteria);
-    SolrUtil.setJSONFacet(solrQuery, jsonUserQuery);
-    SolrUtil.setRowCount(solrQuery, 0);
-    try {
-      BarGraphDataListResponse barGraphDataListResponse = new BarGraphDataListResponse();
-      QueryResponse queryResponse = auditSolrDao.process(solrQuery);
-      if (queryResponse == null) {
-        return barGraphDataListResponse;
-      }
-
-      NamedList<Object> namedList = queryResponse.getResponse();
-
-      if (namedList == null) {
-        return barGraphDataListResponse;
-      }
-
-      @SuppressWarnings("unchecked")
-      SimpleOrderedMap<Object> jsonFacetResponse = (SimpleOrderedMap<Object>) namedList.get("facets");
-      if (jsonFacetResponse == null) {
-        return barGraphDataListResponse;
-      }
-      if (jsonFacetResponse.toString().equals("{count=0}")) {
-        return barGraphDataListResponse;
-      }
-      barGraphDataListResponse = BizUtil.buildSummaryForTopCounts(jsonFacetResponse, "Repo", "Users");
-      return barGraphDataListResponse;
-
-    } catch (SolrServerException | SolrException | IOException e) {
-      logger.error("Error during solrQuery=" + e);
-      throw RESTErrorUtil.createRESTException(MessageEnums.SOLR_ERROR.getMessage().getMessage(), MessageEnums.ERROR_SYSTEM);
-    }
-  }
-
-  public BarGraphDataListResponse topTenResources(FieldAuditLogSearchCriteria searchCriteria) {
-
-    String jsonUserQuery =
-      "{Users:{type:terms,field:resource,facet:{Repo:{type:terms,field:repo,facet:{eventCount:\"sum(event_count)\"}}}}}";
-    SolrQuery solrQuery = queryGenerator.commonAuditFilterQuery(searchCriteria);
-    SolrUtil.setJSONFacet(solrQuery, jsonUserQuery);
-    SolrUtil.setRowCount(solrQuery, 0);
-    try {
-      BarGraphDataListResponse barGraphDataListResponse = new BarGraphDataListResponse();
-      QueryResponse queryResponse = auditSolrDao.process(solrQuery);
-      if (queryResponse == null) {
-        return barGraphDataListResponse;
-      }
-
-      NamedList<Object> namedList = queryResponse.getResponse();
-      if (namedList == null) {
-        return barGraphDataListResponse;
-      }
-
-      @SuppressWarnings("unchecked")
-      SimpleOrderedMap<Object> jsonFacetResponse = (SimpleOrderedMap<Object>) namedList.get("facets");
-
-      barGraphDataListResponse = BizUtil.buildSummaryForTopCounts(jsonFacetResponse, "Repo", "Users");
-      return barGraphDataListResponse;
-
-    } catch (SolrServerException | SolrException | IOException e) {
-      logger.error("Error during solrQuery=" + solrQuery, e);
-      throw RESTErrorUtil.createRESTException(MessageEnums.SOLR_ERROR.getMessage().getMessage(), MessageEnums.ERROR_SYSTEM);
-    }
+  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);
   }
 
-  @SuppressWarnings("unchecked")
-  public BarGraphDataListResponse getRequestUserLineGraph(FieldAuditBarGraphSearchCriteria searchCriteria) {
-
-    String from = getFrom(searchCriteria.getStartTime());
-    String to = getTo(searchCriteria.getEndTime());
-    String unit = getUnit(searchCriteria.getUnit());
-
-    SolrQuery solrQuery = queryGenerator.commonAuditFilterQuery(searchCriteria);
-
-    BarGraphDataListResponse dataList = new BarGraphDataListResponse();
-    List<BarGraphData> histogramData = new ArrayList<BarGraphData>();
-
-    SolrUtil.setFacetSort(solrQuery, LogSearchConstants.FACET_INDEX);
-
-    String jsonHistogramQuery = queryGenerator.buildJSONFacetTermTimeRangeQuery(LogSearchConstants.AUDIT_REQUEST_USER,
-      LogSearchConstants.AUDIT_EVTTIME, from, to, unit).replace("\\", "");
-
-    return getGraphResponse(dataList, solrQuery, histogramData, jsonHistogramQuery);
+  public BarGraphDataListResponse topResources(FieldAuditLogRequest request) {
+    SimpleFacetQuery facetQuery = conversionService.convert(request, SimpleFacetQuery.class);
+    QueryResponse queryResponse = auditSolrDao.process(facetQuery);
+    return graphDataGenerator.generateSecondLevelBarGraphDataResponse(queryResponse, 0);
   }
 
   public String getAuditLogsSchemaFieldsName() {
-    return convertObjToString(auditSolrDao.schemaFieldNameMap);
+    return convertObjToString(auditSolrDao.getSolrSchemaFieldDao().getSchemaFieldNameMap());
   }
 
-  public BarGraphDataListResponse getAnyGraphData(AnyGraphSearchCriteria searchCriteria) {
-    searchCriteria.addParam("fieldTime", LogSearchConstants.AUDIT_EVTTIME);
-    SolrQuery solrQuery = queryGenerator.commonAuditFilterQuery(searchCriteria);
-    BarGraphDataListResponse result = graphDataGenerator.getAnyGraphData(searchCriteria, auditSolrDao, solrQuery);
-    if (result == null) {
-      result = new BarGraphDataListResponse();
-    }
-    return result;
-
+  public BarGraphDataListResponse getServiceLoad(AuditServiceLoadRequest request) {
+    SimpleFacetQuery facetQuery = conversionService.convert(request, SimpleFacetQuery.class);
+    QueryResponse response = auditSolrDao.process(facetQuery);
+    return graphDataGenerator.generateBarGraphFromFieldFacet(response, AUDIT_COMPONENT);
   }
 
-  @SuppressWarnings({"unchecked"})
-  public Response exportUserTableToTextFile(UserExportSearchCriteria searchCriteria) {
-    String jsonUserQuery =
-      "{ Users: { type: terms, field: reqUser, facet:  {Repo: {  type: terms, field: repo, facet: {  eventCount: \"sum(event_count)\"}}}},x:{ type: terms,field: resource, facet: {y: {  type: terms, field: repo,facet: {  eventCount: \"sum(event_count)\"}}}}}";
-
-    SolrQuery solrQuery = queryGenerator.commonAuditFilterQuery(searchCriteria);
-    String startTime = searchCriteria.getStartTime();
-    String endTime = searchCriteria.getEndTime();
+  public Response export(UserExportRequest request) throws TemplateException {
+    String startTime = request.getFrom();
+    String endTime = request.getTo();
+    SimpleFacetQuery facetQuery = conversionService.convert(request, SimpleFacetQuery.class);
 
     startTime = startTime == null ? "" : startTime;
     endTime = endTime == null ? "" : "_" + endTime;
 
-    SolrUtil.setJSONFacet(solrQuery, jsonUserQuery);
-    SolrUtil.setRowCount(solrQuery, 0);
-
-    String dataFormat = searchCriteria.getFormat();
+    String dataFormat = request.getFormat();
 
     FileOutputStream fis = null;
     try {
-      QueryResponse queryResponse = auditSolrDao.process(solrQuery);
+      QueryResponse queryResponse = auditSolrDao.process(facetQuery);
       if (queryResponse == null) {
         VResponse response = new VResponse();
-        response.setMsgDesc("Query was not able to execute " + solrQuery);
+        response.setMsgDesc("Query was not able to execute " + facetQuery);
         throw RESTErrorUtil.createRESTException(response);
       }
-
-      NamedList<Object> namedList = queryResponse.getResponse();
-      if (namedList == null) {
-        VResponse response = new VResponse();
-        response.setMsgDesc("Query was not able to execute " + solrQuery);
-        throw RESTErrorUtil.createRESTException(response);
-      }
-      BarGraphDataListResponse vBarUserDataList = new BarGraphDataListResponse();
-      BarGraphDataListResponse vBarResourceDataList = new BarGraphDataListResponse();
-
-      SimpleOrderedMap<Object> jsonFacetResponse = (SimpleOrderedMap<Object>) namedList.get("facets");
-      vBarUserDataList = BizUtil.buildSummaryForTopCounts(jsonFacetResponse, "Repo", "Users");
-      vBarResourceDataList = BizUtil.buildSummaryForTopCounts(jsonFacetResponse, "y", "x");
+      BarGraphDataListResponse vBarUserDataList = graphDataGenerator.generateSecondLevelBarGraphDataResponse(queryResponse, 0);
+      BarGraphDataListResponse vBarResourceDataList = graphDataGenerator.generateSecondLevelBarGraphDataResponse(queryResponse, 1);
       String data = "";
-      String summary = "";
       if ("text".equals(dataFormat)) {
-        int users = 0;
-        int resources = 0;
-        summary += "\n\n\n\n";
-        data += addBlank("Users") + "Components/Access" + "\n";
-        data += "--------------------------------------------------------------------------\n";
-        Collection<BarGraphData> tableUserData = vBarUserDataList.getGraphData();
-        for (BarGraphData graphData : tableUserData) {
-          String userName = graphData.getName();
-          String largeUserName = "";
-
-          if (userName.length() > 45) {
-            largeUserName = userName.substring(0, 45);
-            data += addBlank(largeUserName);
-          } else
-            data += addBlank(userName);
-
-          Collection<NameValueData> vnameValueList = graphData.getDataCount();
-          data = appendNameValueData(data, vnameValueList);
-          while (largeUserName.length() > 0) {
-            data += largeUserName.substring(0, 45) + "\n";
-          }
-
-          users += 1;
-        }
-        data += "\n\n\n\n\n\n";
-        data += addBlank("Resources") + "Components/Access" + "\n";
-        data += "--------------------------------------------------------------------------\n";
-        Collection<BarGraphData> tableResourceData = vBarResourceDataList.getGraphData();
-        for (BarGraphData graphData : tableResourceData) {
-          String resourceName = graphData.getName();
-          String largeResourceName = resourceName;
-          if (largeResourceName.length() > 45) {
-            resourceName = largeResourceName.substring(0, 45);
-            largeResourceName = largeResourceName.substring(45, largeResourceName.length());
-          } else {
-            largeResourceName = "";
-          }
+        StringWriter stringWriter = new StringWriter();
+        Template template = freemarkerConfiguration.getTemplate(AUDIT_LOG_TEMPLATE);
+        Map<String, Object> models = new HashMap<>();
+        DownloadUtil.fillUserResourcesModel(models, vBarUserDataList, vBarResourceDataList);
+        template.process(models, stringWriter);
+        data = stringWriter.toString();
 
-          //resourceName = resourceName.replaceAll("(.{45})", resourceName.substring(0, 45)+"\n");
-          data += addBlank(resourceName);
-          Collection<NameValueData> vnameValueList = graphData.getDataCount();
-          data = appendNameValueData(data, vnameValueList);
-          String tempLargeResourceName = largeResourceName;
-          while (largeResourceName.length() > 45) {
-            largeResourceName = tempLargeResourceName.substring(0, 45);
-            tempLargeResourceName = tempLargeResourceName.substring(45, tempLargeResourceName.length());
-            data += largeResourceName + "\n";
-          }
-          if (largeResourceName.length() < 45 && !largeResourceName.isEmpty()) {
-            data += largeResourceName + "\n";
-          }
-          resources += 1;
-        }
-        String header = "--------------------------------SUMMARY-----------------------------------\n";
-        summary = header + "Users  = " + users + "\nResources  = " + resources + "\n" + summary;
-        data = summary + data;
       } else {
         data = "{" + convertObjToString(vBarUserDataList) + "," + convertObjToString(vBarResourceDataList) + "}";
         dataFormat = "json";
       }
       String fileName = "Users_Resource" + startTime + endTime + ".";
       File file = File.createTempFile(fileName, dataFormat);
-
       fis = new FileOutputStream(file);
       fis.write(data.getBytes());
       return Response
@@ -419,8 +169,8 @@ public class AuditLogsManager extends ManagerBase<SolrAuditLogData, AuditLogResp
         .header("Content-Disposition", "attachment;filename=" + fileName + dataFormat)
         .build();
 
-    } catch (SolrServerException | SolrException | IOException e) {
-      logger.error("Error during solrQuery=" + e);
+    } catch (IOException e) {
+      logger.error("Error during download file (audit log) " + e);
       throw RESTErrorUtil.createRESTException(MessageEnums.SOLR_ERROR.getMessage().getMessage(), MessageEnums.ERROR_SYSTEM);
     } finally {
       if (fis != null) {
@@ -432,97 +182,6 @@ public class AuditLogsManager extends ManagerBase<SolrAuditLogData, AuditLogResp
     }
   }
 
-  private BarGraphDataListResponse getGraphResponse(BarGraphDataListResponse dataList, SolrQuery solrQuery,
-                                                    List<BarGraphData> histogramData, String jsonHistogramQuery) {
-    try {
-      SolrUtil.setJSONFacet(solrQuery, jsonHistogramQuery);
-      SolrUtil.setRowCount(solrQuery, 0);
-      QueryResponse response = auditSolrDao.process(solrQuery);
-      if (response == null) {
-        return dataList;
-      }
-      SimpleOrderedMap<Object> jsonFacetResponse = (SimpleOrderedMap<Object>) response.getResponse().get("facets");
-
-      if (jsonFacetResponse == null || jsonFacetResponse.toString().equals("{count=0}")) {
-        return dataList;
-      }
-
-      auditSolrDao.extractValuesFromBuckets(jsonFacetResponse, "x", "y", histogramData);
-
-      dataList.setGraphData(histogramData);
-      return dataList;
-
-    } catch (SolrServerException | SolrException | IOException e) {
-      logger.error(e);
-      throw RESTErrorUtil.createRESTException(MessageEnums.SOLR_ERROR.getMessage().getMessage(), MessageEnums.ERROR_SYSTEM);
-
-    }
-  }
-
-  private String appendNameValueData(String data, Collection<NameValueData> vnameValueList) {
-    int count = 0;
-    String blank = "";
-    for (NameValueData vNameValue : vnameValueList) {
-      data += blank + vNameValue.getName() + " " + vNameValue.getValue() + "\n";
-      if (count == 0)
-        blank = addBlank(blank);
-      count++;
-    }
-    return data;
-  }
-
-  private String addBlank(String field) {
-    int blanks = 50;
-    int strSize = field.length();
-    String fieldWithBlank = field;
-    for (int i = 0; i < blanks - strSize; i++) {
-      fieldWithBlank += " ";
-    }
-    return fieldWithBlank;
-  }
-
-  public BarGraphDataListResponse getServiceLoad(CommonSearchCriteria searchCriteria) {
-    BarGraphDataListResponse dataList = new BarGraphDataListResponse();
-    Collection<BarGraphData> vaDatas = new ArrayList<BarGraphData>();
-    dataList.setGraphData(vaDatas);
-
-    SolrQuery serivceLoadQuery = queryGenerator.commonAuditFilterQuery(searchCriteria);
-
-    try {
-      SolrUtil.setFacetField(serivceLoadQuery, LogSearchConstants.AUDIT_COMPONENT);
-      QueryResponse serviceLoadResponse = auditSolrDao.process(serivceLoadQuery);
-      if (serviceLoadResponse == null) {
-        return dataList;
-      }
-      FacetField serviceFacetField = serviceLoadResponse.getFacetField(LogSearchConstants.AUDIT_COMPONENT);
-      if (serviceFacetField == null) {
-        return dataList;
-      }
-
-      List<Count> serviceLoadFacets = serviceFacetField.getValues();
-      if (serviceLoadFacets == null) {
-        return dataList;
-      }
-      for (Count cnt : serviceLoadFacets) {
-        List<NameValueData> valueList = new ArrayList<NameValueData>();
-        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;
-
-    } catch (SolrException | SolrServerException | IOException e) {
-      logger.error("Error during solrQuery=" + e);
-      throw RESTErrorUtil.createRESTException(MessageEnums.SOLR_ERROR.getMessage().getMessage(), MessageEnums.ERROR_SYSTEM);
-    }
-  }
-
   @Override
   protected List<SolrAuditLogData> convertToSolrBeans(QueryResponse response) {
     return response.getBeans(SolrAuditLogData.class);

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/manager/ManagerBase.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/manager/ManagerBase.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/manager/ManagerBase.java
index 13df470..45d66cf 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/manager/ManagerBase.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/manager/ManagerBase.java
@@ -21,55 +21,28 @@ package org.apache.ambari.logsearch.manager;
 
 import java.io.File;
 import java.io.IOException;
-import java.text.ParseException;
 import java.util.ArrayList;
 import java.util.Collections;
-import java.util.Date;
 import java.util.List;
 import java.util.Scanner;
 
-import org.apache.ambari.logsearch.common.LogSearchConstants;
 import org.apache.ambari.logsearch.common.MessageEnums;
 import org.apache.ambari.logsearch.model.response.LogData;
 import org.apache.ambari.logsearch.model.response.LogSearchResponse;
-import org.apache.ambari.logsearch.query.model.SearchCriteria;
 import org.apache.ambari.logsearch.dao.SolrDaoBase;
-import org.apache.ambari.logsearch.query.QueryGeneration;
-import org.apache.ambari.logsearch.util.DateUtil;
 import org.apache.ambari.logsearch.util.JSONUtil;
 import org.apache.ambari.logsearch.util.RESTErrorUtil;
-import org.apache.ambari.logsearch.util.SolrUtil;
-import org.apache.commons.lang.StringUtils;
 import org.apache.log4j.Logger;
 import org.apache.solr.client.solrj.SolrQuery;
-import org.apache.solr.client.solrj.SolrServerException;
 import org.apache.solr.client.solrj.response.QueryResponse;
 import org.apache.solr.common.SolrDocumentList;
-import org.apache.solr.common.SolrException;
-
-import javax.inject.Inject;
+import org.springframework.data.solr.core.DefaultQueryParser;
+import org.springframework.data.solr.core.query.SimpleQuery;
+import org.springframework.data.solr.core.query.SolrDataQuery;
 
 public abstract class ManagerBase<LOG_DATA_TYPE extends LogData, SEARCH_RESPONSE extends LogSearchResponse> extends JsonManagerBase {
   private static final Logger logger = Logger.getLogger(ManagerBase.class);
 
-  @Inject
-  protected QueryGeneration queryGenerator;
-
-  public enum LogType {
-    SERVICE("Service"),
-    AUDIT("Audit");
-    
-    private String label;
-    
-    private LogType(String label) {
-      this.label = label;
-    }
-    
-    public String getLabel() {
-      return label;
-    }
-  }
-
   public ManagerBase() {
     super();
   }
@@ -103,116 +76,52 @@ public abstract class ManagerBase<LOG_DATA_TYPE extends LogData, SEARCH_RESPONSE
 
   }
   
-  protected SEARCH_RESPONSE getLastPage(SearchCriteria searchCriteria, String logTimeField, SolrDaoBase solrDoaBase,
-                                    SolrQuery lastPageQuery) {
-    
-    Integer maxRows = searchCriteria.getMaxRows();
-    String givenSortType = searchCriteria.getSortType();
-    searchCriteria = new SearchCriteria();
-    searchCriteria.setSortBy(logTimeField);
-    if (givenSortType == null || givenSortType.equals(LogSearchConstants.DESCENDING_ORDER)) {
-      lastPageQuery.removeSort(LogSearchConstants.LOGTIME);
-      searchCriteria.setSortType(LogSearchConstants.ASCENDING_ORDER);
-    } else {
-      searchCriteria.setSortType(LogSearchConstants.DESCENDING_ORDER);
-    }
-    queryGenerator.setSingleSortOrder(lastPageQuery, searchCriteria);
-
-
-    Long totalLogs = 0l;
-    int startIndex = 0;
-    int numberOfLogsOnLastPage = 0;
-    SEARCH_RESPONSE logResponse = null;
-    try {
-      SolrUtil.setStart(lastPageQuery, 0);
-      SolrUtil.setRowCount(lastPageQuery, maxRows);
-      logResponse = getLogAsPaginationProvided(lastPageQuery, solrDoaBase);
-      totalLogs = countQuery(lastPageQuery,solrDoaBase);
-      startIndex = Integer.parseInt("" + ((totalLogs / maxRows) * maxRows));
-      numberOfLogsOnLastPage = Integer.parseInt("" + (totalLogs - startIndex));
-      logResponse.setStartIndex(startIndex);
-      logResponse.setTotalCount(totalLogs);
-      logResponse.setPageSize(maxRows);
-      List<LOG_DATA_TYPE> docList = logResponse.getLogList();
-      List<LOG_DATA_TYPE> lastPageDocList = new ArrayList<>();
-      logResponse.setLogList(lastPageDocList);
-      int cnt = 0;
-      for(LOG_DATA_TYPE doc:docList){
-        if(cnt<numberOfLogsOnLastPage){
-          lastPageDocList.add(doc);
-        }
-        cnt++;
+  protected SEARCH_RESPONSE getLastPage(SolrDaoBase solrDoaBase, SimpleQuery lastPageQuery, String event) {
+    int maxRows = lastPageQuery.getRows();
+    SEARCH_RESPONSE logResponse = getLogAsPaginationProvided(lastPageQuery, solrDoaBase, event);
+    Long totalLogs = solrDoaBase.count(lastPageQuery);
+    int startIndex = Integer.parseInt("" + ((totalLogs / maxRows) * maxRows));
+    int numberOfLogsOnLastPage = Integer.parseInt("" + (totalLogs - startIndex));
+    logResponse.setStartIndex(startIndex);
+    logResponse.setTotalCount(totalLogs);
+    logResponse.setPageSize(maxRows);
+    List<LOG_DATA_TYPE> docList = logResponse.getLogList();
+    List<LOG_DATA_TYPE> lastPageDocList = new ArrayList<>();
+    logResponse.setLogList(lastPageDocList);
+    int cnt = 0;
+    for (LOG_DATA_TYPE doc : docList) {
+      if (cnt < numberOfLogsOnLastPage) {
+        lastPageDocList.add(doc);
       }
-      Collections.reverse(lastPageDocList);
-
-    } catch (SolrException | SolrServerException | IOException | NumberFormatException e) {
-      logger.error("Count Query was not executed successfully",e);
-      throw RESTErrorUtil.createRESTException(MessageEnums.SOLR_ERROR.getMessage().getMessage(), MessageEnums.ERROR_SYSTEM);
+      cnt++;
     }
+    Collections.reverse(lastPageDocList);
     return logResponse;
   }
 
-  protected SEARCH_RESPONSE getLogAsPaginationProvided(SolrQuery solrQuery, SolrDaoBase solrDaoBase) {
-    try {
-      QueryResponse response = solrDaoBase.process(solrQuery);
-      SEARCH_RESPONSE logResponse = createLogSearchResponse();
-      SolrDocumentList docList = response.getResults();
-      List<LOG_DATA_TYPE> serviceLogDataList = convertToSolrBeans(response);
-      if (docList != null && !docList.isEmpty()) {
-        logResponse.setLogList(serviceLogDataList);
-        logResponse.setStartIndex((int) docList.getStart());
-        logResponse.setTotalCount(docList.getNumFound());
-        Integer rowNumber = solrQuery.getRows();
-        if (rowNumber == null) {
-          logger.error("No RowNumber was set in solrQuery");
-          return createLogSearchResponse();
-        }
-        logResponse.setPageSize(rowNumber);
-      }
-      return logResponse;
-    } catch (SolrException | SolrServerException | IOException e) {
-      logger.error("Error during solrQuery=" + solrQuery, e);
-      throw RESTErrorUtil.createRESTException(MessageEnums.SOLR_ERROR.getMessage().getMessage(), MessageEnums.ERROR_SYSTEM);
-    }
-  }
-  
-  protected Long countQuery(SolrQuery query,SolrDaoBase solrDaoBase) throws SolrException, SolrServerException, IOException {
-    query.setRows(0);
-    QueryResponse response = solrDaoBase.process(query);
-    if (response == null) {
-      return 0l;
-    }
-    SolrDocumentList docList = response.getResults();
-    if (docList == null) {
-      return 0l;
-    }
-    return docList.getNumFound();
+  protected SEARCH_RESPONSE getLogAsPaginationProvided(SolrDataQuery solrQuery, SolrDaoBase solrDaoBase, String event) {
+    SolrQuery query = new DefaultQueryParser().doConstructSolrQuery(solrQuery);
+    return getLogAsPaginationProvided(query, solrDaoBase, event);
   }
 
-  protected String getUnit(String unit) {
-    if (StringUtils.isBlank(unit)) {
-      unit = "+1HOUR";
-    }
-    return unit;
-  }
 
-  protected String getFrom(String from) {
-    if (StringUtils.isBlank(from)) {
-      Date date = DateUtil.getTodayFromDate();
-      try {
-        from = DateUtil.convertGivenDateFormatToSolrDateFormat(date);
-      } catch (ParseException e) {
-        from = "NOW";
+  protected SEARCH_RESPONSE getLogAsPaginationProvided(SolrQuery solrQuery, SolrDaoBase solrDaoBase, String event) {
+    QueryResponse response = solrDaoBase.process(solrQuery, event);
+    SEARCH_RESPONSE logResponse = createLogSearchResponse();
+    SolrDocumentList docList = response.getResults();
+    List<LOG_DATA_TYPE> serviceLogDataList = convertToSolrBeans(response);
+    if (docList != null && !docList.isEmpty()) {
+      logResponse.setLogList(serviceLogDataList);
+      logResponse.setStartIndex((int) docList.getStart());
+      logResponse.setTotalCount(docList.getNumFound());
+      Integer rowNumber = solrQuery.getRows();
+      if (rowNumber == null) {
+        logger.error("No RowNumber was set in solrQuery");
+        return createLogSearchResponse();
       }
+      logResponse.setPageSize(rowNumber);
     }
-    return from;
-  }
-
-  protected String getTo(String to) {
-    if (StringUtils.isBlank(to)) {
-      to = "NOW";
-    }
-    return to;
+    return logResponse;
   }
 
   protected abstract List<LOG_DATA_TYPE> convertToSolrBeans(QueryResponse response);

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7164202/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/manager/PublicManager.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/manager/PublicManager.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/manager/PublicManager.java
index 82817d6..cbab651 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/manager/PublicManager.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/manager/PublicManager.java
@@ -25,11 +25,11 @@ import java.util.List;
 import org.apache.ambari.logsearch.conf.AuthPropsConfig;
 import org.apache.ambari.logsearch.model.response.NameValueData;
 import org.apache.ambari.logsearch.model.response.NameValueDataListResponse;
-import org.springframework.stereotype.Component;
 
 import javax.inject.Inject;
+import javax.inject.Named;
 
-@Component
+@Named
 public class PublicManager extends JsonManagerBase {
 
   @Inject


[47/58] [abbrv] ambari git commit: AMBARI-18523. Use 'enabled' suffix instead of 'enable' for auth properties (oleewere)

Posted by ol...@apache.org.
AMBARI-18523. Use 'enabled' suffix instead of 'enable' for auth properties (oleewere)

Change-Id: I582a9b4e5f5f3671079c4e64a22158411c6953e1


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

Branch: refs/heads/branch-2.5
Commit: 4d5435d3e60256796e964893038bc1e925645164
Parents: 3f48c53
Author: oleewere <ol...@gmail.com>
Authored: Tue Oct 4 12:08:54 2016 +0200
Committer: oleewere <ol...@gmail.com>
Committed: Sat Nov 5 14:46:46 2016 +0100

----------------------------------------------------------------------
 .../org/apache/ambari/logsearch/conf/AuthPropsConfig.java |  8 ++++----
 .../java/org/apache/ambari/logsearch/conf/SolrConfig.java |  5 +++++
 .../apache/ambari/logsearch/dao/UserConfigSolrDao.java    |  2 +-
 .../webapp/scripts/views/tabs/HierarchyTabLayoutView.js   |  1 -
 .../LOGSEARCH/0.5.0/package/scripts/params.py             | 10 +++++-----
 .../test/python/stacks/2.4/LOGSEARCH/test_logsearch.py    |  6 +++---
 6 files changed, 18 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/4d5435d3/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/AuthPropsConfig.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/AuthPropsConfig.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/AuthPropsConfig.java
index 11b1cda..67ddd1f 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/AuthPropsConfig.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/AuthPropsConfig.java
@@ -24,13 +24,13 @@ import org.springframework.context.annotation.Configuration;
 @Configuration
 public class AuthPropsConfig {
 
-  @Value("${logsearch.auth.file.enable:true}")
+  @Value("${logsearch.auth.file.enabled:true}")
   boolean authFileEnabled;
-  @Value("${logsearch.auth.ldap.enable:false}")
+  @Value("${logsearch.auth.ldap.enabled:false}")
   boolean authLdapEnabled;
-  @Value("${logsearch.auth.simple.enable:false}")
+  @Value("${logsearch.auth.simple.enabled:false}")
   boolean authSimpleEnabled;
-  @Value("${logsearch.auth.external_auth.enable:false}")
+  @Value("${logsearch.auth.external_auth.enabled:false}")
   boolean authExternalEnabled;
   @Value("${logsearch.auth.external_auth.host_url:'http://ip:port'}")
   private String externalAuthHostUrl;

http://git-wip-us.apache.org/repos/asf/ambari/blob/4d5435d3/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/SolrConfig.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/SolrConfig.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/SolrConfig.java
index 4868409..79df3c2 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/SolrConfig.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/SolrConfig.java
@@ -90,6 +90,11 @@ public class SolrConfig {
     return new SolrSchemaFieldDao();
   }
 
+  @Bean(name = "userConfigSolrFieldDao")
+  public SolrSchemaFieldDao userConfigSolrFieldDao() {
+    return new SolrSchemaFieldDao();
+  }
+
   private CloudSolrClient createClient(String solrUrl, String zookeeperConnectString, String defaultCollection) {
     if (StringUtils.isNotEmpty(zookeeperConnectString)) {
       CloudSolrClient cloudSolrClient = new CloudSolrClient(zookeeperConnectString);

http://git-wip-us.apache.org/repos/asf/ambari/blob/4d5435d3/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/UserConfigSolrDao.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/UserConfigSolrDao.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/UserConfigSolrDao.java
index a6ea77c..58337f7 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/UserConfigSolrDao.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/dao/UserConfigSolrDao.java
@@ -73,7 +73,7 @@ public class UserConfigSolrDao extends SolrDaoBase {
   private SolrCollectionDao solrCollectionDao;
 
   @Inject
-  @Named("serviceSolrFieldDao")
+  @Named("userConfigSolrFieldDao")
   private SolrSchemaFieldDao solrSchemaFieldDao;
 
   @Inject

http://git-wip-us.apache.org/repos/asf/ambari/blob/4d5435d3/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/tabs/HierarchyTabLayoutView.js
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/tabs/HierarchyTabLayoutView.js b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/tabs/HierarchyTabLayoutView.js
index 605560e..c504afa 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/tabs/HierarchyTabLayoutView.js
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/tabs/HierarchyTabLayoutView.js
@@ -276,7 +276,6 @@ define(['require',
         require(['views/tabs/VisualSearchView'], function (VisualSearchView) {
           var data = _.values(Globals.serviceLogsColumns);
           var columns = _.without(data, _.findWhere(data, "logtime"));
-          console.log("service columns: " + JSON.stringify(columns))
           that.RVisualSearchIncCol.show(new VisualSearchView({
             viewName: "includeServiceColumns",
             placeholder: "Include Search",

http://git-wip-us.apache.org/repos/asf/ambari/blob/4d5435d3/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/params.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/params.py b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/params.py
index 7200d7b..63bc21f 100644
--- a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/params.py
+++ b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/params.py
@@ -215,17 +215,17 @@ logsearch_properties['logsearch.solr.metrics.collector.hosts'] = format(logsearc
 logsearch_properties['logsearch.solr.jmx.port'] = infra_solr_jmx_port
 
 logsearch_properties['logsearch.login.credentials.file'] = logsearch_admin_credential_file
-logsearch_properties['logsearch.auth.file.enable'] = 'true'
-logsearch_properties['logsearch.auth.ldap.enable'] = 'false'
-logsearch_properties['logsearch.auth.simple.enable'] = 'false'
+logsearch_properties['logsearch.auth.file.enabled'] = 'true'
+logsearch_properties['logsearch.auth.ldap.enabled'] = 'false'
+logsearch_properties['logsearch.auth.simple.enabled'] = 'false'
 logsearch_properties['logsearch.roles.allowed'] = 'AMBARI.ADMINISTRATOR'
 logsearch_properties['logsearch.auth.external_auth.host_url'] = format(logsearch_properties['logsearch.auth.external_auth.host_url'])
 
 logsearch_properties['logsearch.protocol'] = logsearch_ui_protocol
 
 if security_enabled:
-  logfeeder_properties['logsearch.solr.kerberos.enable'] = 'true'
-  logfeeder_properties['logsearch.solr.jaas.file'] = logsearch_jaas_file
+  logsearch_properties['logsearch.solr.kerberos.enable'] = 'true'
+  logsearch_properties['logsearch.solr.jaas.file'] = logsearch_jaas_file
 
 
 logsearch_solr_collection_service_logs = logsearch_properties['logsearch.solr.collection.service.logs']

http://git-wip-us.apache.org/repos/asf/ambari/blob/4d5435d3/ambari-server/src/test/python/stacks/2.4/LOGSEARCH/test_logsearch.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.4/LOGSEARCH/test_logsearch.py b/ambari-server/src/test/python/stacks/2.4/LOGSEARCH/test_logsearch.py
index 0378a94..8c0ed16 100644
--- a/ambari-server/src/test/python/stacks/2.4/LOGSEARCH/test_logsearch.py
+++ b/ambari-server/src/test/python/stacks/2.4/LOGSEARCH/test_logsearch.py
@@ -75,9 +75,9 @@ class TestLogSearch(RMFTestCase):
                                             'logsearch.auth.external_auth.enabled': 'false',
                                             'logsearch.auth.external_auth.host_url': 'http://c6401.ambari.apache.org:8080',
                                             'logsearch.auth.external_auth.login_url': '/api/v1/users/$USERNAME/privileges?fields=*',
-                                            'logsearch.auth.file.enable': 'true',
-                                            'logsearch.auth.ldap.enable': 'false',
-                                            'logsearch.auth.simple.enable': 'false',
+                                            'logsearch.auth.file.enabled': 'true',
+                                            'logsearch.auth.ldap.enabled': 'false',
+                                            'logsearch.auth.simple.enabled': 'false',
                                             'logsearch.collection.audit.logs.numshards': '10',
                                             'logsearch.collection.audit.logs.replication.factor': '1',
                                             'logsearch.collection.history.replication.factor': '1',


[49/58] [abbrv] ambari git commit: AMBARI-18510. Use logsearch truststore to look for credential in case of external authentication (Miklos Gergely via oleewere)

Posted by ol...@apache.org.
AMBARI-18510. Use logsearch truststore to look for credential in case of external authentication (Miklos Gergely via oleewere)

Change-Id: I44bd04868d00574c339fd31c8303a7abf97686f6


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

Branch: refs/heads/branch-2.5
Commit: 3f48c53b05f1747d53c7a1490326d440624a1bdf
Parents: 0fac451
Author: Miklos Gergely <mg...@hortonworks.com>
Authored: Mon Oct 3 16:14:54 2016 +0200
Committer: oleewere <ol...@gmail.com>
Committed: Sat Nov 5 14:46:46 2016 +0100

----------------------------------------------------------------------
 .../src/main/scripts/run.sh                     |   4 +-
 .../org/apache/ambari/logsearch/LogSearch.java  |  32 +--
 .../logsearch/common/ExternalServerClient.java  |  24 +-
 .../logsearch/common/PropertiesHelper.java      |   2 +-
 .../apache/ambari/logsearch/util/SSLUtil.java   | 107 +++++++++
 ...LogsearchAbstractAuthenticationProvider.java |  20 +-
 .../LogsearchAuthenticationProvider.java        |  86 +++----
 ...rchExternalServerAuthenticationProvider.java |  97 +++-----
 .../LogsearchFileAuthenticationProvider.java    |   9 +-
 .../LogsearchSimpleAuthenticationProvider.java  |  23 +-
 .../src/main/scripts/run.sh                     |   2 +-
 .../LogsearchAuthenticationProviderTest.java    | 205 ++++++++++++++++
 ...xternalServerAuthenticationProviderTest.java | 185 +++++++++++++++
 ...LogsearchFileAuthenticationProviderTest.java | 231 +++++++++++++++++++
 ...LogsearchLdapAuthenticationProviderTest.java |  61 +++++
 ...gsearchSimpleAuthenticationProviderTest.java | 118 ++++++++++
 .../src/test/resources/logsearch.properties     |   3 +-
 ambari-logsearch/docker/.gitignore              |   2 +-
 ambari-logsearch/docker/Dockerfile              |  14 +-
 ambari-logsearch/docker/bin/start.sh            |  57 ++++-
 ambari-logsearch/docker/logsearch-docker.sh     |   6 +-
 .../test-config/logfeeder/logfeeder-env.sh      |  13 +-
 .../test-config/logsearch/logsearch-env.sh      |  12 +-
 .../logsearch/logsearch-https.properties        |  55 +++++
 .../docker/test-config/solr/solr-env-ssl.sh     | 101 ++++++++
 .../docker/test-config/solr/solr-env.sh         |   4 +-
 .../0.1.0/properties/infra-solr-env.sh.j2       |   4 +-
 .../0.5.0/properties/logsearch-env.sh.j2        |   2 +-
 28 files changed, 1256 insertions(+), 223 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/3f48c53b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/scripts/run.sh
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/scripts/run.sh b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/scripts/run.sh
index dfc7b7b..5aecd00 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/scripts/run.sh
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/scripts/run.sh
@@ -97,9 +97,9 @@ if [ $foreground -eq 0 ]; then
     echo "Starting logfeeder. Output file=$LOGFILE pid_file=$PID_FILE"
     #LOGFEEDER_CLI_CLASSPATH=
     #set -x
-    nohup $JAVA -cp "$LOGFEEDER_CLI_CLASSPATH:$LOGFEEDER_CONF_DIR:$script_dir/libs/*:$script_dir/classes:$script_dir/LogProcessor.jar" $LOGFEEDER_GC_OPTS $LOGFEEDER_JAVA_MEM $LOGFEEDER_JAVA_OPTS $JMX org.apache.ambari.logfeeder.LogFeeder $* > $LOGFILE 2>&1 &
+    nohup $JAVA -cp "$LOGFEEDER_CLI_CLASSPATH:$LOGFEEDER_CONF_DIR:$script_dir/libs/*:$script_dir/classes" $LOGFEEDER_GC_OPTS $LOGFEEDER_JAVA_MEM $LOGFEEDER_JAVA_OPTS $JMX org.apache.ambari.logfeeder.LogFeeder $* > $LOGFILE 2>&1 &
     echo $! > $PID_FILE
 else
-    $JAVA -cp "$LOGFEEDER_CLI_CLASSPATH:$LOGFEEDER_CONF_DIR:$script_dir/libs/*:$script_dir/classes:$script_dir/LogProcessor.jar" $LOGFEEDER_JAVA_MEM $LOGFEEDER_JAVA_OPTS $JMX org.apache.ambari.logfeeder.LogFeeder $*
+    $JAVA -cp "$LOGFEEDER_CLI_CLASSPATH:$LOGFEEDER_CONF_DIR:$script_dir/libs/*:$script_dir/classes" $LOGFEEDER_JAVA_MEM $LOGFEEDER_JAVA_OPTS $JMX org.apache.ambari.logfeeder.LogFeeder $*
 fi
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/3f48c53b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/LogSearch.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/LogSearch.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/LogSearch.java
index 75d8be3..5a7cf02 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/LogSearch.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/LogSearch.java
@@ -29,6 +29,7 @@ import java.util.EnumSet;
 import org.apache.ambari.logsearch.common.ManageStartEndTime;
 import org.apache.ambari.logsearch.common.PropertiesHelper;
 import org.apache.ambari.logsearch.conf.ApplicationConfig;
+import org.apache.ambari.logsearch.util.SSLUtil;
 import org.apache.commons.lang.StringUtils;
 import org.apache.log4j.Logger;
 import org.eclipse.jetty.server.Connector;
@@ -56,15 +57,6 @@ import javax.servlet.DispatcherType;
 public class LogSearch {
   private static final Logger logger = Logger.getLogger(LogSearch.class);
 
-  private static final String KEYSTORE_LOCATION_ARG = "javax.net.ssl.keyStore";
-  private static final String KEYSTORE_PASSWORD_ARG = "javax.net.ssl.keyStorePassword";
-  private static final String KEYSTORE_TYPE_ARG = "javax.net.ssl.keyStoreType";
-  private static final String DEFAULT_KEYSTORE_TYPE = "JKS";
-  private static final String TRUSTSTORE_LOCATION_ARG = "javax.net.ssl.trustStore";
-  private static final String TRUSTSTORE_PASSWORD_ARG = "javax.net.ssl.trustStorePassword";
-  private static final String TRUSTSTORE_TYPE_ARG = "javax.net.ssl.trustStoreType";
-  private static final String DEFAULT_TRUSTSTORE_TYPE = "JKS";
-
   private static final String LOGSEARCH_PROTOCOL_PROP = "logsearch.protocol";
   private static final String HTTPS_PROTOCOL = "https";
   private static final String HTTP_PROTOCOL = "http";
@@ -112,28 +104,13 @@ public class LogSearch {
       protcolProperty = HTTP_PROTOCOL;
     }
     String port = null;
-    String keystoreLocation = System.getProperty(KEYSTORE_LOCATION_ARG);
-    String keystorePassword = System.getProperty(KEYSTORE_PASSWORD_ARG);
-    String keystoreType = System.getProperty(KEYSTORE_TYPE_ARG,DEFAULT_KEYSTORE_TYPE);
-    String trustStoreLocation = System.getProperty(TRUSTSTORE_LOCATION_ARG);
-    String trustStorePassword = System.getProperty(TRUSTSTORE_PASSWORD_ARG);
-    String trustStoreType = System.getProperty(TRUSTSTORE_TYPE_ARG,DEFAULT_TRUSTSTORE_TYPE);
-    if (HTTPS_PROTOCOL.equals(protcolProperty) 
-        && !StringUtils.isEmpty(keystoreLocation) && !StringUtils.isEmpty(keystorePassword)) {
+    if (HTTPS_PROTOCOL.equals(protcolProperty) && SSLUtil.isKeyStoreSpecified()) {
       logger.info("Building https server...........");
       port = portSpecified ? argv[0] : HTTPS_PORT;
       checkPort(Integer.parseInt(port));
       HttpConfiguration https = new HttpConfiguration();
       https.addCustomizer(new SecureRequestCustomizer());
-      SslContextFactory sslContextFactory = new SslContextFactory();
-      sslContextFactory.setKeyStorePath(keystoreLocation);
-      sslContextFactory.setKeyStorePassword(keystorePassword);
-      sslContextFactory.setKeyStoreType(keystoreType);
-      if (!StringUtils.isEmpty(trustStoreLocation) && !StringUtils.isEmpty(trustStorePassword)) {
-        sslContextFactory.setTrustStorePath(trustStoreLocation);
-        sslContextFactory.setTrustStorePassword(trustStorePassword);
-        sslContextFactory.setTrustStoreType(trustStoreType);
-      }
+      SslContextFactory sslContextFactory = SSLUtil.getSslContextFactory();
       ServerConnector sslConnector = new ServerConnector(server,
           new SslConnectionFactory(sslContextFactory, "http/1.1"),
           new HttpConnectionFactory(https));
@@ -146,8 +123,7 @@ public class LogSearch {
       connector.setPort(Integer.parseInt(port));
       server.setConnectors(new Connector[] { connector });
     }
-    URI logsearchURI = URI.create(String.format("%s://0.0.0.0:%s", protcolProperty,
-        port));
+    URI logsearchURI = URI.create(String.format("%s://0.0.0.0:%s", protcolProperty, port));
     logger.info("Starting logsearch server URI=" + logsearchURI);
     return server;
   }

http://git-wip-us.apache.org/repos/asf/ambari/blob/3f48c53b/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 c476b9d..1207373 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
@@ -18,18 +18,14 @@
  */
 package org.apache.ambari.logsearch.common;
 
-import java.util.List;
-import java.util.Map;
-
 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.MultivaluedMap;
 
 import org.apache.ambari.logsearch.conf.AuthPropsConfig;
-import org.apache.commons.lang.StringUtils;
+import org.apache.ambari.logsearch.util.SSLUtil;
 import org.apache.log4j.Logger;
 import org.glassfish.jersey.client.JerseyClient;
 import org.glassfish.jersey.client.JerseyClientBuilder;
@@ -42,10 +38,12 @@ import org.glassfish.jersey.client.authentication.HttpAuthenticationFeature;
 public class ExternalServerClient {
 
   private static Logger LOG = Logger.getLogger(ExternalServerClient.class);
-  private static final ThreadLocal<JerseyClient> localJerseyClient = new ThreadLocal<JerseyClient>(){
+  private static final ThreadLocal<JerseyClient> localJerseyClient = new ThreadLocal<JerseyClient>() {
     @Override
     protected JerseyClient initialValue() {
-      return JerseyClientBuilder.createClient();
+      return SSLUtil.isKeyStoreSpecified() ?
+          new JerseyClientBuilder().sslContext(SSLUtil.getSSLContext()).build() :
+          JerseyClientBuilder.createClient();
     }
   };
 
@@ -55,10 +53,8 @@ public class ExternalServerClient {
   /**
    * Send GET request to an external server
    */
-  public Object sendGETRequest(String url, Class klass, MultivaluedMap<String, String> queryParam,
-                               String username, String password)
-      throws Exception {
-    url = authPropsConfig.getExternalAuthHostUrl() + url;
+  public Object sendGETRequest(String loginUrl, Class<?> klass, String username, String password) throws Exception {
+    String url = authPropsConfig.getExternalAuthHostUrl() + loginUrl;
     JerseyClient client = localJerseyClient.get();
     HttpAuthenticationFeature authFeature = HttpAuthenticationFeature.basicBuilder()
       .credentials(username, password)
@@ -67,11 +63,7 @@ public class ExternalServerClient {
 
     WebTarget target = client.target(url);
     LOG.debug("URL: " + url);
-    for (Map.Entry<String, List<String>> entry : queryParam.entrySet()) {
-      target = target.queryParam(entry.getKey(), entry.getValue());
-      LOG.debug(
-        String.format("Query parameter: name - %s  ; value - %s ;" + entry.getKey(), StringUtils.join(entry.getValue(),',')));
-    }
+    
     Invocation.Builder invocationBuilder =  target.request(MediaType.APPLICATION_JSON_TYPE);
     try {
       return invocationBuilder.get().readEntity(klass);

http://git-wip-us.apache.org/repos/asf/ambari/blob/3f48c53b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/common/PropertiesHelper.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/common/PropertiesHelper.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/common/PropertiesHelper.java
index 1844d8f..257ae3c 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/common/PropertiesHelper.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/common/PropertiesHelper.java
@@ -43,7 +43,7 @@ public class PropertiesHelper extends PropertyPlaceholderConfigurer {
   private PropertiesHelper() {
   }
   
- static {
+  static {
     propertiesMap = new HashMap<String, String>();
     Properties properties = new Properties();
     URL fileCompleteUrl = Thread.currentThread().getContextClassLoader().getResource(LOGSEARCH_PROP_FILE);

http://git-wip-us.apache.org/repos/asf/ambari/blob/3f48c53b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/util/SSLUtil.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/util/SSLUtil.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/util/SSLUtil.java
new file mode 100644
index 0000000..206f793
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/util/SSLUtil.java
@@ -0,0 +1,107 @@
+/*
+ * 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.util;
+
+import javax.net.ssl.SSLContext;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.log4j.Logger;
+import org.eclipse.jetty.util.ssl.SslContextFactory;
+
+public class SSLUtil {
+  private static final Logger logger = Logger.getLogger(SSLUtil.class);
+  
+  private static final String KEYSTORE_LOCATION_ARG = "javax.net.ssl.keyStore";
+  private static final String KEYSTORE_PASSWORD_ARG = "javax.net.ssl.keyStorePassword";
+  private static final String KEYSTORE_TYPE_ARG = "javax.net.ssl.keyStoreType";
+  private static final String DEFAULT_KEYSTORE_TYPE = "JKS";
+  private static final String TRUSTSTORE_LOCATION_ARG = "javax.net.ssl.trustStore";
+  private static final String TRUSTSTORE_PASSWORD_ARG = "javax.net.ssl.trustStorePassword";
+  private static final String TRUSTSTORE_TYPE_ARG = "javax.net.ssl.trustStoreType";
+  private static final String DEFAULT_TRUSTSTORE_TYPE = "JKS";
+  
+  private SSLUtil() {
+    throw new UnsupportedOperationException();
+  }
+  
+  public static String getKeyStoreLocation() {
+    return System.getProperty(KEYSTORE_LOCATION_ARG);
+  }
+  
+  public static String getKeyStorePassword() {
+    return System.getProperty(KEYSTORE_PASSWORD_ARG);
+  }
+  
+  public static String getKeyStoreType() {
+    return System.getProperty(KEYSTORE_TYPE_ARG, DEFAULT_KEYSTORE_TYPE);
+  }
+  
+  public static String getTrustStoreLocation() {
+    return System.getProperty(TRUSTSTORE_LOCATION_ARG);
+  }
+  
+  public static String getTrustStorePassword() {
+    return System.getProperty(TRUSTSTORE_PASSWORD_ARG);
+  }
+  
+  public static String getTrustStoreType() {
+    return System.getProperty(TRUSTSTORE_TYPE_ARG, DEFAULT_TRUSTSTORE_TYPE);
+  }
+  
+  public static boolean isKeyStoreSpecified() {
+    return StringUtils.isNotEmpty(getKeyStoreLocation()) && StringUtils.isNotEmpty(getKeyStorePassword());
+  }
+
+  private static boolean isTrustStoreSpecified() {
+    return StringUtils.isNotEmpty(getTrustStoreLocation()) && StringUtils.isNotEmpty(getTrustStorePassword());
+  }
+  
+  public static SslContextFactory getSslContextFactory() {
+    SslContextFactory sslContextFactory = new SslContextFactory();
+    sslContextFactory.setKeyStorePath(getKeyStoreLocation());
+    sslContextFactory.setKeyStorePassword(getKeyStorePassword());
+    sslContextFactory.setKeyStoreType(getKeyStoreType());
+    if (isTrustStoreSpecified()) {
+      sslContextFactory.setTrustStorePath(getTrustStoreLocation());
+      sslContextFactory.setTrustStorePassword(getTrustStorePassword());
+      sslContextFactory.setTrustStoreType(getTrustStoreType());
+    }
+    
+    return sslContextFactory;
+  }
+  
+  public static SSLContext getSSLContext() {
+    SslContextFactory sslContextFactory = getSslContextFactory();
+    
+    try {
+      sslContextFactory.start();
+      return sslContextFactory.getSslContext();
+    } catch (Exception e) {
+      logger.error("Could not create SSL Context", e);
+      return null;
+    } finally {
+      try {
+        sslContextFactory.stop();
+      } catch (Exception e) {
+        logger.error("Could not stop sslContextFactory", e);
+      }
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/3f48c53b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchAbstractAuthenticationProvider.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchAbstractAuthenticationProvider.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchAbstractAuthenticationProvider.java
index eab33a1..eb6c9f1 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchAbstractAuthenticationProvider.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchAbstractAuthenticationProvider.java
@@ -27,11 +27,11 @@ import org.springframework.security.authentication.UsernamePasswordAuthenticatio
 import org.springframework.security.core.GrantedAuthority;
 import org.springframework.security.core.authority.SimpleGrantedAuthority;
 
-public abstract class LogsearchAbstractAuthenticationProvider implements AuthenticationProvider {
+abstract class LogsearchAbstractAuthenticationProvider implements AuthenticationProvider {
 
-  public final static String AUTH_METHOD_PROP_START_WITH = "logsearch.auth.";
+  private static final String AUTH_METHOD_PROPERTY_PREFIX = "logsearch.auth.";
 
-  protected enum AUTH_METHOD {
+  protected enum AuthMethod {
     LDAP, FILE, EXTERNAL_AUTH, SIMPLE
   };
 
@@ -42,25 +42,19 @@ public abstract class LogsearchAbstractAuthenticationProvider implements Authent
 
   /**
    * GET Default GrantedAuthority
-   * 
-   * @param username
-   * @return List<GrantedAuthority>
    */
-  protected List<GrantedAuthority> getAuthorities(String username) {
-    final List<GrantedAuthority> grantedAuths = new ArrayList<>();
+  protected List<GrantedAuthority> getAuthorities() {
+    List<GrantedAuthority> grantedAuths = new ArrayList<>();
     grantedAuths.add(new SimpleGrantedAuthority("ROLE_USER"));
     return grantedAuths;
   }
 
   /**
    * Check authentication provider is enable or disable for specified method
-   * 
-   * @param method
-   * @return boolean
    */
-  public boolean isEnable(AUTH_METHOD method) {
+  public boolean isEnable(AuthMethod method) {
     String methodName = method.name().toLowerCase();
-    String property = AUTH_METHOD_PROP_START_WITH + methodName + ".enable";
+    String property = AUTH_METHOD_PROPERTY_PREFIX + methodName + ".enable";
     boolean isEnable = PropertiesHelper.getBooleanProperty(property, false);
     return isEnable;
   }

http://git-wip-us.apache.org/repos/asf/ambari/blob/3f48c53b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchAuthenticationProvider.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchAuthenticationProvider.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchAuthenticationProvider.java
index d37e545..711e3ec 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchAuthenticationProvider.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchAuthenticationProvider.java
@@ -20,8 +20,8 @@ package org.apache.ambari.logsearch.web.security;
 
 import java.util.HashMap;
 
-import org.apache.ambari.logsearch.dao.UserDao;
 import org.apache.ambari.logsearch.util.JSONUtil;
+import org.apache.log4j.Level;
 import org.apache.log4j.Logger;
 import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
 import org.springframework.security.core.Authentication;
@@ -32,15 +32,9 @@ import javax.inject.Inject;
 import javax.inject.Named;
 
 @Named
-public class LogsearchAuthenticationProvider extends
-  LogsearchAbstractAuthenticationProvider {
-  private static final Logger logger = Logger
-    .getLogger(LogsearchAuthenticationProvider.class);
-  private static Logger auditLogger = Logger
-    .getLogger("org.apache.ambari.logsearch.audit");
-
-  @Inject
-  private UserDao userDao;
+public class LogsearchAuthenticationProvider extends LogsearchAbstractAuthenticationProvider {
+  private static final Logger logger = Logger .getLogger(LogsearchAuthenticationProvider.class);
+  private static final Logger auditLogger = Logger.getLogger("org.apache.ambari.logsearch.audit");
 
   @Inject
   private LogsearchLdapAuthenticationProvider ldapAuthenticationProvider;
@@ -49,44 +43,40 @@ public class LogsearchAuthenticationProvider extends
   private LogsearchFileAuthenticationProvider fileAuthenticationProvider;
 
   @Inject
-  private LogsearchSimpleAuthenticationProvider simpleAuthenticationProvider;
+  private LogsearchExternalServerAuthenticationProvider externalServerAuthenticationProvider;
 
   @Inject
-  private LogsearchExternalServerAuthenticationProvider externalServerAuthenticationProvider;
+  private LogsearchSimpleAuthenticationProvider simpleAuthenticationProvider;
 
   @Override
-  public Authentication authenticate(Authentication authentication)
-    throws AuthenticationException {
-    logger.info("Authenticating user:" + authentication.getName()
-      + ", userDetail=" + authentication.toString());
-    Authentication inAuthentication = authentication;
-    AuthenticationException authException = null;
+  public Authentication authenticate(Authentication inAuthentication) throws AuthenticationException {
+    logger.info("Authenticating user:" + inAuthentication.getName() + ", userDetail=" + inAuthentication.toString());
+    logger.info("authentication.class=" + inAuthentication.getClass().getName());
+
     HashMap<String, Object> auditRecord = new HashMap<String, Object>();
-    auditRecord.put("user", authentication.getName());
-    auditRecord.put("principal", authentication.getPrincipal().toString());
-    auditRecord.put("auth_class", authentication.getClass().getName());
-    logger.info("authentication.class="
-      + authentication.getClass().getName());
+    auditRecord.put("user", inAuthentication.getName());
+    auditRecord.put("principal", inAuthentication.getPrincipal().toString());
+    auditRecord.put("auth_class", inAuthentication.getClass().getName());
     if (inAuthentication instanceof UsernamePasswordAuthenticationToken) {
       UsernamePasswordAuthenticationToken authClass = (UsernamePasswordAuthenticationToken) inAuthentication;
       Object details = authClass.getDetails();
       if (details instanceof WebAuthenticationDetails) {
         WebAuthenticationDetails webAuthentication = (WebAuthenticationDetails) details;
-        auditRecord.put("remote_ip",
-          webAuthentication.getRemoteAddress());
+        auditRecord.put("remote_ip", webAuthentication.getRemoteAddress());
         auditRecord.put("session", webAuthentication.getSessionId());
       }
     }
+    
     boolean isSuccess = false;
     try {
-      for (AUTH_METHOD authMethod : AUTH_METHOD.values()) {
+      Authentication authentication = inAuthentication;
+      AuthenticationException authException = null;
+      
+      for (AuthMethod authMethod : AuthMethod.values()) {
         try {
           authentication = doAuth(authentication, authMethod);
-          if (authentication != null
-            && authentication.isAuthenticated()) {
-            logger.info("Authenticated using method="
-              + authMethod.name() + ", user="
-              + authentication.getName());
+          if (authentication != null && authentication.isAuthenticated()) {
+            logger.info("Authenticated using method=" + authMethod.name() + ", user=" + authentication.getName());
             auditRecord.put("result", "allowed");
             isSuccess = true;
             auditRecord.put("authType", authMethod.name());
@@ -94,17 +84,15 @@ public class LogsearchAuthenticationProvider extends
           }
         } catch (AuthenticationException ex) {
           if (authException == null) {
-            // Let's save the first one
             authException = ex;
           }
-        }catch(Exception e){
-          logger.error(e,e.getCause());
+        } catch (Exception e) {
+          logger.error(e, e.getCause());
         }
       }
+      
       auditRecord.put("result", "denied");
-      logger.warn("Authentication failed for user="
-        + inAuthentication.getName() + ", userDetail="
-        + inAuthentication.toString());
+      logger.warn("Authentication failed for user=" + inAuthentication.getName() + ", userDetail=" + inAuthentication.toString());
       if (authException != null) {
         auditRecord.put("reason", authException.getMessage());
         throw authException;
@@ -112,25 +100,17 @@ public class LogsearchAuthenticationProvider extends
       return authentication;
     } finally {
       String jsonStr = JSONUtil.mapToJSON(auditRecord);
-      if (isSuccess) {
-        auditLogger.info(jsonStr);
-      } else {
-        auditLogger.warn(jsonStr);
-      }
+      auditLogger.log(isSuccess ? Level.INFO : Level.WARN, jsonStr);
     }
   }
 
-  public Authentication doAuth(Authentication authentication, AUTH_METHOD authMethod) {
-    if (authMethod.equals(AUTH_METHOD.LDAP)) {
-      authentication = ldapAuthenticationProvider.authenticate(authentication);
-    } else if (authMethod.equals(AUTH_METHOD.FILE)) {
-      authentication = fileAuthenticationProvider.authenticate(authentication);
-    } else if (authMethod.equals(AUTH_METHOD.SIMPLE)) {
-      authentication = simpleAuthenticationProvider.authenticate(authentication);
-    } else if (authMethod.equals(AUTH_METHOD.EXTERNAL_AUTH)) {
-      authentication = externalServerAuthenticationProvider.authenticate(authentication);
-    } else {
-      logger.error("Invalid authentication method :" + authMethod.name());
+  private Authentication doAuth(Authentication authentication, AuthMethod authMethod) {
+    switch (authMethod) {
+      case LDAP: return ldapAuthenticationProvider.authenticate(authentication);
+      case FILE: return fileAuthenticationProvider.authenticate(authentication);
+      case EXTERNAL_AUTH: return externalServerAuthenticationProvider.authenticate(authentication);
+      case SIMPLE: return simpleAuthenticationProvider.authenticate(authentication);
+      default: logger.error("Invalid authentication method :" + authMethod.name());
     }
     return authentication;
   }

http://git-wip-us.apache.org/repos/asf/ambari/blob/3f48c53b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchExternalServerAuthenticationProvider.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchExternalServerAuthenticationProvider.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchExternalServerAuthenticationProvider.java
index 7e146ac..e23f0a2 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchExternalServerAuthenticationProvider.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchExternalServerAuthenticationProvider.java
@@ -42,57 +42,30 @@ import org.springframework.security.core.AuthenticationException;
  * call
  */
 @Named
-public class LogsearchExternalServerAuthenticationProvider extends
-    LogsearchAbstractAuthenticationProvider {
+public class LogsearchExternalServerAuthenticationProvider extends LogsearchAbstractAuthenticationProvider {
 
-  private static Logger LOG = Logger
-      .getLogger(LogsearchExternalServerAuthenticationProvider.class);
+  private static Logger LOG = Logger.getLogger(LogsearchExternalServerAuthenticationProvider.class);
 
-  public final static String ALLOWED_ROLE_PROP = "logsearch.roles.allowed";
+  private static final String ALLOWED_ROLE_PROP = "logsearch.roles.allowed";
 
-  public static enum PRIVILEGE_INFO {
-    PERMISSION_LABEL {
-      @Override
-      public String toString() {
-        return "permission_label";
-      }
-    },
-    PERMISSION_NAME {
-      @Override
-      public String toString() {
-        return "permission_name";
-      }
-    },
-    PRINCIPAL_NAME {
-      @Override
-      public String toString() {
-        return "principal_name";
-      }
-    },
-    PRINCIPAL_TYPE {
-      @Override
-      public String toString() {
-        return "principal_type";
-      }
-    },
-    PRIVILEGE_ID {
-      @Override
-      public String toString() {
-        return "privilege_id";
-      }
-    },
-    TYPE {
-      @Override
-      public String toString() {
-        return "type";
-      }
-    },
-    USER_NAME {
-      @Override
-      public String toString() {
-        return "user_name";
-      }
-    };
+  private static enum PrivilegeInfo {
+    PERMISSION_LABEL("permission_label"),
+    PERMISSION_NAME("permission_name"),
+    PRINCIPAL_NAME("principal_name"),
+    PRINCIPAL_TYPE("principal_type"),
+    PRIVILEGE_ID("privilege_id"),
+    TYPE("type"),
+    USER_NAME("user_name");
+    
+    private String propertyKey;
+    
+    private PrivilegeInfo(String name) {
+      this.propertyKey = name;
+    }
+    
+    public String toString() {
+      return propertyKey;
+    }
   }
 
   @Inject
@@ -104,19 +77,17 @@ public class LogsearchExternalServerAuthenticationProvider extends
   /**
    * Authenticating user from external-server using REST call
    * 
-   * @param authentication
-   *          the authentication request object.
+   * @param authentication the authentication request object.
    * @return a fully authenticated object including credentials.
-   * @throws AuthenticationException
-   *           if authentication fails.
+   * @throws AuthenticationException if authentication fails.
    */
   @Override
-  public Authentication authenticate(Authentication authentication)
-      throws AuthenticationException {
+  public Authentication authenticate(Authentication authentication) throws AuthenticationException {
     if (!authPropsConfig.isAuthExternalEnabled()) {
       LOG.debug("external server auth is disabled.");
       return authentication;
     }
+    
     String username = authentication.getName();
     String password = (String) authentication.getCredentials();
     if (StringUtils.isBlank(username)) {
@@ -125,38 +96,32 @@ public class LogsearchExternalServerAuthenticationProvider extends
     if (StringUtils.isBlank(password)) {
       throw new BadCredentialsException("Password can't be null or empty.");
     }
-    // html unescape
     password = StringEscapeUtils.unescapeHtml(password);
     username = StringEscapeUtils.unescapeHtml(username);
+    
     try {
       String finalLoginUrl = authPropsConfig.getExternalAuthLoginUrl().replace("$USERNAME", username);
-      String responseObj = (String) externalServerClient.sendGETRequest(
-          finalLoginUrl, String.class, null, username, password);
+      String responseObj = (String) externalServerClient.sendGETRequest(finalLoginUrl, String.class, username, password);
       if (!isAllowedRole(responseObj)) {
-        LOG.error(username + " does'nt have permission");
+        LOG.error(username + " doesn't have permission");
         throw new BadCredentialsException("Invalid User");
       }
-
     } catch (Exception e) {
-      LOG.error("Login failed for username :" + username + " Error :"
-          + e.getLocalizedMessage());
+      LOG.error("Login failed for username :" + username + " Error :" + e.getLocalizedMessage());
       throw new BadCredentialsException("Bad credentials");
     }
-    authentication = new UsernamePasswordAuthenticationToken(username,
-        password, getAuthorities(username));
+    authentication = new UsernamePasswordAuthenticationToken(username, password, getAuthorities());
     return authentication;
   }
 
   /**
    * Return true/false based on PEMISSION NAME return boolean
    */
-  @SuppressWarnings("static-access")
   private boolean isAllowedRole(String responseJson) {
     String allowedRoleList[] = PropertiesHelper.getPropertyStringList(ALLOWED_ROLE_PROP);
 
     List<String> values = new ArrayList<>();
-    JSONUtil.getValuesOfKey(responseJson,
-        PRIVILEGE_INFO.PERMISSION_NAME.toString(), values);
+    JSONUtil.getValuesOfKey(responseJson, PrivilegeInfo.PERMISSION_NAME.toString(), values);
     if (values.isEmpty())
       return true;
     

http://git-wip-us.apache.org/repos/asf/ambari/blob/3f48c53b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchFileAuthenticationProvider.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchFileAuthenticationProvider.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchFileAuthenticationProvider.java
index 51b3547..8c12e0a 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchFileAuthenticationProvider.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchFileAuthenticationProvider.java
@@ -39,7 +39,7 @@ import javax.inject.Named;
 @Named
 public class LogsearchFileAuthenticationProvider extends LogsearchAbstractAuthenticationProvider {
 
-  private static Logger logger = Logger.getLogger(LogsearchFileAuthenticationProvider.class);
+  private static final Logger logger = Logger.getLogger(LogsearchFileAuthenticationProvider.class);
 
   @Inject
   private AuthPropsConfig authPropsConfig;
@@ -53,6 +53,7 @@ public class LogsearchFileAuthenticationProvider extends LogsearchAbstractAuthen
       logger.debug("File auth is disabled.");
       return authentication;
     }
+    
     String username = authentication.getName();
     String password = (String) authentication.getCredentials();
     if (StringUtils.isBlank(username)) {
@@ -70,16 +71,16 @@ public class LogsearchFileAuthenticationProvider extends LogsearchAbstractAuthen
       logger.error("Username not found.");
       throw new BadCredentialsException("User not found.");
     }
-    if (password == null || password.isEmpty()) {
+    if (StringUtils.isEmpty(user.getPassword())) {
       logger.error("Password can't be null or empty.");
       throw new BadCredentialsException("Password can't be null or empty.");
     }
-
     String encPassword = CommonUtil.encryptPassword(username, password);
     if (!encPassword.equals(user.getPassword())) {
       logger.error("Wrong password for user=" + username);
-      throw new BadCredentialsException("Wrong password");
+      throw new BadCredentialsException("Wrong password.");
     }
+    
     Collection<? extends GrantedAuthority> authorities = user.getAuthorities();
     authentication = new UsernamePasswordAuthenticationToken(username, encPassword, authorities);
     return authentication;

http://git-wip-us.apache.org/repos/asf/ambari/blob/3f48c53b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchSimpleAuthenticationProvider.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchSimpleAuthenticationProvider.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchSimpleAuthenticationProvider.java
index 400361b..92a7aaa 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchSimpleAuthenticationProvider.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchSimpleAuthenticationProvider.java
@@ -34,7 +34,7 @@ import javax.inject.Named;
 @Named
 public class LogsearchSimpleAuthenticationProvider extends LogsearchAbstractAuthenticationProvider {
 
-  private static Logger logger = Logger.getLogger(LogsearchSimpleAuthenticationProvider.class);
+  private static final Logger logger = Logger.getLogger(LogsearchSimpleAuthenticationProvider.class);
 
   @Inject
   private AuthPropsConfig authPropsConfig;
@@ -45,29 +45,28 @@ public class LogsearchSimpleAuthenticationProvider extends LogsearchAbstractAuth
       logger.debug("Simple auth is disabled");
       return authentication;
     }
+    
     String username = authentication.getName();
     String password = (String) authentication.getCredentials();
     username = StringEscapeUtils.unescapeHtml(username);
     if (StringUtils.isBlank(username)) {
       throw new BadCredentialsException("Username can't be null or empty.");
     }
+    
     User user = new User();
     user.setUsername(username);
-    authentication = new UsernamePasswordAuthenticationToken(username, password, getAuthorities(username));
+    authentication = new UsernamePasswordAuthenticationToken(username, password, getAuthorities());
     return authentication;
   }
 
   @Override
-  public boolean isEnable(AUTH_METHOD method) {
-    boolean ldapEnabled = super.isEnable(AUTH_METHOD.LDAP);
-    boolean fileEnabled = super.isEnable(AUTH_METHOD.FILE);
-    boolean externalAuthEnabled = super.isEnable(AUTH_METHOD.EXTERNAL_AUTH);
+  public boolean isEnable(AuthMethod method) {
+    boolean ldapEnabled = super.isEnable(AuthMethod.LDAP);
+    boolean fileEnabled = super.isEnable(AuthMethod.FILE);
+    boolean externalAuthEnabled = super.isEnable(AuthMethod.EXTERNAL_AUTH);
     boolean simpleEnabled = super.isEnable(method);
-    if (!ldapEnabled && !fileEnabled && simpleEnabled && !externalAuthEnabled) {
-      // simple is enabled only when rest three are disabled and simple is enable
-      return true;
-    } else {
-      return false;
-    }
+    
+    // simple is enabled only when rest three are disabled and simple is enable
+    return !ldapEnabled && !fileEnabled && !externalAuthEnabled && simpleEnabled;
   }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/3f48c53b/ambari-logsearch/ambari-logsearch-portal/src/main/scripts/run.sh
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/scripts/run.sh b/ambari-logsearch/ambari-logsearch-portal/src/main/scripts/run.sh
index 4e8901d..1204ef3 100755
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/scripts/run.sh
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/scripts/run.sh
@@ -96,5 +96,5 @@ LOGSEARCH_GC_OPTS="-XX:+PrintGCDetails -XX:+PrintGCDateStamps -Xloggc:$LOGSEARCH
 echo "Starting logsearch. Output file=$LOGFILE pid_file=$PID_FILE"
 #LOGSEARCH_CLI_CLASSPATH=
 #set -x
-nohup $JAVA -cp "$LOGSEARCH_CLI_CLASSPATH:$LOGSEARCH_CONF_DIR:$script_dir/libs/*:$script_dir/classes:$script_dir/LogProcessor.jar" $LOGSEARCH_GC_OPTS $LOGSEARCH_JAVA_MEM $LOGSEARCH_JAVA_OPTS $JMX org.apache.ambari.logsearch.LogSearch $LOGSEARCH_PORT $* > $LOGFILE 2>&1 &
+nohup $JAVA -cp "$LOGSEARCH_CLI_CLASSPATH:$LOGSEARCH_CONF_DIR:$script_dir/libs/*:$script_dir/classes" $LOGSEARCH_GC_OPTS $LOGSEARCH_JAVA_MEM $LOGSEARCH_JAVA_OPTS $JMX org.apache.ambari.logsearch.LogSearch $LOGSEARCH_PORT $* > $LOGFILE 2>&1 &
 echo $! > $PID_FILE

http://git-wip-us.apache.org/repos/asf/ambari/blob/3f48c53b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/web/security/LogsearchAuthenticationProviderTest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/web/security/LogsearchAuthenticationProviderTest.java b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/web/security/LogsearchAuthenticationProviderTest.java
new file mode 100644
index 0000000..c6a5ba5
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/web/security/LogsearchAuthenticationProviderTest.java
@@ -0,0 +1,205 @@
+/*
+ * 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.web.security;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.springframework.security.authentication.TestingAuthenticationToken;
+import org.springframework.security.core.Authentication;
+import org.springframework.security.core.AuthenticationException;
+
+import static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.assertSame;
+import static junit.framework.Assert.assertTrue;
+import static org.easymock.EasyMock.strictMock;
+import static org.easymock.EasyMock.expect;
+import static org.easymock.EasyMock.replay;
+import static org.easymock.EasyMock.verify;
+
+import java.lang.reflect.Field;
+
+public class LogsearchAuthenticationProviderTest {
+  private static final Authentication SUCCESSFUL_AUTHENTICATION = new TestingAuthenticationToken("principal", "credentials");
+  private static final Authentication FAILED_AUTHENTICATION = new TestingAuthenticationToken("principal", "credentials");
+  static {
+    SUCCESSFUL_AUTHENTICATION.setAuthenticated(true);
+    FAILED_AUTHENTICATION.setAuthenticated(false);
+  }
+  
+  private LogsearchAuthenticationProvider provider;
+  
+  private LogsearchLdapAuthenticationProvider mockLdapProvider;
+  private LogsearchFileAuthenticationProvider mockFileProvider;
+  private LogsearchExternalServerAuthenticationProvider mockExternalServerProvider;
+  private LogsearchSimpleAuthenticationProvider mockSimpleProvider;
+  
+  @Before
+  public void resetContext() throws Exception {
+    provider = new LogsearchAuthenticationProvider();
+    
+    mockLdapProvider = strictMock(LogsearchLdapAuthenticationProvider.class);
+    mockFileProvider = strictMock(LogsearchFileAuthenticationProvider.class);
+    mockExternalServerProvider = strictMock(LogsearchExternalServerAuthenticationProvider.class);
+    mockSimpleProvider = strictMock(LogsearchSimpleAuthenticationProvider.class);
+    
+    Field ldapProviderField = LogsearchAuthenticationProvider.class.getDeclaredField("ldapAuthenticationProvider");
+    ldapProviderField.setAccessible(true);
+    ldapProviderField.set(provider, mockLdapProvider);
+    
+    Field fileProviderField = LogsearchAuthenticationProvider.class.getDeclaredField("fileAuthenticationProvider");
+    fileProviderField.setAccessible(true);
+    fileProviderField.set(provider, mockFileProvider);
+    
+    Field extarnalProviderField = LogsearchAuthenticationProvider.class.getDeclaredField("externalServerAuthenticationProvider");
+    extarnalProviderField.setAccessible(true);
+    extarnalProviderField.set(provider, mockExternalServerProvider);
+    
+    Field simpleProviderField = LogsearchAuthenticationProvider.class.getDeclaredField("simpleAuthenticationProvider");
+    simpleProviderField.setAccessible(true);
+    simpleProviderField.set(provider, mockSimpleProvider);
+  }
+  
+  @Test
+  public void testLdapAuthenticates() {
+    Authentication authentication = new TestingAuthenticationToken("principal", "credentials");
+    expect(mockLdapProvider.authenticate(authentication)).andReturn(SUCCESSFUL_AUTHENTICATION);
+    
+    replay(mockLdapProvider, mockFileProvider, mockSimpleProvider, mockExternalServerProvider);
+    
+    Authentication authenticationResult = provider.authenticate(authentication);
+    assertSame(authenticationResult, SUCCESSFUL_AUTHENTICATION);
+    
+    verify(mockLdapProvider, mockFileProvider, mockSimpleProvider, mockExternalServerProvider);
+  }
+  
+  @Test
+  public void testFileAuthenticates() {
+    Authentication authentication = new TestingAuthenticationToken("principal", "credentials");
+    expect(mockLdapProvider.authenticate(authentication)).andReturn(FAILED_AUTHENTICATION);
+    expect(mockFileProvider.authenticate(authentication)).andReturn(SUCCESSFUL_AUTHENTICATION);
+    
+    replay(mockLdapProvider, mockFileProvider, mockSimpleProvider, mockExternalServerProvider);
+    
+    Authentication authenticationResult = provider.authenticate(authentication);
+    assertSame(authenticationResult, SUCCESSFUL_AUTHENTICATION);
+    
+    verify(mockLdapProvider, mockFileProvider, mockSimpleProvider, mockExternalServerProvider);
+  }
+  
+  @Test
+  public void testExternalAuthenticates() {
+    Authentication authentication = new TestingAuthenticationToken("principal", "credentials");
+    expect(mockLdapProvider.authenticate(authentication)).andReturn(FAILED_AUTHENTICATION);
+    expect(mockFileProvider.authenticate(authentication)).andReturn(FAILED_AUTHENTICATION);
+    expect(mockExternalServerProvider.authenticate(authentication)).andReturn(SUCCESSFUL_AUTHENTICATION);
+    
+    replay(mockLdapProvider, mockFileProvider, mockSimpleProvider, mockExternalServerProvider);
+    
+    Authentication authenticationResult = provider.authenticate(authentication);
+    assertSame(authenticationResult, SUCCESSFUL_AUTHENTICATION);
+    
+    verify(mockLdapProvider, mockFileProvider, mockSimpleProvider, mockExternalServerProvider);
+  }
+  
+  @Test
+  public void testSimpleAuthenticates() {
+    Authentication authentication = new TestingAuthenticationToken("principal", "credentials");
+    expect(mockLdapProvider.authenticate(authentication)).andReturn(FAILED_AUTHENTICATION);
+    expect(mockFileProvider.authenticate(authentication)).andReturn(FAILED_AUTHENTICATION);
+    expect(mockExternalServerProvider.authenticate(authentication)).andReturn(FAILED_AUTHENTICATION);
+    expect(mockSimpleProvider.authenticate(authentication)).andReturn(SUCCESSFUL_AUTHENTICATION);
+    
+    replay(mockLdapProvider, mockFileProvider, mockSimpleProvider, mockExternalServerProvider);
+    
+    Authentication authenticationResult = provider.authenticate(authentication);
+    assertSame(authenticationResult, SUCCESSFUL_AUTHENTICATION);
+    
+    verify(mockLdapProvider, mockFileProvider, mockSimpleProvider, mockExternalServerProvider);
+  }
+  
+  @Test
+  public void testNoOneAuthenticates() {
+    Authentication authentication = new TestingAuthenticationToken("principal", "credentials");
+    expect(mockLdapProvider.authenticate(authentication)).andReturn(FAILED_AUTHENTICATION);
+    expect(mockFileProvider.authenticate(authentication)).andReturn(FAILED_AUTHENTICATION);
+    expect(mockExternalServerProvider.authenticate(authentication)).andReturn(FAILED_AUTHENTICATION);
+    expect(mockSimpleProvider.authenticate(authentication)).andReturn(FAILED_AUTHENTICATION);
+    
+    replay(mockLdapProvider, mockFileProvider, mockSimpleProvider, mockExternalServerProvider);
+    
+    Authentication authenticationResult = provider.authenticate(authentication);
+    assertSame(authenticationResult, FAILED_AUTHENTICATION);
+    
+    verify(mockLdapProvider, mockFileProvider, mockSimpleProvider, mockExternalServerProvider);
+  }
+  
+  @Test
+  public void testOneExceptionAndAuthenticates() {
+    Authentication authentication = new TestingAuthenticationToken("principal", "credentials");
+    expect(mockLdapProvider.authenticate(authentication)).andThrow(new AuthenticationException("") {});
+    expect(mockFileProvider.authenticate(authentication)).andReturn(SUCCESSFUL_AUTHENTICATION);
+    
+    replay(mockLdapProvider, mockFileProvider, mockSimpleProvider, mockExternalServerProvider);
+    
+    Authentication authenticationResult = provider.authenticate(authentication);
+    assertSame(authenticationResult, SUCCESSFUL_AUTHENTICATION);
+    
+    verify(mockLdapProvider, mockFileProvider, mockSimpleProvider, mockExternalServerProvider);
+  }
+  
+  @Test
+  public void testOneExceptionNoOneAuthenticates() {
+    Authentication authentication = new TestingAuthenticationToken("principal", "credentials");
+    expect(mockLdapProvider.authenticate(authentication)).andThrow(new AuthenticationException("msg1") {});
+    expect(mockFileProvider.authenticate(authentication)).andReturn(FAILED_AUTHENTICATION);
+    expect(mockExternalServerProvider.authenticate(authentication)).andReturn(FAILED_AUTHENTICATION);
+    expect(mockSimpleProvider.authenticate(authentication)).andReturn(FAILED_AUTHENTICATION);
+    
+    replay(mockLdapProvider, mockFileProvider, mockSimpleProvider, mockExternalServerProvider);
+    
+    try {
+      provider.authenticate(authentication);
+      assertTrue("Should have thrown AuthenticationException", false);
+    } catch(AuthenticationException e) {
+      assertEquals(e.getMessage(), "msg1");
+    }
+    
+    verify(mockLdapProvider, mockFileProvider, mockSimpleProvider, mockExternalServerProvider);
+  }
+  
+  @Test
+  public void testTwoExceptionNoOneAuthenticates() {
+    Authentication authentication = new TestingAuthenticationToken("principal", "credentials");
+    expect(mockLdapProvider.authenticate(authentication)).andThrow(new AuthenticationException("msg1") {});
+    expect(mockFileProvider.authenticate(authentication)).andThrow(new AuthenticationException("msg2") {});
+    expect(mockExternalServerProvider.authenticate(authentication)).andReturn(FAILED_AUTHENTICATION);
+    expect(mockSimpleProvider.authenticate(authentication)).andReturn(FAILED_AUTHENTICATION);
+    
+    replay(mockLdapProvider, mockFileProvider, mockSimpleProvider, mockExternalServerProvider);
+    
+    try {
+      provider.authenticate(authentication);
+      assertTrue("Should have thrown AuthenticationException", false);
+    } catch(AuthenticationException e) {
+      assertEquals(e.getMessage(), "msg1");
+    }
+    
+    verify(mockLdapProvider, mockFileProvider, mockSimpleProvider, mockExternalServerProvider);
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/3f48c53b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/web/security/LogsearchExternalServerAuthenticationProviderTest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/web/security/LogsearchExternalServerAuthenticationProviderTest.java b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/web/security/LogsearchExternalServerAuthenticationProviderTest.java
new file mode 100644
index 0000000..d6247a1
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/web/security/LogsearchExternalServerAuthenticationProviderTest.java
@@ -0,0 +1,185 @@
+/*
+ * 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.web.security;
+
+import org.apache.ambari.logsearch.common.ExternalServerClient;
+import org.apache.ambari.logsearch.conf.AuthPropsConfig;
+import org.junit.Before;
+import org.junit.Test;
+import org.springframework.security.authentication.BadCredentialsException;
+import org.springframework.security.authentication.TestingAuthenticationToken;
+import org.springframework.security.core.Authentication;
+import org.springframework.security.core.authority.SimpleGrantedAuthority;
+
+import static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.assertSame;
+import static junit.framework.Assert.assertTrue;
+import static org.easymock.EasyMock.strictMock;
+import static org.easymock.EasyMock.expect;
+import static org.easymock.EasyMock.replay;
+import static org.easymock.EasyMock.verify;
+
+import java.lang.reflect.Field;
+
+public class LogsearchExternalServerAuthenticationProviderTest {
+
+  private LogsearchExternalServerAuthenticationProvider provider;
+  private AuthPropsConfig mockAuthPropsConfig;
+  private ExternalServerClient mockExternalServerClient;
+  
+  @Before
+  public void init() throws Exception {
+    provider = new LogsearchExternalServerAuthenticationProvider();
+    mockAuthPropsConfig = strictMock(AuthPropsConfig.class);
+    mockExternalServerClient = strictMock(ExternalServerClient.class);
+    
+    Field authPropsConfigField = LogsearchExternalServerAuthenticationProvider.class.getDeclaredField("authPropsConfig");
+    authPropsConfigField.setAccessible(true);
+    authPropsConfigField.set(provider, mockAuthPropsConfig);
+    
+    Field externalServerClientField = LogsearchExternalServerAuthenticationProvider.class.getDeclaredField("externalServerClient");
+    externalServerClientField.setAccessible(true);
+    externalServerClientField.set(provider, mockExternalServerClient);
+  }
+  
+  @Test
+  public void testAuthenticationDisabled() {
+    expect(mockAuthPropsConfig.isAuthExternalEnabled()).andReturn(false);
+    
+    replay(mockAuthPropsConfig);
+    
+    Authentication authentication = new TestingAuthenticationToken("principal", "credentials");
+    assertSame(provider.authenticate(authentication), authentication);
+    
+    verify(mockAuthPropsConfig);
+  }
+  
+  @Test
+  public void testAuthenticationEmptyUser() {
+    expect(mockAuthPropsConfig.isAuthExternalEnabled()).andReturn(true);
+    
+    replay(mockAuthPropsConfig);
+    
+    Authentication authentication = new TestingAuthenticationToken("", "credentials");
+    
+    try {
+      provider.authenticate(authentication);
+      assertTrue("Should have thrown BadCredentialsException", false);
+    } catch(BadCredentialsException e) {
+      assertEquals("Username can't be null or empty.", e.getMessage());
+    }
+    
+    verify(mockAuthPropsConfig);
+  }
+  
+  @Test
+  public void testAuthenticationNullUser() {
+    expect(mockAuthPropsConfig.isAuthExternalEnabled()).andReturn(true);
+    
+    replay(mockAuthPropsConfig);
+    
+    Authentication authentication = new TestingAuthenticationToken(null, "credentials");
+    
+    try {
+      provider.authenticate(authentication);
+      assertTrue("Should have thrown BadCredentialsException", false);
+    } catch(BadCredentialsException e) {
+      assertEquals("Username can't be null or empty.", e.getMessage());
+    }
+    
+    verify(mockAuthPropsConfig);
+  }
+  
+  
+  @Test
+  public void testAuthenticationEmptyPassword() {
+    expect(mockAuthPropsConfig.isAuthExternalEnabled()).andReturn(true);
+    
+    replay(mockAuthPropsConfig);
+    
+    Authentication authentication = new TestingAuthenticationToken("principal", "");
+    
+    try {
+      provider.authenticate(authentication);
+      assertTrue("Should have thrown BadCredentialsException", false);
+    } catch(BadCredentialsException e) {
+      assertEquals("Password can't be null or empty.", e.getMessage());
+    }
+    
+    verify(mockAuthPropsConfig);
+  }
+  
+  @Test
+  public void testAuthenticationNullPassword() {
+    expect(mockAuthPropsConfig.isAuthExternalEnabled()).andReturn(true);
+    
+    replay(mockAuthPropsConfig);
+    
+    Authentication authentication = new TestingAuthenticationToken("principal", null);
+    
+    try {
+      provider.authenticate(authentication);
+      assertTrue("Should have thrown BadCredentialsException", false);
+    } catch(BadCredentialsException e) {
+      assertEquals("Password can't be null or empty.", e.getMessage());
+    }
+    
+    verify(mockAuthPropsConfig);
+  }
+  
+  @Test
+  public void testAuthenticationUnsuccessful() throws Exception {
+    expect(mockAuthPropsConfig.isAuthExternalEnabled()).andReturn(true);
+    expect(mockAuthPropsConfig.getExternalAuthLoginUrl()).andReturn("http://server.com?userName=$USERNAME");
+    expect(mockExternalServerClient.sendGETRequest("http://server.com?userName=principal", String.class, "principal", "credentials"))
+    .andReturn("{\"permission_name\": \"NOT.AMBARI.ADMINISTRATOR\" }");
+    
+    replay(mockAuthPropsConfig, mockExternalServerClient);
+    
+    Authentication authentication = new TestingAuthenticationToken("principal", "credentials");
+    try {
+      provider.authenticate(authentication);
+      assertTrue("Should have thrown BadCredentialsException", false);
+    } catch (BadCredentialsException e) {
+      assertEquals("Bad credentials", e.getMessage());
+    }
+    
+    verify(mockAuthPropsConfig, mockExternalServerClient);
+  }
+  
+  @Test
+  public void testAuthenticationSuccessful() throws Exception {
+    expect(mockAuthPropsConfig.isAuthExternalEnabled()).andReturn(true);
+    expect(mockAuthPropsConfig.getExternalAuthLoginUrl()).andReturn("http://server.com?userName=$USERNAME");
+    expect(mockExternalServerClient.sendGETRequest("http://server.com?userName=principal", String.class, "principal", "credentials"))
+      .andReturn("{\"permission_name\": \"AMBARI.ADMINISTRATOR\" }");
+    
+    replay(mockAuthPropsConfig, mockExternalServerClient);
+    
+    Authentication authentication = new TestingAuthenticationToken("principal", "credentials");
+    Authentication authenticationResult = provider.authenticate(authentication);
+    
+    assertEquals("principal", authenticationResult.getName());
+    assertEquals("credentials", authenticationResult.getCredentials());
+    assertEquals(1, authenticationResult.getAuthorities().size());
+    assertEquals(new SimpleGrantedAuthority("ROLE_USER"), authenticationResult.getAuthorities().iterator().next());
+    
+    verify(mockAuthPropsConfig, mockExternalServerClient);
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/3f48c53b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/web/security/LogsearchFileAuthenticationProviderTest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/web/security/LogsearchFileAuthenticationProviderTest.java b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/web/security/LogsearchFileAuthenticationProviderTest.java
new file mode 100644
index 0000000..407cc83
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/web/security/LogsearchFileAuthenticationProviderTest.java
@@ -0,0 +1,231 @@
+/*
+ * 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.web.security;
+
+import org.apache.ambari.logsearch.conf.AuthPropsConfig;
+import org.apache.ambari.logsearch.util.CommonUtil;
+import org.apache.ambari.logsearch.web.model.User;
+import org.junit.Before;
+import org.junit.Test;
+import org.springframework.security.authentication.BadCredentialsException;
+import org.springframework.security.authentication.TestingAuthenticationToken;
+import org.springframework.security.core.Authentication;
+import org.springframework.security.core.GrantedAuthority;
+import org.springframework.security.core.authority.SimpleGrantedAuthority;
+import org.springframework.security.core.userdetails.UserDetailsService;
+
+import static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.assertSame;
+import static junit.framework.Assert.assertTrue;
+import static org.easymock.EasyMock.strictMock;
+import static org.easymock.EasyMock.expect;
+import static org.easymock.EasyMock.replay;
+import static org.easymock.EasyMock.verify;
+
+import java.lang.reflect.Field;
+import java.util.Arrays;
+import java.util.List;
+
+public class LogsearchFileAuthenticationProviderTest {
+
+  private LogsearchFileAuthenticationProvider provider;
+  private AuthPropsConfig mockAuthPropsConfig;
+  private UserDetailsService mockUserDetailsService;
+  
+  @Before
+  public void init() throws Exception {
+    provider = new LogsearchFileAuthenticationProvider();
+    mockAuthPropsConfig = strictMock(AuthPropsConfig.class);
+    mockUserDetailsService = strictMock(UserDetailsService.class);
+    
+    Field authPropsConfigField = LogsearchFileAuthenticationProvider.class.getDeclaredField("authPropsConfig");
+    authPropsConfigField.setAccessible(true);
+    authPropsConfigField.set(provider, mockAuthPropsConfig);
+    
+    Field userDetailsServiceField = LogsearchFileAuthenticationProvider.class.getDeclaredField("userDetailsService");
+    userDetailsServiceField.setAccessible(true);
+    userDetailsServiceField.set(provider, mockUserDetailsService);
+  }
+  
+  @Test
+  public void testAuthenticationDisabled() {
+    expect(mockAuthPropsConfig.isAuthFileEnabled()).andReturn(false);
+    
+    replay(mockAuthPropsConfig);
+    
+    Authentication authentication = new TestingAuthenticationToken("principal", "credentials");
+    assertSame(provider.authenticate(authentication), authentication);
+    
+    verify(mockAuthPropsConfig);
+  }
+  
+  @Test
+  public void testAuthenticationEmptyUser() {
+    expect(mockAuthPropsConfig.isAuthFileEnabled()).andReturn(true);
+    
+    replay(mockAuthPropsConfig);
+    
+    Authentication authentication = new TestingAuthenticationToken("", "credentials");
+    
+    try {
+      provider.authenticate(authentication);
+      assertTrue("Should have thrown BadCredentialsException", false);
+    } catch(BadCredentialsException e) {
+      assertEquals("Username can't be null or empty.", e.getMessage());
+    }
+    
+    verify(mockAuthPropsConfig);
+  }
+  
+  @Test
+  public void testAuthenticationNullUser() {
+    expect(mockAuthPropsConfig.isAuthFileEnabled()).andReturn(true);
+    
+    replay(mockAuthPropsConfig);
+    
+    Authentication authentication = new TestingAuthenticationToken(null, "credentials");
+    
+    try {
+      provider.authenticate(authentication);
+      assertTrue("Should have thrown BadCredentialsException", false);
+    } catch(BadCredentialsException e) {
+      assertEquals("Username can't be null or empty.", e.getMessage());
+    }
+    
+    verify(mockAuthPropsConfig);
+  }
+  
+  
+  @Test
+  public void testAuthenticationEmptyPassword() {
+    expect(mockAuthPropsConfig.isAuthFileEnabled()).andReturn(true);
+    
+    replay(mockAuthPropsConfig);
+    
+    Authentication authentication = new TestingAuthenticationToken("principal", "");
+    
+    try {
+      provider.authenticate(authentication);
+      assertTrue("Should have thrown BadCredentialsException", false);
+    } catch(BadCredentialsException e) {
+      assertEquals("Password can't be null or empty.", e.getMessage());
+    }
+    
+    verify(mockAuthPropsConfig);
+  }
+  
+  @Test
+  public void testAuthenticationNullPassword() {
+    expect(mockAuthPropsConfig.isAuthFileEnabled()).andReturn(true);
+    
+    replay(mockAuthPropsConfig);
+    
+    Authentication authentication = new TestingAuthenticationToken("principal", null);
+    
+    try {
+      provider.authenticate(authentication);
+      assertTrue("Should have thrown BadCredentialsException", false);
+    } catch(BadCredentialsException e) {
+      assertEquals("Password can't be null or empty.", e.getMessage());
+    }
+    
+    verify(mockAuthPropsConfig);
+  }
+  
+  @Test
+  public void testAuthenticationUnknownUser() {
+    expect(mockAuthPropsConfig.isAuthFileEnabled()).andReturn(true);
+    expect(mockUserDetailsService.loadUserByUsername("principal")).andReturn(null);
+    
+    replay(mockAuthPropsConfig, mockUserDetailsService);
+    
+    Authentication authentication = new TestingAuthenticationToken("principal", "credentials");
+    try {
+      provider.authenticate(authentication);
+      assertTrue("Should have thrown BadCredentialsException", false);
+    } catch (BadCredentialsException e) {
+      assertEquals("User not found.", e.getMessage());
+    }
+    
+    verify(mockAuthPropsConfig, mockUserDetailsService);
+  }
+  
+  @Test
+  public void testAuthenticationNoPassword() {
+    List<GrantedAuthority> grantedAuths = Arrays.<GrantedAuthority>asList(new SimpleGrantedAuthority("ROLE_USER"));
+    User user = new User("principal", null, grantedAuths);
+    
+    expect(mockAuthPropsConfig.isAuthFileEnabled()).andReturn(true);
+    expect(mockUserDetailsService.loadUserByUsername("principal")).andReturn(user);
+    
+    replay(mockAuthPropsConfig, mockUserDetailsService);
+    
+    Authentication authentication = new TestingAuthenticationToken("principal", "credentials");
+    try {
+      provider.authenticate(authentication);
+      assertTrue("Should have thrown BadCredentialsException", false);
+    } catch (BadCredentialsException e) {
+      assertEquals("Password can't be null or empty.", e.getMessage());
+    }
+    
+    verify(mockAuthPropsConfig, mockUserDetailsService);
+  }
+  
+  @Test
+  public void testAuthenticationWrongPassword() {
+    List<GrantedAuthority> grantedAuths = Arrays.<GrantedAuthority>asList(new SimpleGrantedAuthority("ROLE_USER"));
+    User user = new User("principal", CommonUtil.encryptPassword("principal", "notCredentials"), grantedAuths);
+    
+    expect(mockAuthPropsConfig.isAuthFileEnabled()).andReturn(true);
+    expect(mockUserDetailsService.loadUserByUsername("principal")).andReturn(user);
+    
+    replay(mockAuthPropsConfig, mockUserDetailsService);
+    
+    Authentication authentication = new TestingAuthenticationToken("principal", "credentials");
+    try {
+      provider.authenticate(authentication);
+      assertTrue("Should have thrown BadCredentialsException", false);
+    } catch (BadCredentialsException e) {
+      assertEquals("Wrong password.", e.getMessage());
+    }
+    
+    verify(mockAuthPropsConfig, mockUserDetailsService);
+  }
+  
+  @Test
+  public void testAuthenticationSuccessful() {
+    List<GrantedAuthority> grantedAuths = Arrays.<GrantedAuthority>asList(new SimpleGrantedAuthority("ROLE_USER"));
+    User user = new User("principal", CommonUtil.encryptPassword("principal", "credentials"), grantedAuths);
+    
+    expect(mockAuthPropsConfig.isAuthFileEnabled()).andReturn(true);
+    expect(mockUserDetailsService.loadUserByUsername("principal")).andReturn(user);
+    
+    replay(mockAuthPropsConfig, mockUserDetailsService);
+    
+    Authentication authentication = new TestingAuthenticationToken("principal", "credentials");
+    
+    Authentication authenticationResult = provider.authenticate(authentication);
+    assertEquals("principal", authenticationResult.getName());
+    assertEquals(CommonUtil.encryptPassword("principal", "credentials"), authenticationResult.getCredentials());
+    assertEquals(1, authenticationResult.getAuthorities().size());
+    assertEquals(new SimpleGrantedAuthority("ROLE_USER"), authenticationResult.getAuthorities().iterator().next());
+    
+    verify(mockAuthPropsConfig, mockUserDetailsService);
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/3f48c53b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/web/security/LogsearchLdapAuthenticationProviderTest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/web/security/LogsearchLdapAuthenticationProviderTest.java b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/web/security/LogsearchLdapAuthenticationProviderTest.java
new file mode 100644
index 0000000..c6af3e2
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/web/security/LogsearchLdapAuthenticationProviderTest.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.web.security;
+
+import org.apache.ambari.logsearch.conf.AuthPropsConfig;
+import org.junit.Before;
+import org.junit.Test;
+import org.springframework.security.authentication.TestingAuthenticationToken;
+import org.springframework.security.core.Authentication;
+
+import static junit.framework.Assert.assertSame;
+import static org.easymock.EasyMock.strictMock;
+import static org.easymock.EasyMock.expect;
+import static org.easymock.EasyMock.replay;
+import static org.easymock.EasyMock.verify;
+
+import java.lang.reflect.Field;
+
+public class LogsearchLdapAuthenticationProviderTest {
+
+  private LogsearchLdapAuthenticationProvider provider;
+  private AuthPropsConfig mockAuthPropsConfig;
+  
+  @Before
+  public void init() throws Exception {
+    provider = new LogsearchLdapAuthenticationProvider();
+    mockAuthPropsConfig = strictMock(AuthPropsConfig.class);
+    
+    Field f = LogsearchLdapAuthenticationProvider.class.getDeclaredField("authPropsConfig");
+    f.setAccessible(true);
+    f.set(provider, mockAuthPropsConfig);
+  }
+  
+  @Test
+  public void testAuthenticationDisabled() {
+    expect(mockAuthPropsConfig.isAuthLdapEnabled()).andReturn(false);
+    
+    replay(mockAuthPropsConfig);
+    
+    Authentication authentication = new TestingAuthenticationToken("principal", "credentials");
+    assertSame(provider.authenticate(authentication), authentication);
+    
+    verify(mockAuthPropsConfig);
+  }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/3f48c53b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/web/security/LogsearchSimpleAuthenticationProviderTest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/web/security/LogsearchSimpleAuthenticationProviderTest.java b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/web/security/LogsearchSimpleAuthenticationProviderTest.java
new file mode 100644
index 0000000..7287012
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/test/java/org/apache/ambari/logsearch/web/security/LogsearchSimpleAuthenticationProviderTest.java
@@ -0,0 +1,118 @@
+/*
+ * 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.web.security;
+
+import org.apache.ambari.logsearch.conf.AuthPropsConfig;
+import org.junit.Before;
+import org.junit.Test;
+import org.springframework.security.authentication.BadCredentialsException;
+import org.springframework.security.authentication.TestingAuthenticationToken;
+import org.springframework.security.core.Authentication;
+import org.springframework.security.core.authority.SimpleGrantedAuthority;
+
+import static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.assertSame;
+import static junit.framework.Assert.assertTrue;
+import static org.easymock.EasyMock.strictMock;
+import static org.easymock.EasyMock.expect;
+import static org.easymock.EasyMock.replay;
+import static org.easymock.EasyMock.verify;
+
+import java.lang.reflect.Field;
+
+public class LogsearchSimpleAuthenticationProviderTest {
+
+  private LogsearchSimpleAuthenticationProvider provider;
+  private AuthPropsConfig mockAuthPropsConfig;
+  
+  @Before
+  public void init() throws Exception {
+    provider = new LogsearchSimpleAuthenticationProvider();
+    mockAuthPropsConfig = strictMock(AuthPropsConfig.class);
+    
+    Field f = LogsearchSimpleAuthenticationProvider.class.getDeclaredField("authPropsConfig");
+    f.setAccessible(true);
+    f.set(provider, mockAuthPropsConfig);
+  }
+  
+  @Test
+  public void testAuthenticationDisabled() {
+    expect(mockAuthPropsConfig.isAuthSimpleEnabled()).andReturn(false);
+    
+    replay(mockAuthPropsConfig);
+    
+    Authentication authentication = new TestingAuthenticationToken("principal", "credentials");
+    assertSame(provider.authenticate(authentication), authentication);
+    
+    verify(mockAuthPropsConfig);
+  }
+  
+  @Test
+  public void testAuthenticationEmptyUser() {
+    expect(mockAuthPropsConfig.isAuthSimpleEnabled()).andReturn(true);
+    
+    replay(mockAuthPropsConfig);
+    
+    Authentication authentication = new TestingAuthenticationToken("", "credentials");
+    
+    try {
+      provider.authenticate(authentication);
+      assertTrue("Should have thrown BadCredentialsException", false);
+    } catch(BadCredentialsException e) {
+      assertEquals("Username can't be null or empty.", e.getMessage());
+    }
+    
+    verify(mockAuthPropsConfig);
+  }
+  
+  @Test
+  public void testAuthenticationNullUser() {
+    expect(mockAuthPropsConfig.isAuthSimpleEnabled()).andReturn(true);
+    
+    replay(mockAuthPropsConfig);
+    
+    Authentication authentication = new TestingAuthenticationToken(null, "credentials");
+    
+    try {
+      provider.authenticate(authentication);
+      assertTrue("Should have thrown BadCredentialsException", false);
+    } catch(BadCredentialsException e) {
+      assertEquals("Username can't be null or empty.", e.getMessage());
+    }
+    
+    verify(mockAuthPropsConfig);
+  }
+  
+  @Test
+  public void testAuthenticationSuccessful() {
+    expect(mockAuthPropsConfig.isAuthSimpleEnabled()).andReturn(true);
+    
+    replay(mockAuthPropsConfig);
+    
+    Authentication authentication = new TestingAuthenticationToken("principal", "credentials");
+    
+    Authentication authenticationResult = provider.authenticate(authentication);
+    assertEquals("principal", authenticationResult.getName());
+    assertEquals("credentials", authenticationResult.getCredentials());
+    assertEquals(1, authenticationResult.getAuthorities().size());
+    assertEquals(new SimpleGrantedAuthority("ROLE_USER"), authenticationResult.getAuthorities().iterator().next());
+    
+    verify(mockAuthPropsConfig);
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/3f48c53b/ambari-logsearch/ambari-logsearch-portal/src/test/resources/logsearch.properties
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/test/resources/logsearch.properties b/ambari-logsearch/ambari-logsearch-portal/src/test/resources/logsearch.properties
index fa3efb8..2715d1f 100755
--- a/ambari-logsearch/ambari-logsearch-portal/src/test/resources/logsearch.properties
+++ b/ambari-logsearch/ambari-logsearch-portal/src/test/resources/logsearch.properties
@@ -29,4 +29,5 @@ logsearch.collection.history.replication.factor=234
 logsearch.solr.collection.history=test_history_logs_collection
 
 logsearch.auth.file.enable=true
-logsearch.login.credentials.file=user_pass.json
\ No newline at end of file
+logsearch.login.credentials.file=user_pass.json
+logsearch.roles.allowed=AMBARI.ADMINISTRATOR

http://git-wip-us.apache.org/repos/asf/ambari/blob/3f48c53b/ambari-logsearch/docker/.gitignore
----------------------------------------------------------------------
diff --git a/ambari-logsearch/docker/.gitignore b/ambari-logsearch/docker/.gitignore
index 0d6af58..99455ed 100644
--- a/ambari-logsearch/docker/.gitignore
+++ b/ambari-logsearch/docker/.gitignore
@@ -1 +1 @@
-Profile
\ No newline at end of file
+Profile

http://git-wip-us.apache.org/repos/asf/ambari/blob/3f48c53b/ambari-logsearch/docker/Dockerfile
----------------------------------------------------------------------
diff --git a/ambari-logsearch/docker/Dockerfile b/ambari-logsearch/docker/Dockerfile
index a09f235..dfa1462 100644
--- a/ambari-logsearch/docker/Dockerfile
+++ b/ambari-logsearch/docker/Dockerfile
@@ -62,12 +62,12 @@ ADD test-logs /root/test-logs
 RUN chmod -R 777 /root/test-config
 RUN chmod +x /root/start.sh
 
-ENV SOLR_CONFIG_LOCATION /root/test-config/solr
-ENV LOGSEARCH_CONFIG_LOCATION /root/test-config/logsearch
-ENV LOGFEEDER_CONFIG_LOCATION /root/test-config/logfeeder
-ENV SOLR_INCLUDE /root/test-config/solr/solr-env.sh
-ENV LOGSEARCH_INCLUDE /root/test-config/logsearch/logsearch-env.sh
-ENV LOGFEEDER_INCLUDE /root/test-config/logfeeder/logfeeder-env.sh
+ENV SOLR_CONFIG_LOCATION /root/config/solr
+ENV LOGSEARCH_CONFIG_LOCATION /root/config/logsearch
+ENV LOGFEEDER_CONFIG_LOCATION /root/config/logfeeder
+ENV SOLR_INCLUDE /root/config/solr/solr-env.sh
+ENV LOGSEARCH_INCLUDE /root/config/logsearch/logsearch-env.sh
+ENV LOGFEEDER_INCLUDE /root/config/logfeeder/logfeeder-env.sh
 
 RUN mkdir -p /var/run/ambari-logsearch-solr /var/log/ambari-logsearch-solr /var/run/ambari-logsearch-solr-client \
   /var/log/ambari-logsearch-solr-client /root/logsearch_solr_index/data \
@@ -78,4 +78,4 @@ RUN cp /root/test-config/solr/solr.xml /root/logsearch_solr_index/data
 RUN cp /root/test-config/solr/zoo.cfg /root/logsearch_solr_index/data
 
 WORKDIR /root
-CMD /root/start.sh
\ No newline at end of file
+CMD /root/start.sh

http://git-wip-us.apache.org/repos/asf/ambari/blob/3f48c53b/ambari-logsearch/docker/bin/start.sh
----------------------------------------------------------------------
diff --git a/ambari-logsearch/docker/bin/start.sh b/ambari-logsearch/docker/bin/start.sh
index a09e4b2..81c9e66 100644
--- a/ambari-logsearch/docker/bin/start.sh
+++ b/ambari-logsearch/docker/bin/start.sh
@@ -28,27 +28,70 @@ function build_all() {
   cd $AMBARI_PATH/ambari-logsearch && mvn clean package -DskipTests && mvn -pl ambari-logsearch-logfeeder clean package -DskipTests
 }
 
+function create_config() {
+  mkdir /root/config
+
+  mkdir /root/config/solr
+  cp /root/test-config/solr/log4j.properties /root/config/solr/
+  cp /root/test-config/solr/zoo.cfg /root/config/solr/
+  cp /root/test-config/solr/solr.xml /root/config/solr/
+  if [ $LOGSEARCH_SOLR_SSL_ENABLED == 'true' ]
+  then
+    cp /root/test-config/solr/solr-env-ssl.sh /root/config/solr/solr-env.sh
+  else
+    cp /root/test-config/solr/solr-env.sh /root/config/solr/solr-env.sh
+  fi
+
+  mkdir /root/config/logfeeder
+  cp -r /root/test-config/logfeeder/* /root/config/logfeeder/
+
+  mkdir /root/config/logsearch
+  cp /root/test-config/logsearch/log4j.xml /root/config/logsearch/
+  cp /root/test-config/logsearch/logsearch-env.sh /root/config/logsearch/
+  if [ $LOGSEARCH_HTTPS_ENABLED == 'true' ]
+  then
+    cp /root/test-config/logsearch/logsearch-https.properties /root/config/logsearch/logsearch.properties
+  else
+    cp /root/test-config/logsearch/logsearch.properties /root/config/logsearch/logsearch.properties
+  fi
+
+  chmod -R 777 /root/config
+}
+
+function generate_keys() {
+  IP=`hostname --ip-address`
+  echo "generating stores for IP: $IP"
+  mkdir /root/config/ssl
+  keytool -genkeypair -alias logsearch -keyalg RSA -keysize 2048 -keypass bigdata -storepass bigdata -validity 9999 -keystore /root/config/ssl/logsearch.keyStore.jks -ext SAN=DNS:localhost,IP:127.0.0.1,IP:$IP -dname "CN=Common Name, OU=Organizational Unit, O=Organization, L=Location, ST=State, C=Country" -rfc
+  cp /root/config/ssl/logsearch.keyStore.jks /root/config/ssl/logsearch.trustStore.jks
+}
+
 function start_solr() {
   echo "Starting Solr..."
   /root/solr-$SOLR_VERSION/bin/solr start -cloud -s /root/logsearch_solr_index/data -verbose
   touch /var/log/ambari-logsearch-solr/solr.log
+
+  if [ $LOGSEARCH_SOLR_SSL_ENABLED == 'true'  ]
+  then
+    echo "Setting urlScheme as https and restarting solr..."
+    $ZKCLI -zkhost localhost:9983 -cmd clusterprop -name urlScheme -val https
+    /root/solr-$SOLR_VERSION/bin/solr stop
+    /root/solr-$SOLR_VERSION/bin/solr start -cloud -s /root/logsearch_solr_index/data -verbose
+  fi
 }
 
 function start_logsearch() {
   echo "Upload configuration sets ..."
+
   $ZKCLI  -zkhost localhost:9983 -cmd upconfig -confdir $LOGSEARCH_SERVER_PATH/solr_configsets/audit_logs/conf -confname audit_logs
   $ZKCLI  -zkhost localhost:9983 -cmd upconfig -confdir $LOGSEARCH_SERVER_PATH/solr_configsets/hadoop_logs/conf -confname hadoop_logs
   $ZKCLI  -zkhost localhost:9983 -cmd upconfig -confdir $LOGSEARCH_SERVER_PATH/solr_configsets/history/conf -confname history
-
-  cp $LOGSEARCH_CONFIG_LOCATION/logsearch.properties /root/ambari/ambari-logsearch/ambari-logsearch-portal/target/package/classes/logsearch.properties
-  cp $LOGSEARCH_CONFIG_LOCATION/log4j.xml /root/ambari/ambari-logsearch/ambari-logsearch-portal/target/package/classes/logsearch.properties
+  
   $LOGSEARCH_SERVER_PATH/run.sh
   touch /var/log/ambari-logsearch-portal/logsearch-app.log
 }
 
 function start_logfeeder() {
-  cp $LOGFEEDER_CONFIG_LOCATION/logfeeder.properties /root/ambari/ambari-logsearch/ambari-logsearch-logfeeder/target/package/classes/logfeeder.properties
-  cp $LOGFEEDER_CONFIG_LOCATION/log4j.xml /root/ambari/ambari-logsearch/ambari-logsearch-logfeeder/target/package/classes/log4j.xml
   $LOGFEEDER_PATH/run.sh
   touch /var/log/ambari-logsearch-logfeeder/logsearch-logfeeder.log
 }
@@ -68,10 +111,10 @@ function log() {
   esac
 }
 
+create_config
+generate_keys
 start_solr
 start_logsearch
 start_logfeeder
 log
 
-
-

http://git-wip-us.apache.org/repos/asf/ambari/blob/3f48c53b/ambari-logsearch/docker/logsearch-docker.sh
----------------------------------------------------------------------
diff --git a/ambari-logsearch/docker/logsearch-docker.sh b/ambari-logsearch/docker/logsearch-docker.sh
index 022b1ba..76994ee 100755
--- a/ambari-logsearch/docker/logsearch-docker.sh
+++ b/ambari-logsearch/docker/logsearch-docker.sh
@@ -57,8 +57,10 @@ function setup_profile() {
 AMBARI_LOCATION=$HOME/prj/ambari
 MAVEN_REPOSITORY_LOCATION=$HOME/.m2
 LOGSEARCH_EXPOSED_PORTS="-p 8886:8886 -p 61888:61888 -p 5005:5005 -p 5006:5006"
-LOGSEARCH_ENV_OPTS="-e LOGFEEDER_DEBUG_SUSPEND=n -e LOGSEARCH_DEBUG_SUSPEND=n -e COMPONENT_LOG=logsearch"
-LOGSEARCH_VOLUME_OPTS="-v \$AMBARI_LOCATION/ambari-logsearch/docker/test-logs:/root/test-logs -v \$AMBARI_LOCATION/ambari-logsearch/docker/test-config:/root/test-config "
+LOGSEARCH_ENV_OPTS="-e LOGFEEDER_DEBUG_SUSPEND=n -e LOGSEARCH_DEBUG_SUSPEND=n -e COMPONENT_LOG=logsearch -e LOGSEARCH_HTTPS_ENABLED=false -e LOGSEARCH_SOLR_SSL_ENABLED=false"
+
+LOGSEARCH_VOLUME_OPTS="-v $AMBARI_LOCATION/ambari-logsearch/docker/test-logs:/root/test-logs -v $AMBARI_LOCATION/ambari-logsearch/docker/test-config:/root/test-config"
+
 LOGSEARCH_EXTRA_OPTS=""
 EOF
     echo "Profile has been created. Check it out before starting Log Search. ($sdir/Profile)"

http://git-wip-us.apache.org/repos/asf/ambari/blob/3f48c53b/ambari-logsearch/docker/test-config/logfeeder/logfeeder-env.sh
----------------------------------------------------------------------
diff --git a/ambari-logsearch/docker/test-config/logfeeder/logfeeder-env.sh b/ambari-logsearch/docker/test-config/logfeeder/logfeeder-env.sh
index e69b1db..5beb093 100644
--- a/ambari-logsearch/docker/test-config/logfeeder/logfeeder-env.sh
+++ b/ambari-logsearch/docker/test-config/logfeeder/logfeeder-env.sh
@@ -18,7 +18,7 @@ set -e
 
 export LOGFEEDER_PATH=/root/ambari/ambari-logsearch/ambari-logsearch-logfeeder/target/package
 
-export LOGFEEDER_CONF_DIR=/root/test-config/logfeeder
+export LOGFEEDER_CONF_DIR=/root/config/logfeeder
 
 #Logfile e.g. /var/log/logfeeder.log
 export LOGFILE=/var/log/ambari-logsearch-logfeeder/logfeeder.out
@@ -32,4 +32,13 @@ LOGFEEDER_JAVA_MEM=${LOGFEEDER_JAVA_MEM:-"-Xmx512m"}
 
 export LOGFEEDER_DEBUG=true
 
-export LOGFEEDER_DEBUG_PORT=5006
\ No newline at end of file
+export LOGFEEDER_DEBUG_PORT=5006
+
+export LOGFEEDER_SSL="true"
+export LOGFEEDER_KEYSTORE_LOCATION=/root/config/ssl/logsearch.keyStore.jks
+export LOGFEEDER_KEYSTORE_PASSWORD=bigdata
+export LOGFEEDER_KEYSTORE_TYPE=jks
+export LOGFEEDER_TRUSTSTORE_LOCATION=/root/config/ssl/logsearch.trustStore.jks
+export LOGFEEDER_TRUSTSTORE_PASSWORD=bigdata
+export LOGFEEDER_TRUSTSTORE_TYPE=jks
+