当前位置: 首页 > news >正文

做国外网站用国内服务器成都微网站开发

做国外网站用国内服务器,成都微网站开发,国际公司名字,民宿网站建设 世家1、作用 1、可以在本机收集日志2、也可以远程收集日志3、轻量级的日志收集系统,可以在非java环境运行。logstash是在jmv环境中运行,资源消耗很大,启动一个logstash要消耗500M左右的内存,filebeat只消耗10M左右的内存。收集nginx的…

1、作用

1、可以在本机收集日志2、也可以远程收集日志3、轻量级的日志收集系统,可以在非java环境运行。logstash是在jmv环境中运行,资源消耗很大,启动一个logstash要消耗500M左右的内存,filebeat只消耗10M左右的内存。收集nginx的日志

2、收集nginx日志

systemctl restart nginx
systemctl stop firewalld
setenforce 0#解压,将filebeat移到/usr/local下
tar -xf filebeat-6.7.2-linux-x86_64.tar.gz
mv filebeat-6.7.2-linux-x86_64 /usr/local/filebeat#备份
cd /usr/local/filebeat
cp filebeat.yml filebeat.yml.bak#修改配置文件
vim filebeat.yml
type: log
enabled: true
paths:- /usr/local/nginx/logs/access.log- /usr/local/nginx/logs/error.log
#开启日志收集,以及确定日志文本的路径,指定标签和发送到目标主机的logstashtags: ["nginx"]fields: service_name: 192.168.230.21_nginxlog_type_ nginxfrom: 192.168.230.21#output.elasticsearch:# Array of hosts to connect to.#hosts: ["localhost:9200"]outout elasticsearch
output.logsatsh:
hosts: ["192.168.230.30:5045"]
#5044是logstash默认的端口,只要是logstash主机上没有被占用的端口都可以使用,端口号要大于1024#修改从21接收的nginx日志文件
vim nginx_21.confinput {beats { port => "5045"}
}output {if "nginx" in [tags] {elasticsearch {hosts => ["192.168.230.10:9200","192.168.230.230:9200"]index => "%{[fields][service_name]}-%{+YYYY.MM.dd}"}}
}#启动filebeat
nohup ./filebeat -e -c filebeat.yml > filebeat.out &
#-e:输出到标准输出-c:指定配置文件nohup:在系统的后台运行,不会因为终端的关闭导致程序停机运行;可以把运行的日志保存到指定文件#后后台运行
logstash -f nginx_61.conf --path.data /opt/test2 &

3、远程收集nginx、http、mysql日志

filebeat远程收集发送到logstash主机

展示的索引:

192.168.230.21_mysql-*

192.168.230.21_nginx-*

192.168.230.21_http-*

systemctl stop firewalld
setenforce 0#修改配置文件
vim /etc/my.cnf
添加:
general_log=ON
general_log_file=/usr/local/mysql/data/mysql_general.log#安装httpd、nginx
yum -y install httpd nginx#重启mysqld、httpd
systemctl restart mysqld
systemctl restart httpd#修改nginx的端口号
listen       85;
#listen       [::]:80;#重启nginx
systemctl restart nginx#浏览器访问nginx、httpd#将filebeat的安装包放到/opt目录下,并解压
tar -xf filebeat-6.7.2-linux-x86_64.tar.gz#将filebeat-6.7.2-linux-x86_64放到/opt命令下,改名为filebeat
mv filebeat-6.7.2-linux-x86_64 filebeat#修改filebeat的配置文件
vim filebeat.yml
- type: logenabled: truepaths:- /var/log/nginx/access.log- /var/log/nginx/error.logtags: ["nginx"]fields:service_name: 192.168.230.21_nginxlog_type: nginxfrom: 192.168.230.21- type: logenabled: truepaths:- /var/log/httpd/access_log- /var/log/httpd/error_logtags: ["httpd"]fields:service_name: 192.168.230.21_httpdlog_type: httpdfrom: 192.168.230.21- type: logenabled: truepaths:- /usr/local/mysql/data/mysql_general.logtags: ["mysqld"]fields:service_name: 192.168.230.21_mysqldlog_type: mysqldfrom: 192.168.230.21#output.elasticsearch:# Array of hosts to connect to.#hosts: ["localhost:9200"]output.logstash:# The Logstash hostshosts: ["192.168.230.30:5048"]vim nmh_21.confinput {beats { port => "5048"}
}output {if "nginx" in [tags] {elasticsearch {hosts => ["192.168.230.10:9200","192.168.230.230:9200"]index => "%{[fields][service_name]}-%{+YYYY.MM.dd}"}}if "httpd" in [tags] {elasticsearch {hosts => ["192.168.230.10:9200","192.168.230.230:9200"]index => "%{[fields][service_name]}-%{+YYYY.MM.dd}"}}if "mysqld" in [tags] {elasticsearch {hosts => ["192.168.230.10:9200","192.168.230.230:9200"]index => "%{[fields][service_name]}-%{+YYYY.MM.dd}"}}
}#开启日志收集
nohup ./filebeat -e -c filebeat.yml > filebeat.out &#后台运行
logstash -f nmh_21.conf --path.data /opt/test3 &#多了httpd、nginx、mysqld的日志#到kibana可视化界面创建索引模式

