2020-11-19

实验名称: 配置日志服务器 实验人 HJSM 日期 2020-11-19
实验目的: 配置日志服务器数据库日志客户端动态上传服务器

实验拓扑:
实验环境: 操作系统:centos 7 两台
实验器材: Centos 7
实验步骤:

1、配置日志服务器
在日志服务器上构建LAMP
在这里插入图片描述

2、设置测试页并测试
[root@localhost html]# cd /var/www/html
[root@localhost html]# vim test.php
在这里插入图片描述

t@localhost html]# firefox http://127.0.0.1/test.php
在这里插入图片描述

3、配置日志服务器数据库。
在这里插入图片描述

在这里插入图片描述

4.配置服务器rsyslogd的主配置文件
[root@localhost rsyslog-8.24.0]# cd
[root@localhost ~]# vim /etc/rsyslog.conf
在这里插入图片描述

[root@localhost ~]# systemctl restart rsyslog.service
[root@localhost ~]# setenforce 0
5.配置日志客户端
[root@localhost ~]# vim /etc/rsyslog.conf
在这里插入图片描述

[root@localhost ~]# systemctl restart rsyslog.service
6、编辑/etc/bashrc,将客户端执行的所有命 令写入系统日志/var/log/messages中,在 文档末尾添加

[root@localhost ~]# vim /etc/bashrc
在这里插入图片描述

扫描二维码关注公众号,回复: 12123443 查看本文章

[root@localhost ~]# source /etc/bashrc
客户机使用命令
在这里插入图片描述

7服务器监控日志实时信息
[root@localhost ~]# systemctl stop firewalld
[root@localhost ~]# tailf /var/log/messages

在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/weixin_51167520/article/details/109818962