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

网站不用模板如何更新文章长春网站建设方案优化

网站不用模板如何更新文章,长春网站建设方案优化,卫浴网站怎么做,页面设计站在学员的角度1 filestream介绍 官方宣布:输入类型为log在filebeat7.16版本已经弃用了 Filestream 是 Filebeat 中的一种 输入类型(Input),用于处理日志文件的读取。它是为了取代 Filebeat 中传统的 log 输入(Input)设…

1 filestream介绍

官方宣布:输入类型为log在filebeat7.16版本已经弃用了

Filestream 是 Filebeat 中的一种 输入类型(Input),用于处理日志文件的读取。它是为了取代 Filebeat 中传统的 log 输入(Input)设计的,更加现代化和高效

  • filestream 直接与操作系统的文件系统事件接口(如 Linux 的 inotify 或 Windows 的 ReadDirectoryChangesW)集成,从而更高效地监听文件变化

  • 专为处理容器化环境或日志动态生成的场景设计,能够动态追踪日志文件的创建和删除

  • 使用唯一的文件标识符(如 inode + dev)而非文件路径,避免因路径变化导致日志丢失或重复采集

  • 未来版本中,filestream 将成为日志文件采集的首选,逐步取代 log 输入

2 filestream解析nginx json日志

1.filebeat执行该文件

cat > 11-filestream-to-es.yaml <<EOF
filebeat.inputs:
- type: filestreampaths:- /var/log/nginx/access.log# 配置解析parsers:# 解析json格式- ndjson:# 将解析的数据放在哪个字段,若为""代表放在顶级字段中target: ""# 对哪个字段进行解析,若不指定,则默认会对message字段进行解析,并删除该字段。message_key: messageoutput.elasticsearch:hosts: - "http://10.0.0.91:9200"- "http://10.0.0.92:9200"- "http://10.0.0.93:9200"index: "zhiyong18-luckyboy-log-filestream-nginx"setup.ilm.enabled: false
setup.template.name: "zhiyong18-luckyboy"
setup.template.pattern: "zhiyong18-luckyboy-log*"
setup.template.overwrite: false
setup.template.settings:index.number_of_shards: 5index.number_of_replicas: 0
EOF

2.索引可以正常创建,discover 中看到内容和 之前的 nginx json 格式采集一样

3 filestream多行匹配

1.filebeat执行该文件

cat > 12-filestream_multiple-to-es.yaml <<EOF
filebeat.inputs:
- type: filestreampaths:- /app/apache-tomcat-10.1.25/logs/catalina.outparsers:- multiline:type: patternpattern: '^\d{2}'negate: truematch: afteroutput.elasticsearch:hosts: - "http://10.0.0.91:9200"- "http://10.0.0.92:9200"- "http://10.0.0.93:9200"index: "zhiyong18-luckyboy-log-filestream-tomcat-errorlog"setup.ilm.enabled: false
setup.template.name: "zhiyong18-luckyboy"
setup.template.pattern: "zhiyong18-luckyboy-log*"
setup.template.overwrite: false
setup.template.settings:index.number_of_shards: 5index.number_of_replicas: 0
EOF

2.验证采集的错误日志

在这里插入图片描述

4 filestream count多行匹配+json采集

1.准备测试文件 /tmp/apps.json

{"name": "韩V童","hobby": ["下海","睡觉","抽奖"]
}
{"name": "康Z阳","hobby": ["看美女","打游戏","学习"]
}

2.编写测试 filebeat 采集配置。

注意:如果这条索引同时匹配到了多个索引模版,可能就会报错。建议修改匹配模式

cat > 13-filestream_json_multiple_line-to-es.yaml <<EOF
filebeat.config.modules:# 注意,此处的"${path.config}"对应的路径是/etc/filebeat目录path: ${path.config}/modules.d/*.yml# 支持热加载reload.enabled: true# 指定每间隔多长时间检测一次“${path.config}/modules.d/*.yml”reload.period: 5soutput.elasticsearch:hosts: - "http://10.0.0.91:9200"- "http://10.0.0.92:9200"- "http://10.0.0.93:9200"index: "zhiyong18-luckyboy-log-modules-nginx"etup.ilm.enabled: false
setup.template.name: "zhiyong18-luckyboy-modules"
setup.template.pattern: "zhiyong18-luckyboy-log-modules*"
setup.template.overwrite: false
setup.template.settings:index.number_of_shards: 5index.number_of_replicas: 0
EOF

