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

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM