Data coding mode

Last Updated: Mar 31, 2017

Protocol Buffer is a structured data interchange format developed by Google. It is widely used in many internal and external services of Google. Log Service uses Protocol Buffer as the standard format in writing logs. You need to serialize the original log data into Protocol Buffer data streams before writing [Logs] (28961) into the server by using API.

  1. message Log
  2. {
  3. required uint32 time = 1; // UNIX Time Format
  4. message Content
  5. {
  6. required string key = 1;
  7. required string value = 2;
  8. }
  9. repeated Content contents= 2;
  10. }
  11. message LogGroup
  12. {
  13. repeated Log logs= 1;
  14. optional string reserved =2; // Internal field, which does not need to be specified
  15. optional string topic = 3;
  16. optional string source = 4;
  17. }
  18. message LogGroupList
  19. {
  20. repeated LogGroup logGroupList = 1;
  21. }

Note:

  • Because PB does not require uniqueness of the Key-Value pair, you need to avoid such case. Otherwise, the behavior is undefined.
  • For more details about Protocol Buffer, go to Github Home.
  • For details about the APIs for log write function in Log Service, refer to [PostLogStoreLogs] (29026).
Thank you! We've received your feedback.