splunk.es.splunk_data_inputs_network 模块 – 管理 Splunk TCP 或 UDP 类型数据输入资源模块

注意

此模块是 splunk.es 集合 (版本 4.0.0) 的一部分。

如果您使用的是 ansible 软件包,则可能已安装此集合。它不包含在 ansible-core 中。要检查它是否已安装,请运行 ansible-galaxy collection list

要安装它,请使用:ansible-galaxy collection install splunk.es

要在 playbook 中使用它,请指定:splunk.es.splunk_data_inputs_network

splunk.es 2.1.0 中的新增功能

概要

  • 允许添加/更新或删除 Splunk 中 TCP 和 UDP 数据输入的模块。

注意

此模块具有相应的 action 插件

参数

参数

注释

config

列表 / 元素=字典

管理和预览协议输入数据。

cipher_suite

字符串

指定在 ssl 中使用的可接受密码列表。

仅在设备上存在 TCP SSL 配置时才能获取。

connection_host

字符串

设置发送数据的远程服务器的主机。

ip 将主机设置为发送数据的远程服务器的 IP 地址。

dns 将主机设置为发送数据的远程服务器的 IP 地址的反向 DNS 条目。

none 将主机保留为 inputs.conf 中指定的主机,通常是 Splunk 系统主机名。

选项

  • "ip"

  • "dns"

  • "none"

datatype

字符串

cooked 允许访问已处理的 TCP 输入信息并创建用于管理已处理数据的新的容器。

raw 允许管理来自转发器的原始 tcp 输入。

splunktcptoken 允许使用令牌管理接收器访问。

ssl 提供对 Splunk 服务器的 SSL 配置的访问。此选项不支持状态 *deleted* 和 *replaced*。

选项

  • "cooked"

  • "raw"

  • "splunktcptoken"

  • "ssl"

disabled

布尔值

指示输入是否已禁用。

选项

  • false

  • true

host

字符串

索引器从中获取数据的 Host。

index

字符串

存储生成的事件的默认索引。

name

字符串 / 必填

接收原始数据的输入端口。

no_appending_timestamp

布尔值

如果设置为 true,则阻止 Splunk 软件在传入事件前添加时间戳和主机名。

仅适用于 UDP 数据输入配置。

选项

  • false

  • true

no_priority_stripping

布尔值

如果设置为 true,则 Splunk 软件不会从传入的 syslog 事件中删除 priority 字段。

仅适用于 UDP 数据输入配置。

选项

  • false

  • true

password

字符串

服务器证书密码(如有)。

仅适用于 TCP SSL 配置。

protocol

字符串 / 必填

选择是管理 TCP 输入还是 UDP 输入

选项

  • "tcp"

  • "udp"

queue

字符串

指定输入处理器应将其读取的事件存储到哪里。默认为 parsingQueue。

将 queue 设置为 parsingQueue 以将 props.conf 和其他解析规则应用于您的数据。有关 props.conf 和时间戳和换行规则的更多信息,请参阅 props.conf 和在线文档“使用 inputs.conf 监控文件和目录”

将 queue 设置为 indexQueue 以将数据直接发送到索引中。

仅适用于“/tcp/raw”和“/udp”API

选项

  • "parsingQueue"

  • "indexQueue"

raw_tcp_done_timeout

整数

以秒为单位指定添加 Done-key 的超时值。

如果在接收指定秒数的数据后,通过 name 指定的端口上的连接保持空闲状态,则会添加 Done-key。这意味着已完全接收最后一个事件。

仅适用于 TCP 原始输入配置。

require_client_cert

字符串

确定客户端是否必须进行身份验证。

仅适用于 TCP SSL 配置。

restrict_to_host

字符串

允许将此输入限制为仅接受从此处指定的主机的数据。

root_ca

字符串

证书颁发机构列表(根文件)。

仅适用于 TCP SSL 配置。

server_cert

字符串

服务器证书的完整路径。

仅适用于 TCP SSL 配置。

source

字符串

设置此输入事件的源键/字段。默认为输入文件路径。

设置源键的初始值。该键在解析/索引期间使用,特别是用于在索引期间设置源字段。它也是搜索时使用的源字段。为方便起见,所选字符串前缀为“source::”。

请注意,通常不建议覆盖源键。通常,输入层提供更准确的字符串以帮助进行问题分析和调查,准确记录从中检索数据的文件。在覆盖此值之前,请考虑使用源类型、标记和搜索通配符。

sourcetype

字符串

设置此输入事件的源类型。

“sourcetype=” 自动添加到 <string> 前。

默认为 audittrail(如果 signedaudit=true)或 fschange(如果 signedaudit=false)。

ssl

布尔值

启用或禁用数据流的 ssl

选项

  • false

  • true

token

字符串

用于 SplunkTcpToken 的令牌值。如果未指定,则会自动生成令牌。

running_config

字符串

