ADC

将事务日志直接从 NetScaler 导出到 Splunk

现在,您可以将事务日志从 NetScaler 导出到 Splunk 等行业标准日志聚合器平台。事务日志是 NetScaler 上应用流量事件的记录,例如 HTTP 请求和响应、连接的开始和结束。有关事务日志的更多信息,请参阅 AppFlow

您可以以 JSON 格式导出交易日志,以获得不同的见解,例如 Web Insight、安全、网关、HDX 见解。要将事务日志导出到 Splunk,必须将 Splunk 配置为 HTTP 服务器,并使用 HTTP 事件收集器通过 HTTP(或 HTTPS)将事务日志从 NetScaler 直接发送到 Splunk 平台。使用 Splunk 的可视化工具,您可以获得有关导出数据的有意义的见解。

注意:

作为事务日志的一部分导出的 IP 地址以十进制格式显示,而不是标准格式。例如,如果您的 NetScaler IP 地址为 10.102.154.153,则 Splunk 交易日志中的相同地址将显示为 174496409。您可以使用 Splunk 上可用的内置表达式将 IP 地址从十进制格式转换为标准格式。

将事务日志从 NetScaler 导出到配置为 HTTP 服务器的 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 地址:Splunk 服务器 IP 地址。
    • 收藏家姓名:收藏家的名字。
    • 协议:将协议指定为 HTTP 或 SSL。
    • 端口:端口号。
  2. 创建分析配置文件。

    add analytics profile `profile-name` -type <insight> -collectors `collector-name` -analyticsAuthToken `<auth-scheme> <authorization-parameters>` `-analyticsEndpointContentType` `application/json` -analyticsEndpointUrl `endpoint-url`
    

    示例:

    add analytics profile transaction-log-profile -type webinsight -collectors -analyticsAuthToken "Splunk 1234-5678-12345" -analyticsEndpointContentType "application/json" -analyticsEndpointUrl "/services/collector/event"
    

    注意:

    Splunk 事务日志导出不支持 -allHttpHeaders 选项。

    add analytics profile <profile-name> -type webinsight -allHttpHeaders

    set analytics profile <profile-name> -type webinsight -allHttpHeaders

    在此配置中:

    • 洞察力:您可以导出的见解类型以下选项可用:
      • botinsight
      • CIinsight
      • Gatewayinsight
      • hdxinsigh
      • lsninsight
      • securityinsight
      • tcpinsigh
      • udpinsight
      • videoinsight
      • webinsight
    • -analyticsAuthToke auth-scheme authorization-parameters:在向 Splunk 发送日志时,使用身份验证方案“Splunk”指定要包含在授权标头中的身份验证令牌。此令牌是配置 HTTP 事件收集器时在 Splunk 服务器上创建的身份验证令牌。

    • analyticsEndpointContentType:内容类型标头。硬编码值为 application/json。

    • analyticsEndpointUrl:Splunk(/services/collector/event 或 /services/collector)上的 HEC 的路径。

      注意:

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

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

    > sh analytics profile 
        
    ns_analytics_default_http_profile
    1)      Name: ns_analytics_default_http_profile
            Collector: splunk
            Profile-type: webinsight
                    Page Tracking: DISABLED
                    Client Side Measurements: DISABLED
                    URL Logging: ENABLED
                    Host Header Logging: ENABLED
                    Method Logging: ENABLED
                    Cookie Header Logging: DISABLED
                    Referer Header Logging: DISABLED
                    User Agent Logging: DISABLED
                    Content Type Logging: DISABLED
                    Authorization Header Logging: DISABLED
                    Via Header Logging: DISABLED
                    Location Header Logging: DISABLED
                    URL Category Logging: DISABLED
                    Log All HTTP Headers: DISABLED
                    X-Forwarded-For Header Logging: DISABLED
                    Set-Cookie Header Logging: DISABLED
                    Set-Cookie2 Header Logging: DISABLED
                    Domain Name Logging: DISABLED
                    URL-Query Logging: DISABLED
                    Integrated Cache Logging: DISABLED
                    gRPC Status Logging: DISABLED
                    API Spec Info Export Logging: DISABLED
            Authentication Token:
            Endpoint URL: /services/collector/event
            Endpoint Content-type: text/json
            Reference Count: 1
            Managementlog: NONE
    
  4. 将分析配置文件绑定到虚拟服务器。

    bind lb vserver <vserver-name> -analyticsProfile transaction-log-profile
    

    示例:

    bind lb vserver sample-virtualserver -analyticsProfile transaction-log-profile
    

