[root@localhost ~]# cd /home/elk
[root@localhost elk]# wget https://artifacts.elastic.co/downloads/logstash/logstash-7.8.1.tar.gz
[root@localhost elk]# wget https://artifacts.elastic.co/downloads/kibana/kibana-7.8.1-linux-x86_64.tar.gz
[root@localhost elk]# wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.8.1-linux-x86_64.tar.gz
[root@localhost elk]# wget https://artifacts.elastic.co/downloads/logstash/logstash-7.6.2.tar.gz
[root@localhost elk]# wget https://artifacts.elastic.co/downloads/kibana/kibana-7.6.2-linux-x86_64.tar.gz
[root@localhost elk]# wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.6.2-linux-x86_64.tar.gz
[root@localhost elk]# tar -zxvf kibana-7.8.1-linux-x86_64.tar.gz
[root@localhost elk]# cd kibana-7.8.1-linux-x86_64/
[root@localhost kibana-7.8.1-linux-x86_64]# vi config/kibana.yml
#server.host: "localhost" server.host: "0.0.0.0" #elasticsearch.hosts: ["http://localhost:9200"] #elasticsearch.hosts: ["http://192.168.56.13:9200"] elasticsearch.hosts: ["http://192.168.56.13:9200", "http://192.168.56.13:9201", "http://192.168.56.13:9202"] #elasticsearch.requestTimeout: 30000 elasticsearch.requestTimeout: 90000 #i18n.locale: "en" i18n.locale: "zh-CN"
#后台启动 [root@localhost kibana-7.8.1-linux-x86_64]# nohup ./bin/kibana --allow-root & #查看控制台 [root@localhost kibana-7.8.1-linux-x86_64]# tail -f nohup.out
浏览器请求http://192.168.56.13:5601
进入“Management”->“Stack Management”菜单。
第 1 步(共 2 步):定义索引模式
索引模式输入:gsdss-boss-*
,若提示“匹配 成功!您的索引模式匹配 1 个索引”,则表示索引模式可用,然后点击【下一步】。
第 2 步(共 2 步):配置设置
时间筛选字段名称选择:@timestamp
,点击【创建索引模式】,完成创建。
生成的索引模式,包含了在logstash通道过滤定义的变量字段,如"message" => "%{TIMESTAMP_ISO8601:logTime} %{GREEDYDATA:logThread} %{LOGLEVEL:logLevel} %{GREEDYDATA:loggerClass} - %{GREEDYDATA:logContent}"
此时在发现菜单,就会列出gsdss-boss-*
的索引模式,同时可以从可用字段里选择显示的字段,例如logContent和logLevel
。
#控制台查询命令 GET _cat/health?v # 创建索引 PUT /test_index { "settings" : { "number_of_shards" : 3, "number_of_replicas" : 1 } } #查询索引设置 GET /test_index/_settings "number_of_shards" : "1", #索引主分片数,默认值5,索引创建后不可修改 "number_of_replicas" : "1", #每个主分片的副本数,默认值是 1 # 添加文档 POST /test_index/_doc { "id": 2, "name": "李四", "age": 21 } # 查询索引文档 POST /test_index/_search # 删除索引 DELETE /test_index