3.查看采集到的日志

在这里插入图片描述

5 filebeat模块介绍

filebeat模块是官方提供的一种对各种中间件进行日志采集的解决方案,用于简化常见服务(如 NGINX、MySQL、Apache 等)日志的采集、解析和可视化过程。

  • 模块在/etc/filebeat/modules.d/ 下, 启用模块本质上是将 /etc/filebeat/modules.d/ 目录下的 *.yml.disabled 文件更名为 *.yml

  • filebeat启用,禁用和查看模块

# 查看支持的模块
[root@elk91 filebeat]# ll modules.d/ | egrep "tomcat|nginx"
-rw-r--r-- 1 root root   784 May 30 21:52 nginx.yml.disabled
-rw-r--r-- 1 root root   623 May 30 21:52 tomcat.yml.disabled# 进行模块开启操作
[root@elk91 filebeat]# filebeat modules enable nginx tomcat
Enabled nginx# 查看已开启的模块
[root@elk91 filebeat]# ll modules.d/ | egrep "tomcat|nginx"
-rw-r--r-- 1 root root   784 May 30 21:52 nginx.yml
-rw-r--r-- 1 root root   623 May 30 21:52 tomcat.yml# 禁用模块
[root@elk91 filebeat]# filebeat modules disable nginx tomcat

模块大全:

[root@elk93~]# ls /etc/filebeat/modules.d/
activemq.yml.disabled     cyberark.yml.disabled          infoblox.yml.disabled         nginx.yml                snyk.yml.disabled
apache.yml.disabled       cylance.yml.disabled           iptables.yml.disabled         o365.yml.disabled        sonicwall.yml.disabled
auditd.yml.disabled       envoyproxy.yml.disabled        juniper.yml.disabled          okta.yml.disabled        sophos.yml.disabled
awsfargate.yml.disabled   f5.yml.disabled                kafka.yml.disabled            oracle.yml.disabled      squid.yml.disabled
aws.yml.disabled          fortinet.yml.disabled          logstash.yml.disabled         osquery.yml.disabled     suricata.yml.disabled
azure.yml.disabled        gcp.yml.disabled               microsoft.yml.disabled        panw.yml.disabled        system.yml.disabled
barracuda.yml.disabled    googlecloud.yml.disabled       misp.yml.disabled             pensando.yml.disabled    threatintel.yml.disabled
bluecoat.yml.disabled     google_workspace.yml.disabled  mongodb.yml.disabled          postgresql.yml.disabled  tomcat.yml
cef.yml.disabled          gsuite.yml.disabled            mssql.yml.disabled            proofpoint.yml.disabled  traefik.yml.disabled
checkpoint.yml.disabled   haproxy.yml.disabled           mysqlenterprise.yml.disabled  rabbitmq.yml.disabled    zeek.yml.disabled
cisco.yml.disabled        ibmmq.yml.disabled             mysql.yml.disabled            radware.yml.disabled     zookeeper.yml.disabled
coredns.yml.disabled      icinga.yml.disabled            nats.yml.disabled             redis.yml.disabled       zoom.yml.disabled
crowdstrike.yml.disabled  iis.yml.disabled               netflow.yml.disabled          santa.yml.disabled       zscaler.yml.disabled
cyberarkpas.yml.disabled  imperva.yml.disabled           netscout.yml.disabled         snort.yml.disabled

6 使用模块采集nginx日志

前提: nginx 模块已经开启,nginx日志是常规格式

1.修改nginx模块配置

cat > /etc/filebeat/modules.d/nginx.yml <<EOF
- module: nginxaccess:enabled: truevar.paths: ["/var/log/nginx/access.log*"]error:enabled: truevar.paths: ["/var/log/nginx/error.log*"]ingress_controller:enabled: false
EOF

2.filebeat执行该文件。

可能遇到的故障:

  • 由于之前创建了大量索引模式,可能会导致索引匹配冲突,要么改优先级或匹配其他索引。
    • 索引模式冲突举例:zhiyong18-luckyboy-log*zhiyong18-luckyboy-log-modules*
  • vim access.log 后日志不采集,或这不写入。需要重启nginx
