前言:
是这样的,之前有老版本splunk6.1.2的日志收集,但是后面由centos6-7的2.6内核换为了ubuntu22.04的5.15内核版本,所以之前收集器的rpm包就没法在ubuntu机器上运行了,后面找啊找,找到只有2.6内核版本的6.1.2的转发器deb文件,也就是ubuntu的“rpm”包,没用tar.gz二进制包哈。当然我也会附上下载链接。
安装客户端转发器splunkforwarder6.1.2
下载地址:
ubuntu的deb包:
这几个包我都有上传到我的csdn资源哈,可以自己去下载,或者私聊我下载发你。
备注:发现没这些下载链接啊,如果你版本和我不一样,那就自己按照这个链接格式改一下,下载你要的版本应该问题不大,因为我也是这个测出来这个老版本的包的,现在2022-08-10官网展示的最老版本都是7.1,我这都6.1.2了,官网没展示,但是后台下载链接还能ok下载,所以你懂的。
安装客户端
root@Ubuntu:/opt# wget https://download.splunk.com/products/universalforwarder/releases/6.1.2/linux/splunkforwarder-6.1.2-213098-linux-2.6-amd64.deb
--2022-08-10 09:01:37-- https://download.splunk.com/products/universalforwarder/releases/6.1.2/linux/splunkforwarder-6.1.2-213098-linux-2.6-amd64.deb
Resolving download.splunk.com (download.splunk.com)... 13.225.103.93, 13.225.103.10, 13.225.103.60, ...
Connecting to download.splunk.com (download.splunk.com)|13.225.103.93|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 12457610 (12M) [binary/octet-stream]
Saving to: ‘splunkforwarder-6.1.2-213098-linux-2.6-amd64.deb’
splunkforwarder-6.1.2-213098-linux-2.6-amd 100%[======================================================================================>] 11.88M 2.70MB/s in 4.4s
2022-08-10 09:01:44 (2.70 MB/s) - ‘splunkforwarder-6.1.2-213098-linux-2.6-amd64.deb’ saved [12457610/12457610]
root@Ubuntu:/opt# ll
total 12176
drwxr-xr-x 2 root root 4096 Aug 10 09:01 ./
drwxr-xr-x 21 root root 4096 Jul 28 11:17 ../
-rw-r--r-- 1 root root 12457610 Jul 14 2021 splunkforwarder-6.1.2-213098-linux-2.6-amd64.deb
root@Ubuntu:/opt# dpkg -i splunkforwarder-6.1.2-213098-linux-2.6-amd64.deb
Selecting previously unselected package splunkforwarder.
(Reading database ... 73945 files and directories currently installed.)
Preparing to unpack splunkforwarder-6.1.2-213098-linux-2.6-amd64.deb ...
Unpacking splunkforwarder (6.1.2-213098) ...
Setting up splunkforwarder (6.1.2-213098) ...
complete
root@Ubuntu:/opt# ls
splunkforwarder splunkforwarder-6.1.2-213098-linux-2.6-amd64.deb
root@Ubuntu:/opt#
如图,/opt目录下就已经安装好客户端转发器了。多了个目录
启动客户端
root@Ubuntu:/opt# /opt/splunkforwarder/bin/splunk staus
会出现一个阅读服务条款就是同意书,你一直空格下来最后输入y就行了。第一次启动会出现
再次启动即可
管理客户端
他这个也有客户端管理密码的默认的: admin/changeme
当你添加splunk服务器啊,添加索引和搜集日志目录啊,就会出现这个输入账号密码。
下面这个是命令行的管理客户端的一些案例命令。参考即可
客户端配置
添加需要读取的日志地址和索引
vi /opt/splunkforwarder/etc/apps/search/local/inputs.conf 修改索引的指定配置文件
/opt/splunkforwarder/bin/splunk restart 重启生效
/opt/splunkforwarder/bin/splunk add monitor "日志文件绝对路径" -index “索引名称”
例如:
/opt/splunkforwarder/bin/splunk add monitor "/bkb/logs/backend/wechat-server/wechat-server.log" -index wechat
注意:日志可用*正则匹配
/opt/splunkforwarder/bin/splunk add monitor "/home/wwwlogs/*.log" -index wechat
输入默认账号密码: admin/changeme
连接服务端,换为你的ip地址即可
/opt/splunkforwarder/bin/splunk add forward-server 192.168.1.24:9997
客户端配置的管理员 (管理客户端的配置)
admin/changeme
---查看客户端配置
/opt/splunkforwarder/bin/splunk show config inputs
查看 客户端提交给服务端,服务端的地址/端口
/opt/splunkforwarder/bin/splunk list forward-server
192.168.1.24:9997
查看本地监控的日志
/opt/splunkforwarder/bin/splunk list monitor
查看本地建立的索引
/opt/splunkforwarder/bin/splunk show config inputs |grep -i ind |grep -v "index=default" |grep -v "index=_internal"
/opt/splunkforwarder/bin/splunk show config inputs
/opt/splunkforwarder/bin/splunk show config inputs > /tmp/i.txt 找到具体的索引名,可知索引使用的log文件
./splunk remove monitor ‘移除的监控文件路径’ //删除监控项
如果要更改索引:
/opt/splunkforwarder/etc/apps/search/local/inputs.conf修改这个文件有老的