在这里插入图片描述

4、收集http日志

#安装httpd
yum -y install httpdcd /etc/logstash
cd conf.d#配置文件
vim http.confinput {file {path => "/etc/httpd/logs/access_log"type => "access"start_position => "beginning"} file {path => "/etc/httpd/logs/error_log"type => "error"start_position => "beginning"}
}output {if [type] == "access" {elasticsearch {hosts => ["192.168.230.10:9200","192.168.230.230:9200"]index => "apache_access-%{+YYYY.MM.dd}"} 
}if [type] == "error" {elasticsearch {hosts => ["192.168.230.10:9200","192.168.230.230:9200"]index => "apache_error-%{+YYYY.MM.dd}"}
}#启动logstash
logstash -f http.conf --path.data /opt/test1 &
显示:Successful started Logstash API endpoint {:port=>9601}
API接口:软件内部代码之间通信的接口,代码的连接点
端口是对外提供访问程序的内容接口#到kibana可视化界面创建索引模式
http://www.yayakq.cn/news/83716/

相关文章:

  • 有什么国外的设计网站推荐网址导航系统
  • 网站北京备案快吗大岭山营销型网站建设
  • 东莞做网站的联系电话做婚纱网站是怎么确认主题
  • 九江浔阳网站建设电子商务网站成本
  • 做淘宝有哪些推广网站当前业界主流的网站建设
  • 网站建设立项申请建设网站方向
  • 长春网站建设有什么云南网络营销文化优化
  • 网站哪里备案有区别么电商购物平台软件开发
  • 没有备案的交易网站网站会员充值做哪个分录
  • 网站设计会存在什么问题关键词查询工具哪个好
  • 太原做网站软件免费手机网站空间申请
  • 美食网站二级页面模板小红书手工
  • 手机网站的后台管理外包公司做网站多少钱
  • 做校园文化的网站郑州高新区做网站开发的公司
  • 怎样建小型网站wordpress主题 怎么安装
  • 网站后台域名解析怎么做网站建设公司中企动力强
  • 淄博seo北京百度seo点击器
  • 做网站花的钱和优化网站有关系吗图片手机网站建设
  • 合肥网站建设之4个细节要注意事项物联卡官方免费申请入口
  • 江山市建设局网站公司的介绍怎么写
  • 成都科技网站建设电话广州建设网站公司简介
  • 网站下方链接图标怎么做广州模板网站建设价格
  • 自建服务器做网站要备案零基础网站开发设计
  • 国外哪些网站有黄图wordpress 返回顶部代码
  • 河南省财政厅经济建设网站重庆网站建设合肥公司
  • 建设网站公开教学视频下载空调设备公司网站建设
  • ps做字幕模板下载网站有哪些网站设计平台 动易
  • 关于做网站的调查问卷赞助网站怎么做
  • 网络公司网站建设方案书电子商务主要学什么课程
  • 凡科做网站是否安全网站开发怎么做