Kubesphere上搭建ELK日志收集系统

Kubesphere上搭建ELK日志收集系统

Elasticsearch

版本:elasticsearch:7.14.0

1)创建挂载文件elasticsearch.yml

单节点:

复制代码
cluster.name: "cluster-es"
node.name: "elasticsearch-0"
network.host: "0.0.0.0"
node.master: true
node.data: true
http.port: 9200
transport.tcp.port: 9300
http.cors.allow-origin: "*"
http.cors.enabled: true
http.max_content_length: 200mb
discovery.seed_hosts: ["127.0.0.1"]
cluster.initial_master_nodes: ["elasticsearch-0"]

集群(几个节点就设置几份,更改下name就行):

复制代码
cluster.name: "cluster-es"
node.name: "elasticsearch-0"
network.host: "0.0.0.0"
node.master: true
node.data: true
http.port: 9200
transport.tcp.port: 9300
http.cors.allow-origin: "*"
http.cors.enabled: true
http.max_content_length: 200mb
discovery.seed_hosts:
  - 192.168.1.100:9300
  - 192.168.1.101:9300
  - 192.168.1.102:9300
cluster.initial_master_nodes:
  - "elasticsearch-0"
  - "elasticsearch-1"
  - "elasticsearch-2"

2)开放端口,设置环境变量

ES_JAVA_OPTS -Xms512m -Xmx512m

3)挂载配置

kibana

版本:

kibana:7.14.0

1)开放端口5601,添加环境变量

ELASTICSEARCH_HOSTS : http://elasticsearch-0.elasticsearch-iwy9.mp-java.svc.cluster.local:9200

I18N_LOCALE : zh-CN

Logstash

版本:logstash:7.14.0

1)创建配置文件

logstash.conf:

复制代码
input {
  tcp {
    port => 5044
    codec => json_lines
  }
}

filter {
  date {
    match => [ "@timestamp", "yyyy-MM-dd HH:mm:ss Z" ]
  }
  mutate {
    remove_field => ["@version", "agent", "cloud", "host", "input", "log", "tags", "_index", "_source", "ecs", "event"]
    add_field => { "app_name" => "%{[app_name]}" }
  }
}

output {
  elasticsearch {
    hosts => ["http://10.233.42.25:9200"]
    index => "server-%{+YYYY.MM.dd}"
  }
}

logstash.yml:

复制代码
http.host: "0.0.0.0"
xpack.monitoring.enabled: true
xpack.monitoring.elasticsearch.hosts: [ "http://10.233.42.25:9200" ]

pipelines.yml:

复制代码
- pipeline.id: main
  path.config: "/usr/share/logstash/pipeline/logstash.conf"

2)开放端口

3)挂载配置文件

相关推荐
我是koten2 小时前
【运维杂谈】K8s遇到Terminating的名称空间删除不了怎么办?(解决方案亲测有效)
linux·运维·服务器·云原生·kubernetes·k8s·名称空间
RuoyiOffice8 小时前
KubeSphere 容器云实践:从管理 K8s 到建设企业 PaaS,还需要哪些能力
spring boot·kubernetes·kubesphere·jenkins·paas·微服务部署·ruoyi office
风吹稻子9 小时前
etcd备份与恢复:删了 etcd.yaml,容器为什么还在跑?——一次 K8s 控制面死锁排查实录
kubernetes
修己xj10 小时前
服务器无法解析域名?一次 DNS 配置缺失的排查与修复
运维
weirong12 小时前
Operator 的测试该写到哪一层?139 个用例之后我划的三条线
kubernetes
xbzb15 小时前
自定义 yum 软件源:Linux 上 createrepo,Windows 上纯 Python 也能造
linux·运维·windows·python·yum·createrepo
Android系统攻城狮15 小时前
Linux FFmpeg深度解析之avio_open调用流程与实战(三十八)
linux·运维·服务器·ffmpeg·音视频进阶·ffmpeg音视频
逐流人15 小时前
手工建集群到全自动发布:k8s集群部署与DevOps流水线整合实战
ci/cd·云原生·kubernetes·云计算·devops
我不会起名字32216 小时前
K8s Pod 反复重启 CrashLoopBackOff:从 exit code 到根因的 5 步排查
云原生·容器·kubernetes·k8s
瑞克-桑切斯16 小时前
ERP 企业生产管理系统部署手册
运维·docker·云原生·容器·eureka