web.log-view.cassandra_log_viewer.jsp Maven / Gradle / Ivy
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib uri="http://wso2.org/projects/carbon/taglibs/carbontags.jar"
prefix="carbon"%>
<%@ page import="org.wso2.carbon.logging.view.ui.LogViewerClient"%>
<%@ page import="org.apache.axis2.context.ConfigurationContext"%>
<%@ page import="org.wso2.carbon.CarbonConstants"%>
<%-- <%@ page --%>
<%@ page import="org.wso2.carbon.utils.ServerConstants"%>
<%@ page import="org.wso2.carbon.ui.CarbonUIUtil"%>
<%@ page import="org.wso2.carbon.ui.CarbonUIMessage"%>
<%@ page import="org.wso2.carbon.ui.CarbonUIUtil"%>
<%@ page import="org.wso2.carbon.logging.view.stub.types.carbon.LogEvent"%>
View System Logs
<%
String backendServerURL = CarbonUIUtil
.getServerURL(config.getServletContext(), session);
ConfigurationContext configContext = (ConfigurationContext) config.getServletContext()
.getAttribute(CarbonConstants.CONFIGURATION_CONTEXT);
String cookie = (String) session.getAttribute(ServerConstants.ADMIN_SERVICE_COOKIE);
LogViewerClient logViewerClient;
LogEvent[] events;
String tenantDomain = "";
String serviceName = "WSO2 Stratos Manager";
boolean isLogsFromSyslog;
boolean isSTSyslog = false;
String serviceNames[];
boolean isManager = false;
boolean showManager = false;
String logIndex = request.getParameter("logIndex");
String start = request.getParameter("start");
String end = request.getParameter("end");
boolean showTenantDomain = false;
boolean isStratosService = false;
tenantDomain = request.getParameter("tenantDomain");
serviceName = request.getParameter("serviceName");
Boolean isDateGiven=false;
String priority = request.getParameter("priority");
String logger = request.getParameter("logger");
String keyWord = request.getParameter("keyword");
// LogEvent logs[];
if (start != null && !start.equals("null")&& !start.equals("")) {
isDateGiven=true;
}
int returnRows;
logIndex = (logIndex == null) ? "20" : logIndex;
tenantDomain = (tenantDomain == null) ? "" : tenantDomain;
start = (start == null) ? "" : start;
end = (end == null) ? "" : end;
priority = (priority == null) ? "ALL" : priority;
keyWord = (keyWord == null) ? "" : keyWord;
logger = (logger == null) ? "" : logger;
try {
returnRows = (logIndex == null) ? 20 : Integer.parseInt(logIndex);
logViewerClient = new LogViewerClient(cookie, backendServerURL, configContext);
isLogsFromSyslog = logViewerClient.isDataFromSysLog(tenantDomain);
isSTSyslog = logViewerClient.isSTSyslogConfig(tenantDomain);
isManager = logViewerClient.isManager();
serviceNames = logViewerClient.getServiceNames();;
serviceName = (serviceName == null) ? "WSO2 Stratos Manager" : serviceName;
tenantDomain = (tenantDomain == null) ? "" : tenantDomain;
isStratosService = logViewerClient.isStratosService();
showTenantDomain = (isSTSyslog && isLogsFromSyslog && isStratosService);
showManager = (isManager && isLogsFromSyslog);
events = logViewerClient.getSystemLogs(start, end,
logger, priority, "", serviceName, "", Integer.parseInt(logIndex));
System.out.println("events "+events);
System.out.println("Return Rows "+logIndex);
System.out.println("isDateGiven "+isDateGiven);
System.out.println("start "+start+" : "+start);
System.out.println("end "+end+" : "+end);
System.out.println("Priority "+priority);
System.out.println("Logger "+logger);
System.out.println("Keyword "+keyWord);
System.out.println();
System.out.println();
// logs = logViewerClient.getAllLogs();
} catch (Exception e) {
CarbonUIMessage.sendCarbonUIMessage(e.getMessage(), CarbonUIMessage.ERROR, request,
e);
%>
<%
return;
}
%>
<%
if (showTenantDomain || showManager) {
%>
<%
if (showTenantDomain) {
%>
<%
} else {
%>
<%
}
if (showManager) {
%>
<%
} else {
%>
<%
}
%>
<%
}
%>