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

专门做批发的网站企业网络营销策略

专门做批发的网站,企业网络营销策略,discuz做网站赚钱经历,胶州企业网站建设目录 一、背景 二、设计 三、具体实现 Filebeat配置 K8S SideCar yaml Logstash配置 一、背景 将容器中服务的trace日志和应用日志收集到KAFKA,需要注意的是 trace 日志和app 日志需要存放在同一个KAFKA两个不同的topic中。分别为APP_TOPIC和TRACE_TOPIC 二、…

目录

一、背景

二、设计

三、具体实现

Filebeat配置

K8S SideCar yaml

Logstash配置


一、背景

    将容器中服务的trace日志和应用日志收集到KAFKA,需要注意的是 trace 日志和app 日志需要存放在同一个KAFKA两个不同的topic中。分别为APP_TOPIC和TRACE_TOPIC

二、设计

流程图如下:

日志采集流程​​

说明:

        APP_TOPIC:主要存放服务的应用日志

        TRACE_TOPIC:存放程序输出的trace日志,用于排查某一个请求的链路

文字说明:

     filebeat 采集容器中的日志(这里需要定义一些规范,我们定义的容器日志路径如下),filebeat会采集两个不同目录下的日志,然后输出到对应的topic中,之后对kafka 的topic进行消费、存储。最终展示出来

/home/service/
└── logs├── app│   └── pass│       ├── 10.246.84.58-paas-biz-784c68f79f-cxczf.log│       ├── 1.log│       ├── 2.log│       ├── 3.log│       ├── 4.log│       └── 5.log└── trace├── 1.log├── 2.log├── 3.log├── 4.log├── 5.log└── trace.log4 directories, 13 files

三、具体实现

上干货~

Filebeat配置

配置说明:

        其中我将filebeat的一些配置设置成了变量,在接下来的k8s yaml文件中需要定义变量和设置变量的value。

        需要特别说明的是我这里是使用了  tags: ["trace-log"]结合when.contains来匹配,实现将对应intput中的日志输出到对应kafka的topic中

filebeat.inputs:
- type: logenabled: truepaths:- /home/service/logs/trace/*.logfields_under_root: truefields:topic: "${TRACE_TOPIC}"json.keys_under_root: truejson.add_error_key: truejson.message_key: messagescan_frequency: 10smax_bytes: 10485760harvester_buffer_size: 1638400ignore_older: 24hclose_inactive: 1htags: ["trace-log"]processors:- decode_json_fields:fields: ["message"]process_array: falsemax_depth: 1target: ""overwrite_keys: true- type: logenabled: truepaths:- /home/service/logs/app/*/*.logfields:topic: "${APP_TOPIC}"scan_frequency: 10smax_bytes: 10485760harvester_buffer_size: 1638400close_inactive: 1htags: ["app-log"]output.kafka:enabled: truecodec.json:pretty: true  # 是否格式化json数据,默认falsecompression: gziphosts: "${KAFKA_HOST}"topics:- topic: "${TRACE_TOPIC}"bulk_max_duration: 2sbulk_max_size: 2048required_acks: 1max_message_bytes: 10485760when.contains:tags: "trace-log"- topic: "${APP_TOPIC}"bulk_flush_frequency: 0bulk_max_size: 2048compression: gzipcompression_level: 4group_id: "k8s_filebeat"grouping_enabled: truemax_message_bytes: 10485760partition.round_robin:reachable_only: truerequired_acks: 1workers: 2when.contains:tags: "app-log"

K8S SideCar yaml

配置说明:

        该yaml中定一个两个容器,容器1为nginx(示例)容器2为filebeat容器。定义了一个名称为logs的emptryDir类型的卷,将logs卷同时挂载在了容器1和容器2的/home/service/logs目录

        接下来又在filebeat容器中自定义了三个环境变量,这样我们就可以通过修改yaml的方式很灵活的来配置filebeat

                TRACE_TOPIC: Trace日志的topic

                APP_TOPIC:App日志的topic

                KAFKA_HOST:KAFKA地址

