更新时间:2023-11-06 GMT+08:00
分享

服务器/终端(Windows操作系统)

操作步骤

  1. 下载nxlog工具,通过nxlog工具进行日志上报。

    进入工具下载地址,根据操作系统找到相应的安装包,如nxlog-ce-x.x.xxx.msi

    图1 下载nxlog工具

  2. 安装nxlog工具。选中nxlog-ce-x.x.xxx.msi文件,右键单击“安装”(或管理员身份运行),按照提示默认安装即可。
  3. 修改配置文件nxlog.conf,默认在C:\Program Files\nxlog\conf下。“C:\Program Files\nxlog”为nxlog的默认安装路径。

    1. 根据实际情况,按照如下格式修改nxlog.conf文件中的对应内容

      如果系统提示无权限修改nxlog.conf文件时,请参见异常处理进行处理。

      ## Please set the ROOT to the folder your nxlog was installed into,   
      ## otherwise it will not start.    
      
      define ROOT C:\Program Files\nxlog  
      
      Moduledir %ROOT%\modules   
      CacheDir %ROOT%\data   
      Pidfile %ROOT%\data\nxlog.pid   
      SpoolDir %ROOT%\data   
      LogFile %ROOT%\data\nxlog.log    
      
      <Extension syslog>     
        Module          xm_syslog 
      </Extension>    
      
      <Input eventlog>
            Module          im_msvistalog
            <QueryXML>
                <QueryList>
                    <Query Id="0">
                        <Select Path="Application">*</Select>
                        <Select Path="Security">*</Select>
                        <Select Path="System">*</Select>
                    </Query>
                </QueryList>
          </QueryXML>
        </Input>
      
      <Output udp>
            Module      om_udp
            Host       10.1.1.1
           Port       514
            Exec        to_syslog_ietf();
        </Output>
      
        <Route eventlog_to_udp>
            Path        eventlog => udp
        </Route>
      • define中的安装路径需要修改为nxlog的实际安装路径。
        define ROOT C:\Program Files\nxlog
      • <Output udp>…</Output>中Host的值需修改为天关侧与资产通信的内网IP地址,Port需修改为在天关配置的端口,与4中配置的端口号保持一致。
        Host       10.1.1.1
        Port       514
    2. (可选)修改input元素。针对不同的Windows操作系统版本,配置稍有差异。
      • Windows操作系统为Windows XP/2000/2003版本时,需要修改nxlog.conf文件中的Input元素。
      • Windows操作系统为Windows Vista、Windows 2008及之后版本时,不需要修改。
      <Input eventlog>   
        Module      im_mseventlog
        ...
      </Input> 

  4. 返回桌面,右键单击“开始 > 运行”,或同时按“Windows+R”,打开“运行”窗口。
  5. 输入services.msc,单击“确定”。
  6. 启动或重启nxlog服务,重启后配置文件才能生效。

    图2 启动nxlog服务

    如果重启服务时,系统提示错误1053:服务没有及时响应启动或控制请求,请确认3.a中配置文件define行的安装路径是否正确。

异常处理

使用普通用户修改nxlog.conf文件时,可能存在修改后无法保存的情况,请按照以下步骤为该用户添加写权限。

  1. 右键单击配置文件nxlog.conf,选择“属性 > 安全”。
  2. 单击“编辑”,在“组或用户名”区域框中选择“Users(XXXX)”,勾选允许“修改”和“写入”权限,单击“应用”,单击“确定”。

    图3 添加写入修改权限

分享:

    相关文档

    相关产品