背景:html
Ossec安裝後用了一段時間的analogi做爲ossec的報警信息顯示平臺,可是查看報警分類信息、linux
以及相關圖標展現等方面總有那麼一點點的差強人意,難以分析。所以使用逼格高一點的splunk做爲web
日誌分析平臺就變得頗有必要了。vim
操做:服務器
1、ossec服務端配置dom
(1)配置ossec數據轉發至splunk監聽端口字體
[root@localhost html]# vim /opt/ossec/etc/ossec.confthis
在<ossec_config>標籤下添加<syslog_output>,內容以下,spa
其中server標籤的IP爲接受syslog記錄的服務端,即安裝splunk服務的主機IP。3d
端口爲splunk的本地監聽端口。
<syslog_output> <server>192.168.129.134</server> <port>10002</port> </syslog_output>
(2)使syslog_output模塊生效並重啓ossec服務端。
[root@localhost html]# /opt/ossec/bin/ossec-control enable client-syslog
[root@localhost html]# /opt/ossec/bin/ossec-control restart
2、下載並安裝splunk
(1)從官網下載splunk(需註冊),下載文件爲splunklight-6.4.2-00f5bb3fa822-linux-2.6-x86_64.rpm
(2)安裝splunk:rpm -Uvh splunklight-6.4.2-00f5bb3fa822-linux-2.6-x86_64.rpm
[root@localhost Desktop]# rpm -Uvh splunklight-6.4.2-00f5bb3fa822-linux-2.6-x86_64.rpm warning: splunklight-6.4.2-00f5bb3fa822-linux-2.6-x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID 653fb112: NOKEY Preparing... ################################# [100%] Updating / installing... 1:splunk-6.4.2-00f5bb3fa822 ################################# [100%] complete
(3)啓動splunk:# /opt/splunk/bin/splunk start (啓動時會詢問是否贊成許可,輸入y後繼續)
[root@localhost Desktop]# /opt/splunk/bin/splunk start ... ... 4. FORCE MAJEURE. Splunk will not be responsible for any failure or delay in its performance under these Terms and Conditions due to causes beyond its reasonable control, including, but not limited to, labor disputes, strikes, lockouts, shortages of or inability to obtain labor, energy, raw materials or supplies, war, acts of terror, riot, acts of God or governmental action. Do you agree with this license? [y/n]: y
... ...
Waiting for web server at http://127.0.0.1:8000 to be available... Done
If you get stuck, we're here to help.
Look for answers here: http://docs.splunk.com
The Splunk web interface is at http://127.0.0.1:8000
(4)Splunk的web接口爲http://127.0.0.1:8000,嘗試訪問。
(5)首次登陸請先按着提示輸入admin/changeme後,設定新的密碼。以後的登陸信息爲admin+你設定的新密碼。
(6)登陸成功
3、配置Splunk接收來自Ossec的日誌轉發
(1)splunk的默認安裝路徑爲/opt/splunk,編輯/opt/splunk/etc/system/local/inputs.conf文件添加如下紅色字體內容
指定的ip爲ossec服務器的IP地址。
[root@localhost local]# vim /opt/splunk/etc/system/local/inputs.conf [default] host = localhost.localdomain [udp://192.168.129.128:10002] # IP address of OSSEC server disabled = false sourcetype = ossec
(2)重啓Splunk服務
# /opt/splunk/bin/splunk restart
4、Splunk數據導入
(1)導入頁面
數據已成功導入