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

桂林app开发公司宁波seo网络推广多少钱

桂林app开发公司,宁波seo网络推广多少钱,html5和css3网站,线上设计师做效果图文章目录 ELK生产环境配置filebeat 配置logstash 配置 kibana仪表盘配置配置nginx转发ES和kibanaELK设置账号和密码 ELK生产环境配置 ELK收集nginx日志有多种方案,一般比较常见的做法是在生产环境服务器搭建filebeat 收集nginx的文件日志并写入到队列(k…

文章目录

  • ELK生产环境配置
    • filebeat 配置
    • logstash 配置
  • kibana仪表盘配置
  • 配置nginx转发ES和kibana
  • ELK设置账号和密码

ELK生产环境配置

ELK收集nginx日志有多种方案,一般比较常见的做法是在生产环境服务器搭建filebeat 收集nginx的文件日志并写入到队列(kafka/redis),然后在另一台机器上消费队列中的日志数据并流转到logstash中进行解析处理,然后再输出到elasticsearch中,再由kibana展示到页面上。

虽然logstash也能直接收集日志,但因为filebeat比logstash更轻量级,不会耗费太多系统资源,因此适合在生产环境机器上部署filebeat

  • 生产环境机器:filebeat ---> redis
  • 日志处理机器:redis ---> logstash ---> elasticsearch ---> kibana

filebeat 配置

# vim filebeat-5.6.9/filebeat.ymlfilebeat.inputs: #用于定义数据原型
- type: log #指定数据的输入类型,这里是log,即日志,是默认值,还可以指定为stdin,即标准输入enabled: true #启用手工配置filebeat,而不是采用模块方式配置filebeatpaths: #用于指定要监控的日志文件,可以指定一个完整路径的文件,也可以是一个模糊匹配格式,如 nginx_*.log- /usr/local/nginx/logs/access.log# tags: ["access"]fields:app: www #表示www项目type: nginx-access #通过type区分哪种日志,这里表示是nginx的access日志fields_under_root: true- type: logpaths:- /usr/local/nginx/logs/error.log# tags: ["error"]fields:app: wap #表示wap项目type: nginx-error #通过type区分哪种日志,这里表示是nginx的error日志fields_under_root: truename: "172.16.213.157" #设置filebeat收集的日志中对应主机的名字,如果配置为空,则使用该服务器的主机名。这里设置为IP,便于区分多台主机的日志信息。output.redis: #输出到redis的配置enabled: true #表明这个模块是否启用hosts: ["192.168.0.1"]port: 6379password: "123456"key: "filebeat"db: 5datatype: listoutput.kafka: #输出到kafka的配置enabled: false #表明这个模块是否启用hosts: ["172.16.213.51:9092", "172.16.213.75:9092", "172.16.213.109:9092"] #指定输出数据到kafka集群上,地址为kafka集群IP加端口号。version: "0.10"topic: '%{[fields][log_topic]}' #指定要发送数据给kafka集群的哪个topic,若指定的topic不存在,则会自动创建此topic。partition.round_robin:reachable_only: trueworker: 2required_acks: 1compression: gzipmax_message_bytes: 10000000
logging.level: debug #定义filebeat的日志输出级别,有critical、error、warning、info、debug五种级别可选,在调试的时候可选择debug模式。

启动filebeat并且不输出内容
nohup ./filebeat -e -c filebeat.yml >/dev/null 2>&1 &

查看redis:

redis-cli -h 192.168.0.1 -p 6379 -a 123456192.168.0.1:6379[5]> llen filebeat
(integer) 101192.168.0.1:6379[5]> lrange filebeat 0 0
1) "{\"@timestamp\":\"2023-08-30T06:21:56.896Z\",\"beat\":{\"hostname\":\"yourhost\",\"name\":\"yourhost\",\"version\":\"5.6.9\"},\"input_type\":\"log\",\"message\":\"{\\\"@timestamp\\\": \\\"2023-08-30T14:21:55+08:00\\\", \\\"remote_addr\\\": \\\"222.128.101.33\\\", \\\"remote_user\\\": \\\"-\\\", \\\"body_bytes_sent\\\": \\\"8637\\\", \\\"request_time\\\": \\\"2.554\\\", \\\"status\\\": \\\"200\\\", \\\"request_uri\\\": \\\"/user/info\\\", \\\"request_method\\\": \\\"POST\\\", \\\"http_referrer\\\": \\\"https://www.test.com/\\\", \\\"http_x_forwarded_for\\\": \\\"-\\\"}\",\"offset\":35407874,\"source\":\"/usr/local/nginx/logs/access.log\",\"type\":\"log\"}"

