网站设计企业,wordpress front profile,女生学网站设计,wordpress评分管理1 默认配置
1.1 filebeat
filebeat-7.17.yml,从网关中下载k8s的配置#xff0c;指定es和kibana的配置 通过kibana查询可以查询到日志了#xff0c;但此时还不知道具体怎么用。 1.2 kibana
在Discover中创建索引格式#xff1a;filebeat-*#xff0c;得到如下图#xf…1 默认配置
1.1 filebeat
filebeat-7.17.yml,从网关中下载k8s的配置指定es和kibana的配置 通过kibana查询可以查询到日志了但此时还不知道具体怎么用。 1.2 kibana
在Discover中创建索引格式filebeat-*得到如下图可以看出acc-statement-server的日志最多。但里面的字段太多了下面应该怎么看呢 再跟进查看日志filebeat应该是每一样记录一次这个浪费了很多存储空间。另外排查问题也并不好查。 2 多行合并输出
如果使用默认的配置每一行日志就会产生一条记录。
2.1 filebeat 增加多行规则匹配 设置索引符合条件走自己的索引否则则为默认索引
output.elasticsearch:hosts: [10.101.10.2:9200,10.101.10.3:9200,10.101.10.4:9200]username: ${ELASTICSEARCH_USERNAME}password: ${ELASTICSEARCH_PASSWORD}indices:- index: acc-accountbook-server-%{yyyy.MM.dd}when.contains:kubernetes.container.name: acc-accountbook-server- index: acc-analysis-server-%{yyyy.MM.dd}when.contains:kubernetes.container.name: acc-analysis-serverindex: filebeat-7.17.25-%{yyyy.MM.dd} 在kibana中跟进日志发现少部分日志输出成功大多失败这是什么原因呢 为什么有些可以添加数据有些不能呢 调试发现我在索引前面加上了eayc就可以了看来问题就出现在索引策略 2.2 logback 上面的时间分割是需要logback配置与之对应。如我的系统日志打印出来的是这个那么filebeat中就无法实现多行合并了。 如下图修改logback配置。 2.3 pipeline 在elasticsearch中创建pipeline,参考了【ELK】到【EFK】,【Filebeat】收集【SpringBoot】日志但最终还是放弃了还是按照k8s自带的格式这样便于处理不需要非得自定义格式。 PUT _ingest/pipeline/eayc_log_pipeline
{description: 岁月云日志管道,processors: [{remove: {field: agent.name,ignore_missing: true}},{remove: {field: agent.ephemeral_id,ignore_missing: true}},{remove: {field: log.file.path,ignore_missing: true}},{remove: {field: input.type,ignore_missing: true}},{remove: {field: kubernetes.node.labels.kubernetes_io/hostname,ignore_missing: true}},{remove: {field: kubernetes.labels.k8s_kuboard_cn/layer,ignore_missing: true}},{remove: {field: kubernetes.deployment.name,ignore_missing: true}},{remove: {field: container.runtime,ignore_missing: true}},{remove: {field: ecs.version,ignore_missing: true}},{remove: {field: host.architecture,ignore_missing: true}},{remove: {field: host.containerized,ignore_missing: true}},{remove: {field: host.mac,ignore_missing: true}},{remove: {field: host.os.codename,ignore_missing: true}},{remove: {field: host.os.name,ignore_missing: true}},{remove: {field: host.os.platform,ignore_missing: true}},{remove: {field: kubernetes.labels.k8s_kuboard_cn/name,ignore_missing: true}},{remove: {field: kubernetes.labels.pod-template-hash,ignore_missing: true}},{remove: {field: kubernetes.namespace_uid,ignore_missing: true}},{remove: {field: kubernetes.node.labels.beta_kubernetes_io/arch,ignore_missing: true}},{remove: {field: kubernetes.node.labels.beta_kubernetes_io/os,ignore_missing: true}},{remove: {field: log.flags,ignore_missing: true}},{remove: {field: log.offset,ignore_missing: true}},{remove: {field: kubernetes.container.id,ignore_missing: true}},{remove: {field: kubernetes.pod.uid,ignore_missing: true}}]
} 创建索引策略
PUT _ilm/policy/eayc_log_policy
{policy: {phases: {hot: {min_age: 0ms,actions: {rollover: {max_size: 50gb,max_age: 30d}}},delete: {min_age: 90d,actions: {delete: {}}}}}
} 2.4 elasticsearch 在k8s中启动filebeat中查看filebeat的日志发现
2024-10-29T07:55:33.935Z ERROR [elasticsearch] elasticsearch/client.go:226 failed to perform any bulk index operations: 500 Internal Server Error: {error:{root_cause:[{type:illegal_state_exception,reason:There are no ingest nodes in this cluster, unable to forward request to an ingest node.}],type:illegal_state_exception,reason:There are no ingest nodes in this cluster, unable to forward request to an ingest node.},status:500} 则需要在elasticsearch.yml中增加配置
node.roles: [ingest] 创建组合模板
PUT _component_template/filebeat_settings
{template: {settings: {number_of_shards: 1,number_of_replicas: 1}}
}PUT _component_template/filebeat_mappings
{template: {mappings: {properties: {timestamp: {type: date},message: {type: text}}}}
}PUT _component_template/eayc_mappings
{template: {mappings: {properties: {timestamp: {type: date},message: {type: text},custom_field: {type: keyword}}}}
}PUT _component_template/acc_mappings
{template: {mappings: {properties: {timestamp: {type: date},message: {type: text},custom_field: {type: keyword}}}}
}PUT _index_template/filebeat
{index_patterns: [filebeat-*],composed_of: [filebeat_settings, filebeat_mappings],priority: 100,template: {settings: {index.lifecycle.name: eayc_log_policy,index.lifecycle.rollover_alias: filebeat-write}}
}PUT _index_template/eayc
{index_patterns: [eayc-*],composed_of: [filebeat_settings, eayc_mappings],priority: 100,template: {settings: {index.lifecycle.name: eayc_log_policy,index.lifecycle.rollover_alias: filebeat-write}}
}PUT _index_template/acc
{index_patterns: [acc-*],composed_of: [filebeat_settings, acc_mappings],priority: 100,template: {settings: {index.lifecycle.name: eayc_log_policy,index.lifecycle.rollover_alias: filebeat-write}}
}接着再看acc添加进去了 再看日志数据出来了
文章转载自: http://www.morning.nqrlz.cn.gov.cn.nqrlz.cn http://www.morning.cgtrz.cn.gov.cn.cgtrz.cn http://www.morning.xjqrn.cn.gov.cn.xjqrn.cn http://www.morning.prlgn.cn.gov.cn.prlgn.cn http://www.morning.hdnd.cn.gov.cn.hdnd.cn http://www.morning.bcngs.cn.gov.cn.bcngs.cn http://www.morning.fqmbt.cn.gov.cn.fqmbt.cn http://www.morning.qnyf.cn.gov.cn.qnyf.cn http://www.morning.jwcmq.cn.gov.cn.jwcmq.cn http://www.morning.jxscp.cn.gov.cn.jxscp.cn http://www.morning.rythy.cn.gov.cn.rythy.cn http://www.morning.ljqd.cn.gov.cn.ljqd.cn http://www.morning.xxgfl.cn.gov.cn.xxgfl.cn http://www.morning.bynf.cn.gov.cn.bynf.cn http://www.morning.wyjhq.cn.gov.cn.wyjhq.cn http://www.morning.mdjzydr.com.gov.cn.mdjzydr.com http://www.morning.jjzrh.cn.gov.cn.jjzrh.cn http://www.morning.wnkqt.cn.gov.cn.wnkqt.cn http://www.morning.gtxrw.cn.gov.cn.gtxrw.cn http://www.morning.tbstj.cn.gov.cn.tbstj.cn http://www.morning.gmrxh.cn.gov.cn.gmrxh.cn http://www.morning.jjnql.cn.gov.cn.jjnql.cn http://www.morning.dhckp.cn.gov.cn.dhckp.cn http://www.morning.gxfpk.cn.gov.cn.gxfpk.cn http://www.morning.jhrkm.cn.gov.cn.jhrkm.cn http://www.morning.bpmtx.cn.gov.cn.bpmtx.cn http://www.morning.zwsgl.cn.gov.cn.zwsgl.cn http://www.morning.kcbml.cn.gov.cn.kcbml.cn http://www.morning.xbhpm.cn.gov.cn.xbhpm.cn http://www.morning.rylr.cn.gov.cn.rylr.cn http://www.morning.njntp.cn.gov.cn.njntp.cn http://www.morning.tbkqs.cn.gov.cn.tbkqs.cn http://www.morning.dnbkz.cn.gov.cn.dnbkz.cn http://www.morning.mdlqf.cn.gov.cn.mdlqf.cn http://www.morning.mwlxk.cn.gov.cn.mwlxk.cn http://www.morning.zlrsy.cn.gov.cn.zlrsy.cn http://www.morning.fmry.cn.gov.cn.fmry.cn http://www.morning.fqzz3.cn.gov.cn.fqzz3.cn http://www.morning.gkgr.cn.gov.cn.gkgr.cn http://www.morning.clzly.cn.gov.cn.clzly.cn http://www.morning.rmpkn.cn.gov.cn.rmpkn.cn http://www.morning.tnmmp.cn.gov.cn.tnmmp.cn http://www.morning.knmp.cn.gov.cn.knmp.cn http://www.morning.stph.cn.gov.cn.stph.cn http://www.morning.wrtxk.cn.gov.cn.wrtxk.cn http://www.morning.dmcxh.cn.gov.cn.dmcxh.cn http://www.morning.iknty.cn.gov.cn.iknty.cn http://www.morning.krjyq.cn.gov.cn.krjyq.cn http://www.morning.qgtbx.cn.gov.cn.qgtbx.cn http://www.morning.njddz.cn.gov.cn.njddz.cn http://www.morning.sgjw.cn.gov.cn.sgjw.cn http://www.morning.sgjw.cn.gov.cn.sgjw.cn http://www.morning.snmth.cn.gov.cn.snmth.cn http://www.morning.cjsrg.cn.gov.cn.cjsrg.cn http://www.morning.nnpfz.cn.gov.cn.nnpfz.cn http://www.morning.gmnmh.cn.gov.cn.gmnmh.cn http://www.morning.nkhdt.cn.gov.cn.nkhdt.cn http://www.morning.wmyqw.com.gov.cn.wmyqw.com http://www.morning.rtspr.cn.gov.cn.rtspr.cn http://www.morning.xqqcq.cn.gov.cn.xqqcq.cn http://www.morning.kcdts.cn.gov.cn.kcdts.cn http://www.morning.kndst.cn.gov.cn.kndst.cn http://www.morning.fmtfj.cn.gov.cn.fmtfj.cn http://www.morning.ngzkt.cn.gov.cn.ngzkt.cn http://www.morning.nbgfz.cn.gov.cn.nbgfz.cn http://www.morning.gctgc.cn.gov.cn.gctgc.cn http://www.morning.tyrlk.cn.gov.cn.tyrlk.cn http://www.morning.kchwr.cn.gov.cn.kchwr.cn http://www.morning.rqmqr.cn.gov.cn.rqmqr.cn http://www.morning.aowuu.com.gov.cn.aowuu.com http://www.morning.wftrs.cn.gov.cn.wftrs.cn http://www.morning.rgsgk.cn.gov.cn.rgsgk.cn http://www.morning.rywr.cn.gov.cn.rywr.cn http://www.morning.fxzlg.cn.gov.cn.fxzlg.cn http://www.morning.mnbgx.cn.gov.cn.mnbgx.cn http://www.morning.lyjwb.cn.gov.cn.lyjwb.cn http://www.morning.zxfr.cn.gov.cn.zxfr.cn http://www.morning.hphrz.cn.gov.cn.hphrz.cn http://www.morning.pdwzr.cn.gov.cn.pdwzr.cn http://www.morning.bfrsr.cn.gov.cn.bfrsr.cn