步骤二:修改配置文件
<section><div class="tasklabel"><h2 class="doc-tairway">操作步骤</h2></div><ol class="ol steps"><li class="li step stepexpand">
<span class="ph cmd">在C:\Program Files (x86)\nxlog\conf目录下,以记事本方式打开nxlog.conf文件,将<Output
out>段中Host IP修改成安全日志审计服务的IP地址。下图以安全日志审计服务的IP为10.20.90.46为例。</span>
<div class="itemgroup info">
<img class="image" id="configWin__image_prz_khw_ssb" src="https://obs-cn-shanghai.ocftcloud.com/pacloud/20222803112055-19af638d9f1e.png" width="400">
<div class="note important note_important" id="configWin__note_rkv_nhw_ssb"><span class="note__title">重要:</span> Port默认是UDP端口514,如果安全日志审计服务上改为其他端口号,此处也需要修改成相应的端口号。</div>
</div>
</li><li class="li step stepexpand">
<span class="ph cmd">(可选)如果nxlog-ce没有安装在默认目录C:\Program Files
(x86)\nxlog目录下,则需手动指定nxlog-ce安装目录,即需要手动将define ROOT指向实际的安装目录。例如安装在D:\Program
Files (x86)\nxlog目录下,则修改为define ROOT D:\Program Files (x86)\nxlog。</span>
<div class="itemgroup info">
<img class="image" id="configWin__image_prz_khw" src="https://obs-cn-shanghai.ocftcloud.com/pacloud/20222803112055-1a28fe7a9d28.png" width="600">
</div>
</li><li class="li step stepexpand">
<span class="ph cmd">(可选)nxlog-ce默认采集主机上应用程序、安全、系统三个模块的日志,如需采集文本型日志,需要进行以下配置:</span>
<ol type="a" class="ol substeps" id="configWin__substeps_agl_vjw_ssb">
<li class="li substep substepexpand">
<span class="ph cmd">需要将配置文件中Input
in2模块中的File段指定为文本型日志文件的具体路径。例如采集<strong class="ph b">D:\nginx\</strong>目录下<strong class="ph b">access.log</strong>文本型日志,配置方法如下图所示。</span>
<div class="itemgroup info">
<img class="image" id="configWin__image_pr" src="https://obs-cn-shanghai.ocftcloud.com/pacloud/20222803112055-142ca1fe9b69.png" width="600">
<div class="note important note_important" id="configWin__note_g4n_2kw_ssb"><span class="note__title">重要:</span>
<ul class="ul" id="configWin__ul_gfx_gkw_ssb">
<li class="li">File后需要修改成实际监控的日志文件,支持通配符*来匹配多个文件,比如D:\nginx\\*.log,表示采集<strong class="ph b">D:\nginx</strong>目录下所有<strong class="ph b">*.log</strong>结尾的文本型日志文件。</li>
<li class="li">文本型日志文件的路径中不能包含中文。</li>
<li class="li">如需监控多个应用或多个路径的日志,可配置多个Input,Input的名称唯一,并把该名称添加到Path中即可,以<Input></Input>为一段。</li>
</ul>
</div>
</div>
</li>
<li class="li substep substepexpand">
<span class="ph cmd">把in2添如下加到<Route>配置段的Path中,修改后的配置如下:</span>
<div class="itemgroup info">
<img class="image" src="https://obs-cn-shanghai.ocftcloud.com/pacloud/20222803112055-1ba8646f9608.png" width="700">
</div>
</li>
<li class="li substep substepexpand">
<span class="ph cmd">(可选)配置日志源资产重识别:</span>
<div class="itemgroup info">
<p class="p">安全日志审计服务同时采集了主机上的系统事件日志和文本型日志,如需在安全日志审计服务上区分这两部分日志来源,则需要配置日志源资产重识别。例如,可以将文本型日志的来源用虚拟资产例(如资产名称为46_nxlog)来标识,这样,在安全日志审计服务上选择名称为46_nxlog的日志源资产时,就可以只查询所收集的文本型日志。</p>
<p class="p"> 配置资产重识别,只需将#Exec $raw_event = 'DbAppSOCAgent get log from "nginx" '
+ $raw_event;前面的#删除,并将from后面值改为资产名称(如nginx)即可。</p>
</div>
<div class="itemgroup info">
<figure class="fig fignone" id="configWin__fig_z1p_vrw_ssb"><figcaption xmlns:table="http://dita-ot.sourceforge.net/ns/201007/dita-ot/table" xmlns:dita-ot="http://dita-ot.sourceforge.net/ns/201007/dita-ot" class="figcap"><span class="figtitleprefix fig--title-label">图<span class="fig--title-label-number"> 1</span>: </span>修改前</figcaption>
<img class="image" id="configWin__image_oqc_krw_ssb" src="https://obs-cn-shanghai.ocftcloud.com/pacloud/20222803112055-1508501f95e4.png" width="700">
</figure>
<figure class="fig fignone" id="configWin__fig_kys_xrw_ssb"><figcaption xmlns:table="http://dita-ot.sourceforge.net/ns/201007/dita-ot/table" xmlns:dita-ot="http://dita-ot.sourceforge.net/ns/201007/dita-ot" class="figcap"><span class="figtitleprefix fig--title-label">图<span class="fig--title-label-number"> 2</span>: </span>修改后</figcaption>
<img class="image" id="configWin__image_s4v_xrw_ssb" src="https://obs-cn-shanghai.ocftcloud.com/pacloud/20222803112055-1bf25e4693ee.png" width="700">
</figure>
</div>
</li>
</ol>
</li><li class="li step stepexpand">
<span class="ph cmd">配置文件修改后,必须重启nxlog-ce程序才能使改动项生效。在<span class="ph menucascade"><span class="ph uicontrol">控制面板</span><abbr> > </abbr><span class="ph uicontrol">管理工具</span><abbr> > </abbr><span class="ph uicontrol">服务</span></span>中,选中nxlog服务,右键启动nxlog服务。</span>
<div class="itemgroup info">
<img class="image" id="configWin__image_uxn_glw_ssb" src="https://obs-cn-shanghai.ocftcloud.com/pacloud/20222803112055-147f67de910a.png" width="500">
</div>
</li></ol></section>
提交成功!非常感谢您的反馈,我们会继续努力做到更好!