Protocol Buffer is a structured data interchange format developed by Google. It is widely used in many internal and external services of Google.  Currently, Log Service uses Protocol Buffer format as  the standard log writing format.  You must serialize the original log data into Protocol Buffer data streams before writing logs to Log Service by using APIs.

message Log
{
    Required uint32 time = 1; // UNIX time format
    Message Content
    {
        Required string key = 1;
        required string value = 2;
    }
    Repeated content contents = 2;
}
Message loggroup
{
    repeated Log logs= 1;
        optional string reserved =2; // Internal field, which does not need to be specified.
    optional string topic = 3;
    Optional string source = 4;
}
message LogGroupList
{
    repeated LogGroup logGroupList = 1;
}
Note
  • PB does not require the key-value pair to be unique. You must avoid such situation. Otherwise, the behavior is undefined.
  • For more information about Protocol Buffer format, see Github.
  • For more information about the API for writing logs to Log Service, see PostLogStoreLogs.