通过Kafka方式外发日志
<p class="shortdesc">本文介绍如何通过Kafka方式外发日志。</p>
<section class="section prereq" id="byKafka__prereq_uxw_xpr_4sb"><div class="tasklabel"><h2 class="doc-tairway">前提条件</h2></div>
<p class="p">您已创建实例。</p>
<p class="p">您已添加资产。</p>
</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="https://www.ocftcloud.com/console/db-audit" target="_blank" rel="external noopener">数据库审计控制台</a>,进入<span class="keyword wintitle">实例列表</span>页面。</span>
</li><li class="li step stepexpand">
<span class="ph cmd">单击目标实例<span class="ph uicontrol">操作</span>列的<span class="ph uicontrol">管理</span>,进入数据库审计控制台。</span>
<div class="itemgroup info">
<img class="image" id="byKafka__d23e47" src="https://obs-cn-shanghai.ocftcloud.com/pacloud/20222103110011-12277d5f94d4.png" width="700">
</div>
</li><li class="li step stepexpand">
<span class="ph cmd">在菜单栏选择<span class="ph menucascade"><span class="ph uicontrol">通知外送</span><abbr> > </abbr><span class="ph uicontrol">日志外送</span></span>,进入<span class="keyword wintitle">日志外送</span>页面,选择<span class="keyword wintitle">KAFKA</span>页签。</span>
<div class="itemgroup info">
<img class="image" id="byKafka__image_m3n_3bm_psb" src="https://obs-cn-shanghai.ocftcloud.com/pacloud/20222103110011-1df12aa59574.png" width="700">
</div>
</li><li class="li step stepexpand">
<span class="ph cmd">在<span class="ph uicontrol">日志外送接口管理</span>区域单击<span class="ph uicontrol">新增</span>,进入<span class="keyword wintitle">新增日志外送接口</span>页面,根据以下信息新增日志外送接口。</span>
<div class="itemgroup info">
<img class="image" id="byKafka__image_rp1_b5m_psb" src="https://obs-cn-shanghai.ocftcloud.com/pacloud/20222103110011-1ba1f1b0946b.png" width="500">
<table class="table" id="byKafka__table_zw2_d5m_psb"><caption></caption><colgroup><col style="width:32.467532467532465%"><col style="width:67.53246753246754%"></colgroup><thead class="thead">
<tr class="row">
<th class="entry" id="byKafka__table_zw2_d5m_psb__entry__1">
<p class="p">配置项</p>
</th>
<th class="entry" id="byKafka__table_zw2_d5m_psb__entry__2">
<p class="p">说明</p>
</th>
</tr>
</thead><tbody class="tbody">
<tr class="row">
<td class="entry" headers="byKafka__table_zw2_d5m_psb__entry__1 ">名称</td>
<td class="entry" headers="byKafka__table_zw2_d5m_psb__entry__2 ">
<p class="p">日志外送接口的名称,长度不超过64字符,且只能包含中文、字母、数字、下划线“_”、点“.”或短横“-”。</p>
</td>
</tr>
<tr class="row">
<td class="entry" headers="byKafka__table_zw2_d5m_psb__entry__1 ">
<p class="p">Kafka节点地址</p>
</td>
<td class="entry" headers="byKafka__table_zw2_d5m_psb__entry__2 ">
<p class="p">Kafka服务器的IP(域名)及端口号。例如“192.168.0.1:9200”或“www.123.com:9200”。</p>
</td>
</tr>
<tr class="row">
<td class="entry" headers="byKafka__table_zw2_d5m_psb__entry__1 ">
<p class="p">Kafka主题</p>
</td>
<td class="entry" headers="byKafka__table_zw2_d5m_psb__entry__2 ">
<p class="p">投放到Kafka服务器的消息主题。</p>
</td>
</tr>
<tr class="row">
<td class="entry" headers="byKafka__table_zw2_d5m_psb__entry__1 ">
<p class="p">Kafka分区</p>
</td>
<td class="entry" headers="byKafka__table_zw2_d5m_psb__entry__2 ">
<p class="p"><span class="ph uicontrol">消息投放到的Kafka服务器的分区。</span></p>
<div class="p">
<div class="note important note_important" id="byKafka__note_h2b_g5m_psb"><span class="note__title">重要:</span> Kafka相关配置必须与服务器端保持一致。</div>
</div>
</td>
</tr>
<tr class="row">
<td class="entry" headers="byKafka__table_zw2_d5m_psb__entry__1 ">
<p class="p">审计日志警模板</p>
</td>
<td class="entry" headers="byKafka__table_zw2_d5m_psb__entry__2 ">
<p class="p">设置发送审计日志的模板,具体字段请依据<strong class="ph b">填写说明</strong>编辑。</p>
</td>
</tr>
<tr class="row">
<td class="entry" headers="byKafka__table_zw2_d5m_psb__entry__1 ">
<p class="p">告警日志模板</p>
</td>
<td class="entry" headers="byKafka__table_zw2_d5m_psb__entry__2 ">
<p class="p">设置发送告警日志的模板,具体字段请依据<strong class="ph b">填写说明</strong>编辑。</p>
</td>
</tr>
<tr class="row">
<td class="entry" headers="byKafka__table_zw2_d5m_psb__entry__1 ">
<p class="p">会话日志模板</p>
</td>
<td class="entry" headers="byKafka__table_zw2_d5m_psb__entry__2 ">
<p class="p">设置发送会话日志的模板,具体字段请依据<strong class="ph b">填写说明</strong>编辑。</p>
</td>
</tr>
</tbody></table>
</div>
</li><li class="li step stepexpand">
<span class="ph cmd">单击<span class="ph uicontrol">保存</span>。</span>
</li><li class="li step stepexpand">
<span class="ph cmd">将配置好的日志外送接口挂载到指定数据库资产上:</span>
<ol type="a" class="ol substeps" id="byKafka__substeps_a1h_qbm_psb">
<li class="li substep substepexpand">
<span class="ph cmd">在<span class="ph uicontrol">日志外送任务管理</span>区域单击<span class="ph uicontrol">新增</span>。</span>
<div class="itemgroup info">
<img class="image" id="byKafka__image_h1g_35m_psb" src="https://obs-cn-shanghai.ocftcloud.com/pacloud/20222103110011-12bfdce09f43.png" width="700">
</div>
</li>
<li class="li substep substepexpand">
<span class="ph cmd">在弹出的<span class="keyword wintitle">新增日志外送任务</span>对话框中新增日志外送任务。</span>
<div class="itemgroup info">
<img class="image" id="byKafka__image_hrg_j5m_psb" src="https://obs-cn-shanghai.ocftcloud.com/pacloud/20222103110011-1b4e86ab9d1d.png" width="450">
<table class="table" id="byKafka__table_lzx_k5m_psb"><caption></caption><colgroup><col style="width:32.36245954692557%"><col style="width:67.63754045307444%"></colgroup><thead class="thead">
<tr class="row">
<th class="entry" id="byKafka__table_lzx_k5m_psb__entry__1">
<p class="p">配置项</p>
</th>
<th class="entry" id="byKafka__table_lzx_k5m_psb__entry__2">
<p class="p">说明</p>
</th>
</tr>
</thead><tbody class="tbody">
<tr class="row">
<td class="entry" headers="byKafka__table_lzx_k5m_psb__entry__1 ">
<p class="p">资产</p>
</td>
<td class="entry" headers="byKafka__table_lzx_k5m_psb__entry__2 ">
<p class="p">选择要发送日志信息的资产,可选择多个。</p>
</td>
</tr>
<tr class="row">
<td class="entry" headers="byKafka__table_lzx_k5m_psb__entry__1 ">
<p class="p">日志类型</p>
</td>
<td class="entry" headers="byKafka__table_lzx_k5m_psb__entry__2 ">
<p class="p">选择要发送的日志类型,包括审计日志、告警日志和会话日志。</p>
</td>
</tr>
<tr class="row">
<td class="entry" headers="byKafka__table_lzx_k5m_psb__entry__1 ">
<p class="p">外送接口</p>
</td>
<td class="entry" headers="byKafka__table_lzx_k5m_psb__entry__2 ">
<p class="p">选择Kafka日志外送接口。关于Kafka日志外送接口的配置请参见步骤3和步骤4。</p>
</td>
</tr>
</tbody></table>
</div>
</li>
<li class="li substep substepexpand">
<span class="ph cmd">单击<span class="ph uicontrol">确定</span></span>
</li>
</ol>
</li></ol></section>
提交成功!非常感谢您的反馈,我们会继续努力做到更好!