ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mgerg...@apache.org
Subject ambari git commit: AMBARI-19659 Log Search should handle new services (mgergely)
Date Sat, 21 Jan 2017 22:18:22 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 75100cb4d -> f98c2b4ed


AMBARI-19659 Log Search should handle new services (mgergely)

Change-Id: Iea0a9923f437897ab7722861290ac7e5edf2df41


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

Branch: refs/heads/trunk
Commit: f98c2b4ed5189d9bf3048d4829e21569b447b12e
Parents: 75100cb
Author: Miklos Gergely <mgergely@hortonworks.com>
Authored: Sat Jan 21 23:18:13 2017 +0100
Committer: Miklos Gergely <mgergely@hortonworks.com>
Committed: Sat Jan 21 23:18:13 2017 +0100

----------------------------------------------------------------------
 .../ambari/logsearch/dao/UserConfigSolrDao.java | 32 +++++++-----
 .../LOGSEARCH/0.5.0/metainfo.xml                | 52 ++++++++++----------
 2 files changed, 46 insertions(+), 38 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/f98c2b4e/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 13d7e03..256ddae 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
@@ -152,30 +152,36 @@ public class UserConfigSolrDao extends SolrDaoBase {
       logfeederDataMap = (LogFeederDataMap) JSONUtil.jsonToObj(json, LogFeederDataMap.class);
       logfeederDataMap.setId("" + configDoc.get(ID));
     } else {
-      logfeederDataMap = initUserFilter();
+      logfeederDataMap = new LogFeederDataMap();
+      logfeederDataMap.setFilter(new TreeMap<String, LogfeederFilterData>());
+      logfeederDataMap.setId(Long.toString(System.currentTimeMillis()));
     }
+    
+    addMissingFilters(logfeederDataMap);
+    
     return logfeederDataMap;
   }
 
-  private LogFeederDataMap initUserFilter() throws SolrServerException, IOException {
-    LogFeederDataMap logfeederDataMap = new LogFeederDataMap();
-    
+  private void addMissingFilters(LogFeederDataMap logfeederDataMap) throws SolrServerException,
IOException {
     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();
       
+      boolean modified = false;
       for (String logId : logIds) {
-        LogfeederFilterData logfeederFilterData = new LogfeederFilterData();
-        logfeederFilterData.setLabel(logId);
-        logfeederFilterData.setDefaultLevels(logfeederDefaultLevels);
-        logfeederDataMap.getFilter().put(logId, logfeederFilterData);
+        if (!logfeederDataMap.getFilter().containsKey(logId)) {
+          LogfeederFilterData logfeederFilterData = new LogfeederFilterData();
+          logfeederFilterData.setLabel(logId);
+          logfeederFilterData.setDefaultLevels(logfeederDefaultLevels);
+          logfeederDataMap.getFilter().put(logId, logfeederFilterData);
+          modified = true;
+        }
+      }
+      
+      if (modified) {
+        saveUserFilter(logfeederDataMap);
       }
-      saveUserFilter(logfeederDataMap);
     }
-    
-    return logfeederDataMap;
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/ambari/blob/f98c2b4e/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 2bd5bd1..8a9105e 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
@@ -65,7 +65,6 @@
             <config-type>logsearch-admin-json</config-type>
             <config-type>logsearch-service_logs-solrconfig.xml</config-type>
             <config-type>logsearch-audit_logs-solrconfig.xml</config-type>
-            <config-type>logfeeder-custom-logsearch-config</config-type>
           </configuration-dependencies>
         </component>
 
@@ -95,31 +94,7 @@
             <config-type>logfeeder-grok</config-type>
             <config-type>logfeeder-log4j</config-type>
             <config-type>logfeeder-system_log-env</config-type>
-            <config-type>logfeeder-ambari-config</config-type>
             <config-type>logfeeder-output-config</config-type>
-            <config-type>logfeeder-custom-logsearch-config</config-type>
-            <config-type>accumulo-logsearch-conf</config-type>
-            <config-type>ams-logsearch-conf</config-type>
-            <config-type>atlas-logsearch-conf</config-type>
-            <config-type>falcon-logsearch-conf</config-type>
-            <config-type>flume-logsearch-conf</config-type>
-            <config-type>hbase-logsearch-conf</config-type>
-            <config-type>hdfs-logsearch-conf</config-type>
-            <config-type>hive-logsearch-conf</config-type>
-            <config-type>infra-logsearch-conf</config-type>
-            <config-type>kafka-logsearch-conf</config-type>
-            <config-type>knox-logsearch-conf</config-type>
-            <config-type>mapred-logsearch-conf</config-type>
-            <config-type>nifi-logsearch-conf</config-type>
-            <config-type>oozie-logsearch-conf</config-type>
-            <config-type>ranger-kms-logsearch-conf</config-type>
-            <config-type>ranger-logsearch-conf</config-type>
-            <config-type>spark-logsearch-conf</config-type>
-            <config-type>spark2-logsearch-conf</config-type>
-            <config-type>storm-logsearch-conf</config-type>
-            <config-type>yarn-logsearch-conf</config-type>
-            <config-type>zeppelin-logsearch-conf</config-type>
-            <config-type>zookeeper-logsearch-conf</config-type>
           </configuration-dependencies>
         </component>
 
@@ -170,6 +145,33 @@
         <timeout>300</timeout>
       </commandScript>
 
+      <configuration-dependencies>
+        <config-type>logfeeder-ambari-config</config-type>
+        <config-type>logfeeder-custom-logsearch-config</config-type>
+        <config-type>accumulo-logsearch-conf</config-type>
+        <config-type>ams-logsearch-conf</config-type>
+        <config-type>atlas-logsearch-conf</config-type>
+        <config-type>falcon-logsearch-conf</config-type>
+        <config-type>flume-logsearch-conf</config-type>
+        <config-type>hbase-logsearch-conf</config-type>
+        <config-type>hdfs-logsearch-conf</config-type>
+        <config-type>hive-logsearch-conf</config-type>
+        <config-type>infra-logsearch-conf</config-type>
+        <config-type>kafka-logsearch-conf</config-type>
+        <config-type>knox-logsearch-conf</config-type>
+        <config-type>mapred-logsearch-conf</config-type>
+        <config-type>nifi-logsearch-conf</config-type>
+        <config-type>oozie-logsearch-conf</config-type>
+        <config-type>ranger-kms-logsearch-conf</config-type>
+        <config-type>ranger-logsearch-conf</config-type>
+        <config-type>spark-logsearch-conf</config-type>
+        <config-type>spark2-logsearch-conf</config-type>
+        <config-type>storm-logsearch-conf</config-type>
+        <config-type>yarn-logsearch-conf</config-type>
+        <config-type>zeppelin-logsearch-conf</config-type>
+        <config-type>zookeeper-logsearch-conf</config-type>
+      </configuration-dependencies>
+
       <quickLinksConfigurations>
         <quickLinksConfiguration>
           <fileName>quicklinks.json</fileName>


Mime
View raw message