“腾讯云日志服务“对接的前前后后

一、绪论

经过几天的探索,终于把"腾讯云日志服务"(使用API的方式)给接上了,为此写上一篇博客来记录我的劳动成果

二、几个概念

(1)、日志集(Logset)

日志集(Logset)是日志服务的项目管理单元,用于区分不同项目的日志。一个日志集对应一个项目或应用,建议将不同项目和不同产品的日志,使用不同的日志集进行管理。例如,某公司有两种业务:电商业务、支付业务,每种业务可以创建一个日志集。

一个日志集可以包含多个日志主题,每个日志集有以下基本属性信息:

  • 日志集名称:日志集命名。
  • 日志集 ID:标识一个日志集的 ID 编号,全局唯一。
  • 地域:日志集所属地域
  • 存储周期:当前日志集里数据的保存时间周期,可保存时间周期为1 - 90天。

(2)、日志主题(Topic)

日志主题(Topic)是日志服务的基本管理单元,一个 日志集 可以包含多个日志主题。一个日志主题对应一类应用或服务,建议将不同机器上的同类日志收集到同一个日志主题。例如,一个业务项目有三种日志:操作日志、应用程序日志、访问日志,每种类型可以创建一个日志主题。

日志服务系统以日志主题为单位,区分管理用户不同的日志数据,每个日志主题都可以配置不同的数据源、不同的索引规则和投递规则。因此,日志主题是日志服务配置管理日志数据的基本单元,创建日志主题后需配置相关规则,才能如期有效地进行日志采集,并使用检索分析和投递等功能。

从场景功能上理解,日志主题主要提供:

  • 采集日志到日志主题。
  • 以日志主题为单元存储管理日志。
  • 以日志主题为单元检索分析日志。
  • 以日志主题为单元投递日志到其他平台。
  • 从日志主题下载、消费日志。

 (3)、日志组(LogGroup)

日志组(LogGroup)是一个包含多条日志的集合。在上传、消费日志的过程中,考虑读写的效率和压力,日志组作为 CLS 基本的数据单元,可将多条日志打包成一个日志组,并以日志组为单位发送到 CLS 。

一个日志组里的日志具有相同的元信息(__FILENAME__、__SOURCE__、__LogTag__等),详细参考上传数据结构 CLS Protobuf 数据格式

相关限制:

  • 一个数据包里 LogGroup 包含日志条数至少为1条,最多为10000条
  • LogGroup 所有 Value 大小最大总和为5MB

(4)、机器组(MachineGroup)

机器组(MachineGroup)是一组需要采集日志的机器列表,日志服务通过机器组来管理所有需要通过 LogListener 采集日志的服务器。

一个机器组可以包含多台机器。通常情况下,一类服务应用程序会部署在多台机器上,并且这些机器的日志采集配置相同,可以将其归于同一个机器组,并将该机器组关联到对应的日志主题。一个日志主题可以关联多个机器组,一个机器组也可被关联到多个日志主题。

机器组的定义方式:添加 IP 地址到机器组,通过 IP 地址识别服务器。

三、开始对接API(前奏)

(1)、准备工作

需要获取 SecretId 和 SecretKey

(2)、"腾讯云日志服务"API一览

日志管理

接口名称 功能描述
上传结构化日志 上传日志到指定的日志主题
获取下载日志游标 获取并下载指定日志主题下的日志游标
搜索日志 根据指定的条件搜索日志内容
下载日志 使用游标下载日志

日志集管理

接口名称 功能描述
创建日志集 创建日志集,返回新日志集 ID
获取日志集信息 获取日志集信息
获取日志集列表 获取日志集信息列表
修改日志集 修改日志集
删除日志集 删除日志集

日志主题管理

接口名称 功能描述
创建日志主题 创建日志主题,返回新日志主题 ID
获取日志主题信息 获取日志主题信息
获取日志主题绑定的机器组 获取日志主题绑定的机器组信息
获取日志主题列表 获取日志主题信息列表
修改日志主题 修改日志主题
设置日志主题绑定的机器组 设置日志主题绑定的机器组信息
删除日志主题 删除日志主题
获取主题分区列表 获取主题分区信息列表
合并主题分区 合并一个读写态的主题分区
分裂主题分区 分裂一个读写态的主题分区

投递任务管理

接口名称 功能描述
创建投递任务 创建新的投递任务
获取投递配置 获取指定投递策略的详细信息
获取日志主题投递列表 获取指定日志主题的投递策略详细列表
获取投递任务列表 获取投递任务信息列表
修改投递任务 修改现有的投递任务
重试失败的任务 重试失败的投递任务
删除投递配置 删除投递配置

机器组管理

接口名称 功能描述
创建机器组 创建机器组,返回新机器组 ID
获取机器组信息 获取机器组信息
获取机器状态 获取指定机器组下的机器状态
获取机器组列表 获取机器组信息列表
修改机器组 修改机器组
删除机器组 删除机器组

消费管理

接口名称 功能描述
创建消费组 创建消费组
获取消费游标 获取消费游标
获取消费组游标 获取消费组游标
消费数据 用于消费读取日志
消费者心跳 用于消费者上传心跳
获取消费组列表 获取日志主题的消费组列表
修改消费组 修改消费组
修改消费组游标 修改消费组游标信息
删除消费组 删除消费组

索引管理

接口名称 功能描述
获取索引信息 获取指定索引策略的详细信息
修改索引任务 修改现有的索引任务

 (3)、生成请求签名(每次请求需要带上请求签名的header)(示例代码:ClsSignatureUtil工具类)

API地址

package com.yd.core.log;

import org.apache.commons.codec.digest.DigestUtils;
import org.apache.commons.codec.digest.HmacUtils;

import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.HashMap;
import java.util.Map;
import java.util.TreeMap;

/**
 * @Author: wukefan
 * @Date: 2020/12/15 14:04
 * 腾讯云日志服务API工具类
 */
public class ClsSignatureUtil {

    public static final String LINE_SEPARATOR = "\n";
    public static final String Q_SIGN_ALGORITHM_KEY = "q-sign-algorithm";
    public static final String Q_SIGN_ALGORITHM_VALUE = "sha1";
    public static final String Q_AK = "q-ak";
    public static final String Q_SIGN_TIME = "q-sign-time";
    public static final String Q_KEY_TIME = "q-key-time";
    public static final String Q_HEADER_LIST = "q-header-list";
    public static final String Q_URL_PARAM_LIST = "q-url-param-list";
    public static final String Q_SIGNATURE = "q-signature";
    public static final String DEFAULT_ENCODING = "UTF-8";
    public static final String SecretId = "SecretId";
    public static final String SecretKey ="SecretKey";
    //内网域名 ap-guangzhou.cls.tencentyun.com
    //外网域名 ap-guangzhou.cls.tencentcs.com
    public static final String Host = "host";


    private static Map<String, String> buildSignHeaders(Map<String, String> originHeaders) {
        Map<String, String> signHeaders = new HashMap<String, String>();
        for (Map.Entry<String, String> headerEntry : originHeaders.entrySet()) {
            String key = headerEntry.getKey();
            if (key.equalsIgnoreCase("content-type") || key.equalsIgnoreCase("content-md5")
                    || key.equalsIgnoreCase("host") || key.startsWith("x") || key.startsWith("X")) {
                String lowerKey = key.toLowerCase();
                String value = headerEntry.getValue();
                signHeaders.put(lowerKey, value);
            }
        }

        return signHeaders;
    }

    private static String buildSignMemberStr(Map<String, String> signHeaders) {
        StringBuilder strBuilder = new StringBuilder();
        boolean seenOne = false;
        for (String key : signHeaders.keySet()) {
            if (!seenOne) {
                seenOne = true;
            } else {
                strBuilder.append(";");
            }
            strBuilder.append(key.toLowerCase());
        }
        return strBuilder.toString();
    }

    private static String formatMapToStr(Map<String, String> kVMap) throws UnsupportedEncodingException {
        StringBuilder strBuilder = new StringBuilder();
        boolean seeOne = false;
        for (Map.Entry<String, String> entry : kVMap.entrySet()) {
            String key = entry.getKey();
            String value = entry.getValue();
            String lowerKey = key.toLowerCase();
            String encodeKey = URLEncoder.encode(lowerKey, DEFAULT_ENCODING).replace("*", "%2A");
            String encodedValue = "";
            if (value != null) {
                encodedValue = URLEncoder.encode(value.toString(), DEFAULT_ENCODING).replace("*", "%2A");
            }
            if (!seeOne) {
                seeOne = true;
            } else {
                strBuilder.append("&");
            }
            strBuilder.append(encodeKey).append("=").append(encodedValue);
        }
        return strBuilder.toString();
    }

    private static String buildTimeStr(long expireMillsecond) {
        StringBuilder strBuilder = new StringBuilder();
        long startTime = System.currentTimeMillis() / 1000 - 60;
        long endTime = (System.currentTimeMillis() + expireMillsecond) / 1000;
        strBuilder.append(startTime).append(";").append(endTime);
        //return "1510109254;1510109314";
        return strBuilder.toString();
    }

    /**
     * 具体的构建类方法
     * @param secretId
     * @param secretKey
     * @param method
     * @param path
     * @param paramMap
     * @param headerMap
     * @param expireMillsecond
     * @return
     * @throws UnsupportedEncodingException
     */
    public static String buildSignature(String secretId, String secretKey, String method, String path,
                                        Map<String, String> paramMap, Map<String, String> headerMap, long expireMillsecond)
            throws UnsupportedEncodingException {

        Map<String, String> signHeaders = buildSignHeaders(headerMap);
        TreeMap<String, String> sortedSignHeaders = new TreeMap<String, String>();
        TreeMap<String, String> sortedParams = new TreeMap<String, String>();

        sortedSignHeaders.putAll(signHeaders);
        sortedParams.putAll(paramMap);

        String qHeaderListStr = buildSignMemberStr(sortedSignHeaders);
        String qUrlParamListStr = buildSignMemberStr(sortedParams);
        String qKeyTimeStr, qSignTimeStr;
        qKeyTimeStr = qSignTimeStr = buildTimeStr(expireMillsecond);
        //使用 SecretKey 对 q-key-time 进行加密,得到 SignKey
        String signKey = HmacUtils.hmacSha1Hex(secretKey, qKeyTimeStr);
        String formatMethod = method.toString().toLowerCase();
        String formatUri = path;
        String formatParameters = formatMapToStr(sortedParams);
        String formatHeaders = formatMapToStr(sortedSignHeaders);
        //连接HttpRequestInfo
        String formatStr = new StringBuilder().append(formatMethod).append(LINE_SEPARATOR)
                .append(formatUri).append(LINE_SEPARATOR).append(formatParameters)
                .append(LINE_SEPARATOR).append(formatHeaders).append(LINE_SEPARATOR).toString();
        //System.out.println(formatStr + "\n");
        //对 HttpRequestInfo 使用 sha1 算法计算哈希值,与其他指定参数按照指定格式组成签名原串 StringToSign
        String hashFormatStr = DigestUtils.sha1Hex(formatStr);
        String stringToSign = new StringBuilder().append(Q_SIGN_ALGORITHM_VALUE)
                .append(LINE_SEPARATOR).append(qSignTimeStr).append(LINE_SEPARATOR)
                .append(hashFormatStr).append(LINE_SEPARATOR).toString();
        //System.out.println(stringToSign + "\n");
        String signature = HmacUtils.hmacSha1Hex(signKey, stringToSign);
        //使用 SignKey 对 StringToSign 进行加密,生成 Signature
        String authoriationStr = new StringBuilder().append(Q_SIGN_ALGORITHM_KEY).append("=")
                .append(Q_SIGN_ALGORITHM_VALUE).append("&").append(Q_AK).append("=")
                .append(secretId).append("&").append(Q_SIGN_TIME).append("=")
                .append(qSignTimeStr).append("&").append(Q_KEY_TIME).append("=").append(qKeyTimeStr)
                .append("&").append(Q_HEADER_LIST).append("=").append(qHeaderListStr).append("&")
                .append(Q_URL_PARAM_LIST).append("=").append(qUrlParamListStr).append("&")
                .append(Q_SIGNATURE).append("=").append(signature).toString();
        return authoriationStr;
    }

    /**
     * 获取请求签名Signature
     * @param paramMap get请求只需要传初始化的对象
     * @param headerMap get请求只需要传初始化的对象
     * @param path
     * @param method
     * @return
     */
    public static String getGetPostSignature(Map<String, String> paramMap,Map<String, String> headerMap,String path,String method){
        try {
            return ClsSignatureUtil.buildSignature(SecretId, SecretKey,
                    method, path, paramMap, headerMap, 300000);
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
        return null;
    }
}

 (4)需要用到的其他工具类(HttpUtil类)

package com.yd.core.utils;

import com.yd.core.log.Cls;
import org.apache.commons.lang.StringUtils;
import org.apache.http.NameValuePair;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.util.EntityUtils;

import javax.net.ssl.*;
import javax.servlet.http.HttpServletRequest;
import java.io.*;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLEncoder;
import java.security.KeyManagementException;
import java.security.NoSuchAlgorithmException;
import java.security.NoSuchProviderException;
import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;

/**
 * http请求
 */
public class HttpUtil {

    private static int READ_TIMEOUT_TIME=19000;//read timeout time (ms)
    private static int CONNECT_TIMEOUT_TIME=19000;//connect timeout time(ms)

    public static void setReadTimeoutTime(int readTimeoutTime) {

        READ_TIMEOUT_TIME = readTimeoutTime;
    }

    public static void setConnectTimeoutTime(int connectTimeoutTime) {

        CONNECT_TIMEOUT_TIME = connectTimeoutTime;
    }

    private HttpUtil() {}

    /**
     * https 域名校验
     */
    private class TrustAnyHostnameVerifier implements HostnameVerifier {
        public boolean verify(String hostname, SSLSession session) {
            return true;
        }
    }

    /**
     * https 证书管理
     */
    private class TrustAnyTrustManager implements X509TrustManager {
        public X509Certificate[] getAcceptedIssuers() {
            return null;
        }
        public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException {
        }
        public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException {
        }
    }

    private static final String GET  = "GET";
    private static final String POST = "POST";
    private static String CHARSET = "UTF-8";

    private static final SSLSocketFactory sslSocketFactory = initSSLSocketFactory();
    private static final TrustAnyHostnameVerifier trustAnyHostnameVerifier = new HttpUtil().new TrustAnyHostnameVerifier();

    private static SSLSocketFactory initSSLSocketFactory() {
        try {
            TrustManager[] tm = {new HttpUtil().new TrustAnyTrustManager() };
            SSLContext sslContext = SSLContext.getInstance("TLS");	// ("TLS", "SunJSSE");
            sslContext.init(null, tm, new java.security.SecureRandom());
            return sslContext.getSocketFactory();
        }
        catch (Exception e) {
            throw new RuntimeException(e);
        }
    }

    public static void setCharSet(String charSet) {
        if (StringUtils.isBlank(charSet)) {
            throw new IllegalArgumentException("charSet can not be blank.");
        }
        HttpUtil.CHARSET = charSet;
    }

    private static HttpURLConnection getHttpConnection(String url, String method, Map<String, String> headers) throws IOException, NoSuchAlgorithmException, NoSuchProviderException, KeyManagementException {
        URL _url = new URL(url);
        HttpURLConnection conn = (HttpURLConnection)_url.openConnection();
        if (conn instanceof HttpsURLConnection) {
            ((HttpsURLConnection)conn).setSSLSocketFactory(sslSocketFactory);
            ((HttpsURLConnection)conn).setHostnameVerifier(trustAnyHostnameVerifier);
        }
        conn.setRequestMethod(method);
        conn.setDoOutput(true);
        conn.setDoInput(true);
        conn.setConnectTimeout(CONNECT_TIMEOUT_TIME);
        //log.info("CONNECT_TIMEOUT_TIME-------"+CONNECT_TIMEOUT_TIME);
        conn.setReadTimeout(READ_TIMEOUT_TIME);
        //log.info("READ_TIMEOUT_TIME-------"+READ_TIMEOUT_TIME);

        if (headers != null && !headers.isEmpty())
            for (Entry<String, String> entry : headers.entrySet())
                conn.setRequestProperty(entry.getKey(), entry.getValue());
        else{
            conn.setRequestProperty("Content-Type","application/x-www-form-urlencoded");
            conn.setRequestProperty("User-Agent", "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.146 Safari/537.36");
        }
        return conn;
    }

    /**
     * Send GET taobao
     */
    public static String get(String url, Map<String, String> queryParas, Map<String, String> headers) {
        HttpURLConnection conn = null;
        try {
            conn = getHttpConnection(buildUrlWithQueryString(url, queryParas), GET, headers);
            conn.connect();
            return readResponseString(conn);
        }
        catch (Exception e) {
            throw new RuntimeException(e);
        }
        finally {
            if (conn != null) {
                conn.disconnect();
            }
        }
    }


    public static InputStream  getInputStream(String url) {
        HttpURLConnection conn = null;
        try {
            URL uri = new URL(url);
            return uri.openStream();
        }
        catch (Exception e) {
            throw new RuntimeException(e);
        }
        finally {
            if (conn != null) {
                conn.disconnect();
            }
        }
    }



    public static String get(String url, Map<String, String> queryParas) {
        return get(url, queryParas, null);
    }

    public static String get(String url) {
        return get(url, null, null);
    }

    /**
     * Send POST taobao
     */
    public static String post(String url, Map<String, String> queryParas, String data, Map<String, String> headers) {
        HttpURLConnection conn = null;
        try {
            conn = getHttpConnection(buildUrlWithQueryString(url, queryParas), POST, headers);
            conn.connect();
            OutputStream out = conn.getOutputStream();
            if(StringUtils.isNotBlank(data)){

            out.write(data.getBytes(CHARSET));
            }
            out.flush();
            out.close();

            return readResponseString(conn);
        }
        catch (Exception e) {
            throw new RuntimeException(e);
        }
        finally {
            if (conn != null) {
                conn.disconnect();
            }
        }
    }



    /**
     * Send POST taobao
     */
    public static byte[] postForByte(String url, Map<String, String> queryParas, String data, Map<String, String> headers) {
        HttpURLConnection conn = null;
        byte[] byteData = null;
        try {
            conn = getHttpConnection(buildUrlWithQueryString(url, queryParas), POST, headers);
            conn.connect();
            OutputStream out = conn.getOutputStream();
            out.write(data.getBytes(CHARSET));
            out.flush();
            out.close();
            InputStream inputStream = null;
            try {
                inputStream = conn.getInputStream();
                if (0 == inputStream.available()){
                    return byteData;
                }
                byteData = new byte[inputStream.available()];
                inputStream.read(byteData);
            }catch (Exception e) {
                throw new RuntimeException(e);
            }finally {
                if (inputStream != null) {
                    try {
                        inputStream.close();
                    } catch (IOException e) {
                        throw new RuntimeException(e);
                    }
                }
            }
        }catch (Exception e) {
            throw new RuntimeException(e);
        }finally {
            if (conn != null) {
                conn.disconnect();
            }
        }
        return byteData;
    }

    public static String post(String url, Map<String, String> queryParas, String data) {
        return post(url, queryParas, data, null);
    }

    public static String post(String url, Map<String, String> queryParas) {
        return post(url, queryParas, null, null);
    }

    public static String post(String url, String data, Map<String, String> headers) {
        return post(url, null, data, headers);
    }

    public static String post(String url, String data) {
        return post(url, null, data, null);
    }

    /**
     *post提交json数据
     * @param url
     * @param data
     * @return
     */
    public static String postJSON(String url, String data) {
        Map<String, String> headers = new HashMap<>();
        headers.put("Content-Type","application/json;charset=utf-8");
        return post(url, null, data, headers);
    }

    public static byte[] postForByte(String url, String data) {
        return postForByte(url, null, data, null);
    }

