rsyslog 瀛樺偍鍒?mysql
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了rsyslog 瀛樺偍鍒?mysql相关的知识,希望对你有一定的参考价值。
鏍囩锛?a href='http://www.mamicode.com/so/1/kth' title='kth'>kth
admin httpd鏈嶅姟 鍑虹幇 blank rest theme pre 鏁版嵁杈撳嚭Host1/2鐨勭郴缁熸棩蹇? 璁板綍鍒癿ysql鏈嶅姟鍣ㄦ暟鎹簱涓? 骞跺彂甯僱oganalyzer
缁撴瀯鍏崇郴濡備笅鍥?
鍑嗗宸ヤ綔:
-
VMware
-
CentOS 7 鏈€灏忕郴缁熷畨瑁呴暅鍍?/h3>
-
loganalyzer婧愮爜鍖?涓嬭浇
-
瀹夎涓夊彴涓绘満, 鎷疯礉loganalyzer鍒癕ariaDB涓绘満
IP鍦板潃涓庝富鏈哄搴斿叧绯昏〃:
MariaDB涓绘満 192.168.142.128/24 HOST1 192.168.142.135/24 HOST2 192.168.142.141/24 MariaDB鏈嶅姟鍣ㄦ搷浣?
- 鐧婚檰mysql
- mysql -uroot -p 鐧婚檰;
-
GRANT ALL ON Syslog.* TO 鈥?/span>sysloguser鈥?/span>@鈥?/span>192.168.142.%鈥?/span> INDENTIFIED BY 鈥?/span>123456鈥?/span>; FLUSH PRIVILEGES;
寤虹珛 rsyslog 鏁版嵁搴撹处鍙峰苟鎺堟潈;
-
娉ㄦ剰: 姝ゅSyslog鏁版嵁搴撳苟涓嶉渶瑕佹垜浠嚜宸卞缓绔? 鍦℉OST1/2涓婂畨瑁卹syslog-mysql鍚? 浼氭湁涓€涓?sql 鑴氭湰, 璇ユ暟鎹簱鍙婅〃鐢?姝よ剼鏈?寤虹珛, 鍚庢枃鏈夋彁鍒?/h4>
-
- 缂栬緫mysql閰嶇疆鏂囦欢
-
vim /etc/my.cnf ###娣诲姞濡備笅椤圭洰 skip_name_resolve = on innodb_file_per_table = on ####淇濆瓨閫€鍑? 閲嶅惎鏈嶅姟 systemctl restart mariadb
HOST1/2 鎿嶄綔:
-
yum -y install rsyslog-mysql mariadb
# 瀹夎mysql妯″潡, 瀹夎mysql瀹㈡埛绔?br />mysql -usysloguser -p123456 -h192.168.142.128
# 娴嬭瘯鏄惁鍙互杩炴帴涓?--> 濡傛灉杩炴帴澶辫触, 鍦╩ariadb鏈嶅姟鍣ㄧ閲嶅仛鎺堟潈; 妫€鏌ユ湇鍔″櫒鐨勯槻鐏鍜宻elinux鏄惁鍏抽棴 -
鏌ョ湅rsyslog-mysql 杩欎釜鍖呯浉鍏虫枃浠剁瓑:
[[email protected] ~]# rpm -ql rsyslog-mysql
/usr/lib64/rsyslog/ommysql.so --> rsyslog妯″潡
/usr/share/doc/rsyslog-8.24.0/mysql-createDB.sql --> 姝ql鑴氭湰鍗充负涓婃枃鎻愬埌鐨? rsyslog-mysql杩欎釜鍖呮彁渚涚殑 寤哄簱鑴氭湰 - 閫氳繃杈撳叆閲嶅畾鍚戠殑鏂瑰紡, 瀹夎涓婅堪sql鑴氭湰:
mysql -usysloguser -h192.168.142.128 -p < /usr/share/doc/rsyslog-8.24.0/mysql-createDB.sql
妫€鏌ュ簱寤虹珛鏄惁鎴愬姛:
- 缂栬緫 /etc/rsyslog.conf 閰嶇疆鏂囦欢
vim /etc/rsyslog.conf ####MODULES#### $ModLoad ommysql --> 鍔犺浇ommysql妯″潡浠ユ敮鎸佸姛鑳? ####RULES#### *.info;mail.none; :ommysql:192.168.142.128,Syslog,sysloguser,123456
- 閲嶅惎rsyslog鏈嶅姟 systemctl restart rsyslog
鍥炲埌MariaDB鏈嶅姟鍣? 閮ㄧ讲 loganalyzer
- mysql -uroot -p -->杩炴帴鏌ョ湅鏄惁璁板綍鎴愬姛
MariaDB [(none)]> use Syslog MariaDB [Syslog]> SELECT * FROM SystemEventsG;
- 娴嬭瘯httpd, php, php-mysql 鏄惁閰嶇疆鎴愬姛 --> 鍙傝涓婁竴绡?
- 杩欓噷纰板埌涓€涓棶棰橈細sysloguser 1045鎷掔粷鐧婚檰;root鍙互鐧婚檰; 瑙e喅鍔炴硶: 鍒犻櫎鎵€鏈夌┖瀵嗙爜鐢ㄦ埛;
-21-[[email protected]]16:07 ~ # mysql -usysloguser -h192.168.142.128 -p Enter password: ERROR 1045 (28000): Access denied for user 鈥?/span>sysloguser鈥?/span>@鈥?/span>vm鈥?/span> (using password: YES)
- 杩欓噷纰板埌涓€涓棶棰橈細sysloguser 1045鎷掔粷鐧婚檰;root鍙互鐧婚檰; 瑙e喅鍔炴硶: 鍒犻櫎鎵€鏈夌┖瀵嗙爜鐢ㄦ埛;
- 閮ㄧ讲loganalyzer
- 涓嬭浇璧勬簮鍖? 瑙e帇
- 鎴戜滑闇€瑕?./contrib 涓嬬殑涓や釜鑴氭湰, 浠ュ強./src 涓嬬殑鍏ㄩ儴鏂囦欢
-44-[[email protected]]16:18 ~/loganalyzer-4.1.6 # ls ChangeLog contrib COPYING doc INSTALL src -45-[[email protected]]16:18 ~/loganalyzer-4.1.6 # cp -r ./src /var/www/html/log -46-[[email protected]]16:20 ~/loganalyzer-4.1.6 # cd /var/www/html/log -47-[[email protected]]16:20 /var/www/html/log # ls admin chartgenerator.php cron export.php include js reportgenerator.php statistics.php userchange.php asktheoracle.php classes css favicon.ico index.php lang reports.php templates BitstreamVeraFonts convert.php details.php images install.php login.php search.php themes -48-[[email protected]]16:20 /var/www/html/log # cd - /root/loganalyzer-4.1.6 -49-[[email protected]]16:20 ~/loganalyzer-4.1.6 # ls ChangeLog contrib COPYING doc INSTALL src -50-[[email protected]]16:20 ~/loganalyzer-4.1.6 # cp ./contrib/*.sh /var/www/html/log -51-[[email protected]]16:21 ~/loganalyzer-4.1.6 # cd - /var/www/html/log -52-[[email protected]]16:21 /var/www/html/log # ls admin chartgenerator.php convert.php details.php images install.php login.php search.php templates asktheoracle.php classes cron export.php include js reportgenerator.php secure.sh themes BitstreamVeraFonts configure.sh css favicon.ico index.php lang reports.php statistics.php userchange.php -53-[[email protected]]16:21 /var/www/html/log # chmod +x *.sh -54-[[email protected]]16:21 /var/www/html/log # ./configure.sh -55-[[email protected]]16:21 /var/www/html/log # ./secure.sh -56-[[email protected]]16:21 /var/www/html/log # chmod -x *.sh -57-[[email protected]]16:21 /var/www/html/log # touch config.php;chmod 666 config.php
- 鐩存帴璁块棶192.168.142.128/log
-
- 鐩存帴鐐瑰嚮Click here 寮€濮嬪畨瑁?/strong>
-
鍦ㄧ涓夋(Step 3),鍙互鍕鹃€? 骞朵娇鐢╩ysql鍋?loganalyzer 鐨勭敤鎴锋暟鎹簱; 鎴戜滑杩欓噷鍋氭祴璇曞氨鐩存帴璺宠繃浜?img alt="鎶€鏈垎浜浘鐗? src="http://image.mamicode.com/info/201806/20180617173716653579.png" />
-
Step 7
-
璇峰姟蹇呬娇鐢╟hrome, 鐐瑰嚮MYSQL Native鍚? IE/ EDGE/ 360娴忚鍣ㄤ笉浼氬脊鍑轰笅闈㈢殑鏁版嵁搴撻€夐」妗?
-
- 鎼炲畾
- 涓嬭浇璧勬簮鍖? 瑙e帇
鎬荤粨:
-
浣跨敤绾磥鐨勮櫄鎷熸満瀹夎; 杩欐鍋锋噿, 涓婃鐢ㄥ畬httpd瀹為獙鍚庢帴鐫€浣跨敤, 鍑虹幇浜唌ysql鎶ラ敊鐨勯棶棰?
-
360娴忚鍣ㄥ瀮鍦? 娴垂鎴戝崐涓皬鏃?
-
涓嶈鎬曠帺鍧忎簡, 澶т笉浜嗛噸瑁? 鍙嶆ks鏂囦欢鍋氬ソ浜? 瑁呯郴缁熷張涓嶇敤鍜卞姩鎵?/a>
-
以上是关于rsyslog 瀛樺偍鍒?mysql的主要内容,如果未能解决你的问题,请参考以下文章
鏈懆鐩存挱棰勫憡 | 涓棿浠?Kafka 浼佷笟搴旂敤瀹炴垬銆丏M8 鏁版嵁瀛樺偍绠$悊