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

相关推荐
无忧.芙桃1 小时前
线程同步与线程互斥(上)
linux·运维·操作系统·运维开发
xywww1685 小时前
大模型 API 选型实战:GPT、Gemini、Claude 接入时该看哪些指标?
运维·服务器·人工智能·python·gpt·langchain
梦想的颜色8 小时前
【Docker原理】Docker 容器一文打尽:生命周期、环境管控、迁移备份、日志进程排查、垃圾清理
运维·docker·容器·容器生命周期·容器日志排查·容器迁移备份·容器进程管理
donoot11 小时前
Linux系统下图书馆级电子书全自动标准化分类整理完整实施方案
大数据·linux·运维·电子书管理
ITKEY_11 小时前
macOS brew 安装的nginx 文件在哪里?
运维·nginx·macos
Elastic 中国社区官方博客11 小时前
如何比较两个 Elasticsearch 索引并找出缺失的文档
大数据·运维·数据库·elasticsearch·搜索引擎
Tim_Van12 小时前
在 CentOS 7 中安装 Chromium 的完整步骤
linux·运维·chrome·centos
孫治AllenSun13 小时前
【Nginx】配置参数和使用案例
运维·nginx
啵啵鱼爱吃小猫咪14 小时前
Ubuntu 20.04 + ROS Noetic 源码安装 libfranka 0.8.0 和 franka_ros 0.8.0 完整教程
linux·运维·ubuntu
Piko61415 小时前
锐捷 VSU 虚拟化堆叠配置
运维·网络·笔记