@Test public void testReadLog() { aliyunLogServiceImpl.readLog("collect-nginx-logs","ka-www"); }
public void readLog(String project, String logstore) { Client client = acqClient(); int shard_id = 0; long curTimeInSec = System.currentTimeMillis() / 1000; try { GetCursorResponse cursorRes = client.GetCursor(project, logstore, shard_id, curTimeInSec - 3600); String beginCursor = cursorRes.GetCursor(); cursorRes = client.GetCursor(project, logstore, shard_id, Consts.CursorMode.END); String endCursor = cursorRes.GetCursor(); String curCursor = beginCursor; while (curCursor.equals(endCursor) == false) { int loggroup_count = 2; BatchGetLogResponse logDataRes = client.BatchGetLog(project, logstore, shard_id, loggroup_count, curCursor, endCursor); List<LogGroupData> logGroups = logDataRes.GetLogGroups(); for (LogGroupData logGroupData : logGroups) { Logs.LogGroup log_group_pb = logGroupData.GetLogGroup(); for (Logs.Log log_pb : log_group_pb.getLogsList()) { for (Logs.Log.Content content : log_pb.getContentsList()) { } } } String next_cursor = logDataRes.GetNextCursor(); curCursor = next_cursor; } } catch (Exception e) { e.printStackTrace(); } }
AliyunLogServiceImpl implements AliyunLogService { public void readLog(String project, String logstore) { Client client = acqClient(); int shard_id = 0; long curTimeInSec = System.currentTimeMillis() / 1000; try { GetCursorResponse cursorRes = client.GetCursor(project, logstore, shard_id, curTimeInSec - 3600); String beginCursor = cursorRes.GetCursor(); cursorRes = client.GetCursor(project, logstore, shard_id, Consts.CursorMode.END); String endCursor = cursorRes.GetCursor(); String curCursor = beginCursor; while (curCursor.equals(endCursor) == false) { int loggroup_count = 2; BatchGetLogResponse logDataRes = client.BatchGetLog(project, logstore, shard_id, loggroup_count, curCursor, endCursor); List<LogGroupData> logGroups = logDataRes.GetLogGroups(); for (LogGroupData logGroupData : logGroups) { Logs.LogGroup log_group_pb = logGroupData.GetLogGroup(); for (Logs.Log log_pb : log_group_pb.getLogsList()) { for (Logs.Log.Content content : log_pb.getContentsList()) { } } } String next_cursor = logDataRes.GetNextCursor(); curCursor = next_cursor; } } catch (Exception e) { e.printStackTrace(); } } }
AliyunLogServiceImpl implements AliyunLogService { public void readLog(String project, String logstore) { Client client = acqClient(); int shard_id = 0; long curTimeInSec = System.currentTimeMillis() / 1000; try { GetCursorResponse cursorRes = client.GetCursor(project, logstore, shard_id, curTimeInSec - 3600); String beginCursor = cursorRes.GetCursor(); cursorRes = client.GetCursor(project, logstore, shard_id, Consts.CursorMode.END); String endCursor = cursorRes.GetCursor(); String curCursor = beginCursor; while (curCursor.equals(endCursor) == false) { int loggroup_count = 2; BatchGetLogResponse logDataRes = client.BatchGetLog(project, logstore, shard_id, loggroup_count, curCursor, endCursor); List<LogGroupData> logGroups = logDataRes.GetLogGroups(); for (LogGroupData logGroupData : logGroups) { Logs.LogGroup log_group_pb = logGroupData.GetLogGroup(); for (Logs.Log log_pb : log_group_pb.getLogsList()) { for (Logs.Log.Content content : log_pb.getContentsList()) { } } } String next_cursor = logDataRes.GetNextCursor(); curCursor = next_cursor; } } catch (Exception e) { e.printStackTrace(); } }  }
AliyunLogServiceImpl implements AliyunLogService { public void readLog(String project, String logstore) { Client client = acqClient(); int shard_id = 0; long curTimeInSec = System.currentTimeMillis() / 1000; try { GetCursorResponse cursorRes = client.GetCursor(project, logstore, shard_id, curTimeInSec - 3600); String beginCursor = cursorRes.GetCursor(); cursorRes = client.GetCursor(project, logstore, shard_id, Consts.CursorMode.END); String endCursor = cursorRes.GetCursor(); String curCursor = beginCursor; while (curCursor.equals(endCursor) == false) { int loggroup_count = 2; BatchGetLogResponse logDataRes = client.BatchGetLog(project, logstore, shard_id, loggroup_count, curCursor, endCursor); List<LogGroupData> logGroups = logDataRes.GetLogGroups(); for (LogGroupData logGroupData : logGroups) { Logs.LogGroup log_group_pb = logGroupData.GetLogGroup(); for (Logs.Log log_pb : log_group_pb.getLogsList()) { for (Logs.Log.Content content : log_pb.getContentsList()) { } } } String next_cursor = logDataRes.GetNextCursor(); curCursor = next_cursor; } } catch (Exception e) { e.printStackTrace(); } }  @Override TableVO<List<LogServiceCfgDO>> getLogServiceCfgPage(int page, int length, String serverName); @Override LogServiceVO queryLog(LogServiceQuery logServiceQuery); GetHistogramsResponse queryHistograms(String project, String logstore, String topic, int from, int to, String query); @Override TableVO<List<LogServicePathDO>> getLogServicePathPage(int page, int length, String tagPath, long serverGroupId); @Override TableVO<List<LogFormatDefault>> queryDefaultLog(LogHistogramsVO logHistogramsVO); @Override TableVO<List<LogFormatKa>> queryKaLog(LogHistogramsVO logHistogramsVO); void readLog(String project, String logstore); void init(); @Override Client acqClient(); @Override TableVO<List<LogHistogramsVO>> getLogHistogramsPage(long logServiceId, int page, int length); @Override TableVO<List<LogServiceServerGroupCfgVO>> queryServerGroupPage(int page, int length, String name, boolean isUsername, int useType); }
AliyunLogServiceImpl implements AliyunLogService { public void readLog(String project, String logstore) { Client client = acqClient(); int shard_id = 0; long curTimeInSec = System.currentTimeMillis() / 1000; try { GetCursorResponse cursorRes = client.GetCursor(project, logstore, shard_id, curTimeInSec - 3600); String beginCursor = cursorRes.GetCursor(); cursorRes = client.GetCursor(project, logstore, shard_id, Consts.CursorMode.END); String endCursor = cursorRes.GetCursor(); String curCursor = beginCursor; while (curCursor.equals(endCursor) == false) { int loggroup_count = 2; BatchGetLogResponse logDataRes = client.BatchGetLog(project, logstore, shard_id, loggroup_count, curCursor, endCursor); List<LogGroupData> logGroups = logDataRes.GetLogGroups(); for (LogGroupData logGroupData : logGroups) { Logs.LogGroup log_group_pb = logGroupData.GetLogGroup(); for (Logs.Log log_pb : log_group_pb.getLogsList()) { for (Logs.Log.Content content : log_pb.getContentsList()) { } } } String next_cursor = logDataRes.GetNextCursor(); curCursor = next_cursor; } } catch (Exception e) { e.printStackTrace(); } }  @Override TableVO<List<LogServiceCfgDO>> getLogServiceCfgPage(int page, int length, String serverName); @Override LogServiceVO queryLog(LogServiceQuery logServiceQuery); GetHistogramsResponse queryHistograms(String project, String logstore, String topic, int from, int to, String query); @Override TableVO<List<LogServicePathDO>> getLogServicePathPage(int page, int length, String tagPath, long serverGroupId); @Override TableVO<List<LogFormatDefault>> queryDefaultLog(LogHistogramsVO logHistogramsVO); @Override TableVO<List<LogFormatKa>> queryKaLog(LogHistogramsVO logHistogramsVO); void readLog(String project, String logstore); void init(); @Override Client acqClient(); @Override TableVO<List<LogHistogramsVO>> getLogHistogramsPage(long logServiceId, int page, int length); @Override TableVO<List<LogServiceServerGroupCfgVO>> queryServerGroupPage(int page, int length, String name, boolean isUsername, int useType); static final String PROJECT_JAVA_LOG; }