Source:
public static void main(String[] args) throws Exception { String userEmail = "daddy@demo.com"; String userPassword = "Rummel1"; String apiUrl = "http://localhost:23667"; Credentials credential = new Credentials(userEmail, userPassword); SumoLogicClient sumoClient = new SumoLogicClient(credential); sumoClient.setURL(apiUrl); String searchSessionId = sumoClient.createSearchSession( "*", "2013-01-13T00:00:00", "2013-01-15T00:00:00", "UTC"); System.out.printf("Search session ID: '%s'\n", searchSessionId); int messageCount = 0; GetSearchSessionStatusResponse getSearchSessionStatusResponse = null; while (getSearchSessionStatusResponse == null || (!getSearchSessionStatusResponse.getState().equals("DONE GATHERING RESULTS") && !getSearchSessionStatusResponse.getState().equals("CANCELLED"))) { Thread.sleep(5000); getSearchSessionStatusResponse = sumoClient.getSearchSessionStatus(searchSessionId); messageCount = getSearchSessionStatusResponse.getMessageCount(); System.out.printf( "Search session ID: '%s', %s\n", searchSessionId, getSearchSessionStatusResponse); } int offset = 0; int length = Math.min(messageCount, 10); GetMessagesForSearchSessionResponse getMessagesForSearchSessionResponse = sumoClient.getMessagesForSearchSession(searchSessionId, offset, length); System.out.printf( "Search session ID: '%s', %s\n", searchSessionId, getMessagesForSearchSessionResponse); List<SearchSessionMessage> messages = getMessagesForSearchSessionResponse.getMessages(); for (SearchSessionMessage message : messages) { System.out.printf(" %s, %s, %s, %s, %s\n", new Date(message.getMessageTime()), message.getSourceHost(), message.getSourceName(), message.getSourceCategory(), message.getRaw()); } }

Target:
public static void main(String[] args) throws Exception { String userEmail = "daddy@demo.com"; String userPassword = "Rummel1"; String apiUrl = "http://localhost:23667"; Credentials credential = new Credentials(userEmail, userPassword); SumoLogicClient sumoClient = new SumoLogicClient(credential); sumoClient.setURL(apiUrl); String searchSessionId = sumoClient.createSearchSession( "*", "2013-01-13T00:00:00", "2013-01-15T00:00:00", "UTC"); System.out.printf("Search session ID: '%s'\n", searchSessionId); int messageCount = 0; GetSearchSessionStatusResponse getSearchSessionStatusResponse = null; while (getSearchSessionStatusResponse == null || (!getSearchSessionStatusResponse.getState().equals("DONE GATHERING RESULTS") && !getSearchSessionStatusResponse.getState().equals("CANCELLED"))) { Thread.sleep(5000); getSearchSessionStatusResponse = sumoClient.getSearchSessionStatus(searchSessionId); messageCount = getSearchSessionStatusResponse.getMessageCount(); System.out.printf( "Search session ID: '%s', %s\n", searchSessionId, getSearchSessionStatusResponse); } int offset = 0; int length = Math.min(messageCount, 10); GetMessagesForSearchSessionResponse getMessagesForSearchSessionResponse = sumoClient.getMessagesForSearchSession(searchSessionId, offset, length); System.out.printf( "Search session ID: '%s', %s\n", searchSessionId, getMessagesForSearchSessionResponse); List<LogMessage> messages = getMessagesForSearchSessionResponse.getMessages(); for (LogMessage message : messages) { System.out.printf(" %s, %s, %s, %s, %s\n", message.getTime(), message.getSourceHost(), message.getSourceName(), message.getSourceCategory(), message.getLogLine()); } }