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

相关推荐
阿巴阿巴boer1 分钟前
用wsl搭建远程linux服务器
linux·运维·服务器·ssh
lisanmengmeng41 分钟前
docker 方式安装部署禅道zentao(五)
运维·docker·容器
wanhengidc1 小时前
云手机的硬件依赖性如何?
运维·服务器·智能手机·云计算
piaoroumi2 小时前
UVC调试
linux·运维·前端
VekiSon2 小时前
Linux系统编程——标准IO
linux·运维·服务器
Evan芙2 小时前
DNS服务器类型,解析答案,正反解析域,资源记录定义总结
运维·服务器
wanhengidc2 小时前
巨椰 云手机办公便利性高
运维·服务器·安全·智能手机·云计算
Saniffer_SH2 小时前
【每日一题】PCIe答疑 - 接大量 GPU 时主板不认设备或无法启动和MMIO的可能关系?
运维·服务器·网络·人工智能·驱动开发·fpga开发·硬件工程
爱宇阳3 小时前
Linux 安全加固:禁用 IPv4 ICMP 重定向发送
linux·运维·安全
Saniffer_SH3 小时前
【每日一题】讲讲PCIe链路训练和枚举的前后关系
运维·服务器·网络·数据库·驱动开发·fpga开发·硬件工程