com.aliyun.openservices.log.request.PutLogsRequest Java Examples
The following examples show how to use
com.aliyun.openservices.log.request.PutLogsRequest.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AliyunSLSLogger.java From utils with Apache License 2.0 | 6 votes |
@Override public void log(String store, String topic, String source, Object... args) { List<LogItem> logs = new ArrayList<LogItem>(); LogItem item = new LogItem((int) (System.currentTimeMillis() / 1000)); for (int i = 0; i < args.length; ++i) { item.PushBack(String.valueOf(args[i]), String.valueOf(args[++i])); } logs.add(item); PutLogsRequest req = new PutLogsRequest(project, store, topic, source, logs); try { client.PutLogs(req); } catch (LogException ex) { //Logger.log(ex); } }
Example #2
Source File: IOThread.java From aliyun-log-producer-java with Apache License 2.0 | 5 votes |
private PutLogsResponse sendRequest(Client clt, BlockedData bd) throws LogException { PutLogsRequest request = buildRequest(bd); List<TagContent> tags = new ArrayList<TagContent>(); tags.add(new TagContent("__pack_id__", bd.data.getPackageId())); request.SetTags(tags); request.setContentType(producerConfig.logsFormat.equals("protobuf") ? Consts.CONST_PROTO_BUF : Consts.CONST_SLS_JSON); PutLogsResponse response = clt.PutLogs(request); long tmpBytes = sendLogBytes.get(); sendLogBytes.set(tmpBytes + bd.bytes); return response; }
Example #3
Source File: IOThread.java From aliyun-log-producer-java with Apache License 2.0 | 5 votes |
private PutLogsRequest buildRequest(BlockedData bd) { if (bd.data.shardHash != null && !bd.data.shardHash.isEmpty()) { return new PutLogsRequest( bd.data.project, bd.data.logstore, bd.data.topic, bd.data.source, bd.data.items, bd.data.shardHash); } else { return new PutLogsRequest( bd.data.project, bd.data.logstore, bd.data.topic, bd.data.source, bd.data.items); } }