成功配置后,将根据流量记录交易并将其导出到 Splunk 上的 HEC。

输出示例

本节包含不同事务日志的示例输出。

HTTP 事务日志输出示例

以下是 HTTP 事务日志的输出示例。

{
    appName: VS1
    clientMss: 1460
    clntFastRetxCount: 0
    clntTcpJitter: 0
    cintTcpPacketsRetransmited: 0
    clntTcpRtoCount: 0
    clntTcpZeroWindowCount: 0
    cltDstIpv4Address: 174496411
    cltIpv4Address: 174496407
    connEndTimestamp: 0
    connStartTimestamp: 7329468222993076980
    exportingProcessId: 0
    httpRegHost: 10.102.154.155
    httpReqMethod: GET
    httpReqUrl: /big.html
    httpRspLen: 114380
    httpRspStatus: 200
    mainPageCoreId: 0
    mainPageId: 0
    nsPartitionId: 0
    observationPointId: 174496409
    originRspLen: 0
    srvrIcpPacketsRetransmited: 0
    srvrTcpZeroWindowCount: 0
    svrDstIpv4Address: 174496415
    svrIpv4Address: 174496408
    tepSrvrConnRstCode: 0
    transClntRTT: 0
    transCltDstPort: 20480
    transCltFlowEndUsecRx: 7329468222993084980
    transCltFlowEndUsecTx: 7329468222993084980
    transCltFlowStartUsecRx: 7329468222993076980
    transCltFlowStartUsecTx: 7329468222993077984
    transCltSrcPort: 60315
    transCltTotRx0ctCnt: 1766
    transCltTotTx0ctCnt: 117580
    transSrvDstPort: 36895
    transSrvSrcPort: 15213
    transSrvrRTT: 0
    transSvrFlowEndUsecRx: 7329468222993084980
    transSvrFlowEndUsecTx: 7329468222993084980
    transSvrFlowStartUsecRx: 7329468222993077984
    transSvrFlowStartUsecTx: 0
    transSvrTotRx0ctCnt: 117580
    transSvrTotTx0ctCnt: 1766
    transactionId: 4890
}

TCP 事务日志输出示例

以下是 TCP 事务日志的输出示例。

{
    appName: vs1
    clientConnEndTimestamp: 7333165210582386064
    clientConnStartTimestamp: 7333165210582386054
    clientMss: 1460
    clntFastRetxCount: 0
    clntTcpJitter: 0
    clntTcpPacketsRetransmited: 0
    clntTcpRtoCount: 0
    clntTcpZeroWindowCount: 0
    cltDstIpv4Address: 174496411
    cltDstPort: 20480
    cltIpv4Address: 174496407
    cltSrcPort: 42939
    connectionChainHopCount: 0
    exportingProcessId: 0
    nsPartitionId: 0
    observationPointId: 174496409
    serverConnEndTimestamp: 7333165201992708470
    serverConnStartTimestamp: 7333165201992708459
    srvDstPort: 36895
    srvSrcPort: 51973
    srvrTcpPacketsRetransmited: 0
    srvrTcpZeroWindowCount: 0
    svrDstIpv4Address: 174496415
    svrIpv4Address: 174496408
    tcpClntConnRstCode: 0
    tcpSrvrConnRstCode: 0
    transClntRTT: 0
    transCltTotRxOctCnt: 208
    transCltTotTxOctCnt: 331
    transSrvrRTT: 0
    transSvrTotRxOctCnt: 331
    transSvrTotTxOctCnt: 208
    transactionId: 330
    vlanNumber: 1
}

SSL 事务日志输出示例

以下是 SSL 事务日志的输出示例。