cat > 14-modules_nginx-to-es.yaml <<'EOF'
filebeat.config.modules:# 注意,此处的"${path.config}"对应的路径是/etc/filebeat目录path: ${path.config}/modules.d/*.yml# 支持热加载reload.enabled: true# 指定每间隔多长时间检测一次“${path.config}/modules.d/*.yml”reload.period: 5soutput.elasticsearch:hosts: - "http://10.0.0.91:9200"- "http://10.0.0.92:9200"- "http://10.0.0.93:9200"index: "zhiyong18-luckyboy-log-modules-nginx"# 禁用索引的生命周期(Index Lifecycle Management,简称"ilm"),如果不禁用则忽略自定义索引名称
setup.ilm.enabled: false
# ES的索引模板名称,和ES最好别冲突
setup.template.name: "zhiyong18-luckyboy-modules"
# ES索引模板的匹配模式
setup.template.pattern: "zhiyong18-luckyboy-log*"
# 如果索引模板已经存在,是否覆盖,推荐设置为false
setup.template.overwrite: false
EOF
    "source": {"geo": {"continent_name": "Africa","country_iso_code": "SC","country_name": "Seychelles","location": {"lon": 55.6667,"lat": -4.5833}},

3.去 discover 查看,官方模块非常详细,把日志中隐藏的国家、IP、状态码都显示出来了

在这里插入图片描述

7 nginx模块中经纬度混合问题

1.在使用了nginx模块采集原生nginx日志后,若发现地理位置坐标点全在一个字段中,无法确定其地理位置坐标点。需要使用数据映射。

下图为正确的示例,地理位置正确映射

在这里插入图片描述

2.创建一条索引模式,以后使用nginx模块采集日志时就匹配这条索引

索引名称zhiyong18-luckyboy-modules
索引模式zhiyong18-luckyboy-log*

3.索引设置:

{"number_of_shards": 3,"number_of_replicas": 0
}

4.设置数据映射:source.geo.location --> 地理位置坐标点

在这里插入图片描述

5.创建后预览:

{"template": {"settings": {"index": {"number_of_shards": "3","number_of_replicas": "0"}},"mappings": {"properties": {"source": {"properties": {"geo": {"properties": {"location": {"type": "geo_point"}}}}}}},"aliases": {}}
}

最后,创建地图查看分布图

最后,创建地图查看分布图

在这里插入图片描述


文章转载自:
http://dinncogratefully.tpps.cn
http://dinncocytoarchitecture.tpps.cn
http://dinncododgy.tpps.cn
http://dinnconulliparity.tpps.cn
http://dinncotemperate.tpps.cn
http://dinncolivelihood.tpps.cn
http://dinncogrisliness.tpps.cn
http://dinncounworn.tpps.cn
http://dinncoresurrection.tpps.cn
http://dinncoso.tpps.cn
http://dinncoeely.tpps.cn
http://dinncotextural.tpps.cn
http://dinncohollow.tpps.cn
http://dinncoclitellum.tpps.cn
http://dinncoskosh.tpps.cn
http://dinncothallic.tpps.cn
http://dinncocosmographic.tpps.cn
http://dinncoangelus.tpps.cn
http://dinncoontogenetic.tpps.cn
http://dinncojuvie.tpps.cn
http://dinncoshoppy.tpps.cn
http://dinncobridesmaid.tpps.cn
http://dinncobessarabian.tpps.cn
http://dinncoroose.tpps.cn
http://dinncoinnovative.tpps.cn
http://dinncoto.tpps.cn
http://dinncounreserve.tpps.cn
http://dinncodeclivous.tpps.cn
http://dinnconutburger.tpps.cn
http://dinncochoking.tpps.cn
http://dinncotrochal.tpps.cn
http://dinncoestivate.tpps.cn
http://dinncoblack.tpps.cn
http://dinncoproboscidian.tpps.cn
http://dinncocabman.tpps.cn
http://dinnconephanalysis.tpps.cn
http://dinncodifferentia.tpps.cn
http://dinncoluminal.tpps.cn
http://dinncoboong.tpps.cn
http://dinncoalcoholysis.tpps.cn
http://dinncobeccaccia.tpps.cn
http://dinncotrowel.tpps.cn
http://dinncohypnotherapy.tpps.cn
http://dinncoagnomen.tpps.cn
http://dinncopathognomonic.tpps.cn
http://dinncofrogbit.tpps.cn
http://dinncorizaiyeh.tpps.cn
http://dinncoinflicter.tpps.cn
http://dinncotoll.tpps.cn
http://dinncosinology.tpps.cn
http://dinnconightclub.tpps.cn
http://dinncobegnaw.tpps.cn
http://dinncowindward.tpps.cn
http://dinncotizwin.tpps.cn
http://dinncoextraditable.tpps.cn
http://dinncoargala.tpps.cn
http://dinncobangka.tpps.cn
http://dinncofingernail.tpps.cn
http://dinncofeudist.tpps.cn
http://dinncocapillary.tpps.cn
http://dinncomandril.tpps.cn
http://dinncoswabian.tpps.cn
http://dinncoparochiaid.tpps.cn
http://dinncobanbury.tpps.cn
http://dinncoactivation.tpps.cn
http://dinncocompandor.tpps.cn
http://dinncoclockwork.tpps.cn
http://dinncologos.tpps.cn
http://dinncotaffetized.tpps.cn
http://dinncodoa.tpps.cn
http://dinncostub.tpps.cn
http://dinncoapi.tpps.cn
http://dinncosomewhere.tpps.cn
http://dinncoinappropriate.tpps.cn
http://dinncoregurgitant.tpps.cn
http://dinncodhu.tpps.cn
http://dinncohyoscyamin.tpps.cn
http://dinncoability.tpps.cn
http://dinncohabitmaker.tpps.cn
http://dinncosmalto.tpps.cn
http://dinncowordsworthian.tpps.cn
http://dinncojostler.tpps.cn
http://dinncovoyeuristic.tpps.cn
http://dinncoirradiant.tpps.cn
http://dinncolobulation.tpps.cn
http://dinncobedding.tpps.cn
http://dinncoshipbuilding.tpps.cn
http://dinncolayamon.tpps.cn
http://dinncoepibolic.tpps.cn
http://dinncohumid.tpps.cn
http://dinncopaganize.tpps.cn
http://dinncoimprudently.tpps.cn
http://dinncoradiogenic.tpps.cn
http://dinncocalyceal.tpps.cn
http://dinncokilomegacycle.tpps.cn
http://dinncoinfiltrate.tpps.cn
http://dinncopalship.tpps.cn
http://dinncograntee.tpps.cn
http://dinncoaspermia.tpps.cn
http://dinncomagnamycin.tpps.cn
http://www.dinnco.com/news/156077.html

相关文章:

  • 最个人网站百度高级搜索首页
  • 建设网站需要的软硬件搜索引擎技术基础
  • 网站收录变少百度手机助手app下载
  • 网站设计建设制作日本搜索引擎naver入口
  • 做宴会有哪些素材网站网站怎么优化
  • 做亚马逊网站费用获取排名
  • 网站分辨率做多大百度网页版主页网址
  • 无人区电影中加油站司机公司百度推广一年多少钱
  • wordpress 腾讯视频插件灰色行业关键词优化
  • 百度做网站要多久免费seo工具
  • 常州做的网站的公司百度一下你就知道手机版官网
  • 编程网站scratch在线使用南宁网站建设公司
  • wordpress用虚拟主机还是vps青岛seo网络优化公司
  • 高端网站建设的市场分析百度接单平台
  • 做高仿包的能做网站吗重庆森林经典台词罐头
  • 河池网站建设公司如何制作一个网页网站
  • 低价服装网站建设怎么优化网络
  • 韩国网页设计公司网站网站的seo 如何优化
  • 顺德顺的网站建设推介网
  • 网站模板文件在哪里下载免费开源代码网站
  • 西安网站制作资源太原seo全网营销
  • 苏州专业做网站较好的公司有哪些排名优化seo
  • 网站开发流程任务百度查询入口
  • dede网站地图代码seo常见优化技术
  • 做最好的网站新新百度提交工具
  • 阿里巴巴网站建设与维护百度百科词条
  • 市场监督管理局24小时热线商品标题优化
  • 咋么做网站在电脑上软文编辑
  • 哪个网站的域名到期直接注册表千博企业网站管理系统
  • wordpress淘宝宁波seo网络优化公司