ADC

将审核日志和事件直接从 NetScaler 导出到 Splunk

审核日志记录使您能够记录 NetScaler 状态和由 NetScaler 中各种模块收集的状态信息。通过查看日志,您可以解决问题或错误并进行修复。

现在,您可以将审核日志和事件从 NetScaler 导出到 Splunk 等行业标准日志聚合器平台,并获得有意义的见解。

有多种方法可以将审核日志从 NetScaler 导出到 Splunk。您可以将 Splunk 配置为系统日志服务器或 HTTP 服务器。本主题提供有关使用 Splunk HTTP 事件收集器将 Splunk 配置为 HTTP 服务器的信息。使用 HTTP 事件收集器,您可以通过 HTTP(或 HTTPS)将审核日志从 NetScaler 直接发送到 Splunk 平台。

配置将审核日志从 NetScaler 导出到 Splunk

要配置审核日志的导出,必须执行以下步骤:

  1. 在 Splunk 上配置 HTTP 事件收集器。
  2. 在 NetScaler 上创建收集器服务和时间序列分析配置文件。

在 Splunk 上配置 HTTP 事件收集器

您可以通过配置 HTTP 事件收集器将审核日志转发到 Splunk。

有关如何配置 HTTP 事件收集器的信息,请参阅 Splunk 文档

配置 HTTP 事件收集器后,复制身份验证令牌并将其保存以供参考。在 NetScaler 上配置分析配置文件时,您需要指定此标记。

在 NetScaler 上配置时间序列分析配置文件

执行以下操作将 NetScaler 审核日志导出到 Splunk。

  1. 为 Splunk 创建收集器服务。

    add service <collector> <splunk-server-ip-address> <protocol> <port>
    

    示例:

    add service splunk_service 10.102.34.155 HTTP 8088
    

    在此配置中:

    • ip-address:指定 Splunk 服务器 IP 地址。
    • collector-name:指定收集器。
    • protocol: 将协议指定为 HTTP 或 HTTPS
    • port:指定端口号。
  2. 创建时间序列分析配置文件。

        add analytics profile <profile-name> -type time series -auditlog enabled -collectors <collector-name>  -analyticsAuthToken <"auth-token">
        -analyticsEndpointContentType <"Application/json"> -analyticsEndpointMetadata <"meta-data-for-endpoint:"> -analyticsEndpointUrl <"endpoint-url">
    

    示例:

        add analytics profile audit_profile -type timeseries -auditlog enabled -collectors -analyticsAuthToken "Splunk 1234-5678-12345" -analyticsEndpointContentType "Application/json" -analyticsEndpointMetadata "{\"event\":[" -analyticsEndpointUrl "/services/collector/event"
    

    在此配置中:

    • auditlog:将值指定为 enabled 以启用审核日志。
    • analyticsAuthToken:指定向 Splunk 发送日志时要包含在授权标头中的身份验证令牌。此令牌是配置 HTTP 事件收集器时在 Splunk 服务器上创建的身份验证令牌。身份验证令牌必须采用“Splunk”<token-copied-from-splunk>格式。例如,“Splunk 3e52aa4b-1db7-45b2-9af9-173eedc8e1bc”。

    • analyticsEndpointContentType: 指定日志的格式。
    • analyticsEndpointMetadata:指定 Splunk 在数据开头所需的元数据,即 "{\"event\":["

    • analyticsEndpointUrl: 指定您配置 Splunk HEC 以将请求发送到的 URL。例如,“/services/collector/event”。

    注意:

    您可以使用 set analytics profile 命令修改时间序列分析配置文件参数。

  3. 使用 show analytics profile 命令验证分析配置文件配置。

    # show analytics profile audit_profile
    
    1)    Name: audit_profile
          Collector: splunk
          Profile-type: timeseries
                Output Mode: avro
                Metrics: DISABLED
                  Schema File: schema.json
                  Metrics Export Frequency: 30
                Events: DISABLED
                Auditlog: ENABLED
                Serve mode: Push
           Authentication Token: <auth-token>
           Endpoint URL: /services/collector/event
           Endpoint Content-type: Application/json
           Endpoint Metadata: {"event":[
           Reference Count: 0
    

配置成功后,审核日志将作为 HTTP 有效载荷发送到 Splunk,您可以在 Splunk 应用程序用户界面上查看。

配置将事件从 NetScaler 导出到 Splunk

要配置将事件从 NetScaler 导出到 Splunk,必须执行以下步骤:

  1. 按照在 Splunk 上配置 HTTP 事件收集器中的步骤在 Splunk 上配置 HTTP 事件收集器

  2. 使用以下命令在 NetScaler 上创建收集器服务。

    add service <collector> <splunk-server-ip-address> <protocol> <port>
    

    示例:

    add service splunk_service 10.102.34.155 HTTP 8088
    

    在此配置中:

    • ip-address:指定 Splunk 服务器 IP 地址。
    • collector-name:指定收集器。
    • protocol:将协议指定为 HTTP 或 HTTPS。
    • port:指定端口号。
  3. 使用 add analytics profile 命令在 NetScaler 上创建时间序列分析配置文件。您必须在创建分析配置文件时指定 -events enabled 选项才能启用导出事件。

    示例:

    add analytics profile event_profile -type timeseries -events enabled -collectors splunk -analyticsAuthToken "Splunk 1234-5678-12345" -analyticsEndpointContentType "Application/json" -analyticsEndpointMetadata "{\"event\":[" -analyticsEndpointUrl "/services/collector/event"
    
  4. 使用 show analytics profile 命令验证分析配置文件配置。

    # show analytics profile event_profile
    
    1)    Name: event_profile
          Collector: splunk
          Profile-type: timeseries
                Output Mode: avro
                Metrics: DISABLED
                  Schema File: schema.json
                  Metrics Export Frequency: 30
                Events: ENABLED
                Auditlog: DISABLED
                Serve mode: Push
           Authentication Token: <auth-token>
           Endpoint URL: /services/collector/event
           Endpoint Content-type: Application/json
           Endpoint Metadata: {"event":[
           Reference Count: 0
    
将审核日志和事件直接从 NetScaler 导出到 Splunk