{
    appName: sslvs
    clientConnEndTimestamp: 0
    clientConnStartTimestamp: 7333182669624439854
    clientMss: 1460
    clntFastRetxCount: 0
    clntTcpJitter: 0
    clntTcpPacketsRetransmited: 0
    clntTcpRtoCount: 0
    clntTcpZeroWindowCount: 0
    cltDstIpv4Address: 174496411
    cltDstPort: 47873
    cltIpv4Address: 174496407
    cltSrcPort: 17499
    connectionChainHopCount: 0
    exportingProcessId: 0
    httpContentType: text/html
    httpReqHost: 10.102.154.155
    httpReqMethod: GET
    httpReqUrl: /index.html
    httpReqUserAgent: curl/7.69.1
    httpRspLen: 291
    httpRspStatus: 200
    nsPartitionId: 0
    observationPointId: 174496409
    originRspLen: 0
    serverConnEndTimestamp: 0
    serverConnStartTimestamp: 7333182665330184556
    srvDstPort: 36895
    srvSrcPort: 34802
    srvrTcpPacketsRetransmited: 0
    srvrTcpZeroWindowCount: 0
    sslCipherValueBE: 0
    sslCipherValueFE: 50331701
    sslClientCertSizeBE: 0
    sslClientCertSizeFE: 0
    sslClntCertSigHashBE: 0
    sslClntCertSigHashFE: 0
    sslFLagsBE: 0
    sslFLagsFE: 1096
    sslServerCertSizeBE: 0
    sslServerCertSizeFE: 4096
    sslSessionIDBE: 0
    sslSessionIDFE: 2433458443
    sslSigHashAlgBE: 0
    sslSigHashAlgFE: 0
    sslSrvrCertSigHashBE: 0
    sslSrvrCertSigHashFE: 668
    svrDstIpv4Address: 174496415
    svrIpv4Address: 174496408
    tcpClntConnRstCode: 0
    tcpSrvrConnRstCode: 0
    transClntRTT: 0
    transCltFlowEndUsecRx: 7333182669624447854
    transCltFlowEndUsecTx: 7333182669624446854
    transCltFlowStartUsecRx: 7333182669624439854
    transCltFlowStartUsecTx: 7333182669624439854
    transCltTotRxOctCnt: 1501
    transCltTotTxOctCnt: 2223
    transSrvrRTT: 0
    transSvrFlowEndUsecRx: 7333182669624446854
    transSvrFlowEndUsecTx: 7333182669624446854
    transSvrFlowStartUsecRx: 7333182669624446854
    transSvrFlowStartUsecTx: 0
    transSvrTotRxOctCnt: 331
    transSvrTotTxOctCnt: 168
    transactionId: 2640
    vlanNumber: 1
}

Web Insight 事务日志输出示例

以下是 Web Insight 事务日志的输出示例。

{
    appName: vs1
    clientConnEndTimestamp: 0
    clientConnStartTimestamp: 7333336201820249485
    clientMss: 1460
    clntFastRetxCount: 0
    clntTcpJitter: 0
    clntTcpPacketsRetransmited: 0
    clntTcpRtoCount: 0
    clntTcpZeroWindowCount: 0
    cltDstIpv4Address: 174496411
    cltDstPort: 20480
    cltIpv4Address: 174758625
    cltSrcPort: 46824
    connectionChainHopCount: 0
    exportingProcessId: 0
    httpContentType: text/html
    httpReqHost: 10.102.154.155
    httpReqMethod: GET
    httpReqUrl: /
    httpRspLen: 291
    httpRspStatus: 200
    nsPartitionId: 0
    observationPointId: 174496409
    originRspLen: 0
    serverConnEndTimestamp: 0
    serverConnStartTimestamp: 7333336201820250487
    srvDstPort: 36895
    srvSrcPort: 6465
    srvrTcpPacketsRetransmited: 0
    srvrTcpZeroWindowCount: 0
    svrDstIpv4Address: 174496415
    svrIpv4Address: 174496408
    tcpClntConnRstCode: 0
    tcpSrvrConnRstCode: 0
    transClntRTT: 0
    transCltFlowEndUsecRx: 7333336201820251488
    transCltFlowEndUsecTx: 7333336201820251488
    transCltFlowStartUsecRx: 7333336201820249485
    transCltFlowStartUsecTx: 7333336201820250487
    transCltTotRxOctCnt: 190
    transCltTotTxOctCnt: 371
    transSrvrRTT: 0
    transSvrFlowEndUsecRx: 7333336201820251488
    transSvrFlowEndUsecTx: 7333336201820250487
    transSvrFlowStartUsecRx: 7333336201820250487
    transSvrFlowStartUsecTx: 7333336201820250487
    transSvrTotRxOctCnt: 371
    transSvrTotTxOctCnt: 202
    transactionId: 11218
    vlanNumber: 1
}

事务日志的示例控制板

Splunk 上提供的以下控制板提供与事务日志相关的数据:

  • NetScaler HTTP 洞察控制面板
  • NetScaler SSL Insight 控制面板
  • NetScaler TCP Insight 控制面板

有关更多信息,请参阅 Splunk 上的示例控制板