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/09/07 23:38:00 UTC
[10/50] [abbrv] ambari git commit: AMBARI-18214. Restify Log Search
endpoints (oleewere)
AMBARI-18214. Restify Log Search endpoints (oleewere)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/f8cf23e4
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/f8cf23e4
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/f8cf23e4
Branch: refs/heads/branch-dev-logsearch
Commit: f8cf23e429f0f084822eafe63fed0a3ffb9e77f2
Parents: dff48f0
Author: oleewere <ol...@gmail.com>
Authored: Fri Aug 19 17:31:55 2016 +0200
Committer: oleewere <ol...@gmail.com>
Committed: Thu Sep 8 01:33:58 2016 +0200
----------------------------------------------------------------------
.../ambari/logsearch/dao/SolrDaoBase.java | 2 +-
.../ambari/logsearch/doc/DocConstants.java | 1 +
.../ambari/logsearch/manager/AuditMgr.java | 2 +-
.../ambari/logsearch/manager/LogsMgr.java | 119 ++--
.../ambari/logsearch/rest/AuditLogsREST.java | 283 +++++++++
.../apache/ambari/logsearch/rest/AuditREST.java | 312 ----------
.../ambari/logsearch/rest/DashboardREST.java | 575 ------------------
.../ambari/logsearch/rest/LogFileREST.java | 5 +-
.../ambari/logsearch/rest/PublicREST.java | 2 +-
.../ambari/logsearch/rest/ServiceLogsREST.java | 578 +++++++++++++++++++
.../ambari/logsearch/rest/UserConfigREST.java | 17 +-
.../src/main/webapp/login.html | 28 +-
.../collection_bases/VAuditLogListBase.js | 16 +-
.../collection_bases/VEventHistoryListBase.js | 14 +-
.../scripts/collection_bases/VGroupListBase.js | 16 +-
.../collection_bases/VLogLevelListBase.js | 2 +-
.../scripts/collection_bases/VLogListBase.js | 10 +-
.../collection_bases/VNameValueListBase.js | 14 +-
.../scripts/collection_bases/VNodeListBase.js | 4 +-
.../webapp/scripts/model_bases/VAuditLogBase.js | 2 +-
.../scripts/model_bases/VCommonModelBase.js | 2 +-
.../scripts/model_bases/VEventHistoryBase.js | 2 +-
.../scripts/model_bases/VGraphInfoBase.js | 2 +-
.../webapp/scripts/model_bases/VLogLevelBase.js | 2 +-
.../scripts/model_bases/VUserFilterBase.js | 2 +-
.../src/main/webapp/scripts/utils/ViewUtils.js | 2 +-
.../scripts/views/audit/AuditAggregatedView.js | 6 +-
.../scripts/views/audit/AuditTabLayoutView.js | 22 +-
.../dashboard/BubbleGraphTableLayoutView.js | 30 +-
.../views/dashboard/ComponentListView.js | 4 +-
.../scripts/views/dashboard/ComponentsView.js | 2 +-
.../scripts/views/dashboard/DashboardView.js | 12 +-
.../views/dashboard/GridTableLayoutView.js | 2 +-
.../webapp/scripts/views/dashboard/HostsView.js | 2 +-
.../scripts/views/dashboard/LogLevelBoxView.js | 2 +-
.../scripts/views/dashboard/MainLayoutView.js | 44 +-
.../dialog/GlobalExclusionCompositeView.js | 2 +-
.../views/filter/CreateLogfeederFilterView.js | 20 +-
.../scripts/views/graphs/GraphLayoutView.js | 12 +-
.../scripts/views/graphs/GridGraphLayoutView.js | 2 +-
.../webapp/scripts/views/tabs/ComparisonView.js | 2 +-
.../views/tabs/HierarchyTabLayoutView.js | 36 +-
.../webapp/scripts/views/tabs/LogFileView.js | 12 +-
.../main/webapp/scripts/views/tabs/TreeView.js | 2 +-
.../troubleshoot/TroubleShootLayoutView.js | 6 +-
.../src/main/webapp/templates/graphs/backup.js | 12 +-
.../logging/LoggingRequestHelperImpl.java | 4 +-
47 files changed, 1107 insertions(+), 1143 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/f8cf23e4/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 672507a..91c4a26 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
@@ -547,7 +547,7 @@ public abstract class SolrDaoBase {
QueryResponse queryResponse = solrClient.query(solrQuery,
METHOD.POST);
- if (event != null && !"/getLiveLogsCount".equalsIgnoreCase(event)) {
+ if (event != null && !"/audit/logs/live/count".equalsIgnoreCase(event)) {
logPerformance.info("\n Username :- "
+ LogsearchContextUtil.getCurrentUsername()
+ " Event :- " + event + " SolrQuery :- " + solrQuery
http://git-wip-us.apache.org/repos/asf/ambari/blob/f8cf23e4/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 c1572b7..c14fc08 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
@@ -105,6 +105,7 @@ public class DocConstants {
public static final String HOST_D = "";
public static final String COMPONENT_D = "";
public static final String LOG_TYPE_D = "";
+ public static final String TAIL_SIZE_D = "";
}
public class LogFileOperationDescriptions {
http://git-wip-us.apache.org/repos/asf/ambari/blob/f8cf23e4/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
index d4f2986..58c3a4d 100644
--- 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
@@ -258,7 +258,7 @@ public class AuditMgr extends MgrBase {
public String getLiveLogCounts() {
VNameValueList nameValueList = new VNameValueList();
SolrQuery solrQuery = new SolrQuery();
- solrQuery.setParam("event", "/getLiveLogsCount");
+ solrQuery.setParam("event", "/audit/logs/live/count");
try {
String startDate = dateUtil
.convertGivenDateFormatToSolrDateFormat(ManageStartEndTime.startDate);
http://git-wip-us.apache.org/repos/asf/ambari/blob/f8cf23e4/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
index b03a643..451fac1 100644
--- 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
@@ -6,9 +6,9 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -88,7 +88,7 @@ public class LogsMgr extends MgrBase {
public static List<String> cancelByDate = new CopyOnWriteArrayList<String>();
public static Map<String, String> mapUniqueId = new ConcurrentHashMap<String, String>();
-
+
public static enum CONDITION {
OR, AND
}
@@ -140,7 +140,7 @@ public class LogsMgr extends MgrBase {
SolrQuery solrQuery = queryGenerator
.commonServiceFilterQuery(searchCriteria);
- solrQuery.setParam("event", "/solr/logs_search");
+ solrQuery.setParam("event", "/service/logs");
VSolrLogList collection = getLogAsPaginationProvided(solrQuery,
serviceLogsSolrDao);
@@ -151,7 +151,7 @@ public class LogsMgr extends MgrBase {
public String getHosts(SearchCriteria searchCriteria) {
return getFields(searchCriteria, LogSearchConstants.SOLR_HOST);
}
-
+
public String getFields(SearchCriteria searchCriteria,String field){
SolrQuery solrQuery = new SolrQuery();
@@ -185,7 +185,7 @@ public class LogsMgr extends MgrBase {
solrDoc.put(field, temp);
docList.add(solrDoc);
}
-
+
collection.setGroupDocuments(docList);
if(!docList.isEmpty()){
collection.setStartIndex((int) docList.getStart());
@@ -197,7 +197,7 @@ public class LogsMgr extends MgrBase {
throw restErrorUtil.createRESTException(MessageEnums.SOLR_ERROR
.getMessage().getMessage(), MessageEnums.ERROR_SYSTEM);
}
-
+
}
public String getComponents(SearchCriteria searchCriteria) {
@@ -274,11 +274,11 @@ public class LogsMgr extends MgrBase {
return collection;
}
List<Count> fieldList = facetFields.getValues();
-
+
if(fieldList == null){
return collection;
}
-
+
for (Count cnt : fieldList) {
if (cnt != null) {
VCount vCount = new VCount();
@@ -293,11 +293,11 @@ public class LogsMgr extends MgrBase {
throw restErrorUtil.createRESTException(MessageEnums.SOLR_ERROR
.getMessage().getMessage(), MessageEnums.ERROR_SYSTEM);
}
-
+
collection.setCounts(vCounts);
return collection;
}
-
+
public VCountList getLogLevelCount(SearchCriteria searchCriteria) {
return getFieldCount(searchCriteria, LogSearchConstants.SOLR_LEVEL);
}
@@ -331,7 +331,7 @@ public class LogsMgr extends MgrBase {
if(!stringUtil.isEmpty(firstPriority)){
hostNode.setType(firstPriority);
}
-
+
hostNode.setParent(true);
hostNode.setRoot(true);
PivotField hostPivot = null;
@@ -467,7 +467,7 @@ public class LogsMgr extends MgrBase {
public String getHostListByComponent(SearchCriteria searchCriteria) {
SolrQuery solrQuery = queryGenerator.commonServiceFilterQuery(searchCriteria);
- solrQuery.setParam("event", "/getHostListByComponent");
+ solrQuery.setParam("event", "/service/hosts/component");
VNodeList list = new VNodeList();
if (searchCriteria.getSortBy() == null) {
@@ -484,10 +484,10 @@ public class LogsMgr extends MgrBase {
} else {
return convertObjToString(list);
}
-
+
String firstHirarchy = "type,host,level";
String secondHirarchy = "type,level";
-
+
try {
queryGenerator.setFacetPivot(solrQuery, 1, firstHirarchy,
secondHirarchy);
@@ -528,7 +528,7 @@ public class LogsMgr extends MgrBase {
public VNameValueList getLogsLevelCount(SearchCriteria sc) {
VNameValueList nameValueList = new VNameValueList();
SolrQuery query = queryGenerator.commonServiceFilterQuery(sc);
- query.setParam("event", "/getLogLevelCounts");
+ query.setParam("event", "/service/logs/levels/counts/namevalues");
List<VNameValue> logsCounts = getLogLevelFacets(query);
nameValueList.setVNameValues(logsCounts);
@@ -628,40 +628,40 @@ public class LogsMgr extends MgrBase {
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(stringUtil.isEmpty(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;
@@ -684,7 +684,7 @@ public class LogsMgr extends MgrBase {
nextPageLogTimeQuery.remove("rows");
nextPageLogTimeQuery.setStart(lastLogIndexNumber);
nextPageLogTimeQuery.setRows(1);
-
+
queryResponse = serviceLogsSolrDao.process(
nextPageLogTimeQuery);
if(queryResponse == null){
@@ -697,7 +697,7 @@ public class LogsMgr extends MgrBase {
throw restErrorUtil.createRESTException("The keyword "+"\""+key+"\""+" was not found",
MessageEnums.ERROR_SYSTEM);
}
-
+
SolrDocument solrDoc = docList.get(0);
Date logDate = (Date) solrDoc.get(LogSearchConstants.LOGTIME);
@@ -765,7 +765,7 @@ public class LogsMgr extends MgrBase {
if (!stringUtil.isEmpty(sortByType) && sortByType
.equalsIgnoreCase(LogSearchConstants.ASCENDING_ORDER)) {
-
+
queryGenerator.setSingleRangeFilter(logTimeThroughRangeQuery,
LogSearchConstants.LOGTIME, nextPageLogTime,
endTime);
@@ -774,7 +774,7 @@ public class LogsMgr extends MgrBase {
+ LogSearchConstants.ASCENDING_ORDER);
} else {
-
+
queryGenerator.setSingleRangeFilter(logTimeThroughRangeQuery,
LogSearchConstants.LOGTIME, startTime,
nextPageLogTime);
@@ -803,7 +803,7 @@ public class LogsMgr extends MgrBase {
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",
@@ -837,9 +837,9 @@ public class LogsMgr extends MgrBase {
long countNumberLogs = countQuery(rangeLogQuery,serviceLogsSolrDao) - 1;
-
- //Adding numbers on
+
+ //Adding numbers on
try {
@@ -854,7 +854,7 @@ public class LogsMgr extends MgrBase {
String id = (String) solrDocumenent
.getFieldValue(LogSearchConstants.ID);
countNumberLogs++;
-
+
if (stringUtil.isEmpty(id) && id.equals(keywordId)){
break;
}
@@ -980,8 +980,8 @@ public class LogsMgr extends MgrBase {
logTimeThroughRangeQuery.set(LogSearchConstants.SORT,
LogSearchConstants.LOGTIME + " "
+ LogSearchConstants.DESCENDING_ORDER);
-
-
+
+
queryGenerator.setSingleRangeFilter(
logTimeThroughRangeQuery,
LogSearchConstants.LOGTIME, startTime,
@@ -993,7 +993,7 @@ public class LogsMgr extends MgrBase {
logTimeThroughRangeQuery.set(LogSearchConstants.SORT,
LogSearchConstants.LOGTIME + " "
+ LogSearchConstants.ASCENDING_ORDER);
-
+
queryGenerator.setSingleRangeFilter(logTimeThroughRangeQuery,
LogSearchConstants.LOGTIME, lastLogsLogTime, endTime);
@@ -1054,7 +1054,7 @@ public class LogsMgr extends MgrBase {
long countNumberLogs = countQuery(rangeLogQuery,serviceLogsSolrDao) - 1;
-
+
//Adding numbers on
try {
SolrQuery sameIdQuery = queryGenerator
@@ -1123,9 +1123,9 @@ public class LogsMgr extends MgrBase {
.process(logTimeByIdQuery);
if(queryResponse == null){
- return convertObjToString(new VSolrLogList());
+ return convertObjToString(new VSolrLogList());
}
-
+
SolrDocumentList docList = queryResponse.getResults();
Date dateOfLogId = null;
if (docList != null && !docList.isEmpty()) {
@@ -1162,10 +1162,10 @@ public class LogsMgr extends MgrBase {
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);
@@ -1216,14 +1216,14 @@ public class LogsMgr extends MgrBase {
return logsCounts;
}
-
+
@SuppressWarnings("rawtypes")
RangeFacet rangeFacet=rangeFacetList.get(0);
if (rangeFacet == null) {
return logsCounts;
}
logLevelCounts = rangeFacet.getCounts();
-
+
if(logLevelCounts == null){
return logsCounts;
}
@@ -1254,7 +1254,7 @@ public class LogsMgr extends MgrBase {
String deafalutValue = "0";
VBarDataList dataList = new VBarDataList();
SolrQuery solrQuery = queryGenerator.commonServiceFilterQuery(searchCriteria);
- solrQuery.set("event", "/getHistogramData");
+ 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"));
@@ -1339,10 +1339,7 @@ public class LogsMgr extends MgrBase {
}
}
- public String cancelFindRequestByDate(HttpServletRequest request) {
- String uniqueId = null;
-
- uniqueId = (String) request.getParameter("token");
+ public String cancelFindRequestByDate(String uniqueId) {
if (stringUtil.isEmpty(uniqueId)) {
logger.error("Unique id is Empty");
throw restErrorUtil.createRESTException("Unique id is Empty",
@@ -1377,21 +1374,21 @@ public class LogsMgr extends MgrBase {
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(stringUtil.isEmpty(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(".", ",");
@@ -1411,7 +1408,7 @@ public class LogsMgr extends MgrBase {
fileName = searchCriteria.getParamValue("hostLogFile") + "_"
+ searchCriteria.getParamValue("compLogFile");
}
-
+
String textToSave = "";
try {
QueryResponse response = serviceLogsSolrDao.process(solrQuery);
@@ -1516,7 +1513,7 @@ public class LogsMgr extends MgrBase {
public String getComponentListWithLevelCounts(SearchCriteria searchCriteria) {
SolrQuery solrQuery = queryGenerator.commonServiceFilterQuery(searchCriteria);
- solrQuery.setParam("event", "/getComponentListWithLevelCounts");
+ solrQuery.setParam("event", "/service/logs/components/level/counts");
if (searchCriteria.getSortBy() == null) {
searchCriteria.setSortBy(LogSearchConstants.SOLR_COMPONENT);
@@ -1586,10 +1583,10 @@ public class LogsMgr extends MgrBase {
queryGenerator.setMainQuery(solrQuery, null);
solrQuery.setSort(LogSearchConstants.LOGTIME, SolrQuery.ORDER.asc);
queryGenerator.setRowCount(solrQuery, 1);
-
+
List<VNameValue> vNameValues = new ArrayList<VNameValue>();
QueryResponse response = serviceLogsSolrDao.process(solrQuery);
-
+
if(response == null){
return convertObjToString(nameValueList);
}
@@ -1635,7 +1632,7 @@ public class LogsMgr extends MgrBase {
}
}
nameValueList.setVNameValues(vNameValues);
-
+
} catch (SolrServerException | SolrException | IOException e) {
logger.error(e.getMessage() + "SolrQuery"+solrQuery);
@@ -1789,7 +1786,7 @@ public class LogsMgr extends MgrBase {
if(stringUtil.isEmpty(scrollType)){
scrollType = "";
}
-
+
String logTime = null;
String sequenceId = null;
try {
@@ -1827,7 +1824,7 @@ public class LogsMgr extends MgrBase {
}
vSolrLogList.setSolrDocuments(solrDocList);
return convertObjToString(vSolrLogList);
-
+
} else if (LogSearchConstants.SCROLL_TYPE_AFTER.equals(scrollType)) {
SolrDocumentList solrDocList = new SolrDocumentList();
vSolrLogList = new VSolrLogList();
@@ -1859,9 +1856,9 @@ public class LogsMgr extends MgrBase {
}
vSolrLogList.setSolrDocuments(initial);
-
+
return convertObjToString(vSolrLogList);
-
+
}
}
@@ -1964,4 +1961,4 @@ public class LogsMgr extends MgrBase {
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/f8cf23e4/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
new file mode 100644
index 0000000..3d99dc0
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/AuditLogsREST.java
@@ -0,0 +1,283 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * 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/f8cf23e4/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/AuditREST.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/AuditREST.java b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/AuditREST.java
deleted file mode 100644
index 5ed49fd..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/AuditREST.java
+++ /dev/null
@@ -1,312 +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.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", description = "Audit operations")
-@Path("audit")
-@Component
-@Scope("request")
-public class AuditREST {
-
- @Autowired
- AuditMgr auditMgr;
-
- @GET
- @Path("/getAuditSchemaFieldsName")
- @Produces({"application/json"})
- @ApiOperation(GET_AUDIT_SCHEMA_FIELD_LIST_OD)
- public String getSolrFieldList(@Context HttpServletRequest request) {
- return auditMgr.getAuditLogsSchemaFieldsName();
- }
-
- @GET
- @Path("/getAuditLogs")
- @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("/getAuditComponents")
- @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("/getAuditLineGraphData")
- @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("/getTopAuditUsers")
- @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("/getTopAuditResources")
- @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("/getTopAuditComponents")
- @Produces({"application/json"})
- @ApiOperation(GET_TOP_AUDIT_COMPONENTS_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 getTopAuditComponents(@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.getTopAuditFieldCount(searchCriteria);
- }
-
- @GET
- @Path("/getLiveLogsCount")
- @Produces({"application/json"})
- @ApiOperation(GET_LIVE_LOGS_COUNT_OD)
- public String getLiveLogsCount() {
- return auditMgr.getLiveLogCounts();
- }
-
- @GET
- @Path("/getRequestUserLineGraph")
- @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("/getAnyGraphData")
- @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("/exportUserTableToTextFile")
- @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("/getServiceLoad")
- @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);
- }
-
-}
-
\ No newline at end of file