use of com.emc.storageos.systemservices.impl.logsvc.LogStatusInfo in project coprhd-controller by CoprHD.
the class LogStreamPerfTest method testPerformanceNoFilter.
/**
* Test performance without filter
*/
@Test
@Ignore
public void testPerformanceNoFilter() throws Exception {
System.out.println("starting testPerformanceNoFilter");
String svcName = "bigFile-dbsvc";
LogRequest req = new LogRequest.Builder().build();
LogStatusInfo status = new LogStatusInfo();
LogFileStream stream = new LogFileStream(svcName, new ArrayList<File>(), req, status);
long startTime = 0;
long endTime = 0;
startTime = System.nanoTime();
while (true) {
LogMessage log = stream.readNextLogMessage();
if (log == null) {
endTime = System.nanoTime();
break;
}
}
double fileSize = (double) stream.getTotalSizeCount() / (1024L * 1024L);
double elapsedTime = (double) (endTime - startTime) / 1000000000.0;
double speed = fileSize / elapsedTime;
// System.out.println("Total files size(after compressed) is " +
// fileSize + "MB. Log messages count is "
// + stream.getTotalLogCount());
// System.out.println("Speed of LogStream without Filter is: " + speed
// + " MB/sed");
System.out.println("Total files size(after decompressing) is 4286.8 MB. Log messages count is " + stream.getTotalLogCount());
System.out.println("Speed of LogStream without Filter is: " + 4286.8 / elapsedTime + " MB/sec and " + stream.getTotalLogCount() / elapsedTime + " logs/sec");
System.out.println("done testPerformanceNoFilter");
}
use of com.emc.storageos.systemservices.impl.logsvc.LogStatusInfo in project coprhd-controller by CoprHD.
the class LogStreamPerfTest method testPerformanceMultipleFilters.
/**
* Test performance with time, level and pattern filters, the speed should
* be faster than 50 Mbs
*/
@Test
@Ignore
public void testPerformanceMultipleFilters() throws Exception {
System.out.println("starting testPerformanceMultipleFilters");
String svcName = "bigFile-dbsvc";
String pattern = "Memory";
Calendar calendar = Calendar.getInstance();
calendar.set(2013, 10, 20, 16, 38, 16);
Date startTimeFilter = calendar.getTime();
calendar.set(2014, 0, 16, 16, 38, 0);
Date endTimeFilter = calendar.getTime();
LogRequest req = new LogRequest.Builder().startTime(startTimeFilter).endTime(endTimeFilter).logLevel(7).regex(pattern).build();
LogStatusInfo status = new LogStatusInfo();
LogFileStream stream = new LogFileStream(svcName, new ArrayList<File>(), req, status);
long startTime = 0;
long endTime = 0;
startTime = System.nanoTime();
while (true) {
LogMessage log = stream.readNextLogMessage();
if (log == null) {
endTime = System.nanoTime();
break;
}
}
double fileSize = (double) stream.getTotalSizeCount() / (1024L * 1024L);
double elapsedTime = (double) (endTime - startTime) / 1000000000.0;
double speed = fileSize / elapsedTime;
System.out.println("Total files size is " + fileSize + "MB. Log messages count is " + stream.getTotalLogCount());
System.out.println("Speed of LogStream with multiple Filters is: " + speed + " Mbs");
System.out.println("Total files size(after decompressing) is 3436.7 MB. Log messages count is " + stream.getTotalLogCount());
System.out.println("Speed of LogStream with multiple Filters is: " + 3436.7 / elapsedTime + " MB/sec");
System.out.println("done testPerformanceMultipleFilters");
}
use of com.emc.storageos.systemservices.impl.logsvc.LogStatusInfo in project coprhd-controller by CoprHD.
the class LogStreamPerfTest method testPerformanceTimeFilter.
/**
* Test performance with time range filter
*/
@Test
@Ignore
public void testPerformanceTimeFilter() throws Exception {
System.out.println("starting testPerformanceTimeFilter");
String svcName = "bigFile-dbsvc";
Calendar calendar = Calendar.getInstance();
calendar.set(2013, 10, 20, 16, 38, 16);
Date startTimeFilter = calendar.getTime();
calendar.set(2014, 0, 16, 16, 38, 0);
Date endTimeFilter = calendar.getTime();
LogRequest req = new LogRequest.Builder().startTime(startTimeFilter).endTime(endTimeFilter).build();
LogStatusInfo status = new LogStatusInfo();
LogFileStream stream = new LogFileStream(svcName, new ArrayList<File>(), req, status);
long startTime = 0;
long endTime = 0;
startTime = System.nanoTime();
while (true) {
LogMessage log = stream.readNextLogMessage();
if (log == null) {
endTime = System.nanoTime();
break;
}
}
double fileSize = (double) stream.getTotalSizeCount() / (1024L * 1024L);
double elapsedTime = (double) (endTime - startTime) / 1000000000.0;
double speed = fileSize / elapsedTime;
System.out.println("Total files size is " + fileSize + "MB. Log messages count is " + stream.getTotalLogCount());
System.out.println("Speed of LogStream with time range Filter is: " + speed + " Mbs");
System.out.println("Total files size(after decompressing) is 3436.7 MB. Log messages count is " + stream.getTotalLogCount());
System.out.println("Speed of LogStream with time filter is: " + 3436.7 / elapsedTime + " MB/sec");
System.out.println("done testPerformanceTimeFilter");
}
use of com.emc.storageos.systemservices.impl.logsvc.LogStatusInfo in project coprhd-controller by CoprHD.
the class ParserTest method testNginxAccessLog.
@Test
public void testNginxAccessLog() throws Exception {
LogReader reader = null;
String regexStr = ".*login HTTP.*";
Calendar calendar = Calendar.getInstance();
calendar.set(2014, 1, 20, 16, 38, 16);
Date startTimeFilter = calendar.getTime();
calendar.set(2014, 6, 16, 16, 38, 0);
Date endTimeFilter = calendar.getTime();
LogRequest request = new LogRequest.Builder().regex(regexStr).startTime(startTimeFilter).endTime(endTimeFilter).build();
LogStatusInfo status = new LogStatusInfo();
// "/opt/storageos/logs/nginx_access.log";
String filePath = nginxAccessLogPath;
String baseName = "nginx";
reader = new LogReader(filePath, request, status, baseName);
final LogMessage log = reader.readNextLogMessage();
assertTrue("log is null", log != null);
assertTrue("log message is null", !new String(log.getLogContent()).equals("null"));
assertTrue("log message does not match regex", Pattern.compile(regexStr, Pattern.DOTALL | Pattern.MULTILINE).matcher(LogUtil.bytesToString(log.getLogContent())).matches());
assertTrue("log time does not fit time filter", log.getTime() >= startTimeFilter.getTime() && log.getTime() <= endTimeFilter.getTime());
assertTrue("log file name is not null", new String(log.getFileName()).equals("null"));
assertTrue("log thread name not is null", new String(log.getThreadName()).equals("null"));
assertTrue("log level is not null", new String(log.getLevel()).equals("null"));
assertTrue("log line is not -1", new String(log.getLineNumber()).equals("-1"));
}
use of com.emc.storageos.systemservices.impl.logsvc.LogStatusInfo in project coprhd-controller by CoprHD.
the class ParserTest method testParticularLog.
@Test
public void testParticularLog() throws Exception {
LogReader reader = null;
LogRequest request = new LogRequest.Builder().build();
LogStatusInfo status = new LogStatusInfo();
String filePath = particularLogPath;
String baseName = "log";
reader = new LogReader(filePath, request, status, baseName);
final LogMessage log = reader.readNextLogMessage();
assertTrue("log is null", log != null);
// assertTrue("log message is null", log.getLogContent() != null);
assertTrue("log message is null", log.getLogContent() != null);
assertTrue("log file name is null", log.getFileName() != null);
assertTrue("log thread name is null", log.getThreadName() != null);
assertTrue("log level is not Error", new String(log.getLevel()).equals("ERROR"));
assertTrue("log line is null", log.getLineNumber() != null);
}
Aggregations