默认情况下,模块将连接到远程设备并检索当前运行配置,将其用作与源内容进行比较的基础。有时,不需要任务获取 playbook 中每个任务的当前运行配置。running_config 参数允许实现者传入用作比较基础配置的配置。此选项的值应该是通过执行命令从设备接收到的输出。

state

字符串

配置应保留的状态

选项

  • "merged" ← (默认)

  • "replaced"

  • "deleted"

  • "gathered"

示例

# Using gathered
# --------------

- name: Gathering information about TCP Cooked Inputs
  splunk.es.splunk_data_inputs_network:
    config:
      - protocol: tcp
        datatype: cooked
    state: gathered

# RUN output:
# -----------

# "gathered": [
#     {
#         "connection_host": "ip",
#         "disabled": true,
#         "host": "$decideOnStartup",
#         "index": "default",
#         "name": "8101"
#     },
#     {
#         "disabled": false,
#         "host": "$decideOnStartup",
#         "index": "default",
#         "name": "9997"
#     },
#     {
#         "connection_host": "ip",
#         "disabled": true,
#         "host": "$decideOnStartup",
#         "index": "default",
#         "name": "default:8101",
#         "restrict_to_host": "default"
#     }
# ]


- name: Gathering information about TCP Cooked Inputs by Name
  splunk.es.splunk_data_inputs_network:
    config:
      - protocol: tcp
        datatype: cooked
        name: 9997
    state: gathered

# RUN output:
# -----------

# "gathered": [
#     {
#         "datatype": "cooked",
#         "disabled": false,
#         "host": "$decideOnStartup",
#         "name": "9997",
#         "protocol": "tcp"
#     }
# ]


- name: Gathering information about TCP Raw Inputs
  splunk.es.splunk_data_inputs_network:
    config:
      - protocol: tcp
        datatype: raw
    state: gathered

# RUN output:
# -----------

# "gathered": [
#     {
#         "connection_host": "ip",
#         "disabled": false,
#         "host": "$decideOnStartup",
#         "index": "default",
#         "name": "8099",
#         "queue": "parsingQueue",
#         "raw_tcp_done_timeout": 10
#     },
#     {
#         "connection_host": "ip",
#         "disabled": true,
#         "host": "$decideOnStartup",
#         "index": "default",
#         "name": "default:8100",
#         "queue": "parsingQueue",
#         "raw_tcp_done_timeout": 10,
#         "restrict_to_host": "default",
#         "source": "test_source",
#         "sourcetype": "test_source_type"
#     }
# ]

- name: Gathering information about TCP Raw inputs by Name
  splunk.es.splunk_data_inputs_network:
    config:
      - protocol: tcp
        datatype: raw
        name: 8099
    state: gathered

# RUN output:
# -----------

# "gathered": [
#     {
#         "connection_host": "ip",
#         "datatype": "raw",
#         "disabled": false,
#         "host": "$decideOnStartup",
#         "index": "default",
#         "name": "8099",
#         "protocol": "tcp",
#         "queue": "parsingQueue",
#         "raw_tcp_done_timeout": 10
#     }
# ]

- name: Gathering information about TCP SSL configuration
  splunk.es.splunk_data_inputs_network:
    config:
      - protocol: tcp
        datatype: ssl
    state: gathered

# RUN output:
# -----------

# "gathered": [
#     {
#         "cipher_suite": <cipher-suites>,
#         "disabled": true,
#         "host": "$decideOnStartup",
#         "index": "default",
#         "name": "test_host"
#     }
# ]

- name: Gathering information about TCP SplunkTcpTokens
  splunk.es.splunk_data_inputs_network:
    config:
      - protocol: tcp
        datatype: splunktcptoken
    state: gathered

# RUN output:
# -----------

# "gathered": [
#     {
#         "disabled": false,
#         "host": "$decideOnStartup",
#         "index": "default",
#         "name": "splunktcptoken://test_token1",
#         "token": <token1>
#     },
#     {
#         "disabled": false,
#         "host": "$decideOnStartup",
#         "index": "default",
#         "name": "splunktcptoken://test_token2",
#         "token": <token2>
#     }
# ]

# Using merged
# ------------

- name: To add the TCP raw config
  splunk.es.splunk_data_inputs_network:
    config:
      - protocol: tcp
        datatype: raw
        name: 8100
        connection_host: ip
        disabled: true
        raw_tcp_done_timeout: 9
        restrict_to_host: default
        queue: parsingQueue
        source: test_source
        sourcetype: test_source_type
    state: merged

# RUN output:
# -----------

# "after": [
#     {
#         "connection_host": "ip",
#         "datatype": "raw",
#         "disabled": true,
#         "host": "$decideOnStartup",
#         "index": "default",
#         "name": "default:8100",
#         "protocol": "tcp",
#         "queue": "parsingQueue",
#         "raw_tcp_done_timeout": 9,
#         "restrict_to_host": "default",
#         "source": "test_source",
#         "sourcetype": "test_source_type"
#     }
# ],
# "before": [
#     {
#         "connection_host": "ip",
#         "datatype": "raw",
#         "disabled": true,
#         "host": "$decideOnStartup",
#         "index": "default",
#         "name": "default:8100",
#         "protocol": "tcp",
#         "queue": "parsingQueue",
#         "raw_tcp_done_timeout": 10,
#         "restrict_to_host": "default",
#         "source": "test_source",
#         "sourcetype": "test_source_type"
#     }
# ]

