创建通用采集策略
<p class="shortdesc">本文主要介绍如何为主机组创建通用的采集策略。</p>
<section class="section prereq" id="Create_Strategy__prereq_ifh_zpz_wmb"><div class="tasklabel"><h2 class="doc-tairway">前提条件</h2></div>
<p class="p">您已成功创建主机组,可参考<a class="xref" href="/ssr/help/middleware/LogCloud/User_Guide.Collect.Agent_Group.Create_Agent_Group" target="_blank" rel="external noopener">创建主机组</a>。</p>
</section>
<section class="section context"><div class="tasklabel"><h2 class="doc-tairway">背景信息</h2></div>
<p class="p">使用平安云日志服务采集日志:</p>
<ul class="ul" id="Create_Strategy__ul_pxh_wpz_wmb">
<li class="li">安装日志采集客户端:平安云会自动为您需要采集日志的主机组安装日志采集客户端。<div class="note note note_note"><span class="note__title">说明:</span> 目前支持针对Linux
、Windows和Unix系统安装采集客户端。</div></li>
<li class="li">配置采集策略:您可以通过控制台给相应的主机组创建日志采集策略。</li>
</ul>
</section>
<section><div class="tasklabel"><h2 class="doc-tairway">操作步骤</h2></div><ol class="ol steps"><li class="li step stepexpand">
<span class="ph cmd"> 登录<a class="xref" href="/console/logcloud/indexed/list" target="_blank" rel="external noopener">日志服务管理控制台</a>。</span>
</li><li class="li step stepexpand">
<span class="ph cmd">单击左侧导航栏<span class="ph uicontrol">项目管理</span>,进入<span class="keyword wintitle">项目列表</span>页面。</span>
</li><li class="li step stepexpand">
<span class="ph cmd">选择目标地域,单击目标项目名称。</span>
</li><li class="li step stepexpand">
<span class="ph cmd">单击<span class="ph uicontrol">AGENT配置</span>页签。</span>
</li><li class="li step stepexpand">
<span class="ph cmd">单击页面右上角<span class="ph uicontrol">创建配置</span>,进入<span class="keyword wintitle">创建配置</span>页面。</span>
</li><li class="li step stepexpand">
<span class="ph cmd">根据以下信息,创建通用日志采集策略:</span>
<div class="itemgroup info">
<table class="table" id="Create_Strategy__table_yhf_hqz_wmb"><caption></caption><colgroup><col><col></colgroup><thead class="thead">
<tr class="row">
<th class="entry" id="Create_Strategy__table_yhf_hqz_wmb__entry__1">配置项</th>
<th class="entry" id="Create_Strategy__table_yhf_hqz_wmb__entry__2">说明</th>
</tr>
</thead><tbody class="tbody">
<tr class="row">
<td class="entry" headers="Create_Strategy__table_yhf_hqz_wmb__entry__1 ">
<p class="p">数据类型</p>
</td>
<td class="entry" headers="Create_Strategy__table_yhf_hqz_wmb__entry__2 ">
<p class="p">配置采集的日志类型,支持:</p>
<ul class="ul" id="Create_Strategy__ul_zhf_hqz_wmb">
<li class="li">Nginx</li>
<li class="li">通用</li>
</ul>
<p class="p">此处选择通用。</p>
</td>
</tr>
<tr class="row">
<td class="entry" headers="Create_Strategy__table_yhf_hqz_wmb__entry__1 ">
<p class="p">名称</p>
</td>
<td class="entry" headers="Create_Strategy__table_yhf_hqz_wmb__entry__2 ">
<p class="p">配置通用采集策略的名称。</p>
<ul class="ul" id="Create_Strategy__ul_a3f_hqz_wmb">
<li class="li">支持汉字、英文大小写字母、数字、特殊字符“_”“-”“@”。</li>
<li class="li">长度在1~45个字符之间。</li>
</ul>
</td>
</tr>
<tr class="row">
<td class="entry" headers="Create_Strategy__table_yhf_hqz_wmb__entry__1 ">
<p class="p">日志路径</p>
</td>
<td class="entry" headers="Create_Strategy__table_yhf_hqz_wmb__entry__2 ">
<p class="p">配置待采集日志的云主机上的绝对路径。</p>
<div class="note note note_note"><span class="note__title">说明:</span>
<ul class="ul" id="Create_Strategy__ul_c3f_hqz_wmb">
<li class="li">目录必须具体到文件。</li>
<li class="li">默认不扫描子目录。</li>
<li class="li">多个路径使用英文逗号隔开。</li>
</ul>
</div>
</td>
</tr>
<tr class="row">
<td class="entry" headers="Create_Strategy__table_yhf_hqz_wmb__entry__1 ">
<p class="p">日志编码</p>
</td>
<td class="entry" headers="Create_Strategy__table_yhf_hqz_wmb__entry__2 ">
<p class="p">待采集日志的内容中包含中文时,采用的编码格式,支持:</p>
<ul class="ul" id="Create_Strategy__ul_d3f_hqz_wmb">
<li class="li">UTF-8</li>
<li class="li">GBK</li>
</ul>
</td>
</tr>
<tr class="row">
<td class="entry" headers="Create_Strategy__table_yhf_hqz_wmb__entry__1 ">
<p class="p">应用到主机组</p>
</td>
<td class="entry" headers="Create_Strategy__table_yhf_hqz_wmb__entry__2 ">
<p class="p">选择需要应用此采集策略的主机组。</p>
</td>
</tr>
<tr class="row">
<td class="entry" headers="Create_Strategy__table_yhf_hqz_wmb__entry__1 ">
<p class="p">添加字段</p>
</td>
<td class="entry" headers="Create_Strategy__table_yhf_hqz_wmb__entry__2 ">
<p class="p">可在采集到的日志中根据需求增加自定义字段。</p>
</td>
</tr>
</tbody></table>
</div>
</li><li class="li step stepexpand">
<span class="ph cmd">单击<span class="ph uicontrol">确定</span>。</span>
</li></ol></section>
<section class="section result" id="Create_Strategy__result_zpt_pqz_wmb"><div class="tasklabel"><h2 class="doc-tairway">执行结果</h2></div>
<p class="p">在<span class="ph uicontrol">AGENT配置</span>页签,可以看到刚刚创建的通用采集策略。 </p>
<img class="image" id="Create_Strategy__image_qxg_tqz_wmb" src="https://obs-cn-shanghai.pinganyun.com/pcp-portal/20241101101201-146c80c0928e.png" width="830">
</section>
提交成功!非常感谢您的反馈,我们会继续努力做到更好!