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

相关推荐
JIAKSK22 分钟前
VitePress 接入百度统计:全面教程与优化指南
运维·数据可视化
网硕互联的小客服1 小时前
未来趋势:AI与量子计算对服务器安全的影响
运维·服务器·网络·网络安全·量子计算
宇钶宇夕1 小时前
STEP 7 MicroWIN SMART V2.2 的详细安装步骤及注意事项
运维·服务器·程序人生·自动化
czhc11400756632 小时前
Linux 77 FTP
linux·运维·服务器
天若有情6732 小时前
【Linux】02_CentOS 7 开机运行级别详解:从基础概念到实战配置
linux·运维·centos
張萠飛2 小时前
Linux中程序的limits中的Max open files的配置由哪些参数决定
linux·运维·服务器
Johny_Zhao8 小时前
Docker + CentOS 部署 Zookeeper 集群 + Kubernetes Operator 自动化运维方案
linux·网络安全·docker·信息安全·zookeeper·kubernetes·云计算·系统运维
一心09210 小时前
ubuntu 20.04.6 sudo 源码包在线升级到1.9.17p1
运维·ubuntu·sudo·漏洞升级
好好学习啊天天向上10 小时前
世上最全:ubuntu 上及天河超算上源码编译llvm遇到的坑,cmake,ninja完整过程
linux·运维·ubuntu·自动性能优化
你想考研啊10 小时前
三、jenkins使用tomcat部署项目
运维·tomcat·jenkins