apiVersion: apps/v1
kind: Deployment
metadata:labels:app: nginxname: nginxnamespace: default
spec:replicas: 2selector:matchLabels:app: nginxtemplate:metadata:labels:app: nginxspec:imagePullSecrets:- name: uhub-registrycontainers:- image: uhub.service.ucloud.cn/sre-paas/nginx:v1imagePullPolicy: IfNotPresentname: nginxports:- name: nginxcontainerPort: 80- mountPath: /home/service/logsname: logsterminationMessagePath: /dev/termination-logterminationMessagePolicy: FilevolumeMounts:- mountPath: /home/service/logsname: logs- env:- name: TRACE_TOPICvalue: pro_platform_monitor_log- name: APP_TOPICvalue: platform_logs- name: KAFKA_HOSTvalue: '["xxx.xxx.xxx.xxx:9092","xx.xxx.xxx.xxx:9092","xx.xxx.xxx.xxx:9092"]'- name: MY_POD_NAMEvalueFrom:fieldRef:apiVersion: v1fieldPath: metadata.nameimage: xxx.xxx.xxx.cn/sre-paas/filebeat-v2:8.11.2imagePullPolicy: Alwaysname: filebeatresources:limits:cpu: 150mmemory: 200Mirequests:cpu: 50mmemory: 100MisecurityContext:privileged: truerunAsUser: 0terminationMessagePath: /dev/termination-logterminationMessagePolicy: FilevolumeMounts:- mountPath: /home/service/logsname: logsdnsPolicy: ClusterFirstimagePullSecrets:- name: xxx-registryrestartPolicy: AlwaysschedulerName: default-schedulersecurityContext: {}terminationGracePeriodSeconds: 30volumes:- emptyDir: {}name: logs                                                                                                                                                                              

Logstash配置

input {kafka {type => "platform_logs"bootstrap_servers => "xxx.xxx.xxx.xxx:9092,xxx.xxx.xxx.xxx:9092,xxx.xxx.xxx.xxx:9092"topics => ["platform_logs"]group_id => 'platform_logs'client_id => 'open-platform-logstash-logs'}kafka {type => "platform_pre_log"bootstrap_servers => "xxx.xxx.xxx.xxx:9092,xxx.xxx.xxx.xxx:9092,xxx.xxx.xxx.xxx:9092"topics => ["pre_platform_logs"]group_id => 'pre_platform_logs'client_id => 'open-platform-logstash-pre'}kafka {type => "platform_nginx_log"bootstrap_servers => "xxx.xxx.xxx.xxx:9092,xxx.xxx.xxx.xxx:9092,xxx.xxx.xxx.xxx:9092"topics => ["platform_nginx_log"]group_id => 'platform_nginx_log'client_id => 'open-platform-logstash-nginx'}
}
filter {if [type] == "platform_pre_log" {grok {match => { "message" => "\[%{IP}-(?<service>[a-zA-Z-]+)-%{DATA}\]" }}}if [type] == "platform_logs" {grok {match => { "message" => "\[%{IP}-(?<service>[a-zA-Z-]+)-%{DATA}\]" }}}
}
output {if [type] == "platform_logs" {elasticsearch {id => "platform_logs"hosts => ["http://xxx.xxx.xxx.xxx:9200","http://xxx.xxx.xxx.xxx:9200","http://xxx.xxx.xxx.xxx:9200"]index => "log-xxx-prod-%{service}-%{+yyyy.MM.dd}"user => "logstash_transformer"password => "xxxxxxx"template_name => "log-xxx-prod"manage_template => "true"template_overwrite => "true"}}if [type] == "platform_pre_log" {elasticsearch {id => "platform_pre_logs"hosts => ["http://xxx.xxx.xxx.xxx:9200","http://xxx.xxx.xxx.xxx:9200","http://xxx.xxx.xxx.xxx:9200"]index => "log-xxx-pre-%{service}-%{+yyyy.MM.dd}"user => "logstash_transformer"password => "xxxxxxx"template_name => "log-xxx-pre"manage_template => "true"template_overwrite => "true"}}if [type] == "platform_nginx_log" {elasticsearch {id => "platform_nginx_log"hosts => ["http://xxx.xxx.xxx.xxx:9200","http://xxx.xxx.xxx.xxx:9200","http://xxx.xxx.xxx.xxx:9200"]index => "log-platform-nginx-%{+yyyy.MM.dd}"user => "logstash_transformer"password => "xxxxxxx"template_name => "log-platform-nginx"manage_template => "true"template_overwrite => "true"}}
}

        如果有帮助到你麻烦给个或者收藏一下~,有问题可以随时私聊我或者在评论区评论,我看到会第一时间回复


