最新資訊:ELK給Kibana加上登錄權(quán)限控制

2023-01-08 11:23:12 來源:51CTO博客

0. 背景

我們在使用ELK進行日志記錄的時候,通過網(wǎng)址在Kibana中查看我們的應(yīng)用程序(eg: Java Web)記錄的日志,


【資料圖】

但是默認是任何客戶端都可以訪問Kibana的, 這樣就會造成很不安全,我們應(yīng)該設(shè)置相應(yīng)的用戶名和密碼,

只有通過登錄用戶名和密碼才能通過Kibana查看我們的日志。

1. 在elasticsearch 2.x的版本是怎么做的

一般博文會建議進入elasticsearch的根目錄,執(zhí)行如下命令:bin/plugin install shield

但是,當(dāng)你用的是5.x的時候,你會發(fā)現(xiàn)根本就沒有plugin這條命令,進入es的根目錄,發(fā)現(xiàn)只有

elasticsearch-plugin這條命令,這是怎么回事呢?

于是筆者上了官網(wǎng)一探究竟(任何時候查找技術(shù),官網(wǎng)永遠是最好最權(quán)威的選擇)

官網(wǎng)給出的解釋如下:

2. X-Pack是什么?

以下是官網(wǎng)給出的解釋:

(X-Pack is an Elastic Stack extension that bundles security, alerting, monitoring, reporting, and graph capabilities into one easy-to-install package.

Prior to Elasticsearch 5.0.0, you had to install separate Shield, Watcher, and Marvel plugins to get the features that are bundled together in X-Pack.

With X-Pack, you no longer have to worry about whether or not you have the right version of each plugin,

just install the X-Pack for the Elasticsearch version you’re running)

X-Pack是Elastic技術(shù)棧的擴展,它集安全,提醒,監(jiān)控,報表以及圖標(biāo)功能于一體。

在Elasticsearch 5.0之前,你必須單獨安裝Shield插件,還要配套Watcher, Marvel等插件,現(xiàn)在X-Pack把它們都整合到一塊兒了。

3. 安裝X-Pack

3.1 為elasticsearch安裝X-Pack插件

進入elasticsearch根目錄

執(zhí)行:bin/elasticsearch-plugin install x-pack

3.2 配置elasticsearch.yml

進入config目錄

修改配置文件,在末尾加上如下行:

action.auto_create_index: .security,.monitoring*,.watches,.triggered_watches,.watcher-history*

這是為elasticsearch增加自動創(chuàng)建索引功能

3.3 后臺啟動elasticsearch

[root@hadoop1 elasticsearch]# su es

[es@hadoop1 elasticsearch]$ bin/elasticsearch -d

3.4 為Kibana安裝X-Pack插件

進入Kibana根目錄

執(zhí)行命令:bin/kibana-plugin install x-pack

3.5 啟動Kibana: bin/kibana

3.6 為Logstash節(jié)點安裝X-Pack插件

進入Logstash根目錄

執(zhí)行命令:bin/logstash-plugin install x-pack

3.7 用配置文件啟動Logstash

bin/logstash -f config/log4j_multi_input.conf

3.8 驗證

瀏覽器打開路徑:

?http://localhost:5601/??

你看回到登錄對話框如下:

默認用戶名和密碼是:elastic/changeme

標(biāo)簽: 配置文件 執(zhí)行命令 應(yīng)用程序

上一篇:【報資訊】hadoop中namenode職責(zé)和hdfs讀寫
下一篇:世界熱門:重載的奧義之函數(shù)重載