    private static String readResponseString(HttpURLConnection conn) {
        StringBuilder sb = new StringBuilder();
        InputStream inputStream = null;
        try {
            inputStream = conn.getInputStream();
            BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream, CHARSET));
            String line = null;
            while ((line = reader.readLine()) != null){
                sb.append(line).append("\n");
            }
            return sb.toString();
        }
        catch (Exception e) {
            throw new RuntimeException(e);
        }
        finally {
            if (inputStream != null) {
                try {
                    inputStream.close();
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
        }
    }



    /**
     * Build queryString of the url
     */
    private static String buildUrlWithQueryString(String url, Map<String, String> queryParas) {
        if (queryParas == null || queryParas.isEmpty())
            return url;

        StringBuilder sb = new StringBuilder(url);
        boolean isFirst;
        if (url.indexOf("?") == -1) {
            isFirst = true;
            sb.append("?");
        }
        else {
            isFirst = false;
        }

        for (Entry<String, String> entry : queryParas.entrySet()) {
            if (isFirst) isFirst = false;
            else sb.append("&");

            String key = entry.getKey();
            String value = entry.getValue();
            if (!StringUtils.isBlank(value))
                try {value = URLEncoder.encode(value, CHARSET);} catch (UnsupportedEncodingException e) {throw new RuntimeException(e);}
            sb.append(key).append("=").append(value);
        }
        return sb.toString();
    }

    public static String readData(HttpServletRequest request) {
        BufferedReader br = null;
        try {
            StringBuilder result = new StringBuilder();
            br = request.getReader();
            for (String line=null; (line=br.readLine())!=null;) {
                result.append(line).append("\n");
            }

            return result.toString();
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
        finally {
            if (br != null)
                try {br.close();} catch (IOException e) {throw new RuntimeException(e);}
        }
    }

    @Deprecated
    public static String readIncommingRequestData(HttpServletRequest request) {
        return readData(request);
    }

    public static String doPost(String url, Map<String, String> param) {
        // 创建Httpclient对象
        CloseableHttpClient httpClient = HttpClients.createDefault();
        CloseableHttpResponse response = null;
        String resultString = "";
        try {
            // 创建Http Post请求
            HttpPost httpPost = new HttpPost(url);
            // 创建参数列表
            if (param != null) {
                List<NameValuePair> paramList = new ArrayList<>();
                for (String key : param.keySet()) {
                    paramList.add(new BasicNameValuePair(key, param.get(key)));
                }
                // 模拟表单
                UrlEncodedFormEntity entity = new UrlEncodedFormEntity(paramList,"utf-8");
                httpPost.setEntity(entity);
            }
            // 执行http请求
            response = httpClient.execute(httpPost);
            resultString = EntityUtils.toString(response.getEntity(), "utf-8");
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            try {
                response.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }

        return resultString;
    }

    public static Integer doPostByClsByte(String url,Cls.LogGroupList.Builder logGroupList,Map<String, String> param,Map<String,String> header){
        HttpURLConnection conn = null;
        try {
            conn = getHttpConnection(buildUrlWithQueryString(url, param), "POST", header);
            conn.connect();
            OutputStream out = conn.getOutputStream();
            byte[] buff = logGroupList.build().toByteArray();
            out.write(buff);
            out.flush();
            out.close();
            return conn.getResponseCode();
        } catch (IOException e) {
            e.printStackTrace();
        } catch (NoSuchAlgorithmException e) {
            e.printStackTrace();
        } catch (KeyManagementException e) {
            e.printStackTrace();
        } catch (NoSuchProviderException e) {
            e.printStackTrace();
        } finally {
            if (conn != null) {
                conn.disconnect();
            }
        }
        return null;
    }
}






四、创建日志集、日志主题、机器组等

这些可以在腾讯云后台配置,也可使用api的形式,比较简单这里不仔细讲(需要将创建的日志集id和日志主题id放入到项目中)

五、最重要的上传结构化日志(日志主题检索状态必须开启)

(1)、Cls类(PB 文件编译得出的结果)

// Generated by the protocol buffer compiler.  DO NOT EDIT!
// source: cls.proto

package com.yd.core.log;

public final class Cls {
  private Cls() {}
  public static void registerAllExtensions(
      com.google.protobuf.ExtensionRegistry registry) {
  }
  public interface LogOrBuilder extends
      // @@protoc_insertion_point(interface_extends:cls.Log)
      com.google.protobuf.MessageOrBuilder {

    /**
     * <code>required int64 time = 1;</code>
     *
     * <pre>
     * 时间戳,UNIX时间格式
     * </pre>
     */
    boolean hasTime();
    /**
     * <code>required int64 time = 1;</code>
     *
     * <pre>
     * 时间戳,UNIX时间格式
     * </pre>
     */
    long getTime();

    /**
     * <code>repeated .cls.Log.Content contents = 2;</code>
     *
     * <pre>
     * 一条日志里的多个kv组合
     * </pre>
     */
    java.util.List<Log.Content>
        getContentsList();
    /**
     * <code>repeated .cls.Log.Content contents = 2;</code>
     *
     * <pre>
     * 一条日志里的多个kv组合
     * </pre>
     */
    Log.Content getContents(int index);
    /**
     * <code>repeated .cls.Log.Content contents = 2;</code>
     *
     * <pre>
     * 一条日志里的多个kv组合
     * </pre>
     */
    int getContentsCount();
    /**
     * <code>repeated .cls.Log.Content contents = 2;</code>
     *
     * <pre>
     * 一条日志里的多个kv组合
     * </pre>
     */
    java.util.List<? extends Log.ContentOrBuilder>
        getContentsOrBuilderList();
    /**
     * <code>repeated .cls.Log.Content contents = 2;</code>
     *
     * <pre>
     * 一条日志里的多个kv组合
     * </pre>
     */
    Log.ContentOrBuilder getContentsOrBuilder(
            int index);
  }
  /**
   * Protobuf type {@code cls.Log}
   */
  public static final class Log extends
      com.google.protobuf.GeneratedMessage implements
      // @@protoc_insertion_point(message_implements:cls.Log)
      LogOrBuilder {
    // Use Log.newBuilder() to construct.
    private Log(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
      super(builder);
      this.unknownFields = builder.getUnknownFields();
    }
    private Log(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }

    private static final Log defaultInstance;
    public static Log getDefaultInstance() {
      return defaultInstance;
    }

    public Log getDefaultInstanceForType() {
      return defaultInstance;
    }

    private final com.google.protobuf.UnknownFieldSet unknownFields;
    @Override
    public final com.google.protobuf.UnknownFieldSet
        getUnknownFields() {
      return this.unknownFields;
    }
    private Log(
        com.google.protobuf.CodedInputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws com.google.protobuf.InvalidProtocolBufferException {
      initFields();
      int mutable_bitField0_ = 0;
      com.google.protobuf.UnknownFieldSet.Builder unknownFields =
          com.google.protobuf.UnknownFieldSet.newBuilder();
      try {
        boolean done = false;
        while (!done) {
          int tag = input.readTag();
          switch (tag) {
            case 0:
              done = true;
              break;
            default: {
              if (!parseUnknownField(input, unknownFields,
                                     extensionRegistry, tag)) {
                done = true;
              }
              break;
            }
            case 8: {
              bitField0_ |= 0x00000001;
              time_ = input.readInt64();
              break;
            }
            case 18: {
              if (!((mutable_bitField0_ & 0x00000002) == 0x00000002)) {
                contents_ = new java.util.ArrayList<Content>();
                mutable_bitField0_ |= 0x00000002;
              }
              contents_.add(input.readMessage(Content.PARSER, extensionRegistry));
              break;
            }
          }
        }
      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
        throw e.setUnfinishedMessage(this);
      } catch (java.io.IOException e) {
        throw new com.google.protobuf.InvalidProtocolBufferException(
            e.getMessage()).setUnfinishedMessage(this);
      } finally {
        if (((mutable_bitField0_ & 0x00000002) == 0x00000002)) {
          contents_ = java.util.Collections.unmodifiableList(contents_);
        }
        this.unknownFields = unknownFields.build();
        makeExtensionsImmutable();
      }
    }
    public static final com.google.protobuf.Descriptors.Descriptor
        getDescriptor() {
      return Cls.internal_static_cls_Log_descriptor;
    }

    protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
        internalGetFieldAccessorTable() {
      return Cls.internal_static_cls_Log_fieldAccessorTable
          .ensureFieldAccessorsInitialized(
              Log.class, Builder.class);
    }

    public static com.google.protobuf.Parser<Log> PARSER =
        new com.google.protobuf.AbstractParser<Log>() {
      public Log parsePartialFrom(
          com.google.protobuf.CodedInputStream input,
          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
          throws com.google.protobuf.InvalidProtocolBufferException {
        return new Log(input, extensionRegistry);
      }
    };

    @Override
    public com.google.protobuf.Parser<Log> getParserForType() {
      return PARSER;
    }

    public interface ContentOrBuilder extends
        // @@protoc_insertion_point(interface_extends:cls.Log.Content)
        com.google.protobuf.MessageOrBuilder {

      /**
       * <code>required string key = 1;</code>
       *
       * <pre>
       * 每组字段的 key
       * </pre>
       */
      boolean hasKey();
      /**
       * <code>required string key = 1;</code>
       *
       * <pre>
       * 每组字段的 key
       * </pre>
       */
      String getKey();
      /**
       * <code>required string key = 1;</code>
       *
       * <pre>
       * 每组字段的 key
       * </pre>
       */
      com.google.protobuf.ByteString
          getKeyBytes();

      /**
       * <code>required string value = 2;</code>
       *
       * <pre>
       * 每组字段的 value
       * </pre>
       */
      boolean hasValue();
      /**
       * <code>required string value = 2;</code>
       *
       * <pre>
       * 每组字段的 value
       * </pre>
       */
      String getValue();
      /**
       * <code>required string value = 2;</code>
       *
       * <pre>
       * 每组字段的 value
       * </pre>
       */
      com.google.protobuf.ByteString
          getValueBytes();
    }
    /**
     * Protobuf type {@code cls.Log.Content}
     */
    public static final class Content extends
        com.google.protobuf.GeneratedMessage implements
        // @@protoc_insertion_point(message_implements:cls.Log.Content)
        ContentOrBuilder {
      // Use Content.newBuilder() to construct.
      private Content(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
        super(builder);
        this.unknownFields = builder.getUnknownFields();
      }
      private Content(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }

      private static final Content defaultInstance;
      public static Content getDefaultInstance() {
        return defaultInstance;
      }

      public Content getDefaultInstanceForType() {
        return defaultInstance;
      }

      private final com.google.protobuf.UnknownFieldSet unknownFields;
      @Override
      public final com.google.protobuf.UnknownFieldSet
          getUnknownFields() {
        return this.unknownFields;
      }
      private Content(
          com.google.protobuf.CodedInputStream input,
          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
          throws com.google.protobuf.InvalidProtocolBufferException {
        initFields();
        int mutable_bitField0_ = 0;
        com.google.protobuf.UnknownFieldSet.Builder unknownFields =
            com.google.protobuf.UnknownFieldSet.newBuilder();
        try {
          boolean done = false;
          while (!done) {
            int tag = input.readTag();
            switch (tag) {
              case 0:
                done = true;
                break;
              default: {
                if (!parseUnknownField(input, unknownFields,
                                       extensionRegistry, tag)) {
                  done = true;
                }
                break;
              }
              case 10: {
                com.google.protobuf.ByteString bs = input.readBytes();
                bitField0_ |= 0x00000001;
                key_ = bs;
                break;
              }
              case 18: {
                com.google.protobuf.ByteString bs = input.readBytes();
                bitField0_ |= 0x00000002;
                value_ = bs;
                break;
              }
            }
          }
        } catch (com.google.protobuf.InvalidProtocolBufferException e) {
          throw e.setUnfinishedMessage(this);
        } catch (java.io.IOException e) {
          throw new com.google.protobuf.InvalidProtocolBufferException(
              e.getMessage()).setUnfinishedMessage(this);
        } finally {
          this.unknownFields = unknownFields.build();
          makeExtensionsImmutable();
        }
      }
      public static final com.google.protobuf.Descriptors.Descriptor
          getDescriptor() {
        return Cls.internal_static_cls_Log_Content_descriptor;
      }

      protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
          internalGetFieldAccessorTable() {
        return Cls.internal_static_cls_Log_Content_fieldAccessorTable
            .ensureFieldAccessorsInitialized(
                Content.class, Builder.class);
      }

      public static com.google.protobuf.Parser<Content> PARSER =
          new com.google.protobuf.AbstractParser<Content>() {
        public Content parsePartialFrom(
            com.google.protobuf.CodedInputStream input,
            com.google.protobuf.ExtensionRegistryLite extensionRegistry)
            throws com.google.protobuf.InvalidProtocolBufferException {
          return new Content(input, extensionRegistry);
        }
      };

      @Override
      public com.google.protobuf.Parser<Content> getParserForType() {
        return PARSER;
      }

      private int bitField0_;
      public static final int KEY_FIELD_NUMBER = 1;
      private Object key_;
      /**
       * <code>required string key = 1;</code>
       *
       * <pre>
       * 每组字段的 key
       * </pre>
       */
      public boolean hasKey() {
        return ((bitField0_ & 0x00000001) == 0x00000001);
      }
      /**
       * <code>required string key = 1;</code>
       *
       * <pre>
       * 每组字段的 key
       * </pre>
       */
      public String getKey() {
        Object ref = key_;
        if (ref instanceof String) {
          return (String) ref;
        } else {
          com.google.protobuf.ByteString bs =
              (com.google.protobuf.ByteString) ref;
          String s = bs.toStringUtf8();
          if (bs.isValidUtf8()) {
            key_ = s;
          }
          return s;
        }
      }
      /**
       * <code>required string key = 1;</code>
       *
       * <pre>
       * 每组字段的 key
       * </pre>
       */
      public com.google.protobuf.ByteString
          getKeyBytes() {
        Object ref = key_;
        if (ref instanceof String) {
          com.google.protobuf.ByteString b =
              com.google.protobuf.ByteString.copyFromUtf8(
                  (String) ref);
          key_ = b;
          return b;
        } else {
          return (com.google.protobuf.ByteString) ref;
        }
      }

      public static final int VALUE_FIELD_NUMBER = 2;
      private Object value_;
      /**
       * <code>required string value = 2;</code>
       *
       * <pre>
       * 每组字段的 value
       * </pre>
       */
      public boolean hasValue() {
        return ((bitField0_ & 0x00000002) == 0x00000002);
      }
      /**
       * <code>required string value = 2;</code>
       *
       * <pre>
       * 每组字段的 value
       * </pre>
       */
      public String getValue() {
        Object ref = value_;
        if (ref instanceof String) {
          return (String) ref;
        } else {
          com.google.protobuf.ByteString bs =
              (com.google.protobuf.ByteString) ref;
          String s = bs.toStringUtf8();
          if (bs.isValidUtf8()) {
            value_ = s;
          }
          return s;
        }
      }
      /**
       * <code>required string value = 2;</code>
       *
       * <pre>
       * 每组字段的 value
       * </pre>
       */
      public com.google.protobuf.ByteString
          getValueBytes() {
        Object ref = value_;
        if (ref instanceof String) {
          com.google.protobuf.ByteString b =
              com.google.protobuf.ByteString.copyFromUtf8(
                  (String) ref);
          value_ = b;
          return b;
        } else {
          return (com.google.protobuf.ByteString) ref;
        }
      }

      private void initFields() {
        key_ = "";
        value_ = "";
      }
      private byte memoizedIsInitialized = -1;
      public final boolean isInitialized() {
        byte isInitialized = memoizedIsInitialized;
        if (isInitialized == 1) return true;
        if (isInitialized == 0) return false;

        if (!hasKey()) {
          memoizedIsInitialized = 0;
          return false;
        }
        if (!hasValue()) {
          memoizedIsInitialized = 0;
          return false;
        }
        memoizedIsInitialized = 1;
        return true;
      }

      public void writeTo(com.google.protobuf.CodedOutputStream output)
                          throws java.io.IOException {
        getSerializedSize();
        if (((bitField0_ & 0x00000001) == 0x00000001)) {
          output.writeBytes(1, getKeyBytes());
        }
        if (((bitField0_ & 0x00000002) == 0x00000002)) {
          output.writeBytes(2, getValueBytes());
        }
        getUnknownFields().writeTo(output);
      }

      private int memoizedSerializedSize = -1;
      public int getSerializedSize() {
        int size = memoizedSerializedSize;
        if (size != -1) return size;

        size = 0;
        if (((bitField0_ & 0x00000001) == 0x00000001)) {
          size += com.google.protobuf.CodedOutputStream
            .computeBytesSize(1, getKeyBytes());
        }
        if (((bitField0_ & 0x00000002) == 0x00000002)) {
          size += com.google.protobuf.CodedOutputStream
            .computeBytesSize(2, getValueBytes());
        }
        size += getUnknownFields().getSerializedSize();
        memoizedSerializedSize = size;
        return size;
      }

      private static final long serialVersionUID = 0L;
      @Override
      protected Object writeReplace()
          throws java.io.ObjectStreamException {
        return super.writeReplace();
      }

      public static Content parseFrom(
          com.google.protobuf.ByteString data)
          throws com.google.protobuf.InvalidProtocolBufferException {
        return PARSER.parseFrom(data);
      }
      public static Content parseFrom(
          com.google.protobuf.ByteString data,
          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
          throws com.google.protobuf.InvalidProtocolBufferException {
        return PARSER.parseFrom(data, extensionRegistry);
      }
      public static Content parseFrom(byte[] data)
          throws com.google.protobuf.InvalidProtocolBufferException {
        return PARSER.parseFrom(data);
      }
      public static Content parseFrom(
          byte[] data,
          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
          throws com.google.protobuf.InvalidProtocolBufferException {
        return PARSER.parseFrom(data, extensionRegistry);
      }
      public static Content parseFrom(java.io.InputStream input)
          throws java.io.IOException {
        return PARSER.parseFrom(input);
      }
      public static Content parseFrom(
          java.io.InputStream input,
          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
          throws java.io.IOException {
        return PARSER.parseFrom(input, extensionRegistry);
      }
      public static Content parseDelimitedFrom(java.io.InputStream input)
          throws java.io.IOException {
        return PARSER.parseDelimitedFrom(input);
      }
      public static Content parseDelimitedFrom(
          java.io.InputStream input,
          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
          throws java.io.IOException {
        return PARSER.parseDelimitedFrom(input, extensionRegistry);
      }
      public static Content parseFrom(
          com.google.protobuf.CodedInputStream input)
          throws java.io.IOException {
        return PARSER.parseFrom(input);
      }
      public static Content parseFrom(
          com.google.protobuf.CodedInputStream input,
          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
          throws java.io.IOException {
        return PARSER.parseFrom(input, extensionRegistry);
      }

      public static Builder newBuilder() { return Builder.create(); }
      public Builder newBuilderForType() { return newBuilder(); }
      public static Builder newBuilder(Content prototype) {
        return newBuilder().mergeFrom(prototype);
      }
      public Builder toBuilder() { return newBuilder(this); }

      @Override
      protected Builder newBuilderForType(
          com.google.protobuf.GeneratedMessage.BuilderParent parent) {
        Builder builder = new Builder(parent);
        return builder;
      }
      /**
       * Protobuf type {@code cls.Log.Content}
       */
      public static final class Builder extends
          com.google.protobuf.GeneratedMessage.Builder<Builder> implements
          // @@protoc_insertion_point(builder_implements:cls.Log.Content)
          ContentOrBuilder {
        public static final com.google.protobuf.Descriptors.Descriptor
            getDescriptor() {
          return Cls.internal_static_cls_Log_Content_descriptor;
        }

        protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
            internalGetFieldAccessorTable() {
          return Cls.internal_static_cls_Log_Content_fieldAccessorTable
              .ensureFieldAccessorsInitialized(
                  Content.class, Builder.class);
        }

        // Construct using cls.Cls.Log.Content.newBuilder()
        private Builder() {
          maybeForceBuilderInitialization();
        }

        private Builder(
            com.google.protobuf.GeneratedMessage.BuilderParent parent) {
          super(parent);
          maybeForceBuilderInitialization();
        }
        private void maybeForceBuilderInitialization() {
          if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
          }
        }
        private static Builder create() {
          return new Builder();
        }

        public Builder clear() {
          super.clear();
          key_ = "";
          bitField0_ = (bitField0_ & ~0x00000001);
          value_ = "";
          bitField0_ = (bitField0_ & ~0x00000002);
          return this;
        }

        public Builder clone() {
          return create().mergeFrom(buildPartial());
        }

        public com.google.protobuf.Descriptors.Descriptor
            getDescriptorForType() {
          return Cls.internal_static_cls_Log_Content_descriptor;
        }

        public Content getDefaultInstanceForType() {
          return Content.getDefaultInstance();
        }

        public Content build() {
          Content result = buildPartial();
          if (!result.isInitialized()) {
            throw newUninitializedMessageException(result);
          }
          return result;
        }

        public Content buildPartial() {
          Content result = new Content(this);
          int from_bitField0_ = bitField0_;
          int to_bitField0_ = 0;
          if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
            to_bitField0_ |= 0x00000001;
          }
          result.key_ = key_;
          if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
            to_bitField0_ |= 0x00000002;
          }
          result.value_ = value_;
          result.bitField0_ = to_bitField0_;
          onBuilt();
          return result;
        }

        public Builder mergeFrom(com.google.protobuf.Message other) {
          if (other instanceof Content) {
            return mergeFrom((Content)other);
          } else {
            super.mergeFrom(other);
            return this;
          }
        }

        public Builder mergeFrom(Content other) {
          if (other == Content.getDefaultInstance()) return this;
          if (other.hasKey()) {
            bitField0_ |= 0x00000001;
            key_ = other.key_;
            onChanged();
          }
          if (other.hasValue()) {
            bitField0_ |= 0x00000002;
            value_ = other.value_;
            onChanged();
          }
          this.mergeUnknownFields(other.getUnknownFields());
          return this;
        }

        public final boolean isInitialized() {
          if (!hasKey()) {

            return false;
          }
          if (!hasValue()) {

            return false;
          }
          return true;
        }

        public Builder mergeFrom(
            com.google.protobuf.CodedInputStream input,
            com.google.protobuf.ExtensionRegistryLite extensionRegistry)
            throws java.io.IOException {
          Content parsedMessage = null;
          try {
            parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
          } catch (com.google.protobuf.InvalidProtocolBufferException e) {
            parsedMessage = (Content) e.getUnfinishedMessage();
            throw e;
          } finally {
            if (parsedMessage != null) {
              mergeFrom(parsedMessage);
            }
          }
          return this;
        }
        private int bitField0_;

        private Object key_ = "";
        /**
         * <code>required string key = 1;</code>
         *
         * <pre>
         * 每组字段的 key
         * </pre>
         */
        public boolean hasKey() {
          return ((bitField0_ & 0x00000001) == 0x00000001);
        }
        /**
         * <code>required string key = 1;</code>
         *
         * <pre>
         * 每组字段的 key
         * </pre>
         */
        public String getKey() {
          Object ref = key_;
          if (!(ref instanceof String)) {
            com.google.protobuf.ByteString bs =
                (com.google.protobuf.ByteString) ref;
            String s = bs.toStringUtf8();
            if (bs.isValidUtf8()) {
              key_ = s;
            }
            return s;
          } else {
            return (String) ref;
          }
        }
        /**
         * <code>required string key = 1;</code>
         *
         * <pre>
         * 每组字段的 key
         * </pre>
         */
        public com.google.protobuf.ByteString
            getKeyBytes() {
          Object ref = key_;
          if (ref instanceof String) {
            com.google.protobuf.ByteString b =
                com.google.protobuf.ByteString.copyFromUtf8(
                    (String) ref);
            key_ = b;
            return b;
          } else {
            return (com.google.protobuf.ByteString) ref;
          }
        }
        /**
         * <code>required string key = 1;</code>
         *
         * <pre>
         * 每组字段的 key
         * </pre>
         */
        public Builder setKey(
            String value) {
          if (value == null) {
    throw new NullPointerException();
  }
  bitField0_ |= 0x00000001;
          key_ = value;
          onChanged();
          return this;
        }
        /**
         * <code>required string key = 1;</code>
         *
         * <pre>
         * 每组字段的 key
         * </pre>
         */
        public Builder clearKey() {
          bitField0_ = (bitField0_ & ~0x00000001);
          key_ = getDefaultInstance().getKey();
          onChanged();
          return this;
        }
        /**
         * <code>required string key = 1;</code>
         *
         * <pre>
         * 每组字段的 key
         * </pre>
         */
        public Builder setKeyBytes(
            com.google.protobuf.ByteString value) {
          if (value == null) {
    throw new NullPointerException();
  }
  bitField0_ |= 0x00000001;
          key_ = value;
          onChanged();
          return this;
        }

        private Object value_ = "";
        /**
         * <code>required string value = 2;</code>
         *
         * <pre>
         * 每组字段的 value
         * </pre>
         */
        public boolean hasValue() {
          return ((bitField0_ & 0x00000002) == 0x00000002);
        }
        /**
         * <code>required string value = 2;</code>
         *
         * <pre>
         * 每组字段的 value
         * </pre>
         */
        public String getValue() {
          Object ref = value_;
          if (!(ref instanceof String)) {
            com.google.protobuf.ByteString bs =
                (com.google.protobuf.ByteString) ref;
            String s = bs.toStringUtf8();
            if (bs.isValidUtf8()) {
              value_ = s;
            }
            return s;
          } else {
            return (String) ref;
          }
        }
        /**
         * <code>required string value = 2;</code>
         *
         * <pre>
         * 每组字段的 value
         * </pre>
         */
        public com.google.protobuf.ByteString
            getValueBytes() {
          Object ref = value_;
          if (ref instanceof String) {
            com.google.protobuf.ByteString b =
                com.google.protobuf.ByteString.copyFromUtf8(
                    (String) ref);
            value_ = b;
            return b;
          } else {
            return (com.google.protobuf.ByteString) ref;
          }
        }
        /**
         * <code>required string value = 2;</code>
         *
         * <pre>
         * 每组字段的 value
         * </pre>
         */
        public Builder setValue(
            String value) {
          if (value == null) {
    throw new NullPointerException();
  }
  bitField0_ |= 0x00000002;
          value_ = value;
          onChanged();
          return this;
        }
        /**
         * <code>required string value = 2;</code>
         *
         * <pre>
         * 每组字段的 value
         * </pre>
         */
        public Builder clearValue() {
          bitField0_ = (bitField0_ & ~0x00000002);
          value_ = getDefaultInstance().getValue();
          onChanged();
          return this;
        }
        /**
         * <code>required string value = 2;</code>
         *
         * <pre>
         * 每组字段的 value
         * </pre>
         */
        public Builder setValueBytes(
            com.google.protobuf.ByteString value) {
          if (value == null) {
    throw new NullPointerException();
  }
  bitField0_ |= 0x00000002;
          value_ = value;
          onChanged();
          return this;
        }

        // @@protoc_insertion_point(builder_scope:cls.Log.Content)
      }

      static {
        defaultInstance = new Content(true);
        defaultInstance.initFields();
      }

      // @@protoc_insertion_point(class_scope:cls.Log.Content)
    }

    private int bitField0_;
    public static final int TIME_FIELD_NUMBER = 1;
    private long time_;
    /**
     * <code>required int64 time = 1;</code>
     *
     * <pre>
     * 时间戳,UNIX时间格式
     * </pre>
     */
    public boolean hasTime() {
      return ((bitField0_ & 0x00000001) == 0x00000001);
    }
    /**
     * <code>required int64 time = 1;</code>
     *
     * <pre>
     * 时间戳,UNIX时间格式
     * </pre>
     */
    public long getTime() {
      return time_;
    }

    public static final int CONTENTS_FIELD_NUMBER = 2;
    private java.util.List<Content> contents_;
    /**
     * <code>repeated .cls.Log.Content contents = 2;</code>
     *
     * <pre>
     * 一条日志里的多个kv组合
     * </pre>
     */
    public java.util.List<Content> getContentsList() {
      return contents_;
    }
    /**
     * <code>repeated .cls.Log.Content contents = 2;</code>
     *
     * <pre>
     * 一条日志里的多个kv组合
     * </pre>
     */
    public java.util.List<? extends ContentOrBuilder>
        getContentsOrBuilderList() {
      return contents_;
    }
    /**
     * <code>repeated .cls.Log.Content contents = 2;</code>
     *
     * <pre>
     * 一条日志里的多个kv组合
     * </pre>
     */
    public int getContentsCount() {
      return contents_.size();
    }
    /**
     * <code>repeated .cls.Log.Content contents = 2;</code>
     *
     * <pre>
     * 一条日志里的多个kv组合
     * </pre>
     */
    public Content getContents(int index) {
      return contents_.get(index);
    }
    /**
     * <code>repeated .cls.Log.Content contents = 2;</code>
     *
     * <pre>
     * 一条日志里的多个kv组合
     * </pre>
     */
    public ContentOrBuilder getContentsOrBuilder(
        int index) {
      return contents_.get(index);
    }

    private void initFields() {
      time_ = 0L;
      contents_ = java.util.Collections.emptyList();
    }
    private byte memoizedIsInitialized = -1;
    public final boolean isInitialized() {
      byte isInitialized = memoizedIsInitialized;
      if (isInitialized == 1) return true;
      if (isInitialized == 0) return false;

      if (!hasTime()) {
        memoizedIsInitialized = 0;
        return false;
      }
      for (int i = 0; i < getContentsCount(); i++) {
        if (!getContents(i).isInitialized()) {
          memoizedIsInitialized = 0;
          return false;
        }
      }
      memoizedIsInitialized = 1;
      return true;
    }

    public void writeTo(com.google.protobuf.CodedOutputStream output)
                        throws java.io.IOException {
      getSerializedSize();
      if (((bitField0_ & 0x00000001) == 0x00000001)) {
        output.writeInt64(1, time_);
      }
      for (int i = 0; i < contents_.size(); i++) {
        output.writeMessage(2, contents_.get(i));
      }
      getUnknownFields().writeTo(output);
    }

    private int memoizedSerializedSize = -1;
    public int getSerializedSize() {
      int size = memoizedSerializedSize;
      if (size != -1) return size;

      size = 0;
      if (((bitField0_ & 0x00000001) == 0x00000001)) {
        size += com.google.protobuf.CodedOutputStream
          .computeInt64Size(1, time_);
      }
      for (int i = 0; i < contents_.size(); i++) {
        size += com.google.protobuf.CodedOutputStream
          .computeMessageSize(2, contents_.get(i));
      }
      size += getUnknownFields().getSerializedSize();
      memoizedSerializedSize = size;
      return size;
    }

    private static final long serialVersionUID = 0L;
    @Override
    protected Object writeReplace()
        throws java.io.ObjectStreamException {
      return super.writeReplace();
    }

    public static Log parseFrom(
        com.google.protobuf.ByteString data)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data);
    }
    public static Log parseFrom(
        com.google.protobuf.ByteString data,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data, extensionRegistry);
    }
    public static Log parseFrom(byte[] data)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data);
    }
    public static Log parseFrom(
        byte[] data,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data, extensionRegistry);
    }
    public static Log parseFrom(java.io.InputStream input)
        throws java.io.IOException {
      return PARSER.parseFrom(input);
    }
    public static Log parseFrom(
        java.io.InputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      return PARSER.parseFrom(input, extensionRegistry);
    }
    public static Log parseDelimitedFrom(java.io.InputStream input)
        throws java.io.IOException {
      return PARSER.parseDelimitedFrom(input);
    }
    public static Log parseDelimitedFrom(
        java.io.InputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      return PARSER.parseDelimitedFrom(input, extensionRegistry);
    }
    public static Log parseFrom(
        com.google.protobuf.CodedInputStream input)
        throws java.io.IOException {
      return PARSER.parseFrom(input);
    }
    public static Log parseFrom(
        com.google.protobuf.CodedInputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      return PARSER.parseFrom(input, extensionRegistry);
    }

    public static Builder newBuilder() { return Builder.create(); }
    public Builder newBuilderForType() { return newBuilder(); }
    public static Builder newBuilder(Log prototype) {
      return newBuilder().mergeFrom(prototype);
    }
    public Builder toBuilder() { return newBuilder(this); }

    @Override
    protected Builder newBuilderForType(
        com.google.protobuf.GeneratedMessage.BuilderParent parent) {
      Builder builder = new Builder(parent);
      return builder;
    }
    /**
     * Protobuf type {@code cls.Log}
     */
    public static final class Builder extends
        com.google.protobuf.GeneratedMessage.Builder<Builder> implements
        // @@protoc_insertion_point(builder_implements:cls.Log)
        LogOrBuilder {
      public static final com.google.protobuf.Descriptors.Descriptor
          getDescriptor() {
        return Cls.internal_static_cls_Log_descriptor;
      }

      protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
          internalGetFieldAccessorTable() {
        return Cls.internal_static_cls_Log_fieldAccessorTable
            .ensureFieldAccessorsInitialized(
                Log.class, Builder.class);
      }

      // Construct using cls.Cls.Log.newBuilder()
      private Builder() {
        maybeForceBuilderInitialization();
      }

      private Builder(
          com.google.protobuf.GeneratedMessage.BuilderParent parent) {
        super(parent);
        maybeForceBuilderInitialization();
      }
      private void maybeForceBuilderInitialization() {
        if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
          getContentsFieldBuilder();
        }
      }
      private static Builder create() {
        return new Builder();
      }

      public Builder clear() {
        super.clear();
        time_ = 0L;
        bitField0_ = (bitField0_ & ~0x00000001);
        if (contentsBuilder_ == null) {
          contents_ = java.util.Collections.emptyList();
          bitField0_ = (bitField0_ & ~0x00000002);
        } else {
          contentsBuilder_.clear();
        }
        return this;
      }

      public Builder clone() {
        return create().mergeFrom(buildPartial());
      }

      public com.google.protobuf.Descriptors.Descriptor
          getDescriptorForType() {
        return Cls.internal_static_cls_Log_descriptor;
      }

      public Log getDefaultInstanceForType() {
        return Log.getDefaultInstance();
      }

      public Log build() {
        Log result = buildPartial();
        if (!result.isInitialized()) {
          throw newUninitializedMessageException(result);
        }
        return result;
      }

      public Log buildPartial() {
        Log result = new Log(this);
        int from_bitField0_ = bitField0_;
        int to_bitField0_ = 0;
        if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
          to_bitField0_ |= 0x00000001;
        }
        result.time_ = time_;
        if (contentsBuilder_ == null) {
          if (((bitField0_ & 0x00000002) == 0x00000002)) {
            contents_ = java.util.Collections.unmodifiableList(contents_);
            bitField0_ = (bitField0_ & ~0x00000002);
          }
          result.contents_ = contents_;
        } else {
          result.contents_ = contentsBuilder_.build();
        }
        result.bitField0_ = to_bitField0_;
        onBuilt();
        return result;
      }

      public Builder mergeFrom(com.google.protobuf.Message other) {
        if (other instanceof Log) {
          return mergeFrom((Log)other);
        } else {
          super.mergeFrom(other);
          return this;
        }
      }

      public Builder mergeFrom(Log other) {
        if (other == Log.getDefaultInstance()) return this;
        if (other.hasTime()) {
          setTime(other.getTime());
        }
        if (contentsBuilder_ == null) {
          if (!other.contents_.isEmpty()) {
            if (contents_.isEmpty()) {
              contents_ = other.contents_;
              bitField0_ = (bitField0_ & ~0x00000002);
            } else {
              ensureContentsIsMutable();
              contents_.addAll(other.contents_);
            }
            onChanged();
          }
        } else {
          if (!other.contents_.isEmpty()) {
            if (contentsBuilder_.isEmpty()) {
              contentsBuilder_.dispose();
              contentsBuilder_ = null;
              contents_ = other.contents_;
              bitField0_ = (bitField0_ & ~0x00000002);
              contentsBuilder_ =
                com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ?
                   getContentsFieldBuilder() : null;
            } else {
              contentsBuilder_.addAllMessages(other.contents_);
            }
          }
        }
        this.mergeUnknownFields(other.getUnknownFields());
        return this;
      }

      public final boolean isInitialized() {
        if (!hasTime()) {

          return false;
        }
        for (int i = 0; i < getContentsCount(); i++) {
          if (!getContents(i).isInitialized()) {

            return false;
          }
        }
        return true;
      }

      public Builder mergeFrom(
          com.google.protobuf.CodedInputStream input,
          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
          throws java.io.IOException {
        Log parsedMessage = null;
        try {
          parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
        } catch (com.google.protobuf.InvalidProtocolBufferException e) {
          parsedMessage = (Log) e.getUnfinishedMessage();
          throw e;
        } finally {
          if (parsedMessage != null) {
            mergeFrom(parsedMessage);
          }
        }
        return this;
      }
      private int bitField0_;

      private long time_ ;
      /**
       * <code>required int64 time = 1;</code>
       *
       * <pre>
       * 时间戳,UNIX时间格式
       * </pre>
       */
      public boolean hasTime() {
        return ((bitField0_ & 0x00000001) == 0x00000001);
      }
      /**
       * <code>required int64 time = 1;</code>
       *
       * <pre>
       * 时间戳,UNIX时间格式
       * </pre>
       */
      public long getTime() {
        return time_;
      }
      /**
       * <code>required int64 time = 1;</code>
       *
       * <pre>
       * 时间戳,UNIX时间格式
       * </pre>
       */
      public Builder setTime(long value) {
        bitField0_ |= 0x00000001;
        time_ = value;
        onChanged();
        return this;
      }
      /**
       * <code>required int64 time = 1;</code>
       *
       * <pre>
       * 时间戳,UNIX时间格式
       * </pre>
       */
      public Builder clearTime() {
        bitField0_ = (bitField0_ & ~0x00000001);
        time_ = 0L;
        onChanged();
        return this;
      }

      private java.util.List<Content> contents_ =
        java.util.Collections.emptyList();
      private void ensureContentsIsMutable() {
        if (!((bitField0_ & 0x00000002) == 0x00000002)) {
          contents_ = new java.util.ArrayList<Content>(contents_);
          bitField0_ |= 0x00000002;
         }
      }

      private com.google.protobuf.RepeatedFieldBuilder<
          Content, Content.Builder, ContentOrBuilder> contentsBuilder_;

      /**
       * <code>repeated .cls.Log.Content contents = 2;</code>
       *
       * <pre>
       * 一条日志里的多个kv组合
       * </pre>
       */
      public java.util.List<Content> getContentsList() {
        if (contentsBuilder_ == null) {
          return java.util.Collections.unmodifiableList(contents_);
        } else {
          return contentsBuilder_.getMessageList();
        }
      }
      /**
       * <code>repeated .cls.Log.Content contents = 2;</code>
       *
       * <pre>
       * 一条日志里的多个kv组合
       * </pre>
       */
      public int getContentsCount() {
        if (contentsBuilder_ == null) {
          return contents_.size();
        } else {
          return contentsBuilder_.getCount();
        }
      }
      /**
       * <code>repeated .cls.Log.Content contents = 2;</code>
       *
       * <pre>
       * 一条日志里的多个kv组合
       * </pre>
       */
      public Content getContents(int index) {
        if (contentsBuilder_ == null) {
          return contents_.get(index);
        } else {
          return contentsBuilder_.getMessage(index);
        }
      }
      /**
       * <code>repeated .cls.Log.Content contents = 2;</code>
       *
       * <pre>
       * 一条日志里的多个kv组合
       * </pre>
       */
      public Builder setContents(
          int index, Content value) {
        if (contentsBuilder_ == null) {
          if (value == null) {
            throw new NullPointerException();
          }
          ensureContentsIsMutable();
          contents_.set(index, value);
          onChanged();
        } else {
          contentsBuilder_.setMessage(index, value);
        }
        return this;
      }
      /**
       * <code>repeated .cls.Log.Content contents = 2;</code>
       *
       * <pre>
       * 一条日志里的多个kv组合
       * </pre>
       */
      public Builder setContents(
          int index, Content.Builder builderForValue) {
        if (contentsBuilder_ == null) {
          ensureContentsIsMutable();
          contents_.set(index, builderForValue.build());
          onChanged();
        } else {
          contentsBuilder_.setMessage(index, builderForValue.build());
        }
        return this;
      }
      /**
       * <code>repeated .cls.Log.Content contents = 2;</code>
       *
       * <pre>
       * 一条日志里的多个kv组合
       * </pre>
       */
      public Builder addContents(Content value) {
        if (contentsBuilder_ == null) {
          if (value == null) {
            throw new NullPointerException();
          }
          ensureContentsIsMutable();
          contents_.add(value);
          onChanged();
        } else {
          contentsBuilder_.addMessage(value);
        }
        return this;
      }
      /**
       * <code>repeated .cls.Log.Content contents = 2;</code>
       *
       * <pre>
       * 一条日志里的多个kv组合
       * </pre>
       */
      public Builder addContents(
          int index, Content value) {
        if (contentsBuilder_ == null) {
          if (value == null) {
            throw new NullPointerException();
          }
          ensureContentsIsMutable();
          contents_.add(index, value);
          onChanged();
        } else {
          contentsBuilder_.addMessage(index, value);
        }
        return this;
      }
      /**
       * <code>repeated .cls.Log.Content contents = 2;</code>
       *
       * <pre>
       * 一条日志里的多个kv组合
       * </pre>
       */
      public Builder addContents(
          Content.Builder builderForValue) {
        if (contentsBuilder_ == null) {
          ensureContentsIsMutable();
          contents_.add(builderForValue.build());
          onChanged();
        } else {
          contentsBuilder_.addMessage(builderForValue.build());
        }
        return this;
      }
      /**
       * <code>repeated .cls.Log.Content contents = 2;</code>
       *
       * <pre>
       * 一条日志里的多个kv组合
       * </pre>
       */
      public Builder addContents(
          int index, Content.Builder builderForValue) {
        if (contentsBuilder_ == null) {
          ensureContentsIsMutable();
          contents_.add(index, builderForValue.build());
          onChanged();
        } else {
          contentsBuilder_.addMessage(index, builderForValue.build());
        }
        return this;
      }
      /**
       * <code>repeated .cls.Log.Content contents = 2;</code>
       *
       * <pre>
       * 一条日志里的多个kv组合
       * </pre>
       */
      public Builder addAllContents(
          Iterable<? extends Content> values) {
        if (contentsBuilder_ == null) {
          ensureContentsIsMutable();
          com.google.protobuf.AbstractMessageLite.Builder.addAll(
              values, contents_);
          onChanged();
        } else {
          contentsBuilder_.addAllMessages(values);
        }
        return this;
      }
      /**
       * <code>repeated .cls.Log.Content contents = 2;</code>
       *
       * <pre>
       * 一条日志里的多个kv组合
       * </pre>
       */
      public Builder clearContents() {
        if (contentsBuilder_ == null) {
          contents_ = java.util.Collections.emptyList();
          bitField0_ = (bitField0_ & ~0x00000002);
          onChanged();
        } else {
          contentsBuilder_.clear();
        }
        return this;
      }
      /**
       * <code>repeated .cls.Log.Content contents = 2;</code>
       *
       * <pre>
       * 一条日志里的多个kv组合
       * </pre>
       */
      public Builder removeContents(int index) {
        if (contentsBuilder_ == null) {
          ensureContentsIsMutable();
          contents_.remove(index);
          onChanged();
        } else {
          contentsBuilder_.remove(index);
        }
        return this;
      }
      /**
       * <code>repeated .cls.Log.Content contents = 2;</code>
       *
       * <pre>
       * 一条日志里的多个kv组合
       * </pre>
       */
      public Content.Builder getContentsBuilder(
          int index) {
        return getContentsFieldBuilder().getBuilder(index);
      }
      /**
       * <code>repeated .cls.Log.Content contents = 2;</code>
       *
       * <pre>
       * 一条日志里的多个kv组合
       * </pre>
       */
      public ContentOrBuilder getContentsOrBuilder(
          int index) {
        if (contentsBuilder_ == null) {
          return contents_.get(index);  } else {
          return contentsBuilder_.getMessageOrBuilder(index);
        }
      }
      /**
       * <code>repeated .cls.Log.Content contents = 2;</code>
       *
       * <pre>
       * 一条日志里的多个kv组合
       * </pre>
       */
      public java.util.List<? extends ContentOrBuilder>
           getContentsOrBuilderList() {
        if (contentsBuilder_ != null) {
          return contentsBuilder_.getMessageOrBuilderList();
        } else {
          return java.util.Collections.unmodifiableList(contents_);
        }
      }
      /**
       * <code>repeated .cls.Log.Content contents = 2;</code>
       *
       * <pre>
       * 一条日志里的多个kv组合
       * </pre>
       */
      public Content.Builder addContentsBuilder() {
        return getContentsFieldBuilder().addBuilder(
            Content.getDefaultInstance());
      }
      /**
       * <code>repeated .cls.Log.Content contents = 2;</code>
       *
       * <pre>
       * 一条日志里的多个kv组合
       * </pre>
       */
      public Content.Builder addContentsBuilder(
          int index) {
        return getContentsFieldBuilder().addBuilder(
            index, Content.getDefaultInstance());
      }
      /**
       * <code>repeated .cls.Log.Content contents = 2;</code>
       *
       * <pre>
       * 一条日志里的多个kv组合
       * </pre>
       */
      public java.util.List<Content.Builder>
           getContentsBuilderList() {
        return getContentsFieldBuilder().getBuilderList();
      }
      private com.google.protobuf.RepeatedFieldBuilder<
          Content, Content.Builder, ContentOrBuilder>
          getContentsFieldBuilder() {
        if (contentsBuilder_ == null) {
          contentsBuilder_ = new com.google.protobuf.RepeatedFieldBuilder<
              Content, Content.Builder, ContentOrBuilder>(
                  contents_,
                  ((bitField0_ & 0x00000002) == 0x00000002),
                  getParentForChildren(),
                  isClean());
          contents_ = null;
        }
        return contentsBuilder_;
      }

      // @@protoc_insertion_point(builder_scope:cls.Log)
    }

    static {
      defaultInstance = new Log(true);
      defaultInstance.initFields();
    }

    // @@protoc_insertion_point(class_scope:cls.Log)
  }

  public interface LogTagOrBuilder extends
      // @@protoc_insertion_point(interface_extends:cls.LogTag)
      com.google.protobuf.MessageOrBuilder {

    /**
     * <code>required string key = 1;</code>
     */
    boolean hasKey();
    /**
     * <code>required string key = 1;</code>
     */
    String getKey();
    /**
     * <code>required string key = 1;</code>
     */
    com.google.protobuf.ByteString
        getKeyBytes();

    /**
     * <code>required string value = 2;</code>
     */
    boolean hasValue();
    /**
     * <code>required string value = 2;</code>
     */
    String getValue();
    /**
     * <code>required string value = 2;</code>
     */
    com.google.protobuf.ByteString
        getValueBytes();
  }
  /**
   * Protobuf type {@code cls.LogTag}
   */
  public static final class LogTag extends
      com.google.protobuf.GeneratedMessage implements
      // @@protoc_insertion_point(message_implements:cls.LogTag)
      LogTagOrBuilder {
    // Use LogTag.newBuilder() to construct.
    private LogTag(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
      super(builder);
      this.unknownFields = builder.getUnknownFields();
    }
    private LogTag(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }

    private static final LogTag defaultInstance;
    public static LogTag getDefaultInstance() {
      return defaultInstance;
    }

    public LogTag getDefaultInstanceForType() {
      return defaultInstance;
    }

    private final com.google.protobuf.UnknownFieldSet unknownFields;
    @Override
    public final com.google.protobuf.UnknownFieldSet
        getUnknownFields() {
      return this.unknownFields;
    }
    private LogTag(
        com.google.protobuf.CodedInputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws com.google.protobuf.InvalidProtocolBufferException {
      initFields();
      int mutable_bitField0_ = 0;
      com.google.protobuf.UnknownFieldSet.Builder unknownFields =
          com.google.protobuf.UnknownFieldSet.newBuilder();
      try {
        boolean done = false;
        while (!done) {
          int tag = input.readTag();
          switch (tag) {
            case 0:
              done = true;
              break;
            default: {
              if (!parseUnknownField(input, unknownFields,
                                     extensionRegistry, tag)) {
                done = true;
              }
              break;
            }
            case 10: {
              com.google.protobuf.ByteString bs = input.readBytes();
              bitField0_ |= 0x00000001;
              key_ = bs;
              break;
            }
            case 18: {
              com.google.protobuf.ByteString bs = input.readBytes();
              bitField0_ |= 0x00000002;
              value_ = bs;
              break;
            }
          }
        }
      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
        throw e.setUnfinishedMessage(this);
      } catch (java.io.IOException e) {
        throw new com.google.protobuf.InvalidProtocolBufferException(
            e.getMessage()).setUnfinishedMessage(this);
      } finally {
        this.unknownFields = unknownFields.build();
        makeExtensionsImmutable();
      }
    }
    public static final com.google.protobuf.Descriptors.Descriptor
        getDescriptor() {
      return Cls.internal_static_cls_LogTag_descriptor;
    }

    protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
        internalGetFieldAccessorTable() {
      return Cls.internal_static_cls_LogTag_fieldAccessorTable
          .ensureFieldAccessorsInitialized(
              LogTag.class, Builder.class);
    }

    public static com.google.protobuf.Parser<LogTag> PARSER =
        new com.google.protobuf.AbstractParser<LogTag>() {
      public LogTag parsePartialFrom(
          com.google.protobuf.CodedInputStream input,
          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
          throws com.google.protobuf.InvalidProtocolBufferException {
        return new LogTag(input, extensionRegistry);
      }
    };

    @Override
    public com.google.protobuf.Parser<LogTag> getParserForType() {
      return PARSER;
    }

    private int bitField0_;
    public static final int KEY_FIELD_NUMBER = 1;
    private Object key_;
    /**
     * <code>required string key = 1;</code>
     */
    public boolean hasKey() {
      return ((bitField0_ & 0x00000001) == 0x00000001);
    }
    /**
     * <code>required string key = 1;</code>
     */
    public String getKey() {
      Object ref = key_;
      if (ref instanceof String) {
        return (String) ref;
      } else {
        com.google.protobuf.ByteString bs =
            (com.google.protobuf.ByteString) ref;
        String s = bs.toStringUtf8();
        if (bs.isValidUtf8()) {
          key_ = s;
        }
        return s;
      }
    }
    /**
     * <code>required string key = 1;</code>
     */
    public com.google.protobuf.ByteString
        getKeyBytes() {
      Object ref = key_;
      if (ref instanceof String) {
        com.google.protobuf.ByteString b =
            com.google.protobuf.ByteString.copyFromUtf8(
                (String) ref);
        key_ = b;
        return b;
      } else {
        return (com.google.protobuf.ByteString) ref;
      }
    }

    public static final int VALUE_FIELD_NUMBER = 2;
    private Object value_;
    /**
     * <code>required string value = 2;</code>
     */
    public boolean hasValue() {
      return ((bitField0_ & 0x00000002) == 0x00000002);
    }
    /**
     * <code>required string value = 2;</code>
     */
    public String getValue() {
      Object ref = value_;
      if (ref instanceof String) {
        return (String) ref;
      } else {
        com.google.protobuf.ByteString bs =
            (com.google.protobuf.ByteString) ref;
        String s = bs.toStringUtf8();
        if (bs.isValidUtf8()) {
          value_ = s;
        }
        return s;
      }
    }
    /**
     * <code>required string value = 2;</code>
     */
    public com.google.protobuf.ByteString
        getValueBytes() {
      Object ref = value_;
      if (ref instanceof String) {
        com.google.protobuf.ByteString b =
            com.google.protobuf.ByteString.copyFromUtf8(
                (String) ref);
        value_ = b;
        return b;
      } else {
        return (com.google.protobuf.ByteString) ref;
      }
    }

    private void initFields() {
      key_ = "";
      value_ = "";
    }
    private byte memoizedIsInitialized = -1;
    public final boolean isInitialized() {
      byte isInitialized = memoizedIsInitialized;
      if (isInitialized == 1) return true;
      if (isInitialized == 0) return false;

      if (!hasKey()) {
        memoizedIsInitialized = 0;
        return false;
      }
      if (!hasValue()) {
        memoizedIsInitialized = 0;
        return false;
      }
      memoizedIsInitialized = 1;
      return true;
    }

    public void writeTo(com.google.protobuf.CodedOutputStream output)
                        throws java.io.IOException {
      getSerializedSize();
      if (((bitField0_ & 0x00000001) == 0x00000001)) {
        output.writeBytes(1, getKeyBytes());
      }
      if (((bitField0_ & 0x00000002) == 0x00000002)) {
        output.writeBytes(2, getValueBytes());
      }
      getUnknownFields().writeTo(output);
    }

    private int memoizedSerializedSize = -1;
    public int getSerializedSize() {
      int size = memoizedSerializedSize;
      if (size != -1) return size;

      size = 0;
      if (((bitField0_ & 0x00000001) == 0x00000001)) {
        size += com.google.protobuf.CodedOutputStream
          .computeBytesSize(1, getKeyBytes());
      }
      if (((bitField0_ & 0x00000002) == 0x00000002)) {
        size += com.google.protobuf.CodedOutputStream
          .computeBytesSize(2, getValueBytes());
      }
      size += getUnknownFields().getSerializedSize();
      memoizedSerializedSize = size;
      return size;
    }

    private static final long serialVersionUID = 0L;
    @Override
    protected Object writeReplace()
        throws java.io.ObjectStreamException {
      return super.writeReplace();
    }

    public static LogTag parseFrom(
        com.google.protobuf.ByteString data)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data);
    }
    public static LogTag parseFrom(
        com.google.protobuf.ByteString data,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data, extensionRegistry);
    }
    public static LogTag parseFrom(byte[] data)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data);
    }
    public static LogTag parseFrom(
        byte[] data,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data, extensionRegistry);
    }
    public static LogTag parseFrom(java.io.InputStream input)
        throws java.io.IOException {
      return PARSER.parseFrom(input);
    }
    public static LogTag parseFrom(
        java.io.InputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      return PARSER.parseFrom(input, extensionRegistry);
    }
    public static LogTag parseDelimitedFrom(java.io.InputStream input)
        throws java.io.IOException {
      return PARSER.parseDelimitedFrom(input);
    }
    public static LogTag parseDelimitedFrom(
        java.io.InputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      return PARSER.parseDelimitedFrom(input, extensionRegistry);
    }
    public static LogTag parseFrom(
        com.google.protobuf.CodedInputStream input)
        throws java.io.IOException {
      return PARSER.parseFrom(input);
    }
    public static LogTag parseFrom(
        com.google.protobuf.CodedInputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      return PARSER.parseFrom(input, extensionRegistry);
    }

    public static Builder newBuilder() { return Builder.create(); }
    public Builder newBuilderForType() { return newBuilder(); }
    public static Builder newBuilder(LogTag prototype) {
      return newBuilder().mergeFrom(prototype);
    }
    public Builder toBuilder() { return newBuilder(this); }

    @Override
    protected Builder newBuilderForType(
        com.google.protobuf.GeneratedMessage.BuilderParent parent) {
      Builder builder = new Builder(parent);
      return builder;
    }
    /**
     * Protobuf type {@code cls.LogTag}
     */
    public static final class Builder extends
        com.google.protobuf.GeneratedMessage.Builder<Builder> implements
        // @@protoc_insertion_point(builder_implements:cls.LogTag)
        LogTagOrBuilder {
      public static final com.google.protobuf.Descriptors.Descriptor
          getDescriptor() {
        return Cls.internal_static_cls_LogTag_descriptor;
      }

      protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
          internalGetFieldAccessorTable() {
        return Cls.internal_static_cls_LogTag_fieldAccessorTable
            .ensureFieldAccessorsInitialized(
                LogTag.class, Builder.class);
      }

      // Construct using cls.Cls.LogTag.newBuilder()
      private Builder() {
        maybeForceBuilderInitialization();
      }

      private Builder(
          com.google.protobuf.GeneratedMessage.BuilderParent parent) {
        super(parent);
        maybeForceBuilderInitialization();
      }
      private void maybeForceBuilderInitialization() {
        if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
        }
      }
      private static Builder create() {
        return new Builder();
      }

      public Builder clear() {
        super.clear();
        key_ = "";
        bitField0_ = (bitField0_ & ~0x00000001);
        value_ = "";
        bitField0_ = (bitField0_ & ~0x00000002);
        return this;
      }

      public Builder clone() {
        return create().mergeFrom(buildPartial());
      }

      public com.google.protobuf.Descriptors.Descriptor
          getDescriptorForType() {
        return Cls.internal_static_cls_LogTag_descriptor;
      }

      public LogTag getDefaultInstanceForType() {
        return LogTag.getDefaultInstance();
      }

      public LogTag build() {
        LogTag result = buildPartial();
        if (!result.isInitialized()) {
          throw newUninitializedMessageException(result);
        }
        return result;
      }

      public LogTag buildPartial() {
        LogTag result = new LogTag(this);
        int from_bitField0_ = bitField0_;
        int to_bitField0_ = 0;
        if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
          to_bitField0_ |= 0x00000001;
        }
        result.key_ = key_;
        if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
          to_bitField0_ |= 0x00000002;
        }
        result.value_ = value_;
        result.bitField0_ = to_bitField0_;
        onBuilt();
        return result;
      }

      public Builder mergeFrom(com.google.protobuf.Message other) {
        if (other instanceof LogTag) {
          return mergeFrom((LogTag)other);
        } else {
          super.mergeFrom(other);
          return this;
        }
      }

      public Builder mergeFrom(LogTag other) {
        if (other == LogTag.getDefaultInstance()) return this;
        if (other.hasKey()) {
          bitField0_ |= 0x00000001;
          key_ = other.key_;
          onChanged();
        }
        if (other.hasValue()) {
          bitField0_ |= 0x00000002;
          value_ = other.value_;
          onChanged();
        }
        this.mergeUnknownFields(other.getUnknownFields());
        return this;
      }

      public final boolean isInitialized() {
        if (!hasKey()) {

          return false;
        }
        if (!hasValue()) {

          return false;
        }
        return true;
      }

      public Builder mergeFrom(
          com.google.protobuf.CodedInputStream input,
          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
          throws java.io.IOException {
        LogTag parsedMessage = null;
        try {
          parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
        } catch (com.google.protobuf.InvalidProtocolBufferException e) {
          parsedMessage = (LogTag) e.getUnfinishedMessage();
          throw e;
        } finally {
          if (parsedMessage != null) {
            mergeFrom(parsedMessage);
          }
        }
        return this;
      }
      private int bitField0_;

      private Object key_ = "";
      /**
       * <code>required string key = 1;</code>
       */
      public boolean hasKey() {
        return ((bitField0_ & 0x00000001) == 0x00000001);
      }
      /**
       * <code>required string key = 1;</code>
       */
      public String getKey() {
        Object ref = key_;
        if (!(ref instanceof String)) {
          com.google.protobuf.ByteString bs =
              (com.google.protobuf.ByteString) ref;
          String s = bs.toStringUtf8();
          if (bs.isValidUtf8()) {
            key_ = s;
          }
          return s;
        } else {
          return (String) ref;
        }
      }
      /**
       * <code>required string key = 1;</code>
       */
      public com.google.protobuf.ByteString
          getKeyBytes() {
        Object ref = key_;
        if (ref instanceof String) {
          com.google.protobuf.ByteString b =
              com.google.protobuf.ByteString.copyFromUtf8(
                  (String) ref);
          key_ = b;
          return b;
        } else {
          return (com.google.protobuf.ByteString) ref;
        }
      }
      /**
       * <code>required string key = 1;</code>
       */
      public Builder setKey(
          String value) {
        if (value == null) {
    throw new NullPointerException();
  }
  bitField0_ |= 0x00000001;
        key_ = value;
        onChanged();
        return this;
      }
      /**
       * <code>required string key = 1;</code>
       */
      public Builder clearKey() {
        bitField0_ = (bitField0_ & ~0x00000001);
        key_ = getDefaultInstance().getKey();
        onChanged();
        return this;
      }
      /**
       * <code>required string key = 1;</code>
       */
      public Builder setKeyBytes(
          com.google.protobuf.ByteString value) {
        if (value == null) {
    throw new NullPointerException();
  }
  bitField0_ |= 0x00000001;
        key_ = value;
        onChanged();
        return this;
      }

      private Object value_ = "";
      /**
       * <code>required string value = 2;</code>
       */
      public boolean hasValue() {
        return ((bitField0_ & 0x00000002) == 0x00000002);
      }
      /**
       * <code>required string value = 2;</code>
       */
      public String getValue() {
        Object ref = value_;
        if (!(ref instanceof String)) {
          com.google.protobuf.ByteString bs =
              (com.google.protobuf.ByteString) ref;
          String s = bs.toStringUtf8();
          if (bs.isValidUtf8()) {
            value_ = s;
          }
          return s;
        } else {
          return (String) ref;
        }
      }
      /**
       * <code>required string value = 2;</code>
       */
      public com.google.protobuf.ByteString
          getValueBytes() {
        Object ref = value_;
        if (ref instanceof String) {
          com.google.protobuf.ByteString b =
              com.google.protobuf.ByteString.copyFromUtf8(
                  (String) ref);
          value_ = b;
          return b;
        } else {
          return (com.google.protobuf.ByteString) ref;
        }
      }
      /**
       * <code>required string value = 2;</code>
       */
      public Builder setValue(
          String value) {
        if (value == null) {
    throw new NullPointerException();
  }
  bitField0_ |= 0x00000002;
        value_ = value;
        onChanged();
        return this;
      }
      /**
       * <code>required string value = 2;</code>
       */
      public Builder clearValue() {
        bitField0_ = (bitField0_ & ~0x00000002);
        value_ = getDefaultInstance().getValue();
        onChanged();
        return this;
      }
      /**
       * <code>required string value = 2;</code>
       */
      public Builder setValueBytes(
          com.google.protobuf.ByteString value) {
        if (value == null) {
    throw new NullPointerException();
  }
  bitField0_ |= 0x00000002;
        value_ = value;
        onChanged();
        return this;
      }

      // @@protoc_insertion_point(builder_scope:cls.LogTag)
    }

    static {
      defaultInstance = new LogTag(true);
      defaultInstance.initFields();
    }

    // @@protoc_insertion_point(class_scope:cls.LogTag)
  }

  public interface LogGroupOrBuilder extends
      // @@protoc_insertion_point(interface_extends:cls.LogGroup)
      com.google.protobuf.MessageOrBuilder {

    /**
     * <code>repeated .cls.Log logs = 1;</code>
     *
     * <pre>
     * 多条日志合成的日志数组
     * </pre>
     */
    java.util.List<Log>
        getLogsList();
    /**
     * <code>repeated .cls.Log logs = 1;</code>
     *
     * <pre>
     * 多条日志合成的日志数组
     * </pre>
     */
    Log getLogs(int index);
    /**
     * <code>repeated .cls.Log logs = 1;</code>
     *
     * <pre>
     * 多条日志合成的日志数组
     * </pre>
     */
    int getLogsCount();
    /**
     * <code>repeated .cls.Log logs = 1;</code>
     *
     * <pre>
     * 多条日志合成的日志数组
     * </pre>
     */
    java.util.List<? extends LogOrBuilder>
        getLogsOrBuilderList();
    /**
     * <code>repeated .cls.Log logs = 1;</code>
     *
     * <pre>
     * 多条日志合成的日志数组
     * </pre>
     */
    LogOrBuilder getLogsOrBuilder(
            int index);

    /**
     * <code>optional string contextFlow = 2;</code>
     *
     * <pre>
     * 目前暂无效用
     * </pre>
     */
    boolean hasContextFlow();
    /**
     * <code>optional string contextFlow = 2;</code>
     *
     * <pre>
     * 目前暂无效用
     * </pre>
     */
    String getContextFlow();
    /**
     * <code>optional string contextFlow = 2;</code>
     *
     * <pre>
     * 目前暂无效用
     * </pre>
     */
    com.google.protobuf.ByteString
        getContextFlowBytes();

    /**
     * <code>optional string filename = 3;</code>
     *
     * <pre>
     * 日志文件名
     * </pre>
     */
    boolean hasFilename();
    /**
     * <code>optional string filename = 3;</code>
     *
     * <pre>
     * 日志文件名
     * </pre>
     */
    String getFilename();
    /**
     * <code>optional string filename = 3;</code>
     *
     * <pre>
     * 日志文件名
     * </pre>
     */
    com.google.protobuf.ByteString
        getFilenameBytes();

    /**
     * <code>optional string source = 4;</code>
     *
     * <pre>
     * 日志来源,一般使用机器IP
     * </pre>
     */
    boolean hasSource();
    /**
     * <code>optional string source = 4;</code>
     *
     * <pre>
     * 日志来源,一般使用机器IP
     * </pre>
     */
    String getSource();
    /**
     * <code>optional string source = 4;</code>
     *
     * <pre>
     * 日志来源,一般使用机器IP
     * </pre>
     */
    com.google.protobuf.ByteString
        getSourceBytes();

    /**
     * <code>repeated .cls.LogTag logTags = 5;</code>
     */
    java.util.List<LogTag>
        getLogTagsList();
    /**
     * <code>repeated .cls.LogTag logTags = 5;</code>
     */
    LogTag getLogTags(int index);
    /**
     * <code>repeated .cls.LogTag logTags = 5;</code>
     */
    int getLogTagsCount();
    /**
     * <code>repeated .cls.LogTag logTags = 5;</code>
     */
    java.util.List<? extends LogTagOrBuilder>
        getLogTagsOrBuilderList();
    /**
     * <code>repeated .cls.LogTag logTags = 5;</code>
     */
    LogTagOrBuilder getLogTagsOrBuilder(
            int index);
  }
  /**
   * Protobuf type {@code cls.LogGroup}
   */
  public static final class LogGroup extends
      com.google.protobuf.GeneratedMessage implements
      // @@protoc_insertion_point(message_implements:cls.LogGroup)
      LogGroupOrBuilder {
    // Use LogGroup.newBuilder() to construct.
    private LogGroup(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
      super(builder);
      this.unknownFields = builder.getUnknownFields();
    }
    private LogGroup(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }

    private static final LogGroup defaultInstance;
    public static LogGroup getDefaultInstance() {
      return defaultInstance;
    }

    public LogGroup getDefaultInstanceForType() {
      return defaultInstance;
    }

    private final com.google.protobuf.UnknownFieldSet unknownFields;
    @Override
    public final com.google.protobuf.UnknownFieldSet
        getUnknownFields() {
      return this.unknownFields;
    }
    private LogGroup(
        com.google.protobuf.CodedInputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws com.google.protobuf.InvalidProtocolBufferException {
      initFields();
      int mutable_bitField0_ = 0;
      com.google.protobuf.UnknownFieldSet.Builder unknownFields =
          com.google.protobuf.UnknownFieldSet.newBuilder();
      try {
        boolean done = false;
        while (!done) {
          int tag = input.readTag();
          switch (tag) {
            case 0:
              done = true;
              break;
            default: {
              if (!parseUnknownField(input, unknownFields,
                                     extensionRegistry, tag)) {
                done = true;
              }
              break;
            }
            case 10: {
              if (!((mutable_bitField0_ & 0x00000001) == 0x00000001)) {
                logs_ = new java.util.ArrayList<Log>();
                mutable_bitField0_ |= 0x00000001;
              }
              logs_.add(input.readMessage(Log.PARSER, extensionRegistry));
              break;
            }
            case 18: {
              com.google.protobuf.ByteString bs = input.readBytes();
              bitField0_ |= 0x00000001;
              contextFlow_ = bs;
              break;
            }
            case 26: {
              com.google.protobuf.ByteString bs = input.readBytes();
              bitField0_ |= 0x00000002;
              filename_ = bs;
              break;
            }
            case 34: {
              com.google.protobuf.ByteString bs = input.readBytes();
              bitField0_ |= 0x00000004;
              source_ = bs;
              break;
            }
            case 42: {
              if (!((mutable_bitField0_ & 0x00000010) == 0x00000010)) {
                logTags_ = new java.util.ArrayList<LogTag>();
                mutable_bitField0_ |= 0x00000010;
              }
              logTags_.add(input.readMessage(LogTag.PARSER, extensionRegistry));
              break;
            }
          }
        }
      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
        throw e.setUnfinishedMessage(this);
      } catch (java.io.IOException e) {
        throw new com.google.protobuf.InvalidProtocolBufferException(
            e.getMessage()).setUnfinishedMessage(this);
      } finally {
        if (((mutable_bitField0_ & 0x00000001) == 0x00000001)) {
          logs_ = java.util.Collections.unmodifiableList(logs_);
        }
        if (((mutable_bitField0_ & 0x00000010) == 0x00000010)) {
          logTags_ = java.util.Collections.unmodifiableList(logTags_);
        }
        this.unknownFields = unknownFields.build();
        makeExtensionsImmutable();
      }
    }
    public static final com.google.protobuf.Descriptors.Descriptor
        getDescriptor() {
      return Cls.internal_static_cls_LogGroup_descriptor;
    }

    protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
        internalGetFieldAccessorTable() {
      return Cls.internal_static_cls_LogGroup_fieldAccessorTable
          .ensureFieldAccessorsInitialized(
              LogGroup.class, Builder.class);
    }

    public static com.google.protobuf.Parser<LogGroup> PARSER =
        new com.google.protobuf.AbstractParser<LogGroup>() {
      public LogGroup parsePartialFrom(
          com.google.protobuf.CodedInputStream input,
          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
          throws com.google.protobuf.InvalidProtocolBufferException {
        return new LogGroup(input, extensionRegistry);
      }
    };

    @Override
    public com.google.protobuf.Parser<LogGroup> getParserForType() {
      return PARSER;
    }

    private int bitField0_;
    public static final int LOGS_FIELD_NUMBER = 1;
    private java.util.List<Log> logs_;
    /**
     * <code>repeated .cls.Log logs = 1;</code>
     *
     * <pre>
     * 多条日志合成的日志数组
     * </pre>
     */
    public java.util.List<Log> getLogsList() {
      return logs_;
    }
    /**
     * <code>repeated .cls.Log logs = 1;</code>
     *
     * <pre>
     * 多条日志合成的日志数组
     * </pre>
     */
    public java.util.List<? extends LogOrBuilder>
        getLogsOrBuilderList() {
      return logs_;
    }
    /**
     * <code>repeated .cls.Log logs = 1;</code>
     *
     * <pre>
     * 多条日志合成的日志数组
     * </pre>
     */
    public int getLogsCount() {
      return logs_.size();
    }
    /**
     * <code>repeated .cls.Log logs = 1;</code>
     *
     * <pre>
     * 多条日志合成的日志数组
     * </pre>
     */
    public Log getLogs(int index) {
      return logs_.get(index);
    }
    /**
     * <code>repeated .cls.Log logs = 1;</code>
     *
     * <pre>
     * 多条日志合成的日志数组
     * </pre>
     */
    public LogOrBuilder getLogsOrBuilder(
        int index) {
      return logs_.get(index);
    }

    public static final int CONTEXTFLOW_FIELD_NUMBER = 2;
    private Object contextFlow_;
    /**
     * <code>optional string contextFlow = 2;</code>
     *
     * <pre>
     * 目前暂无效用
     * </pre>
     */
    public boolean hasContextFlow() {
      return ((bitField0_ & 0x00000001) == 0x00000001);
    }
    /**
     * <code>optional string contextFlow = 2;</code>
     *
     * <pre>
     * 目前暂无效用
     * </pre>
     */
    public String getContextFlow() {
      Object ref = contextFlow_;
      if (ref instanceof String) {
        return (String) ref;
      } else {
        com.google.protobuf.ByteString bs =
            (com.google.protobuf.ByteString) ref;
        String s = bs.toStringUtf8();
        if (bs.isValidUtf8()) {
          contextFlow_ = s;
        }
        return s;
      }
    }
    /**
     * <code>optional string contextFlow = 2;</code>
     *
     * <pre>
     * 目前暂无效用
     * </pre>
     */
    public com.google.protobuf.ByteString
        getContextFlowBytes() {
      Object ref = contextFlow_;
      if (ref instanceof String) {
        com.google.protobuf.ByteString b =
            com.google.protobuf.ByteString.copyFromUtf8(
                (String) ref);
        contextFlow_ = b;
        return b;
      } else {
        return (com.google.protobuf.ByteString) ref;
      }
    }

    public static final int FILENAME_FIELD_NUMBER = 3;
    private Object filename_;
    /**
     * <code>optional string filename = 3;</code>
     *
     * <pre>
     * 日志文件名
     * </pre>
     */
    public boolean hasFilename() {
      return ((bitField0_ & 0x00000002) == 0x00000002);
    }
    /**
     * <code>optional string filename = 3;</code>
     *
     * <pre>
     * 日志文件名
     * </pre>
     */
    public String getFilename() {
      Object ref = filename_;
      if (ref instanceof String) {
        return (String) ref;
      } else {
        com.google.protobuf.ByteString bs =
            (com.google.protobuf.ByteString) ref;
        String s = bs.toStringUtf8();
        if (bs.isValidUtf8()) {
          filename_ = s;
        }
        return s;
      }
    }
    /**
     * <code>optional string filename = 3;</code>
     *
     * <pre>
     * 日志文件名
     * </pre>
     */
    public com.google.protobuf.ByteString
        getFilenameBytes() {
      Object ref = filename_;
      if (ref instanceof String) {
        com.google.protobuf.ByteString b =
            com.google.protobuf.ByteString.copyFromUtf8(
                (String) ref);
        filename_ = b;
        return b;
      } else {
        return (com.google.protobuf.ByteString) ref;
      }
    }

    public static final int SOURCE_FIELD_NUMBER = 4;
    private Object source_;
    /**
     * <code>optional string source = 4;</code>
     *
     * <pre>
     * 日志来源,一般使用机器IP
     * </pre>
     */
    public boolean hasSource() {
      return ((bitField0_ & 0x00000004) == 0x00000004);
    }
    /**
     * <code>optional string source = 4;</code>
     *
     * <pre>
     * 日志来源,一般使用机器IP
     * </pre>
     */
    public String getSource() {
      Object ref = source_;
      if (ref instanceof String) {
        return (String) ref;
      } else {
        com.google.protobuf.ByteString bs =
            (com.google.protobuf.ByteString) ref;
        String s = bs.toStringUtf8();
        if (bs.isValidUtf8()) {
          source_ = s;
        }
        return s;
      }
    }
    /**
     * <code>optional string source = 4;</code>
     *
     * <pre>
     * 日志来源,一般使用机器IP
     * </pre>
     */
    public com.google.protobuf.ByteString
        getSourceBytes() {
      Object ref = source_;
      if (ref instanceof String) {
        com.google.protobuf.ByteString b =
            com.google.protobuf.ByteString.copyFromUtf8(
                (String) ref);
        source_ = b;
        return b;
      } else {
        return (com.google.protobuf.ByteString) ref;
      }
    }

    public static final int LOGTAGS_FIELD_NUMBER = 5;
    private java.util.List<LogTag> logTags_;
    /**
     * <code>repeated .cls.LogTag logTags = 5;</code>
     */
    public java.util.List<LogTag> getLogTagsList() {
      return logTags_;
    }
    /**
     * <code>repeated .cls.LogTag logTags = 5;</code>
     */
    public java.util.List<? extends LogTagOrBuilder>
        getLogTagsOrBuilderList() {
      return logTags_;
    }
    /**
     * <code>repeated .cls.LogTag logTags = 5;</code>
     */
    public int getLogTagsCount() {
      return logTags_.size();
    }
    /**
     * <code>repeated .cls.LogTag logTags = 5;</code>
     */
    public LogTag getLogTags(int index) {
      return logTags_.get(index);
    }
    /**
     * <code>repeated .cls.LogTag logTags = 5;</code>
     */
    public LogTagOrBuilder getLogTagsOrBuilder(
        int index) {
      return logTags_.get(index);
    }

    private void initFields() {
      logs_ = java.util.Collections.emptyList();
      contextFlow_ = "";
      filename_ = "";
      source_ = "";
      logTags_ = java.util.Collections.emptyList();
    }
    private byte memoizedIsInitialized = -1;
    public final boolean isInitialized() {
      byte isInitialized = memoizedIsInitialized;
      if (isInitialized == 1) return true;
      if (isInitialized == 0) return false;

      for (int i = 0; i < getLogsCount(); i++) {
        if (!getLogs(i).isInitialized()) {
          memoizedIsInitialized = 0;
          return false;
        }
      }
      for (int i = 0; i < getLogTagsCount(); i++) {
        if (!getLogTags(i).isInitialized()) {
          memoizedIsInitialized = 0;
          return false;
        }
      }
      memoizedIsInitialized = 1;
      return true;
    }

    public void writeTo(com.google.protobuf.CodedOutputStream output)
                        throws java.io.IOException {
      getSerializedSize();
      for (int i = 0; i < logs_.size(); i++) {
        output.writeMessage(1, logs_.get(i));
      }
      if (((bitField0_ & 0x00000001) == 0x00000001)) {
        output.writeBytes(2, getContextFlowBytes());
      }
      if (((bitField0_ & 0x00000002) == 0x00000002)) {
        output.writeBytes(3, getFilenameBytes());
      }
      if (((bitField0_ & 0x00000004) == 0x00000004)) {
        output.writeBytes(4, getSourceBytes());
      }
      for (int i = 0; i < logTags_.size(); i++) {
        output.writeMessage(5, logTags_.get(i));
      }
      getUnknownFields().writeTo(output);
    }

    private int memoizedSerializedSize = -1;
    public int getSerializedSize() {
      int size = memoizedSerializedSize;
      if (size != -1) return size;

      size = 0;
      for (int i = 0; i < logs_.size(); i++) {
        size += com.google.protobuf.CodedOutputStream
          .computeMessageSize(1, logs_.get(i));
      }
      if (((bitField0_ & 0x00000001) == 0x00000001)) {
        size += com.google.protobuf.CodedOutputStream
          .computeBytesSize(2, getContextFlowBytes());
      }
      if (((bitField0_ & 0x00000002) == 0x00000002)) {
        size += com.google.protobuf.CodedOutputStream
          .computeBytesSize(3, getFilenameBytes());
      }
      if (((bitField0_ & 0x00000004) == 0x00000004)) {
        size += com.google.protobuf.CodedOutputStream
          .computeBytesSize(4, getSourceBytes());
      }
      for (int i = 0; i < logTags_.size(); i++) {
        size += com.google.protobuf.CodedOutputStream
          .computeMessageSize(5, logTags_.get(i));
      }
      size += getUnknownFields().getSerializedSize();
      memoizedSerializedSize = size;
      return size;
    }

    private static final long serialVersionUID = 0L;
    @Override
    protected Object writeReplace()
        throws java.io.ObjectStreamException {
      return super.writeReplace();
    }

    public static LogGroup parseFrom(
        com.google.protobuf.ByteString data)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data);
    }
    public static LogGroup parseFrom(
        com.google.protobuf.ByteString data,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data, extensionRegistry);
    }
    public static LogGroup parseFrom(byte[] data)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data);
    }
    public static LogGroup parseFrom(
        byte[] data,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data, extensionRegistry);
    }
    public static LogGroup parseFrom(java.io.InputStream input)
        throws java.io.IOException {
      return PARSER.parseFrom(input);
    }
    public static LogGroup parseFrom(
        java.io.InputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      return PARSER.parseFrom(input, extensionRegistry);
    }
    public static LogGroup parseDelimitedFrom(java.io.InputStream input)
        throws java.io.IOException {
      return PARSER.parseDelimitedFrom(input);
    }
    public static LogGroup parseDelimitedFrom(
        java.io.InputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      return PARSER.parseDelimitedFrom(input, extensionRegistry);
    }
    public static LogGroup parseFrom(
        com.google.protobuf.CodedInputStream input)
        throws java.io.IOException {
      return PARSER.parseFrom(input);
    }
    public static LogGroup parseFrom(
        com.google.protobuf.CodedInputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      return PARSER.parseFrom(input, extensionRegistry);
    }

    public static Builder newBuilder() { return Builder.create(); }
    public Builder newBuilderForType() { return newBuilder(); }
    public static Builder newBuilder(LogGroup prototype) {
      return newBuilder().mergeFrom(prototype);
    }
    public Builder toBuilder() { return newBuilder(this); }

    @Override
    protected Builder newBuilderForType(
        com.google.protobuf.GeneratedMessage.BuilderParent parent) {
      Builder builder = new Builder(parent);
      return builder;
    }
    /**
     * Protobuf type {@code cls.LogGroup}
     */
    public static final class Builder extends
        com.google.protobuf.GeneratedMessage.Builder<Builder> implements
        // @@protoc_insertion_point(builder_implements:cls.LogGroup)
        LogGroupOrBuilder {
      public static final com.google.protobuf.Descriptors.Descriptor
          getDescriptor() {
        return Cls.internal_static_cls_LogGroup_descriptor;
      }

      protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
          internalGetFieldAccessorTable() {
        return Cls.internal_static_cls_LogGroup_fieldAccessorTable
            .ensureFieldAccessorsInitialized(
                LogGroup.class, Builder.class);
      }

      // Construct using cls.Cls.LogGroup.newBuilder()
      private Builder() {
        maybeForceBuilderInitialization();
      }

      private Builder(
          com.google.protobuf.GeneratedMessage.BuilderParent parent) {
        super(parent);
        maybeForceBuilderInitialization();
      }
      private void maybeForceBuilderInitialization() {
        if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
          getLogsFieldBuilder();
          getLogTagsFieldBuilder();
        }
      }
      private static Builder create() {
        return new Builder();
      }

      public Builder clear() {
        super.clear();
        if (logsBuilder_ == null) {
          logs_ = java.util.Collections.emptyList();
          bitField0_ = (bitField0_ & ~0x00000001);
        } else {
          logsBuilder_.clear();
        }
        contextFlow_ = "";
        bitField0_ = (bitField0_ & ~0x00000002);
        filename_ = "";
        bitField0_ = (bitField0_ & ~0x00000004);
        source_ = "";
        bitField0_ = (bitField0_ & ~0x00000008);
        if (logTagsBuilder_ == null) {
          logTags_ = java.util.Collections.emptyList();
          bitField0_ = (bitField0_ & ~0x00000010);
        } else {
          logTagsBuilder_.clear();
        }
        return this;
      }

      public Builder clone() {
        return create().mergeFrom(buildPartial());
      }

      public com.google.protobuf.Descriptors.Descriptor
          getDescriptorForType() {
        return Cls.internal_static_cls_LogGroup_descriptor;
      }

      public LogGroup getDefaultInstanceForType() {
        return LogGroup.getDefaultInstance();
      }

      public LogGroup build() {
        LogGroup result = buildPartial();
        if (!result.isInitialized()) {
          throw newUninitializedMessageException(result);
        }
        return result;
      }

      public LogGroup buildPartial() {
        LogGroup result = new LogGroup(this);
        int from_bitField0_ = bitField0_;
        int to_bitField0_ = 0;
        if (logsBuilder_ == null) {
          if (((bitField0_ & 0x00000001) == 0x00000001)) {
            logs_ = java.util.Collections.unmodifiableList(logs_);
            bitField0_ = (bitField0_ & ~0x00000001);
          }
          result.logs_ = logs_;
        } else {
          result.logs_ = logsBuilder_.build();
        }
        if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
          to_bitField0_ |= 0x00000001;
        }
        result.contextFlow_ = contextFlow_;
        if (((from_bitField0_ & 0x00000004) == 0x00000004)) {
          to_bitField0_ |= 0x00000002;
        }
        result.filename_ = filename_;
        if (((from_bitField0_ & 0x00000008) == 0x00000008)) {
          to_bitField0_ |= 0x00000004;
        }
        result.source_ = source_;
        if (logTagsBuilder_ == null) {
          if (((bitField0_ & 0x00000010) == 0x00000010)) {
            logTags_ = java.util.Collections.unmodifiableList(logTags_);
            bitField0_ = (bitField0_ & ~0x00000010);
          }
          result.logTags_ = logTags_;
        } else {
          result.logTags_ = logTagsBuilder_.build();
        }
        result.bitField0_ = to_bitField0_;
        onBuilt();
        return result;
      }

      public Builder mergeFrom(com.google.protobuf.Message other) {
        if (other instanceof LogGroup) {
          return mergeFrom((LogGroup)other);
        } else {
          super.mergeFrom(other);
          return this;
        }
      }

      public Builder mergeFrom(LogGroup other) {
        if (other == LogGroup.getDefaultInstance()) return this;
        if (logsBuilder_ == null) {
          if (!other.logs_.isEmpty()) {
            if (logs_.isEmpty()) {
              logs_ = other.logs_;
              bitField0_ = (bitField0_ & ~0x00000001);
            } else {
              ensureLogsIsMutable();
              logs_.addAll(other.logs_);
            }
            onChanged();
          }
        } else {
          if (!other.logs_.isEmpty()) {
            if (logsBuilder_.isEmpty()) {
              logsBuilder_.dispose();
              logsBuilder_ = null;
              logs_ = other.logs_;
              bitField0_ = (bitField0_ & ~0x00000001);
              logsBuilder_ =
                com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ?
                   getLogsFieldBuilder() : null;
            } else {
              logsBuilder_.addAllMessages(other.logs_);
            }
          }
        }
        if (other.hasContextFlow()) {
          bitField0_ |= 0x00000002;
          contextFlow_ = other.contextFlow_;
          onChanged();
        }
        if (other.hasFilename()) {
          bitField0_ |= 0x00000004;
          filename_ = other.filename_;
          onChanged();
        }
        if (other.hasSource()) {
          bitField0_ |= 0x00000008;
          source_ = other.source_;
          onChanged();
        }
        if (logTagsBuilder_ == null) {
          if (!other.logTags_.isEmpty()) {
            if (logTags_.isEmpty()) {
              logTags_ = other.logTags_;
              bitField0_ = (bitField0_ & ~0x00000010);
            } else {
              ensureLogTagsIsMutable();
              logTags_.addAll(other.logTags_);
            }
            onChanged();
          }
        } else {
          if (!other.logTags_.isEmpty()) {
            if (logTagsBuilder_.isEmpty()) {
              logTagsBuilder_.dispose();
              logTagsBuilder_ = null;
              logTags_ = other.logTags_;
              bitField0_ = (bitField0_ & ~0x00000010);
              logTagsBuilder_ =
                com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ?
                   getLogTagsFieldBuilder() : null;
            } else {
              logTagsBuilder_.addAllMessages(other.logTags_);
            }
          }
        }
        this.mergeUnknownFields(other.getUnknownFields());
        return this;
      }

      public final boolean isInitialized() {
        for (int i = 0; i < getLogsCount(); i++) {
          if (!getLogs(i).isInitialized()) {

            return false;
          }
        }
        for (int i = 0; i < getLogTagsCount(); i++) {
          if (!getLogTags(i).isInitialized()) {

            return false;
          }
        }
        return true;
      }

      public Builder mergeFrom(
          com.google.protobuf.CodedInputStream input,
          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
          throws java.io.IOException {
        LogGroup parsedMessage = null;
        try {
          parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
        } catch (com.google.protobuf.InvalidProtocolBufferException e) {
          parsedMessage = (LogGroup) e.getUnfinishedMessage();
          throw e;
        } finally {
          if (parsedMessage != null) {
            mergeFrom(parsedMessage);
          }
        }
        return this;
      }
      private int bitField0_;

      private java.util.List<Log> logs_ =
        java.util.Collections.emptyList();
      private void ensureLogsIsMutable() {
        if (!((bitField0_ & 0x00000001) == 0x00000001)) {
          logs_ = new java.util.ArrayList<Log>(logs_);
          bitField0_ |= 0x00000001;
         }
      }

      private com.google.protobuf.RepeatedFieldBuilder<
          Log, Log.Builder, LogOrBuilder> logsBuilder_;

      /**
       * <code>repeated .cls.Log logs = 1;</code>
       *
       * <pre>
       * 多条日志合成的日志数组
       * </pre>
       */
      public java.util.List<Log> getLogsList() {
        if (logsBuilder_ == null) {
          return java.util.Collections.unmodifiableList(logs_);
        } else {
          return logsBuilder_.getMessageList();
        }
      }
      /**
       * <code>repeated .cls.Log logs = 1;</code>
       *
       * <pre>
       * 多条日志合成的日志数组
       * </pre>
       */
      public int getLogsCount() {
        if (logsBuilder_ == null) {
          return logs_.size();
        } else {
          return logsBuilder_.getCount();
        }
      }
      /**
       * <code>repeated .cls.Log logs = 1;</code>
       *
       * <pre>
       * 多条日志合成的日志数组
       * </pre>
       */
      public Log getLogs(int index) {
        if (logsBuilder_ == null) {
          return logs_.get(index);
        } else {
          return logsBuilder_.getMessage(index);
        }
      }
      /**
       * <code>repeated .cls.Log logs = 1;</code>
       *
       * <pre>
       * 多条日志合成的日志数组
       * </pre>
       */
      public Builder setLogs(
          int index, Log value) {
        if (logsBuilder_ == null) {
          if (value == null) {
            throw new NullPointerException();
          }
          ensureLogsIsMutable();
          logs_.set(index, value);
          onChanged();
        } else {
          logsBuilder_.setMessage(index, value);
        }
        return this;
      }
      /**
       * <code>repeated .cls.Log logs = 1;</code>
       *
       * <pre>
       * 多条日志合成的日志数组
       * </pre>
       */
      public Builder setLogs(
          int index, Log.Builder builderForValue) {
        if (logsBuilder_ == null) {
          ensureLogsIsMutable();
          logs_.set(index, builderForValue.build());
          onChanged();
        } else {
          logsBuilder_.setMessage(index, builderForValue.build());
        }
        return this;
      }
      /**
       * <code>repeated .cls.Log logs = 1;</code>
       *
       * <pre>
       * 多条日志合成的日志数组
       * </pre>
       */
      public Builder addLogs(Log value) {
        if (logsBuilder_ == null) {
          if (value == null) {
            throw new NullPointerException();
          }
          ensureLogsIsMutable();
          logs_.add(value);
          onChanged();
        } else {
          logsBuilder_.addMessage(value);
        }
        return this;
      }
      /**
       * <code>repeated .cls.Log logs = 1;</code>
       *
       * <pre>
       * 多条日志合成的日志数组
       * </pre>
       */
      public Builder addLogs(
          int index, Log value) {
        if (logsBuilder_ == null) {
          if (value == null) {
            throw new NullPointerException();
          }
          ensureLogsIsMutable();
          logs_.add(index, value);
          onChanged();
        } else {
          logsBuilder_.addMessage(index, value);
        }
        return this;
      }
      /**
       * <code>repeated .cls.Log logs = 1;</code>
       *
       * <pre>
       * 多条日志合成的日志数组
       * </pre>
       */
      public Builder addLogs(
          Log.Builder builderForValue) {
        if (logsBuilder_ == null) {
          ensureLogsIsMutable();
          logs_.add(builderForValue.build());
          onChanged();
        } else {
          logsBuilder_.addMessage(builderForValue.build());
        }
        return this;
      }
      /**
       * <code>repeated .cls.Log logs = 1;</code>
       *
       * <pre>
       * 多条日志合成的日志数组
       * </pre>
       */
      public Builder addLogs(
          int index, Log.Builder builderForValue) {
        if (logsBuilder_ == null) {
          ensureLogsIsMutable();
          logs_.add(index, builderForValue.build());
          onChanged();
        } else {
          logsBuilder_.addMessage(index, builderForValue.build());
        }
        return this;
      }
      /**
       * <code>repeated .cls.Log logs = 1;</code>
       *
       * <pre>
       * 多条日志合成的日志数组
       * </pre>
       */
      public Builder addAllLogs(
          Iterable<? extends Log> values) {
        if (logsBuilder_ == null) {
          ensureLogsIsMutable();
          com.google.protobuf.AbstractMessageLite.Builder.addAll(
              values, logs_);
          onChanged();
        } else {
          logsBuilder_.addAllMessages(values);
        }
        return this;
      }
      /**
       * <code>repeated .cls.Log logs = 1;</code>
       *
       * <pre>
       * 多条日志合成的日志数组
       * </pre>
       */
      public Builder clearLogs() {
        if (logsBuilder_ == null) {
          logs_ = java.util.Collections.emptyList();
          bitField0_ = (bitField0_ & ~0x00000001);
          onChanged();
        } else {
          logsBuilder_.clear();
        }
        return this;
      }
      /**
       * <code>repeated .cls.Log logs = 1;</code>
       *
       * <pre>
       * 多条日志合成的日志数组
       * </pre>
       */
      public Builder removeLogs(int index) {
        if (logsBuilder_ == null) {
          ensureLogsIsMutable();
          logs_.remove(index);
          onChanged();
        } else {
          logsBuilder_.remove(index);
        }
        return this;
      }
      /**
       * <code>repeated .cls.Log logs = 1;</code>
       *
       * <pre>
       * 多条日志合成的日志数组
       * </pre>
       */
      public Log.Builder getLogsBuilder(
          int index) {
        return getLogsFieldBuilder().getBuilder(index);
      }
      /**
       * <code>repeated .cls.Log logs = 1;</code>
       *
       * <pre>
       * 多条日志合成的日志数组
       * </pre>
       */
      public LogOrBuilder getLogsOrBuilder(
          int index) {
        if (logsBuilder_ == null) {
          return logs_.get(index);  } else {
          return logsBuilder_.getMessageOrBuilder(index);
        }
      }
      /**
       * <code>repeated .cls.Log logs = 1;</code>
       *
       * <pre>
       * 多条日志合成的日志数组
       * </pre>
       */
      public java.util.List<? extends LogOrBuilder>
           getLogsOrBuilderList() {
        if (logsBuilder_ != null) {
          return logsBuilder_.getMessageOrBuilderList();
        } else {
          return java.util.Collections.unmodifiableList(logs_);
        }
      }
      /**
       * <code>repeated .cls.Log logs = 1;</code>
       *
       * <pre>
       * 多条日志合成的日志数组
       * </pre>
       */
      public Log.Builder addLogsBuilder() {
        return getLogsFieldBuilder().addBuilder(
            Log.getDefaultInstance());
      }
      /**
       * <code>repeated .cls.Log logs = 1;</code>
       *
       * <pre>
       * 多条日志合成的日志数组
       * </pre>
       */
      public Log.Builder addLogsBuilder(
          int index) {
        return getLogsFieldBuilder().addBuilder(
            index, Log.getDefaultInstance());
      }
      /**
       * <code>repeated .cls.Log logs = 1;</code>
       *
       * <pre>
       * 多条日志合成的日志数组
       * </pre>
       */
      public java.util.List<Log.Builder>
           getLogsBuilderList() {
        return getLogsFieldBuilder().getBuilderList();
      }
      private com.google.protobuf.RepeatedFieldBuilder<
          Log, Log.Builder, LogOrBuilder>
          getLogsFieldBuilder() {
        if (logsBuilder_ == null) {
          logsBuilder_ = new com.google.protobuf.RepeatedFieldBuilder<
              Log, Log.Builder, LogOrBuilder>(
                  logs_,
                  ((bitField0_ & 0x00000001) == 0x00000001),
                  getParentForChildren(),
                  isClean());
          logs_ = null;
        }
        return logsBuilder_;
      }

      private Object contextFlow_ = "";
      /**
       * <code>optional string contextFlow = 2;</code>
       *
       * <pre>
       * 目前暂无效用
       * </pre>
       */
      public boolean hasContextFlow() {
        return ((bitField0_ & 0x00000002) == 0x00000002);
      }
      /**
       * <code>optional string contextFlow = 2;</code>
       *
       * <pre>
       * 目前暂无效用
       * </pre>
       */
      public String getContextFlow() {
        Object ref = contextFlow_;
        if (!(ref instanceof String)) {
          com.google.protobuf.ByteString bs =
              (com.google.protobuf.ByteString) ref;
          String s = bs.toStringUtf8();
          if (bs.isValidUtf8()) {
            contextFlow_ = s;
          }
          return s;
        } else {
          return (String) ref;
        }
      }
      /**
       * <code>optional string contextFlow = 2;</code>
       *
       * <pre>
       * 目前暂无效用
       * </pre>
       */
      public com.google.protobuf.ByteString
          getContextFlowBytes() {
        Object ref = contextFlow_;
        if (ref instanceof String) {
          com.google.protobuf.ByteString b =
              com.google.protobuf.ByteString.copyFromUtf8(
                  (String) ref);
          contextFlow_ = b;
          return b;
        } else {
          return (com.google.protobuf.ByteString) ref;
        }
      }
      /**
       * <code>optional string contextFlow = 2;</code>
       *
       * <pre>
       * 目前暂无效用
       * </pre>
       */
      public Builder setContextFlow(
          String value) {
        if (value == null) {
    throw new NullPointerException();
  }
  bitField0_ |= 0x00000002;
        contextFlow_ = value;
        onChanged();
        return this;
      }
      /**
       * <code>optional string contextFlow = 2;</code>
       *
       * <pre>
       * 目前暂无效用
       * </pre>
       */
      public Builder clearContextFlow() {
        bitField0_ = (bitField0_ & ~0x00000002);
        contextFlow_ = getDefaultInstance().getContextFlow();
        onChanged();
        return this;
      }
      /**
       * <code>optional string contextFlow = 2;</code>
       *
       * <pre>
       * 目前暂无效用
       * </pre>
       */
      public Builder setContextFlowBytes(
          com.google.protobuf.ByteString value) {
        if (value == null) {
    throw new NullPointerException();
  }
  bitField0_ |= 0x00000002;
        contextFlow_ = value;
        onChanged();
        return this;
      }

      private Object filename_ = "";
      /**
       * <code>optional string filename = 3;</code>
       *
       * <pre>
       * 日志文件名
       * </pre>
       */
      public boolean hasFilename() {
        return ((bitField0_ & 0x00000004) == 0x00000004);
      }
      /**
       * <code>optional string filename = 3;</code>
       *
       * <pre>
       * 日志文件名
       * </pre>
       */
      public String getFilename() {
        Object ref = filename_;
        if (!(ref instanceof String)) {
          com.google.protobuf.ByteString bs =
              (com.google.protobuf.ByteString) ref;
          String s = bs.toStringUtf8();
          if (bs.isValidUtf8()) {
            filename_ = s;
          }
          return s;
        } else {
          return (String) ref;
        }
      }
      /**
       * <code>optional string filename = 3;</code>
       *
       * <pre>
       * 日志文件名
       * </pre>
       */
      public com.google.protobuf.ByteString
          getFilenameBytes() {
        Object ref = filename_;
        if (ref instanceof String) {
          com.google.protobuf.ByteString b =
              com.google.protobuf.ByteString.copyFromUtf8(
                  (String) ref);
          filename_ = b;
          return b;
        } else {
          return (com.google.protobuf.ByteString) ref;
        }
      }
      /**
       * <code>optional string filename = 3;</code>
       *
       * <pre>
       * 日志文件名
       * </pre>
       */
      public Builder setFilename(
          String value) {
        if (value == null) {
    throw new NullPointerException();
  }
  bitField0_ |= 0x00000004;
        filename_ = value;
        onChanged();
        return this;
      }
      /**
       * <code>optional string filename = 3;</code>
       *
       * <pre>
       * 日志文件名
       * </pre>
       */
      public Builder clearFilename() {
        bitField0_ = (bitField0_ & ~0x00000004);
        filename_ = getDefaultInstance().getFilename();
        onChanged();
        return this;
      }
      /**
       * <code>optional string filename = 3;</code>
       *
       * <pre>
       * 日志文件名
       * </pre>
       */
      public Builder setFilenameBytes(
          com.google.protobuf.ByteString value) {
        if (value == null) {
    throw new NullPointerException();
  }
  bitField0_ |= 0x00000004;
        filename_ = value;
        onChanged();
        return this;
      }

      private Object source_ = "";
      /**
       * <code>optional string source = 4;</code>
       *
       * <pre>
       * 日志来源,一般使用机器IP
       * </pre>
       */
      public boolean hasSource() {
        return ((bitField0_ & 0x00000008) == 0x00000008);
      }
      /**
       * <code>optional string source = 4;</code>
       *
       * <pre>
       * 日志来源,一般使用机器IP
       * </pre>
       */
      public String getSource() {
        Object ref = source_;
        if (!(ref instanceof String)) {
          com.google.protobuf.ByteString bs =
              (com.google.protobuf.ByteString) ref;
          String s = bs.toStringUtf8();
          if (bs.isValidUtf8()) {
            source_ = s;
          }
          return s;
        } else {
          return (String) ref;
        }
      }
      /**
       * <code>optional string source = 4;</code>
       *
       * <pre>
       * 日志来源,一般使用机器IP
       * </pre>
       */
      public com.google.protobuf.ByteString
          getSourceBytes() {
        Object ref = source_;
        if (ref instanceof String) {
          com.google.protobuf.ByteString b =
              com.google.protobuf.ByteString.copyFromUtf8(
                  (String) ref);
          source_ = b;
          return b;
        } else {
          return (com.google.protobuf.ByteString) ref;
        }
      }
      /**
       * <code>optional string source = 4;</code>
       *
       * <pre>
       * 日志来源,一般使用机器IP
       * </pre>
       */
      public Builder setSource(
          String value) {
        if (value == null) {
    throw new NullPointerException();
  }
  bitField0_ |= 0x00000008;
        source_ = value;
        onChanged();
        return this;
      }
      /**
       * <code>optional string source = 4;</code>
       *
       * <pre>
       * 日志来源,一般使用机器IP
       * </pre>
       */
      public Builder clearSource() {
        bitField0_ = (bitField0_ & ~0x00000008);
        source_ = getDefaultInstance().getSource();
        onChanged();
        return this;
      }
      /**
       * <code>optional string source = 4;</code>
       *
       * <pre>
       * 日志来源,一般使用机器IP
       * </pre>
       */
      public Builder setSourceBytes(
          com.google.protobuf.ByteString value) {
        if (value == null) {
    throw new NullPointerException();
  }
  bitField0_ |= 0x00000008;
        source_ = value;
        onChanged();
        return this;
      }

      private java.util.List<LogTag> logTags_ =
        java.util.Collections.emptyList();
      private void ensureLogTagsIsMutable() {
        if (!((bitField0_ & 0x00000010) == 0x00000010)) {
          logTags_ = new java.util.ArrayList<LogTag>(logTags_);
          bitField0_ |= 0x00000010;
         }
      }

      private com.google.protobuf.RepeatedFieldBuilder<
          LogTag, LogTag.Builder, LogTagOrBuilder> logTagsBuilder_;

      /**
       * <code>repeated .cls.LogTag logTags = 5;</code>
       */
      public java.util.List<LogTag> getLogTagsList() {
        if (logTagsBuilder_ == null) {
          return java.util.Collections.unmodifiableList(logTags_);
        } else {
          return logTagsBuilder_.getMessageList();
        }
      }
      /**
       * <code>repeated .cls.LogTag logTags = 5;</code>
       */
      public int getLogTagsCount() {
        if (logTagsBuilder_ == null) {
          return logTags_.size();
        } else {
          return logTagsBuilder_.getCount();
        }
      }
      /**
       * <code>repeated .cls.LogTag logTags = 5;</code>
       */
      public LogTag getLogTags(int index) {
        if (logTagsBuilder_ == null) {
          return logTags_.get(index);
        } else {
          return logTagsBuilder_.getMessage(index);
        }
      }
      /**
       * <code>repeated .cls.LogTag logTags = 5;</code>
       */
      public Builder setLogTags(
          int index, LogTag value) {
        if (logTagsBuilder_ == null) {
          if (value == null) {
            throw new NullPointerException();
          }
          ensureLogTagsIsMutable();
          logTags_.set(index, value);
          onChanged();
        } else {
          logTagsBuilder_.setMessage(index, value);
        }
        return this;
      }
      /**
       * <code>repeated .cls.LogTag logTags = 5;</code>
       */
      public Builder setLogTags(
          int index, LogTag.Builder builderForValue) {
        if (logTagsBuilder_ == null) {
          ensureLogTagsIsMutable();
          logTags_.set(index, builderForValue.build());
          onChanged();
        } else {
          logTagsBuilder_.setMessage(index, builderForValue.build());
        }
        return this;
      }
      /**
       * <code>repeated .cls.LogTag logTags = 5;</code>
       */
      public Builder addLogTags(LogTag value) {
        if (logTagsBuilder_ == null) {
          if (value == null) {
            throw new NullPointerException();
          }
          ensureLogTagsIsMutable();
          logTags_.add(value);
          onChanged();
        } else {
          logTagsBuilder_.addMessage(value);
        }
        return this;
      }
      /**
       * <code>repeated .cls.LogTag logTags = 5;</code>
       */
      public Builder addLogTags(
          int index, LogTag value) {
        if (logTagsBuilder_ == null) {
          if (value == null) {
            throw new NullPointerException();
          }
          ensureLogTagsIsMutable();
          logTags_.add(index, value);
          onChanged();
        } else {
          logTagsBuilder_.addMessage(index, value);
        }
        return this;
      }
      /**
       * <code>repeated .cls.LogTag logTags = 5;</code>
       */
      public Builder addLogTags(
          LogTag.Builder builderForValue) {
        if (logTagsBuilder_ == null) {
          ensureLogTagsIsMutable();
          logTags_.add(builderForValue.build());
          onChanged();
        } else {
          logTagsBuilder_.addMessage(builderForValue.build());
        }
        return this;
      }
      /**
       * <code>repeated .cls.LogTag logTags = 5;</code>
       */
      public Builder addLogTags(
          int index, LogTag.Builder builderForValue) {
        if (logTagsBuilder_ == null) {
          ensureLogTagsIsMutable();
          logTags_.add(index, builderForValue.build());
          onChanged();
        } else {
          logTagsBuilder_.addMessage(index, builderForValue.build());
        }
        return this;
      }
      /**
       * <code>repeated .cls.LogTag logTags = 5;</code>
       */
      public Builder addAllLogTags(
          Iterable<? extends LogTag> values) {
        if (logTagsBuilder_ == null) {
          ensureLogTagsIsMutable();
          com.google.protobuf.AbstractMessageLite.Builder.addAll(
              values, logTags_);
          onChanged();
        } else {
          logTagsBuilder_.addAllMessages(values);
        }
        return this;
      }
      /**
       * <code>repeated .cls.LogTag logTags = 5;</code>
       */
      public Builder clearLogTags() {
        if (logTagsBuilder_ == null) {
          logTags_ = java.util.Collections.emptyList();
          bitField0_ = (bitField0_ & ~0x00000010);
          onChanged();
        } else {
          logTagsBuilder_.clear();
        }
        return this;
      }
      /**
       * <code>repeated .cls.LogTag logTags = 5;</code>
       */
      public Builder removeLogTags(int index) {
        if (logTagsBuilder_ == null) {
          ensureLogTagsIsMutable();
          logTags_.remove(index);
          onChanged();
        } else {
          logTagsBuilder_.remove(index);
        }
        return this;
      }
      /**
       * <code>repeated .cls.LogTag logTags = 5;</code>
       */
      public LogTag.Builder getLogTagsBuilder(
          int index) {
        return getLogTagsFieldBuilder().getBuilder(index);
      }
      /**
       * <code>repeated .cls.LogTag logTags = 5;</code>
       */
      public LogTagOrBuilder getLogTagsOrBuilder(
          int index) {
        if (logTagsBuilder_ == null) {
          return logTags_.get(index);  } else {
          return logTagsBuilder_.getMessageOrBuilder(index);
        }
      }
      /**
       * <code>repeated .cls.LogTag logTags = 5;</code>
       */
      public java.util.List<? extends LogTagOrBuilder>
           getLogTagsOrBuilderList() {
        if (logTagsBuilder_ != null) {
          return logTagsBuilder_.getMessageOrBuilderList();
        } else {
          return java.util.Collections.unmodifiableList(logTags_);
        }
      }
      /**
       * <code>repeated .cls.LogTag logTags = 5;</code>
       */
      public LogTag.Builder addLogTagsBuilder() {
        return getLogTagsFieldBuilder().addBuilder(
            LogTag.getDefaultInstance());
      }
      /**
       * <code>repeated .cls.LogTag logTags = 5;</code>
       */
      public LogTag.Builder addLogTagsBuilder(
          int index) {
        return getLogTagsFieldBuilder().addBuilder(
            index, LogTag.getDefaultInstance());
      }
      /**
       * <code>repeated .cls.LogTag logTags = 5;</code>
       */
      public java.util.List<LogTag.Builder>
           getLogTagsBuilderList() {
        return getLogTagsFieldBuilder().getBuilderList();
      }
      private com.google.protobuf.RepeatedFieldBuilder<
          LogTag, LogTag.Builder, LogTagOrBuilder>
          getLogTagsFieldBuilder() {
        if (logTagsBuilder_ == null) {
          logTagsBuilder_ = new com.google.protobuf.RepeatedFieldBuilder<
              LogTag, LogTag.Builder, LogTagOrBuilder>(
                  logTags_,
                  ((bitField0_ & 0x00000010) == 0x00000010),
                  getParentForChildren(),
                  isClean());
          logTags_ = null;
        }
        return logTagsBuilder_;
      }

      // @@protoc_insertion_point(builder_scope:cls.LogGroup)
    }

    static {
      defaultInstance = new LogGroup(true);
      defaultInstance.initFields();
    }

    // @@protoc_insertion_point(class_scope:cls.LogGroup)
  }

  public interface LogGroupListOrBuilder extends
      // @@protoc_insertion_point(interface_extends:cls.LogGroupList)
      com.google.protobuf.MessageOrBuilder {

    /**
     * <code>repeated .cls.LogGroup logGroupList = 1;</code>
     *
     * <pre>
     * 日志组列表
     * </pre>
     */
    java.util.List<LogGroup>
        getLogGroupListList();
    /**
     * <code>repeated .cls.LogGroup logGroupList = 1;</code>
     *
     * <pre>
     * 日志组列表
     * </pre>
     */
    LogGroup getLogGroupList(int index);
    /**
     * <code>repeated .cls.LogGroup logGroupList = 1;</code>
     *
     * <pre>
     * 日志组列表
     * </pre>
     */
    int getLogGroupListCount();
    /**
     * <code>repeated .cls.LogGroup logGroupList = 1;</code>
     *
     * <pre>
     * 日志组列表
     * </pre>
     */
    java.util.List<? extends LogGroupOrBuilder>
        getLogGroupListOrBuilderList();
    /**
     * <code>repeated .cls.LogGroup logGroupList = 1;</code>
     *
     * <pre>
     * 日志组列表
     * </pre>
     */
    LogGroupOrBuilder getLogGroupListOrBuilder(
            int index);
  }
  /**
   * Protobuf type {@code cls.LogGroupList}
   */
  public static final class LogGroupList extends
      com.google.protobuf.GeneratedMessage implements
      // @@protoc_insertion_point(message_implements:cls.LogGroupList)
      LogGroupListOrBuilder {
    // Use LogGroupList.newBuilder() to construct.
    private LogGroupList(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
      super(builder);
      this.unknownFields = builder.getUnknownFields();
    }
    private LogGroupList(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }

    private static final LogGroupList defaultInstance;
    public static LogGroupList getDefaultInstance() {
      return defaultInstance;
    }

    public LogGroupList getDefaultInstanceForType() {
      return defaultInstance;
    }

    private final com.google.protobuf.UnknownFieldSet unknownFields;
    @Override
    public final com.google.protobuf.UnknownFieldSet
        getUnknownFields() {
      return this.unknownFields;
    }
    private LogGroupList(
        com.google.protobuf.CodedInputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws com.google.protobuf.InvalidProtocolBufferException {
      initFields();
      int mutable_bitField0_ = 0;
      com.google.protobuf.UnknownFieldSet.Builder unknownFields =
          com.google.protobuf.UnknownFieldSet.newBuilder();
      try {
        boolean done = false;
        while (!done) {
          int tag = input.readTag();
          switch (tag) {
            case 0:
              done = true;
              break;
            default: {
              if (!parseUnknownField(input, unknownFields,
                                     extensionRegistry, tag)) {
                done = true;
              }
              break;
            }
            case 10: {
              if (!((mutable_bitField0_ & 0x00000001) == 0x00000001)) {
                logGroupList_ = new java.util.ArrayList<LogGroup>();
                mutable_bitField0_ |= 0x00000001;
              }
              logGroupList_.add(input.readMessage(LogGroup.PARSER, extensionRegistry));
              break;
            }
          }
        }
      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
        throw e.setUnfinishedMessage(this);
      } catch (java.io.IOException e) {
        throw new com.google.protobuf.InvalidProtocolBufferException(
            e.getMessage()).setUnfinishedMessage(this);
      } finally {
        if (((mutable_bitField0_ & 0x00000001) == 0x00000001)) {
          logGroupList_ = java.util.Collections.unmodifiableList(logGroupList_);
        }
        this.unknownFields = unknownFields.build();
        makeExtensionsImmutable();
      }
    }
    public static final com.google.protobuf.Descriptors.Descriptor
        getDescriptor() {
      return Cls.internal_static_cls_LogGroupList_descriptor;
    }

    protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
        internalGetFieldAccessorTable() {
      return Cls.internal_static_cls_LogGroupList_fieldAccessorTable
          .ensureFieldAccessorsInitialized(
              LogGroupList.class, Builder.class);
    }

    public static com.google.protobuf.Parser<LogGroupList> PARSER =
        new com.google.protobuf.AbstractParser<LogGroupList>() {
      public LogGroupList parsePartialFrom(
          com.google.protobuf.CodedInputStream input,
          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
          throws com.google.protobuf.InvalidProtocolBufferException {
        return new LogGroupList(input, extensionRegistry);
      }
    };

    @Override
    public com.google.protobuf.Parser<LogGroupList> getParserForType() {
      return PARSER;
    }

    public static final int LOGGROUPLIST_FIELD_NUMBER = 1;
    private java.util.List<LogGroup> logGroupList_;
    /**
     * <code>repeated .cls.LogGroup logGroupList = 1;</code>
     *
     * <pre>
     * 日志组列表
     * </pre>
     */
    public java.util.List<LogGroup> getLogGroupListList() {
      return logGroupList_;
    }
    /**
     * <code>repeated .cls.LogGroup logGroupList = 1;</code>
     *
     * <pre>
     * 日志组列表
     * </pre>
     */
    public java.util.List<? extends LogGroupOrBuilder>
        getLogGroupListOrBuilderList() {
      return logGroupList_;
    }
    /**
     * <code>repeated .cls.LogGroup logGroupList = 1;</code>
     *
     * <pre>
     * 日志组列表
     * </pre>
     */
    public int getLogGroupListCount() {
      return logGroupList_.size();
    }
    /**
     * <code>repeated .cls.LogGroup logGroupList = 1;</code>
     *
     * <pre>
     * 日志组列表
     * </pre>
     */
    public LogGroup getLogGroupList(int index) {
      return logGroupList_.get(index);
    }
    /**
     * <code>repeated .cls.LogGroup logGroupList = 1;</code>
     *
     * <pre>
     * 日志组列表
     * </pre>
     */
    public LogGroupOrBuilder getLogGroupListOrBuilder(
        int index) {
      return logGroupList_.get(index);
    }

    private void initFields() {
      logGroupList_ = java.util.Collections.emptyList();
    }
    private byte memoizedIsInitialized = -1;
    public final boolean isInitialized() {
      byte isInitialized = memoizedIsInitialized;
      if (isInitialized == 1) return true;
      if (isInitialized == 0) return false;

      for (int i = 0; i < getLogGroupListCount(); i++) {
        if (!getLogGroupList(i).isInitialized()) {
          memoizedIsInitialized = 0;
          return false;
        }
      }
      memoizedIsInitialized = 1;
      return true;
    }

    public void writeTo(com.google.protobuf.CodedOutputStream output)
                        throws java.io.IOException {
      getSerializedSize();
      for (int i = 0; i < logGroupList_.size(); i++) {
        output.writeMessage(1, logGroupList_.get(i));
      }
      getUnknownFields().writeTo(output);
    }

    private int memoizedSerializedSize = -1;
    public int getSerializedSize() {
      int size = memoizedSerializedSize;
      if (size != -1) return size;

      size = 0;
      for (int i = 0; i < logGroupList_.size(); i++) {
        size += com.google.protobuf.CodedOutputStream
          .computeMessageSize(1, logGroupList_.get(i));
      }
      size += getUnknownFields().getSerializedSize();
      memoizedSerializedSize = size;
      return size;
    }

    private static final long serialVersionUID = 0L;
    @Override
    protected Object writeReplace()
        throws java.io.ObjectStreamException {
      return super.writeReplace();
    }

    public static LogGroupList parseFrom(
        com.google.protobuf.ByteString data)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data);
    }
    public static LogGroupList parseFrom(
        com.google.protobuf.ByteString data,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data, extensionRegistry);
    }
    public static LogGroupList parseFrom(byte[] data)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data);
    }
    public static LogGroupList parseFrom(
        byte[] data,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data, extensionRegistry);
    }
    public static LogGroupList parseFrom(java.io.InputStream input)
        throws java.io.IOException {
      return PARSER.parseFrom(input);
    }
    public static LogGroupList parseFrom(
        java.io.InputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      return PARSER.parseFrom(input, extensionRegistry);
    }
    public static LogGroupList parseDelimitedFrom(java.io.InputStream input)
        throws java.io.IOException {
      return PARSER.parseDelimitedFrom(input);
    }
    public static LogGroupList parseDelimitedFrom(
        java.io.InputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      return PARSER.parseDelimitedFrom(input, extensionRegistry);
    }
    public static LogGroupList parseFrom(
        com.google.protobuf.CodedInputStream input)
        throws java.io.IOException {
      return PARSER.parseFrom(input);
    }
    public static LogGroupList parseFrom(
        com.google.protobuf.CodedInputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      return PARSER.parseFrom(input, extensionRegistry);
    }

    public static Builder newBuilder() { return Builder.create(); }
    public Builder newBuilderForType() { return newBuilder(); }
    public static Builder newBuilder(LogGroupList prototype) {
      return newBuilder().mergeFrom(prototype);
    }
    public Builder toBuilder() { return newBuilder(this); }

    @Override
    protected Builder newBuilderForType(
        com.google.protobuf.GeneratedMessage.BuilderParent parent) {
      Builder builder = new Builder(parent);
      return builder;
    }
    /**
     * Protobuf type {@code cls.LogGroupList}
     */
    public static final class Builder extends
        com.google.protobuf.GeneratedMessage.Builder<Builder> implements
        // @@protoc_insertion_point(builder_implements:cls.LogGroupList)
        LogGroupListOrBuilder {
      public static final com.google.protobuf.Descriptors.Descriptor
          getDescriptor() {
        return Cls.internal_static_cls_LogGroupList_descriptor;
      }

      protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
          internalGetFieldAccessorTable() {
        return Cls.internal_static_cls_LogGroupList_fieldAccessorTable
            .ensureFieldAccessorsInitialized(
                LogGroupList.class, Builder.class);
      }

      // Construct using cls.Cls.LogGroupList.newBuilder()
      private Builder() {
        maybeForceBuilderInitialization();
      }

      private Builder(
          com.google.protobuf.GeneratedMessage.BuilderParent parent) {
        super(parent);
        maybeForceBuilderInitialization();
      }
      private void maybeForceBuilderInitialization() {
        if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
          getLogGroupListFieldBuilder();
        }
      }
      private static Builder create() {
        return new Builder();
      }

      public Builder clear() {
        super.clear();
        if (logGroupListBuilder_ == null) {
          logGroupList_ = java.util.Collections.emptyList();
          bitField0_ = (bitField0_ & ~0x00000001);
        } else {
          logGroupListBuilder_.clear();
        }
        return this;
      }

      public Builder clone() {
        return create().mergeFrom(buildPartial());
      }

      public com.google.protobuf.Descriptors.Descriptor
          getDescriptorForType() {
        return Cls.internal_static_cls_LogGroupList_descriptor;
      }

      public LogGroupList getDefaultInstanceForType() {
        return LogGroupList.getDefaultInstance();
      }

      public LogGroupList build() {
        LogGroupList result = buildPartial();
        if (!result.isInitialized()) {
          throw newUninitializedMessageException(result);
        }
        return result;
      }

      public LogGroupList buildPartial() {
        LogGroupList result = new LogGroupList(this);
        int from_bitField0_ = bitField0_;
        if (logGroupListBuilder_ == null) {
          if (((bitField0_ & 0x00000001) == 0x00000001)) {
            logGroupList_ = java.util.Collections.unmodifiableList(logGroupList_);
            bitField0_ = (bitField0_ & ~0x00000001);
          }
          result.logGroupList_ = logGroupList_;
        } else {
          result.logGroupList_ = logGroupListBuilder_.build();
        }
        onBuilt();
        return result;
      }

      public Builder mergeFrom(com.google.protobuf.Message other) {
        if (other instanceof LogGroupList) {
          return mergeFrom((LogGroupList)other);
        } else {
          super.mergeFrom(other);
          return this;
        }
      }

      public Builder mergeFrom(LogGroupList other) {
        if (other == LogGroupList.getDefaultInstance()) return this;
        if (logGroupListBuilder_ == null) {
          if (!other.logGroupList_.isEmpty()) {
            if (logGroupList_.isEmpty()) {
              logGroupList_ = other.logGroupList_;
              bitField0_ = (bitField0_ & ~0x00000001);
            } else {
              ensureLogGroupListIsMutable();
              logGroupList_.addAll(other.logGroupList_);
            }
            onChanged();
          }
        } else {
          if (!other.logGroupList_.isEmpty()) {
            if (logGroupListBuilder_.isEmpty()) {
              logGroupListBuilder_.dispose();
              logGroupListBuilder_ = null;
              logGroupList_ = other.logGroupList_;
              bitField0_ = (bitField0_ & ~0x00000001);
              logGroupListBuilder_ = 
                com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ?
                   getLogGroupListFieldBuilder() : null;
            } else {
              logGroupListBuilder_.addAllMessages(other.logGroupList_);
            }
          }
        }
        this.mergeUnknownFields(other.getUnknownFields());
        return this;
      }

      public final boolean isInitialized() {
        for (int i = 0; i < getLogGroupListCount(); i++) {
          if (!getLogGroupList(i).isInitialized()) {
            
            return false;
          }
        }
        return true;
      }

      public Builder mergeFrom(
          com.google.protobuf.CodedInputStream input,
          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
          throws java.io.IOException {
        LogGroupList parsedMessage = null;
        try {
          parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
        } catch (com.google.protobuf.InvalidProtocolBufferException e) {
          parsedMessage = (LogGroupList) e.getUnfinishedMessage();
          throw e;
        } finally {
          if (parsedMessage != null) {
            mergeFrom(parsedMessage);
          }
        }
        return this;
      }
      private int bitField0_;

      private java.util.List<LogGroup> logGroupList_ =
        java.util.Collections.emptyList();
      private void ensureLogGroupListIsMutable() {
        if (!((bitField0_ & 0x00000001) == 0x00000001)) {
          logGroupList_ = new java.util.ArrayList<LogGroup>(logGroupList_);
          bitField0_ |= 0x00000001;
         }
      }

      private com.google.protobuf.RepeatedFieldBuilder<
          LogGroup, LogGroup.Builder, LogGroupOrBuilder> logGroupListBuilder_;

      /**
       * <code>repeated .cls.LogGroup logGroupList = 1;</code>
       *
       * <pre>
       * 日志组列表
       * </pre>
       */
      public java.util.List<LogGroup> getLogGroupListList() {
        if (logGroupListBuilder_ == null) {
          return java.util.Collections.unmodifiableList(logGroupList_);
        } else {
          return logGroupListBuilder_.getMessageList();
        }
      }
      /**
       * <code>repeated .cls.LogGroup logGroupList = 1;</code>
       *
       * <pre>
       * 日志组列表
       * </pre>
       */
      public int getLogGroupListCount() {
        if (logGroupListBuilder_ == null) {
          return logGroupList_.size();
        } else {
          return logGroupListBuilder_.getCount();
        }
      }
      /**
       * <code>repeated .cls.LogGroup logGroupList = 1;</code>
       *
       * <pre>
       * 日志组列表
       * </pre>
       */
      public LogGroup getLogGroupList(int index) {
        if (logGroupListBuilder_ == null) {
          return logGroupList_.get(index);
        } else {
          return logGroupListBuilder_.getMessage(index);
        }
      }
      /**
       * <code>repeated .cls.LogGroup logGroupList = 1;</code>
       *
       * <pre>
       * 日志组列表
       * </pre>
       */
      public Builder setLogGroupList(
          int index, LogGroup value) {
        if (logGroupListBuilder_ == null) {
          if (value == null) {
            throw new NullPointerException();
          }
          ensureLogGroupListIsMutable();
          logGroupList_.set(index, value);
          onChanged();
        } else {
          logGroupListBuilder_.setMessage(index, value);
        }
        return this;
      }
      /**
       * <code>repeated .cls.LogGroup logGroupList = 1;</code>
       *
       * <pre>
       * 日志组列表
       * </pre>
       */
      public Builder setLogGroupList(
          int index, LogGroup.Builder builderForValue) {
        if (logGroupListBuilder_ == null) {
          ensureLogGroupListIsMutable();
          logGroupList_.set(index, builderForValue.build());
          onChanged();
        } else {
          logGroupListBuilder_.setMessage(index, builderForValue.build());
        }
        return this;
      }
      /**
       * <code>repeated .cls.LogGroup logGroupList = 1;</code>
       *
       * <pre>
       * 日志组列表
       * </pre>
       */
      public Builder addLogGroupList(LogGroup value) {
        if (logGroupListBuilder_ == null) {
          if (value == null) {
            throw new NullPointerException();
          }
          ensureLogGroupListIsMutable();
          logGroupList_.add(value);
          onChanged();
        } else {
          logGroupListBuilder_.addMessage(value);
        }
        return this;
      }
      /**
       * <code>repeated .cls.LogGroup logGroupList = 1;</code>
       *
       * <pre>
       * 日志组列表
       * </pre>
       */
      public Builder addLogGroupList(
          int index, LogGroup value) {
        if (logGroupListBuilder_ == null) {
          if (value == null) {
            throw new NullPointerException();
          }
          ensureLogGroupListIsMutable();
          logGroupList_.add(index, value);
          onChanged();
        } else {
          logGroupListBuilder_.addMessage(index, value);
        }
        return this;
      }
      /**
       * <code>repeated .cls.LogGroup logGroupList = 1;</code>
       *
       * <pre>
       * 日志组列表
       * </pre>
       */
      public Builder addLogGroupList(
          LogGroup.Builder builderForValue) {
        if (logGroupListBuilder_ == null) {
          ensureLogGroupListIsMutable();
          logGroupList_.add(builderForValue.build());
          onChanged();
        } else {
          logGroupListBuilder_.addMessage(builderForValue.build());
        }
        return this;
      }
      /**
       * <code>repeated .cls.LogGroup logGroupList = 1;</code>
       *
       * <pre>
       * 日志组列表
       * </pre>
       */
      public Builder addLogGroupList(
          int index, LogGroup.Builder builderForValue) {
        if (logGroupListBuilder_ == null) {
          ensureLogGroupListIsMutable();
          logGroupList_.add(index, builderForValue.build());
          onChanged();
        } else {
          logGroupListBuilder_.addMessage(index, builderForValue.build());
        }
        return this;
      }
      /**
       * <code>repeated .cls.LogGroup logGroupList = 1;</code>
       *
       * <pre>
       * 日志组列表
       * </pre>
       */
      public Builder addAllLogGroupList(
          Iterable<? extends LogGroup> values) {
        if (logGroupListBuilder_ == null) {
          ensureLogGroupListIsMutable();
          com.google.protobuf.AbstractMessageLite.Builder.addAll(
              values, logGroupList_);
          onChanged();
        } else {
          logGroupListBuilder_.addAllMessages(values);
        }
        return this;
      }
      /**
       * <code>repeated .cls.LogGroup logGroupList = 1;</code>
       *
       * <pre>
       * 日志组列表
       * </pre>
       */
      public Builder clearLogGroupList() {
        if (logGroupListBuilder_ == null) {
          logGroupList_ = java.util.Collections.emptyList();
          bitField0_ = (bitField0_ & ~0x00000001);
          onChanged();
        } else {
          logGroupListBuilder_.clear();
        }
        return this;
      }
      /**
       * <code>repeated .cls.LogGroup logGroupList = 1;</code>
       *
       * <pre>
       * 日志组列表
       * </pre>
       */
      public Builder removeLogGroupList(int index) {
        if (logGroupListBuilder_ == null) {
          ensureLogGroupListIsMutable();
          logGroupList_.remove(index);
          onChanged();
        } else {
          logGroupListBuilder_.remove(index);
        }
        return this;
      }
      /**
       * <code>repeated .cls.LogGroup logGroupList = 1;</code>
       *
       * <pre>
       * 日志组列表
       * </pre>
       */
      public LogGroup.Builder getLogGroupListBuilder(
          int index) {
        return getLogGroupListFieldBuilder().getBuilder(index);
      }
      /**
       * <code>repeated .cls.LogGroup logGroupList = 1;</code>
       *
       * <pre>
       * 日志组列表
       * </pre>
       */
      public LogGroupOrBuilder getLogGroupListOrBuilder(
          int index) {
        if (logGroupListBuilder_ == null) {
          return logGroupList_.get(index);  } else {
          return logGroupListBuilder_.getMessageOrBuilder(index);
        }
      }
      /**
       * <code>repeated .cls.LogGroup logGroupList = 1;</code>
       *
       * <pre>
       * 日志组列表
       * </pre>
       */
      public java.util.List<? extends LogGroupOrBuilder>
           getLogGroupListOrBuilderList() {
        if (logGroupListBuilder_ != null) {
          return logGroupListBuilder_.getMessageOrBuilderList();
        } else {
          return java.util.Collections.unmodifiableList(logGroupList_);
        }
      }
      /**
       * <code>repeated .cls.LogGroup logGroupList = 1;</code>
       *
       * <pre>
       * 日志组列表
       * </pre>
       */
      public LogGroup.Builder addLogGroupListBuilder() {
        return getLogGroupListFieldBuilder().addBuilder(
            LogGroup.getDefaultInstance());
      }
      /**
       * <code>repeated .cls.LogGroup logGroupList = 1;</code>
       *
       * <pre>
       * 日志组列表
       * </pre>
       */
      public LogGroup.Builder addLogGroupListBuilder(
          int index) {
        return getLogGroupListFieldBuilder().addBuilder(
            index, LogGroup.getDefaultInstance());
      }
      /**
       * <code>repeated .cls.LogGroup logGroupList = 1;</code>
       *
       * <pre>
       * 日志组列表
       * </pre>
       */
      public java.util.List<LogGroup.Builder>
           getLogGroupListBuilderList() {
        return getLogGroupListFieldBuilder().getBuilderList();
      }
      private com.google.protobuf.RepeatedFieldBuilder<
          LogGroup, LogGroup.Builder, LogGroupOrBuilder>
          getLogGroupListFieldBuilder() {
        if (logGroupListBuilder_ == null) {
          logGroupListBuilder_ = new com.google.protobuf.RepeatedFieldBuilder<
              LogGroup, LogGroup.Builder, LogGroupOrBuilder>(
                  logGroupList_,
                  ((bitField0_ & 0x00000001) == 0x00000001),
                  getParentForChildren(),
                  isClean());
          logGroupList_ = null;
        }
        return logGroupListBuilder_;
      }

      // @@protoc_insertion_point(builder_scope:cls.LogGroupList)
    }

    static {
      defaultInstance = new LogGroupList(true);
      defaultInstance.initFields();
    }

    // @@protoc_insertion_point(class_scope:cls.LogGroupList)
  }

  private static final com.google.protobuf.Descriptors.Descriptor
    internal_static_cls_Log_descriptor;
  private static
    com.google.protobuf.GeneratedMessage.FieldAccessorTable
      internal_static_cls_Log_fieldAccessorTable;
  private static final com.google.protobuf.Descriptors.Descriptor
    internal_static_cls_Log_Content_descriptor;
  private static
    com.google.protobuf.GeneratedMessage.FieldAccessorTable
      internal_static_cls_Log_Content_fieldAccessorTable;
  private static final com.google.protobuf.Descriptors.Descriptor
    internal_static_cls_LogTag_descriptor;
  private static
    com.google.protobuf.GeneratedMessage.FieldAccessorTable
      internal_static_cls_LogTag_fieldAccessorTable;
  private static final com.google.protobuf.Descriptors.Descriptor
    internal_static_cls_LogGroup_descriptor;
  private static
    com.google.protobuf.GeneratedMessage.FieldAccessorTable
      internal_static_cls_LogGroup_fieldAccessorTable;
  private static final com.google.protobuf.Descriptors.Descriptor
    internal_static_cls_LogGroupList_descriptor;
  private static
    com.google.protobuf.GeneratedMessage.FieldAccessorTable
      internal_static_cls_LogGroupList_fieldAccessorTable;

  public static com.google.protobuf.Descriptors.FileDescriptor
      getDescriptor() {
    return descriptor;
  }
  private static com.google.protobuf.Descriptors.FileDescriptor
      descriptor;
  static {
    String[] descriptorData = {
      "\n\tcls.proto\022\003cls\"^\n\003Log\022\014\n\004time\030\001 \002(\003\022\"\n" +
      "\010contents\030\002 \003(\0132\020.cls.Log.Content\032%\n\007Con" +
      "tent\022\013\n\003key\030\001 \002(\t\022\r\n\005value\030\002 \002(\t\"$\n\006LogT" +
      "ag\022\013\n\003key\030\001 \002(\t\022\r\n\005value\030\002 \002(\t\"w\n\010LogGro" +
      "up\022\026\n\004logs\030\001 \003(\0132\010.cls.Log\022\023\n\013contextFlo" +
      "w\030\002 \001(\t\022\020\n\010filename\030\003 \001(\t\022\016\n\006source\030\004 \001(" +
      "\t\022\034\n\007logTags\030\005 \003(\0132\013.cls.LogTag\"3\n\014LogGr" +
      "oupList\022#\n\014logGroupList\030\001 \003(\0132\r.cls.LogG" +
      "roup"
    };
    com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
        new com.google.protobuf.Descriptors.FileDescriptor.    InternalDescriptorAssigner() {
          public com.google.protobuf.ExtensionRegistry assignDescriptors(
              com.google.protobuf.Descriptors.FileDescriptor root) {
            descriptor = root;
            return null;
          }
        };
    com.google.protobuf.Descriptors.FileDescriptor
      .internalBuildGeneratedFileFrom(descriptorData,
        new com.google.protobuf.Descriptors.FileDescriptor[] {
        }, assigner);
    internal_static_cls_Log_descriptor =
      getDescriptor().getMessageTypes().get(0);
    internal_static_cls_Log_fieldAccessorTable = new
      com.google.protobuf.GeneratedMessage.FieldAccessorTable(
        internal_static_cls_Log_descriptor,
        new String[] { "Time", "Contents", });
    internal_static_cls_Log_Content_descriptor =
      internal_static_cls_Log_descriptor.getNestedTypes().get(0);
    internal_static_cls_Log_Content_fieldAccessorTable = new
      com.google.protobuf.GeneratedMessage.FieldAccessorTable(
        internal_static_cls_Log_Content_descriptor,
        new String[] { "Key", "Value", });
    internal_static_cls_LogTag_descriptor =
      getDescriptor().getMessageTypes().get(1);
    internal_static_cls_LogTag_fieldAccessorTable = new
      com.google.protobuf.GeneratedMessage.FieldAccessorTable(
        internal_static_cls_LogTag_descriptor,
        new String[] { "Key", "Value", });
    internal_static_cls_LogGroup_descriptor =
      getDescriptor().getMessageTypes().get(2);
    internal_static_cls_LogGroup_fieldAccessorTable = new
      com.google.protobuf.GeneratedMessage.FieldAccessorTable(
        internal_static_cls_LogGroup_descriptor,
        new String[] { "Logs", "ContextFlow", "Filename", "Source", "LogTags", });
    internal_static_cls_LogGroupList_descriptor =
      getDescriptor().getMessageTypes().get(3);
    internal_static_cls_LogGroupList_fieldAccessorTable = new
      com.google.protobuf.GeneratedMessage.FieldAccessorTable(
        internal_static_cls_LogGroupList_descriptor,
        new String[] { "LogGroupList", });
  }

  // @@protoc_insertion_point(outer_class_scope)
}

