Log Service uses Protocol Buffer (Protobuf) as the standard log format. You can write logs to Log Service in the Protobuf format.

Protobuf is used as a format to interchange structured data. Before you write logs to Log Service by calling relevant API operations, you must serialize raw log data to Protobuf data streams. The following sample is Protobuf-formatted data:
message Log
{
    required uint32 Time = 1;// UNIX Time Format
    message Content
    {
        required string Key = 1;
        required string Value = 2;
    }  
    repeated Content Contents = 2;
}

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;
}
Note
  • Keys in Protobuf-formatted data must be unique. Otherwise, an error that indicates undefined behavior will occur.
  • For more information about the Protobuf format, visit GitHub.
  • For more information about the API operation for writing logs to log service, see PutLogs.