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_LOCALEzh-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)挂载配置文件

相关推荐
HUT_Tyne2651 分钟前
Linux 快速入门
linux·运维·服务器
赵文宇(温玉)19 分钟前
不翻墙,基于Rancher极速启动Kubernetes,配置SSO登录,在线环境开放学习体验
学习·kubernetes·rancher
鸠摩智首席音效师24 分钟前
如何在 Linux 中使用 dd 命令 ?
linux·运维·服务器
炸裂狸花猫1 小时前
开源域名证书工具 - cert-manager
云原生·容器·kubernetes·开源·cert-manager
会飞的小蛮猪2 小时前
Ubuntu24.04基于Docker部署K8s(使用私服部署)
经验分享·docker·云原生·容器·kubernetes
JuiceFS2 小时前
JuiceFS sync 原理解析与性能优化,企业级数据同步利器
运维·后端
Logan Lie3 小时前
Web服务监听地址的取舍:0.0.0.0 vs 127.0.0.1
运维·后端
Y淑滢潇潇3 小时前
RHCE 防火墙实验
linux·运维·rhce
稻谷君W4 小时前
Ubuntu 远程访问 Win11 WSL2 并固定访问教程
linux·运维·ubuntu
泡沫·4 小时前
4.iSCSI 服务器
运维·服务器·数据库