(2)、发送结构化日志

    /**
     * 发送腾讯云日志
     * @param level
     * @param contentStr
     * @param userid
     * @param topicId
     * @return
     */
    public static Integer sendClsStructuredLog(String level,String contentStr,String userid,String loggerName,String topicId) {
        Cls.Log.Builder log = Cls.Log.newBuilder();
        log.setTime(new Date().getTime() * 1000);
        Cls.Log.Content.Builder content = Cls.Log.Content.newBuilder();
        content.setKey("level");
        content.setValue(level);
        log.addContents(content);
        content.setKey("content");
        content.setValue(contentStr);
        log.addContents(content);
        content.setKey("loggerName");
        content.setValue(loggerName);
        log.addContents(content);
        if(StringUtils.isNotBlank(userid)){
            content.setKey("userid");
            content.setValue(userid);
            log.addContents(content);
        }

        Cls.LogGroup.Builder logGroup = Cls.LogGroup.newBuilder();
        logGroup.addLogs(log);
        logGroup.setContextFlow("uuid" + new Date().getTime());
        try {
            logGroup.setSource(InetAddress.getLocalHost().getHostAddress());
        } catch (UnknownHostException e) {
            e.printStackTrace();
        }

        Cls.LogGroupList.Builder logGroupList = Cls.LogGroupList.newBuilder();
        logGroupList.addLogGroupList(logGroup);

        String path = "/structuredlog";
        Map<String, String> header = new HashMap<String, String>();
        header.put("Host", ClsSignatureUtil.Host);
        header.put("Content-Type", "application/x-protobuf");
        Map<String, String> param = new HashMap<String, String>();
        param.put("topic_id", topicId);
        header.put("Authorization", ClsSignatureUtil.getGetPostSignature(param, header, path, "post"));
        return HttpUtil.doPostByClsByte("http://" + ClsSignatureUtil.Host + path, logGroupList, param, header);
    }

