安裝collector-sidecar隨筆


日志管理工具graylog的客戶端

--------------------------------------------------------------------

本文參考多篇文章結合自身情況完成,可自由轉載,需保留本文出處!

博主:ElevenHeart

http://www.cnblogs.com/elevenheart/p/7205388.html                      

--------------------------------------------------------------------

collector-sidecar的安裝步驟

  • 1、Xshell遠程登錄服務器

  • 2、進入幫助文檔,下載collector-sidecar,選擇穩定版Linux系統下載collector-sidecar-0.0.9-1.x86_64.rpm

  • 3、在本機上安裝sidecar(centos系統)

    • rpm -i collector-sidecar-0.0.9-1.x86_64.rpm(路徑/etc/graylog/collector-sidecar)
    • 修改配置文件
      • vi collector-id(將本機ip地址寫進去)
      • vi collector_sidecar.yml(修改serverURL:http://graylogip:監聽端口/api/, 添加tags)
    • graylog-collector-sidecar -service install  (安裝服務)
    • systemctl start collector-sidecar(啟動)
  • 4、graylog服務器上添加一個Beat inputs,使graylog可以接收數據

    • graylog->system->Inputs
    • 選擇Beats,點擊Lunch new input
    • 編輯,添加title,IP地址:0.0.0.0,及監聽的端口號,保存
  • 5、查看graylog上是否已經監控到了該服務器

    • graylog->system->collectors
  • 6、添加configuration

    • collectors->Manage configurations->creat configuration
    • 添加name,保存
    • 點擊剛添加好的configuration,添加標簽,點擊update tags
  • 7、添加outputs

    • 點擊creat outputs,添加name,選擇type,填寫IP及端口號,IP地址為graylog的IP,端口號為對應的graylog服務器的input里設置的監聽端口
  • 8、添加一個項目

    • 選擇一個標簽進入,點擊Creat input,填寫name,Forward to,type,及日志路徑等(回到服務器中查看項目日志的路徑),填上所有信息,保存
  • 9、添加Stream

    • 點擊 graylog->stream,可以直接克隆一份已有的,修改名字,並啟動
  • 10、設置郵件報警

    • 點擊alerts->Manage condition->Add new condition ,選擇新加的stream,在condition type中選擇:Message Count Alert Condition,點擊add
    • 點擊edit,設置報警頻率
    • 點擊Manage notifications->add new notification,選擇新添加的一條stream,在type中選擇Email Alert Callback,添加title,及收件人郵箱,並刪掉發件人郵箱,點擊保存
  • 11、設置郵件轉發

    • 選擇error output
  • 12、查看是否添加成功

    • 到search上搜索是否收到該項目的日志信息,name:項目名稱
    • 若有,則添加成功

注:

collector-sidecar安裝好后會在/etc/graylog/collector-sidecar

可通過查看generated/filebeat.xml來查看是否接收到了項目日志

使用‘graylog-collector-sidecar -c /etc/graylog/collector-sidecar/collector_sidecar.yml’校驗collector-sidecar配置文件是否正確,並查看‘/var/log/collector-sidecar.err‘或者‘/var/log/messages‘來獲取錯誤詳情。
 
graylog服務器里system->collector里所展示的就是所有安裝 了sidecar並監聽到日志的服務器
collector里的input用來接收日志,output用來將日志轉發給graylog服務器里
graylog服務器里system->Input,用來接收監聽轉發過來的日志,再通過output發出去。


免責聲明!

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



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