日志服务使用Protocol Buffer格式作为标准的日志写入格式。
Protocol Buffer格式用于结构化数据交换格式,当用户需要写入日志时,需要把原始日志数据序列化成如下格式的Protocol Buffer数据流,然后才能通过API写入服务端。
message Log
{
required uint32 Time = 1;// UNIX Time Format
message Content
{
required string Key = 1;
required string Value = 2;
}
repeated Content Contents = 2;
optional fixed32 Time_ns = 4; // for time nano part
}
message LogTag
{
required string Key = 1;
required string Value = 2;
}
message LogGroup
{
repeated Log Logs= 1;
optional string Reserved = 2; // reserved fields
optional string Topic = 3;
optional string Source = 4;
repeated LogTag LogTags = 6;
}
message LogGroupList
{
repeated LogGroup logGroupList = 1;
}
说明
-
在使用Protobuf时要保证Key-Value对的唯一性,否则会出现行为未定义的错误。
-
关于Protocol Buffer格式的更多信息请参见Github首页。
-
关于日志服务写入日志的API的详细描述,请参见PutLogs。
内容没看懂? 不太想学习?想快速解决? 有偿解决: 联系专家
阿里云企业补贴进行中: 马上申请
腾讯云限时活动1折起,即将结束: 马上收藏
同尘科技为腾讯云授权服务中心。
购买腾讯云产品享受折上折,更有现金返利:同意关联,立享优惠
转转请注明出处:https://www.yunxiaoer.com/160318.html