Search in sources :

Example 6 with LogFileStream

use of com.emc.storageos.systemservices.impl.logsvc.stream.LogFileStream in project coprhd-controller by CoprHD.

the class LogStreamTest method testReadNextLogMaxCountFilterGreaterThanMAXCOUNTOVERFLOW.

/**
 * Test max count filter totalCount > maxCount + MAX_OVERFLOW
 *
 * @throws Exception
 */
@Test
@Ignore
public void testReadNextLogMaxCountFilterGreaterThanMAXCOUNTOVERFLOW() throws Exception {
    List<File> files = new ArrayList<File>();
    files.add(new File(timeStampFilePath));
    // should get 16 log Messages
    long maxCount = 10;
    int count = 0;
    LogRequest req = new LogRequest.Builder().maxCont(maxCount).build();
    LogStatusInfo status = new LogStatusInfo();
    LogFileStream stream = new LogFileStream("", files, req, status);
    while (true) {
        LogMessage log = stream.readNextLogMessage();
        if (log == null) {
            System.out.println("count=" + count);
            assertEquals("Total line number should match max count limit", 16, count);
            break;
        }
        count++;
    }
}
Also used : LogRequest(com.emc.vipr.model.sys.logging.LogRequest) LogFileStream(com.emc.storageos.systemservices.impl.logsvc.stream.LogFileStream) ArrayList(java.util.ArrayList) File(java.io.File) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 7 with LogFileStream

use of com.emc.storageos.systemservices.impl.logsvc.stream.LogFileStream 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");
}
Also used : LogRequest(com.emc.vipr.model.sys.logging.LogRequest) LogStatusInfo(com.emc.storageos.systemservices.impl.logsvc.LogStatusInfo) LogFileStream(com.emc.storageos.systemservices.impl.logsvc.stream.LogFileStream) LogMessage(com.emc.storageos.systemservices.impl.logsvc.LogMessage) File(java.io.File) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 8 with LogFileStream

use of com.emc.storageos.systemservices.impl.logsvc.stream.LogFileStream 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");
}
Also used : LogRequest(com.emc.vipr.model.sys.logging.LogRequest) LogStatusInfo(com.emc.storageos.systemservices.impl.logsvc.LogStatusInfo) LogFileStream(com.emc.storageos.systemservices.impl.logsvc.stream.LogFileStream) LogMessage(com.emc.storageos.systemservices.impl.logsvc.LogMessage) Calendar(java.util.Calendar) File(java.io.File) Date(java.util.Date) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 9 with LogFileStream

use of com.emc.storageos.systemservices.impl.logsvc.stream.LogFileStream 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");
}
Also used : LogRequest(com.emc.vipr.model.sys.logging.LogRequest) LogStatusInfo(com.emc.storageos.systemservices.impl.logsvc.LogStatusInfo) LogFileStream(com.emc.storageos.systemservices.impl.logsvc.stream.LogFileStream) LogMessage(com.emc.storageos.systemservices.impl.logsvc.LogMessage) Calendar(java.util.Calendar) File(java.io.File) Date(java.util.Date) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 10 with LogFileStream

use of com.emc.storageos.systemservices.impl.logsvc.stream.LogFileStream in project coprhd-controller by CoprHD.

the class LogStreamTest method testGetFilePathNullTimeFilters.

/**
 * Test if LogStream can find all files need to read correctly And test if
 * LogStream can deal null time filter value correctly
 * This test can only be tested on root@10.10.191.121
 */
@Test
@Ignore
public void testGetFilePathNullTimeFilters() {
    String svcName = "controllersvc";
    List<File> files = new ArrayList<File>();
    files.add(new File(HARD_CODE_PATH + "/src/main/data/streamData/controllersvc.log.20140110-231105.gz"));
    files.add(new File(HARD_CODE_PATH + "/src/main/data/streamData/controllersvc.log.20140114-151216.gz"));
    files.add(new File(HARD_CODE_PATH + "/src/main/data/streamData/controllersvc.log.20140112-175108.gz"));
    files.add(new File(HARD_CODE_PATH + "/src/main/data/streamData/controllersvc.log.20140116-031010.gz"));
    files.add(new File(HARD_CODE_PATH + "/src/main/data/streamData/controllersvc.log"));
    files.add(new File(HARD_CODE_PATH + "/src/main/data/streamData/controllersvc.log.20140109-101159.gz"));
    LogRequest req = new LogRequest.Builder().build();
    LogStatusInfo status = new LogStatusInfo();
    LogFileStream stream = new LogFileStream(svcName, files, req, status);
    List<String> paths = stream.getLogPaths();
    List<String> result = new ArrayList<String>();
    result.add(HARD_CODE_PATH + "/src/main/data/streamData/controllersvc.log.20140109-101159.gz");
    result.add(HARD_CODE_PATH + "/src/main/data/streamData/controllersvc.log.20140110-231105.gz");
    result.add(HARD_CODE_PATH + "/src/main/data/streamData/controllersvc.log.20140112-175108.gz");
    result.add(HARD_CODE_PATH + "/src/main/data/streamData/controllersvc.log.20140114-151216.gz");
    result.add(HARD_CODE_PATH + "/src/main/data/streamData/controllersvc.log.20140116-031010.gz");
    result.add(HARD_CODE_PATH + "/src/main/data/streamData/controllersvc.log");
    int i = 0;
    assertEquals("Time range and svc filters are not correct", paths.size(), result.size());
    for (String str : paths) {
        assertEquals("Time range and svc filters are not correct", str, result.get(i));
        i++;
    }
}
Also used : LogRequest(com.emc.vipr.model.sys.logging.LogRequest) LogFileStream(com.emc.storageos.systemservices.impl.logsvc.stream.LogFileStream) ArrayList(java.util.ArrayList) File(java.io.File) Ignore(org.junit.Ignore) Test(org.junit.Test)

Aggregations

LogFileStream (com.emc.storageos.systemservices.impl.logsvc.stream.LogFileStream)13 LogRequest (com.emc.vipr.model.sys.logging.LogRequest)13 File (java.io.File)13 Test (org.junit.Test)13 ArrayList (java.util.ArrayList)10 Ignore (org.junit.Ignore)9 Calendar (java.util.Calendar)5 Date (java.util.Date)5 LogMessage (com.emc.storageos.systemservices.impl.logsvc.LogMessage)4 LogStatusInfo (com.emc.storageos.systemservices.impl.logsvc.LogStatusInfo)4