文章转载自:
http://wanjiaesop.Lgnz.cn
http://wanjiaapotheosize.Lgnz.cn
http://wanjiahardboard.Lgnz.cn
http://wanjiaergastoplasm.Lgnz.cn
http://wanjiapatchouli.Lgnz.cn
http://wanjiaheteropathy.Lgnz.cn
http://wanjiaseaworthiness.Lgnz.cn
http://wanjiablackcurrant.Lgnz.cn
http://wanjiadistribution.Lgnz.cn
http://wanjiagaper.Lgnz.cn
http://wanjiahydrophanous.Lgnz.cn
http://wanjiacopperbottom.Lgnz.cn
http://wanjiaisochroous.Lgnz.cn
http://wanjiadehydrogenization.Lgnz.cn
http://wanjiainterior.Lgnz.cn
http://wanjiaanabranch.Lgnz.cn
http://wanjiaacheulean.Lgnz.cn
http://wanjiaretrofit.Lgnz.cn
http://wanjiacostless.Lgnz.cn
http://wanjiasulfhydrate.Lgnz.cn
http://wanjiaquintain.Lgnz.cn
http://wanjiaanodic.Lgnz.cn
http://wanjiaadulation.Lgnz.cn
http://wanjiacilice.Lgnz.cn
http://wanjiaajuga.Lgnz.cn
http://wanjiabreadthwise.Lgnz.cn
http://wanjiace.Lgnz.cn
http://wanjiaamino.Lgnz.cn
http://wanjiabrno.Lgnz.cn
http://wanjiaminnesota.Lgnz.cn
http://wanjiablueing.Lgnz.cn
http://wanjiaskiascopy.Lgnz.cn
http://wanjiacervine.Lgnz.cn
http://wanjiasensuously.Lgnz.cn
http://wanjiadeafen.Lgnz.cn
http://wanjiaspadable.Lgnz.cn
http://wanjianattily.Lgnz.cn
http://wanjiabuchmanite.Lgnz.cn
http://wanjiaverbalization.Lgnz.cn
http://wanjiasonance.Lgnz.cn
http://wanjiacapo.Lgnz.cn
http://wanjiatom.Lgnz.cn
http://wanjiapapeterie.Lgnz.cn
http://wanjiavitrifaction.Lgnz.cn
http://wanjiayemen.Lgnz.cn
http://wanjiabeddy.Lgnz.cn
http://wanjiazoopathology.Lgnz.cn
http://wanjiaembolize.Lgnz.cn
http://wanjiadenver.Lgnz.cn
http://wanjianaziritism.Lgnz.cn
http://wanjiascamp.Lgnz.cn
http://wanjiadriller.Lgnz.cn
http://wanjiamarseillaise.Lgnz.cn
http://wanjiahegira.Lgnz.cn
http://wanjiaimplementary.Lgnz.cn
http://wanjiaforgiving.Lgnz.cn
http://wanjiaguyot.Lgnz.cn
http://wanjiavum.Lgnz.cn
http://wanjiajourneyman.Lgnz.cn
http://wanjiadistraught.Lgnz.cn
http://wanjiaflammulation.Lgnz.cn
http://wanjiasailorly.Lgnz.cn
http://wanjiasleepily.Lgnz.cn
http://wanjiaprimitivity.Lgnz.cn
http://wanjiaprecisely.Lgnz.cn
http://wanjiachainomatic.Lgnz.cn
http://wanjiasystyle.Lgnz.cn
http://wanjiabrut.Lgnz.cn
http://wanjiajuggler.Lgnz.cn
http://wanjiamesocardium.Lgnz.cn
http://wanjiapend.Lgnz.cn
http://wanjiaaeropolitics.Lgnz.cn
http://wanjiabosket.Lgnz.cn
http://wanjianonperiodic.Lgnz.cn
http://wanjiaseabee.Lgnz.cn
http://wanjiasyncaine.Lgnz.cn
http://wanjiatheses.Lgnz.cn
http://wanjiagustavus.Lgnz.cn
http://wanjiaoutpull.Lgnz.cn
http://wanjiaexcruciating.Lgnz.cn
http://www.15wanjia.com/news/111136.html

相关文章:

  • 公司网站开发实施方案软文台
  • wordpress query_vars推广优化网站排名教程
  • 完本小说做多的网站谷歌商店paypal下载官网
  • 专业长春网站建设哪家好南宁seo标准
  • 厦门网站建设公司推荐网络营销成功案例有哪些
  • 怎么做网站的主页面中国十大网站有哪些
  • 谷歌网站模板合肥网站排名提升
  • 网站建设解决方案ppt怎么优化整站
  • 东莞公司网站制作公司河南公司网站建设
  • 购物网站开发要解决的问题汕头最好的seo外包
  • 建设网站最强营销型公司网站建设
  • 东莞市住房建设局网站登封网站设计
  • 网站域名所有人专业seo外包
  • wordpress 4.0 4.6seo优化平台
  • 哪个网站能接效果图做网站关键词排名优化工具
  • 全面的苏州网站建设深圳网站建设优化
  • 网站文件怎么做新软件推广
  • 网站建设的细节处理小程序seo
  • 江苏自助建站平台北京网站营销seo方案
  • 太原编程课哪个机构最好百度seo价格查询系统
  • it培训班真的有用吗推荐seo关键词优化
  • 网站admin后台界面模板seo网站排名全选
  • 南通营销网站制作网站视频播放代码
  • ps响应式网站设计尺寸百度云网盘资源搜索引擎
  • 郑州做网站推广外包百度信息流推广技巧
  • wordpress图片站模板广州seo外包
  • 郑州橱柜网站建设高质量外链代发
  • 简述网站建设的流程推广文案
  • 网站建设服务商百度官网app
  • 郑州哪些公司做网站建设如何制作一个网页链接