说明:

1、必须使用<LogGroupList 的 PB 格式打包内容>

2、使用这种打包方式必须使用二进制流的方式

3、请求的"Content-Type"必须为"application/x-protobuf"

4、使用之前可以学一下PB文件的相关知识

(3)、根据条件检索日志

    /**
     * 根据条件检索日志
     * @param logsetId
     * @param topicIds
     * @param startTime
     * @param endTime
     * @param queryString
     * @param limit
     * @return
     */
    public static String searchClsStructuredLog(String logsetId,String topicIds,String startTime,String endTime,String queryString,String limit,String context,String sort) {
        String path = "/searchlog";
        Map<String,String> header = new HashMap<String, String>();
        header.put("Host", ClsSignatureUtil.Host);
        Map<String,String> query = new HashMap<String, String>();
        query.put("logset_id",logsetId);
        query.put("topic_ids",topicIds);
        query.put("start_time",startTime);
        query.put("end_time",endTime);
        query.put("query_string",queryString);
        query.put("limit",limit);
        if(StringUtils.isNotBlank(context)){
            query.put("context",context);
        }
        if(StringUtils.isNotBlank(sort)){
            query.put("sort",sort);
        }
        header.put("Authorization",ClsSignatureUtil.getGetPostSignature(new HashMap<String, String>(),new HashMap<String, String>(),path,"get"));//get请求可不传入param和header
        return HttpUtil.get("http://"+ClsSignatureUtil.Host+path,query,header);
    }

六、总结

(1)、刚开始无从下手,看不懂API文档,最后还是接起来了,这说明:只要去解决,问题总会被解决的;

(2)、腾讯云日志文件API链接地址

(3)、腾讯云日志文档链接地址

猜你喜欢

转载自blog.csdn.net/qq_37284798/article/details/111795860