日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

nxlog日志采集

發布時間:2023/12/31 编程问答 46 豆豆
生活随笔 收集整理的這篇文章主要介紹了 nxlog日志采集 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

一、nxlog 簡介

? nxlog 是一個模塊化、多線程、高性能的日志管理解決方案,支持多平臺,可實現各類操作系統及其中間件的日志采集和管理

二、nxlog官網下載地址

2.1 社區版官網下載地址:NXLog Community Edition - Downloads | nxlog.co

2.2??下載相應的系統版本

1) Centos 6.x

wget --no-check-certificate https://nxlog.co/system/files/products/files/348/nxlog-ce-2.10.2150-1_rhel6.x86_64.rpm

2)Centos 7.x

wget --no-check-certificate https://nxlog.co/system/files/products/files/348/nxlog-ce-3.0.2272-1_rhel7.x86_64.rpm

3)Centos 8.x

wget --no-check-certificate https://nxlog.co/system/files/products/files/348/nxlog-ce-3.0.2272_rhel8.x86_64.rpm

4) Ubuntu 18.04

wget --no-check-certificate https://nxlog.co/system/files/products/files/348/nxlog-ce_3.0.2272_ubuntu_bionic_amd64.deb

三、安裝nxlog及依賴環境

3.1 Centos 6.x?

yum install apr libdbi* -y #安裝依賴環境(yum源不可用轉步驟四) rpm -ivh nxlog-ce-2.10.2150-1_rhel6.x86_64.rpm #安裝rpm包

3.2?Centos 7.x?

yum install apr libdbi libpython3.6m.so.1.0 -y #安裝依賴環境 rpm -ivh nxlog-ce-3.0.2272-1_rhel7.x86_64.rpm #安裝rpm包

3.3?Centos 8.x?

yum install apr libdbi* libperl.so.5.26 -y #安裝依賴環境(yum源不可用轉步驟四) rpm -ivh nxlog-ce-3.0.2272-1_rhel7.x86_64.rpm #安裝rpm包

3.4?Ubuntu 18.04

sudo dpkg -i nxlog-ce_3.0.2272_ubuntu_bionic_amd64.deb #安裝deb包,提示需依賴環境 sudo apt-get --fix-broken install #解決并安裝依賴環境 sudo dpkg -i nxlog-ce_3.0.2272_ubuntu_bionic_amd64.deb #再次安裝deb包

* Centos6.x 8.x 官方yum源已下線。如系統本身yum源失效, 不能安裝依賴環境,需更換第三方源或搭建本地yum源。

四、解決Centos6.x 8.x yum源失效問題

4.1 Centos6.x 更換阿里云yum源

curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-vault-6.10.repo #更換阿里yum源 yum clean all #清除緩存 yum makecache #重新建立緩存

4.2?Centos 8.x ?更換阿里云yum源

mv /etc/yum.repos.d /etc/yum.repos.d.bak #備份原有yum源目錄 mkdir -p /etc/yum.repos.d #創建新的yum源目錄 curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo #更換阿里yum源 curl -o /etc/yum.repos.d/epel-archive-8.repo https://mirrors.aliyun.com/repo/epel-archive-8.repo #添加阿里epel yum源 yum clean all #清除緩存 yum makecache #重新建立緩存

五、nxlog 服務管理及卸載

5.1?Centos 6.x

service nxlog start #啟動 service nxlog stop #停止 service nxlog restart #重啟 service nxlog status #查看運行狀態

5.2?Centos 7.x 8.x

systemctl start nxlog #啟動 systemctl stop nxlog #停止 systemctl restart nxlog #重啟 systemctl status nxlog #查看運行狀態

5.3?Ubuntu

sudo systemctl start nxlog #啟動 sudo systemctl stop nxlog #啟動 sudo systemctl restart nxlog #重啟 sudo systemctl status nxlog #查看運行狀態

5.4?配置及日志文件

/etc/nxlog.conf #Centos6.x 默認配置文件路徑 /etc/nxlog nxlog.conf #Centos7.x 8.x ubuntu 默認配置文件路徑 /var/log/nxlog/nxlog.log #nxlog本身日志默認存放路徑,用于調試和排錯

5.6?卸載nxlog

yum remove 'nxlog-*' -y #Centos6.x 7.x 8.x sudo apt-get remove '^nxlog*' -y #Ubuntu

六、防火墻放行nxlog服務

6.1 Centos 6.x

iptables -I INPUT -p udp --dport 514 -j ACCEPT #放行udp 514端口 iptables -I OUTPUT -p udp --sport 514 -j ACCEPT #放行udp 514端口 service iptables save #保存防火墻規則 service iptables restart #重啟防火墻

?6.2 Centos 7.x 8x

firewall-cmd --zone=public --add-port=514/udp --permanent #放行udp 514端口 firewall-cmd --reload #重新加載防火墻策略 firewall-cmd --zone=public --list-ports? #查看放行的端口 systemctl restart firewalld? #重啟防火墻

6.3 Ubuntu

udo ufw allow 514 #放行udp 514端口 sudo ufw status #查看放行的端口及規則 sudo ufw reload #重新加載防火墻策略

七、nxlog 采集Apache錯誤日志示例

編輯nxlog配置文件? ?在Modules模塊? <Input apache_error_in>??</Input>? ?和 <Output Apache_error_out>? 中分別填寫apache錯誤日志文件路徑和輸出的日志服務器地址及端口。Routes模塊添加Path參數。 (紅色部分名稱自定義)

######################################## # Global directives # ######################################## User nxlog Group nxlogLogFile /var/log/nxlog/nxlog.log LogLevel INFO Nocache True ######################################## # Modules # ######################################## <Extension _syslog>Module xm_syslog </Extension><Input apache_error_in>SavePos falseReadfromlast falseModule im_fileFile "/var/log/apache/error.log" </Input><Output apache_error_out>Module om_tcpHost 10.19.21.100Port 514 </Output>######################################## # Routes # ######################################## # <Route apache_error_route>Path apache_error_in => apache_error_out </Route>

總結

以上是生活随笔為你收集整理的nxlog日志采集的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。