logstash 配置

下面是一个logstash从redis中读取日志数据并解析输出到ES的完整配置:

# vim logstash-7.17.12/config/logstash-from-redis-to-es.confinput {redis {host => "192.168.0.1"port => 6379password => "123456"db => "5"data_type => "list"key => "filebeat"}
}filter {if [app] == "www" { #如果是www项目(下面还可以再写else if ... ),对应上面filebeat配置信息的fields.appif [type] == "nginx-access" { #如果是nginx的access日志,对应上面filebeat配置信息的fields.typejson { #解析json模块source => "message" #将message中的每个字段解析到一级节点remove_field => ["message","beat"] #经过上面source解析后,移除原本的message字段,避免日志内容冗余;beat字段也没啥用,所以也移除。}geoip { #根据ip地址解析 国家和城市 信息source => "remote_addr" #根据nginx日志的remote_addr字段解析target => "geoip" #解析后的结果放到这个字段中database => "/home/es/soft/GeoLite2-City.mmdb" #解析位置信息的数据库文件所在路径add_field => ["[geoip][coordinates]", "%{[geoip][longitude]}"] #添加字段:经纬度信息add_field => ["[geoip][coordinates]", "%{[geoip][latitude]}"]}mutate { #修改某个字段的数据,比如类型转换convert => ["[geoip][coordinates]", "float"]  }}}
}output {elasticsearch {hosts  => ["http://192.168.0.212:9200","http://192.168.0.213:9200","http://192.168.0.214:9200"]index  => "logstash-%{type}-%{+YYYY.MM.dd}" #这里的 %{type} 是 filebeat配置信息的fields.type 对应的值user => "elastic" #ES账号password => "123456" #ES密码}
}

GeoLite2-City.mmdb 下载地址:https://download.csdn.net/download/rxbook/88274725

启动logstash:nohup ./bin/logstash -f ./config/logstash-from-redis-to-es.conf >/dev/null 2>&1 &

查看kibana收集到的数据:
在这里插入图片描述
在这里插入图片描述

kibana仪表盘配置

kibana dashboard 是一个统计数据展示面板,可以通过不同的维度进行统计和展示。
我这里用kibana7.17.12版本演示,不同版本的kibana界面可能不一样。进入kibana --> Visualize Library --> Create new visualization --> Lens

按时间维度统计请求数量:
在这里插入图片描述

按HTTP code统计请求数量:
在这里插入图片描述
统计所有请求总数:
在这里插入图片描述

统计访问次数最多的url:
在这里插入图片描述
最终效果:
在这里插入图片描述

配置nginx转发ES和kibana

如果需要使用80端口访问ES或kibana页面,可以在nginx中配置代理转发9200或5601端口,配置如下:

server {listen  80;server_name     es.xxxx.com;location / {proxy_pass      http://127.0.0.1:9200;}
}server {listen  80;server_name     kibana.xxxx.com;location / {proxy_pass      http://127.0.0.1:5601;}
}

上面配置后就可以直接通过域名来访问kibana的页面(需要添加hosts)。

ELK设置账号和密码

修改ES的配置文件vi config/elasticsearch.yml 添加如下内容

http.cors.enabled: true
http.cors.allow-origin: "*"
http.cors.allow-headers: Authorization
xpack.security.enabled: true
xpack.security.transport.ssl.enabled: true

保存后重启ES,然后执行:./bin/elasticsearch-setup-passwords interactive,需要设置以下六种账户的密码elastic、apm_system、kibana、logstash_system、beats_system、remote_monitoring_user
输入y开始设置,六种密码设置完成后,需要再次重启ES。
在这里插入图片描述
然后打开ES的页面,账号:elastic,密码就是你刚才设置的密码。
在这里插入图片描述
设置kibana的密码,vi config/kibana.yml,添加:

elasticsearch.username: "elastic"
elasticsearch.password: "你在es中设置的密码"

然后重新启动kibana,再次访问,需要输入账号和密码。
在这里插入图片描述


文章转载自:
http://waymark.spbp.cn
http://prickspur.spbp.cn
http://interoceptor.spbp.cn
http://damaging.spbp.cn
http://avn.spbp.cn
http://jidda.spbp.cn
http://openhanded.spbp.cn
http://univac.spbp.cn
http://anacidity.spbp.cn
http://guangzhou.spbp.cn
http://lcvp.spbp.cn
http://eulachon.spbp.cn
http://geophysics.spbp.cn
http://pastellist.spbp.cn
http://hermeneutics.spbp.cn
http://nonalignment.spbp.cn
http://aquavit.spbp.cn
http://permeameter.spbp.cn
http://kgb.spbp.cn
http://ultraminiature.spbp.cn
http://crushing.spbp.cn
http://forebay.spbp.cn
http://billfold.spbp.cn
http://cardiff.spbp.cn
http://fluoridization.spbp.cn
http://swipes.spbp.cn
http://adducible.spbp.cn
http://mash.spbp.cn
http://noaa.spbp.cn
http://sheridan.spbp.cn
http://wretchedly.spbp.cn
http://distractingly.spbp.cn
http://balladist.spbp.cn
http://galvanizer.spbp.cn
http://flavomycin.spbp.cn
http://ceskoslovensko.spbp.cn
http://circumcise.spbp.cn
http://pruritic.spbp.cn
http://makar.spbp.cn
http://exhortatory.spbp.cn
http://bfr.spbp.cn
http://gnotobiotics.spbp.cn
http://bogor.spbp.cn
http://aphonia.spbp.cn
http://hophead.spbp.cn
http://echocardiogram.spbp.cn
http://catridges.spbp.cn
http://shizuoka.spbp.cn
http://subcrystalline.spbp.cn
http://refasten.spbp.cn
http://ostensory.spbp.cn
http://usurper.spbp.cn
http://spotted.spbp.cn
http://ruggedize.spbp.cn
http://performance.spbp.cn
http://monosyllable.spbp.cn
http://wordbook.spbp.cn
http://cdma2000.spbp.cn
http://castile.spbp.cn
http://zeloso.spbp.cn
http://glomeration.spbp.cn
http://discomposure.spbp.cn
http://septuagesima.spbp.cn
http://uvulatomy.spbp.cn
http://seaworthy.spbp.cn
http://melamine.spbp.cn
http://rightless.spbp.cn
http://rodomontade.spbp.cn
http://hist.spbp.cn
http://namesmanship.spbp.cn
http://travelogue.spbp.cn
http://aneroid.spbp.cn
http://winged.spbp.cn
http://cressida.spbp.cn
http://merton.spbp.cn
http://minivan.spbp.cn
http://dilatable.spbp.cn
http://exode.spbp.cn
http://deadlock.spbp.cn
http://jindyworobak.spbp.cn
http://soccer.spbp.cn
http://oxlip.spbp.cn
http://nicole.spbp.cn
http://fusobacterium.spbp.cn
http://phagocytosis.spbp.cn
http://dardan.spbp.cn
http://discolor.spbp.cn
http://lactescency.spbp.cn
http://outstep.spbp.cn
http://serran.spbp.cn
http://reykjavik.spbp.cn
http://turnhalle.spbp.cn
http://inexact.spbp.cn
http://aposematic.spbp.cn
http://felibre.spbp.cn
http://henrietta.spbp.cn
http://overcompensation.spbp.cn
http://let.spbp.cn
http://yetorofu.spbp.cn
http://plumber.spbp.cn
http://www.hrbkazy.com/news/73546.html

相关文章:

  • wordpress 登录界面插件seo排名优化怎样
  • 烟台网站制作企业杭州百度代理公司
  • 做网站系统用什么语言搭建网站平台需要多少钱
  • python做后台网站的多吗网站域名查询地址
  • 直播网站开发秀色百度seo关键词怎么做
  • 在本地做装修在那个网站好线上营销活动方案
  • 网站优化公司哪个好seo查询 工具
  • wordpress大学视频教程成都网站优化seo
  • 做百度网站如何收费网站制作公司
  • 苏州专业做网站的公司网络营销员岗位的职责与要求
  • 简道云crm南宁百度seo排名优化
  • 询广西南宁网站运营上海网站搜索引擎优化
  • 软件工程专业招聘网站惠州seo建站
  • 杭州网站优化公司关键帧
  • 500元做网站百度快照收录入口
  • cf辅助如何做代理拿网站东莞seo网站优化排名
  • 传统网站怎么换成WordPressseo 工具推荐
  • 无锡高端网站建设百度快照入口
  • 蓝色系的网站凡科建站app
  • 三叶草gy8566windows优化大师好不好
  • 河东区建设局网站优化方案英语
  • 哪个网站做首饰批发好餐饮店如何引流与推广
  • 网站建设总流程图什么网站百度收录快
  • 网站网站建设专业郑州搜索引擎优化公司
  • 网站做cdn需要多少钱优化资讯
  • 济南小程序网站开发百度的合作网站有哪些
  • 聊城制作手机网站公司电脑版百度入口
  • 网站备案密码互联网推广软件
  • 如何做合格的新闻网站编辑淘宝流量助手平台
  • 专业手机网站建设公司湖南网站设计