overipio.splunk-universalforwarder
Splunk Universal Forwarder Ansible角色
Splunk转发器的基本安装和配置
角色变量
目前,Splunk的所有输入/输出配置文件通过变量进行配置,您可以在下面的默认值中看到。
# 系统相关
# Splunk UF应在哪个用户下运行
splunkforwarder_system_user: splunk
splunkforwarder_path: /opt/splunkforwarder
splunkforwarder_start_on_boot: yes
splunkforwarder_get_via_curl: no
# 包位置
# 要安装的Splunk UF二进制文件
splunkforwarder_url: 'https://www.splunk.com/bin/splunk/DownloadActivityServlet?architecture=x86_64&platform=linux&version=6.5.1&product=universalforwarder&filename=splunkforwarder-6.5.1-f74036626f0c-Linux-x86_64.tgz&wget=true'
splunkforwarder_filename: 'splunkforwarder-6.5.1-f74036626f0c-Linux-x86_64.tgz'
splunkforwarder_md5: 'md5:e8468b95b4ca03f73f33714a4430c82e'
# 认证相关
# 登录特定信息
splunkforwarder_user: admin
splunkforwarder_pass: changeme
# 部署服务器
# 如果使用Splunk部署服务器,请设置
# splunkforwarder_deployment_server:
# 默认索引
splunkforwarder_default_index: default
# 配置文件内容
# 可能有更好的实现方式,但为了开始,这里是我们想要部署到系统的配置文件
splunkforwarder_outputs: |
defaultGroup = primary
[tcpout:primary]
server = localhost:9997
# 在此处添加您希望的所有输入,基本默认
splunkforwarder_inputs: |
[default]
index = {{ splunkforwarder_default_index }}
[monitor://$SPLUNK_HOME/var/log/splunk]
index = _internal
示例剧本
- hosts: servers
roles:
- overipio.splunk-universalforwarder
向现有安装添加其他监视器
- hosts: servers
vars:
- splunkforwarder_inputs_monitor:
- path: "/opt/applications/helloworld/*.log"
sourcetype: application_log
index: differentindex
- path: "/opt/foo/bar.log"
roles:
- overipio.splunk-universalforwarder