Splunk安装部署基础篇

Splunk安装(以4.3.4版本为例)

下载splunk软件包,并解压,直接启动即可。

tar -zxvf splunk-4.3.4-136012-Linux-x86_64.tgz -C /opt
cd /opt/splunk/bin
./splunk start

设置开机启动:$SPLUNK_HOME/bin/splunk enable boot-start

检查服务状态:

tcp        0      0 0.0.0.0:18000               0.0.0.0:*                   LISTEN      0          553112836  28537/splunkd
tcp        0      0 0.0.0.0:8089                0.0.0.0:*                   LISTEN      0          553112134  28537/splunkd

Web端口默认8000,浏览器访问:http://192.168.1.2408000

默认账号:admin/changeme

Splunk 分索引器和转发器。类似Server和client的概念。 转发器将本地应用日志生成索引发往服务端。日志统一在服务器侧查看。

Splunk索引器(Server)

设置接受splunk forwarder发送来的数据.

管理器 » 转发和接收 » 接收数据 » 新增

新增服务端监听端口,(用于转发器配置转发地址 IP:Port)

 

 Splunk forwarder客户端

1. 当Splunk配置为转发器时,切换成相应的许可证类型。

2. 转发器侧配置服务端地址(IP:Port)

管理器 » 转发和接收 » 转发数据 » 新增

 

命令行操作

1)添加/删除/查看splunk forward-server

# ./splunk add forward-server 192.168.1.1:18000
Added forwarding to: 192.168.1.1:18000.
# ./splunk list forward-server
Active forwards:
    None
Configured but inactive forwards:
    192.168.1.1:18000
# ./splunk remove forward-server 192.168.1.1:18000
Stopped forwarding to: 192.168.1.1:18000.
# ./splunk list forward-server
Active forwards:
    None
Configured but inactive forwards:
    None

 2)配置需要监控的日志文件

# cd /opt/splunkforwarder/etc/system/local
# vim inputs.conf
[default]
host = newtest

[monitor:///usr/local/nginx/logs/error.log]
disabled = false
index = main
sourcetype = nginx_error

# /opt/splunkforwarder/bin/splunk start
著作权归作者所有。
商业转载请联系作者获得授权,非商业转载请注明出处。
作者:gjc159357
链接:http://www.89cool.com/374.html
来源:http://www.89cool.com/

cd bin/ ps aux | grep splunk ./splunk add forward-server 198.46.145.77:9997 ./splunk add forward-server 198.46.145.77:9997 -auth admin:changeme ./splunk list forward-server
./splunk list monitor ./splunk add monitor /home/logs/access.log (添加监控日志) ./splunk add monitor /home/logs/cache.log (同上)

注意,修改配置文件后,需要重启splunk forwarder。

 

小技巧将不同服务器的同类型日志,指定为同一个sourcetype,则可以通过“来源类型”选项卡合并查看。

 

 

参考:http://www.cnblogs.com/lmgsanm/p/5398308.html

https://www.splunk.com/zh-hans_cn/view/education/SP-CAAAAH9

 

转载于:https://www.cnblogs.com/zihanxing/p/6868619.html

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值