- name: To add the TCP cooked config
  splunk.es.splunk_data_inputs_network:
    config:
      - protocol: tcp
        datatype: cooked
        name: 8101
        connection_host: ip
        disabled: false
        restrict_to_host: default
    state: merged

# RUN output:
# -----------

# "after": [
#     {
#         "connection_host": "ip",
#         "datatype": "cooked",
#         "disabled": false,
#         "host": "$decideOnStartup",
#         "name": "default:8101",
#         "protocol": "tcp",
#         "restrict_to_host": "default"
#     }
# ],
# "before": [
#     {
#         "connection_host": "ip",
#         "datatype": "cooked",
#         "disabled": true,
#         "host": "$decideOnStartup",
#         "name": "default:8101",
#         "protocol": "tcp",
#         "restrict_to_host": "default"
#     }
# ],

- name: To add the Splunk TCP token
  splunk.es.splunk_data_inputs_network:
    config:
      - protocol: tcp
        datatype: splunktcptoken
        name: test_token
    state: merged

# RUN output:
# -----------

# "after": [
#     {
#         "datatype": "splunktcptoken",
#         "name": "splunktcptoken://test_token",
#         "protocol": "tcp",
#         "token": <token>
#     }
# ],
# "before": [],

- name: To add the Splunk SSL
  splunk.es.splunk_data_inputs_network:
    config:
      - protocol: tcp
        datatype: ssl
        name: test_host
        root_ca: {root CA directory}
        server_cert: {server cretificate directory}
    state: merged

# RUN output:
# -----------

# "after": [
#     {
#         "cipher_suite": <cipher suite>,
#         "datatype": "ssl",
#         "disabled": true,
#         "host": "$decideOnStartup",
#         "index": "default",
#         "name": "test_host",
#         "protocol": "tcp"
#     }
# ],
# "before": []


# Using deleted
# -------------

- name: To Delete TCP Raw
  splunk.es.splunk_data_inputs_network:
    config:
      - protocol: tcp
        datatype: raw
        name: default:8100
    state: deleted

# RUN output:
# -----------

# "after": [],
# "before": [
#     {
#         "connection_host": "ip",
#         "datatype": "raw",
#         "disabled": true,
#         "host": "$decideOnStartup",
#         "index": "default",
#         "name": "default:8100",
#         "protocol": "tcp",
#         "queue": "parsingQueue",
#         "raw_tcp_done_timeout": 9,
#         "restrict_to_host": "default",
#         "source": "test_source",
#         "sourcetype": "test_source_type"
#     }
# ]

# Using replaced
# --------------

- name: Replace existing data inputs networks configuration
  register: result
  splunk.es.splunk_data_inputs_network:
    state: replaced
    config:
      - protocol: tcp
        datatype: raw
        name: 8100
        connection_host: ip
        disabled: true
        host: "$decideOnStartup"
        index: default
        queue: parsingQueue
        raw_tcp_done_timeout: 10
        restrict_to_host: default
        source: test_source
        sourcetype: test_source_type

# RUN output:
# -----------

# "after": [
#     {
#         "connection_host": "ip",
#         "datatype": "raw",
#         "disabled": true,
#         "host": "$decideOnStartup",
#         "index": "default",
#         "name": "default:8100",
#         "protocol": "tcp",
#         "queue": "parsingQueue",
#         "raw_tcp_done_timeout": 9,
#         "restrict_to_host": "default",
#         "source": "test_source",
#         "sourcetype": "test_source_type"
#     }
# ],
# "before": [
#     {
#         "connection_host": "ip",
#         "datatype": "raw",
#         "disabled": true,
#         "host": "$decideOnStartup",
#         "index": "default",
#         "name": "default:8100",
#         "protocol": "tcp",
#         "queue": "parsingQueue",
#         "raw_tcp_done_timeout": 10,
#         "restrict_to_host": "default",
#         "source": "test_source",
#         "sourcetype": "test_source_type"
#     }
# ],

返回值

常见的返回值已记录在 此处,以下是此模块独有的字段

描述

after

列表 / 元素=字符串

模块执行后的最终配置。

已返回:已更改时

示例: ["此输出将始终与模块argspec的格式相同。\n"]

之前

列表 / 元素=字符串

模块执行之前的配置。

返回:当状态为 合并替换删除

示例: ["此输出将始终与模块argspec的格式相同。\n"]

收集的

字典

从远程设备收集到的关于网络资源的事实信息,以结构化数据的形式呈现。

返回:当状态为 收集

示例: "此输出将始终与模块argspec的格式相同。\n"

作者