您可以为在 Windows 上运行的 vRealize Log Insight 代理设置或更改目标 vRealize Log Insight 服务器。您可以将日志事件发送到最多三个目标,并可按目标筛选输出。

可以通过 liagent.ini 文件的 [server] 部分配置默认目标。默认目标始终存在,并且默认情况下主机名设置为 loginsight。要添加更多目标,请为每个目标创建 [server|<dest_id>] 部分。对于每个额外连接,必须指定一个唯一的主机名作为目标 ID。您可以对其他目标使用与默认 [server] 部分相同的选项。请勿将其他目标配置为自动升级,也不要使用它们来配置代理。您可以指定两个其他目标。

默认情况下,代理将收集的所有日志发送到所有目标。您可以通过 file 选项筛选日志以将不同的日志发送到不同的目标。有关详细信息,请参见筛选来自 vRealize Log Insight 代理的日志事件

前提条件

  • 登录到已安装 vRealize Log InsightWindows 代理的 Windows 计算机,启动“服务”管理器以验证是否已安装 vRealize Log Insight 代理服务。
  • 如果 vRealize Log Insight 集群具有启用的集成负载均衡器,请参见启用集成负载均衡器以了解自定义 SSL 证书特定的要求。

过程

  1. 导航到 vRealize Log InsightWindows 代理的程序数据目录。
    %ProgramData%\VMware\Log Insight Agent
  2. 在任意文本编辑器中打开 liagent.ini 文件。
  3. 修改以下参数,并设置用于您环境的值。
    参数 描述
    proto

    代理向 vRealize Log Insight 服务器发送日志事件所使用的协议。可能的值为 cfapisyslog

    默认值为 cfapi。

    hostname vRealize Log Insight 虚拟设备的 IP 地址或主机名。
    可以指定 IPv4 或 IPv6 地址。指定 IPv6 地址时可以使用方括号,也可以不使用。例如:
    hostname = 2001:cdba::3257:9652
    or
    hostname = [2001:cdba::3257:9652]
    如果主机同时支持 IPv4 和 IPv6 堆栈,并且域名被指定为主机名,代理将根据名称解析程序返回的 IP 地址选择 IP 堆栈。如果解析程序同时返回 IPv4 和 IPv6 地址,代理将尝试按给定的顺序依次连接这两个地址。
    max_disk_buffer Log Insight Windows 代理可用于缓冲为此特定服务器所收集日志事件的最大磁盘空间 (MB)。此选项将覆盖该服务器的 [storage].max_disk_buffer 值。

    默认值为 150 MB,您可以将缓冲区大小设置为 50 MB 到 8000 MB。

    port
    代理向 vRealize Log Insight 服务器或第三方服务器发送日志事件所使用的通信端口。默认情况下,代理根据为 SSL 和协议设置的选项使用相应的端口。请参见下面列表中提供的默认端口值。仅当端口选项与以下默认值不同时,您才需要指定端口选项。
    • 激活了 SSL 的 cfapi:9543
    • 停用了 SSL 的 cfapi:9000
    • 激活了 SSL 的 syslog:6514
    • 停用了 SSL 的 syslog:514
    ssl 启用或禁用 SSL。默认值为 yes。

    ssl 设置为 yes 时,端口将设置为 9543,除非您另行指定。

    reconnect 强制重新连接到服务器的时间(分钟)。默认值为 30。
    filter 指定代理发送到目标位置的信息。此选项采用以下三个参数:
    {collector_type; collector_filter; event_filter}
    [server]
    hostname=LOGINSIGHT
    ; Hostname or IP address of your Log Insight server / cluster load balancer. Default:
    ;hostname=LOGINSIGHT
     
    ; Protocol can be cfapi (Log Insight REST API), syslog. Default:
    ;proto=cfapi
    
    ; Log Insight server port to connect to. Default ports for protocols (all TCP):
    ; syslog: 514; syslog with ssl: 6514; cfapi: 9000; cfapi with ssl: 9543. Default:
    ;port=9543
    
    ; SSL usage. Default:
    ;ssl=yes
    
  4. 保存并关闭 liagent.ini 文件。

示例

以下配置示例将设置一个使用受信证书颁发机构的目标 vRealize Log Insight服务器。
[server]
proto=cfapi
hostname=LOGINSIGHT
port=9543
ssl=yes;  
ssl_ca_path=/etc/pki/tls/certs/ca.pem

以下示例显示了一个包含每个目标的筛选消息的多目标配置。

; The first (default) destination receives all collected events.
[server]
hostname=prod1.licf.vmware.com

; The second destination receives just syslog events through the plain syslog protocol.
[server|syslog-audit]
hostname=third_party_audit_management.eng.vmware.com
proto=syslog
ssl=no
filter={filelog; syslog; }


; The third destination receives vRealize Operations events if they have the level field equal to "error" or "warning" 
; and they are collected by sections whose name begins with "vrops-"

[server|licf-prod1]
hostname=vrops-errors.licf.vmware.com
filter={; vrops-.*; level == "error" || level == "warning"}

; Collecting syslog messages.
[filelog|syslog]
directory=/var/log
include=messages

; various vROPs logs. Note that all section names begin with a "vrops-" prefix, which is used in third destination filter.
[filelog|vrops-ANALYTICS-analytics]
directory=/data/vcops/log
include=analytics*.log*
exclude=analytics*-gc.log*
parser=auto

[filelog|vrops-COLLECTOR-collector]
directory=/data/vcops/log
include=collector.log*
event_marker=^\d{4}-\d{2}-\d{2}[\s]\d{2}:\d{2}:\d{2}\,\d{3}
parser=auto

[filelog|vrops-COLLECTOR-collector_wrapper]
directory=/data/vcops/log
include=collector-wrapper.log*
event_marker=^\d{4}-\d{2}-\d{2} [\s]\d{2}:\d{2}:\d{2}\.\d{3} 
parser=auto

下一步做什么

您可以为 vRealize Log Insight 代理配置其他 SSL 选项。请参见在服务器和 Log Insight 代理之间配置 SSL 连接