簡介
Kibana是一個為Elasticsearch平臺分析和可視化的開源平臺,使用Kibana能夠搜索、展示存儲在Elasticsearch中的索引數據。使用它可以很方便用圖表、表格、地圖展示和分析數據。
Kibana能夠輕松處理大量數據,通過瀏覽器接口能夠輕松的創建和分享儀表盤,通過改變Elasticsearch查詢時間,可以完成動態儀表盤。
安裝
Kibana使用html和js開發的,需要運行在Node.js,所以在下載的Kibana包中包含了Node平臺。
Kibana的版本要和Elasticsearch版本一直,不支持主版本不一致(比如5.x 和2.x),次版本不一致(比如5.2和5.1)會在logger中打印報警信息,允許補丁版本不一致但是不建議。
下載
wget https://artifacts.elastic.co/downloads/kibana/kibana-5.3.0-linux-x86_64.tar.gz
解壓縮
tar -zxvf kibana-5.3.0-linux-x86_64.tar.gz
Kibana的所有相關信息都在$KIBANA_HOME目錄下,無需創建任何目錄,所以刪除、升級都是比較方便的。
目錄結構
目錄 | 描述 |
---|---|
bin | 二進制腳本目錄,包含啟動kibana和安裝插件的kibana-plugin |
config | Kibana的配置文件目錄,包含kibana.yml文件 |
data | kibana或kibana插件寫數據的存儲目錄 |
plugins | 插件目錄,kibana的每一個插件都會存在該目錄 |
optimize | Transpiled source code. Certain administrative actions (e.g. plugin install) result in the source code being retranspiled on the fly. |
配置
kibana的配置文件在config目錄下的 kibana.yml中:
配置項 | 描述 |
---|---|
server.port: | Default: 5601 Kibana is served by a back end server. This setting specifies the port to use. kibana的端口號。默認是5601 |
server.host: | Default: "localhost" This setting specifies the host of the back end server。kibana安裝主機。默認是localhost |
server.maxPayloadBytes: | Default: 1048576 The maximum payload size in bytes for incoming server requests。最多服務請求數。默認是1048576 |
server.name: | Default: "your-hostname" A human-readable display name that identifies this Kibana instance。kibana實例名稱,用來顯示kibana實例。默認是你的主機名稱 |
server.defaultRoute: | Default: "/app/kibana" This setting specifies the default route when opening Kibana. You can use this setting to modify the landing page when opening Kibana。打開kibana時的默認路由地址,可以通過改變該配置指向指定的路由。默認是/app/kibana |
elasticsearch.url: | Default: "http://localhost:9200" The URL of the Elasticsearch instance to use for all your queries。Elasticsearch實例地址,用來處理所有查詢請求。默認時http://localhost:9200 |
kibana.index: | Default: ".kibana" Kibana uses an index in Elasticsearch to store saved searches, visualizations and dashboards. Kibana creates a new index if the index doesn’t already exist。kibana需要在es中創建一個索引來存儲kibana的搜索、可視化和儀表盤。如果該索引不存在,則會自動創建。默認時.kibana |
kibana.defaultAppId: | Default: "discover" The default application to load。進入kibana時加載的應用。默認是discover |
elasticsearch.pingTimeout: | Default: the value of the elasticsearch.requestTimeout settingTime in milliseconds to wait for Elasticsearch to respond to pings。設置請求Es的響應超時時間,單位毫秒。默認是elasticsearch.requestTimeout |
elasticsearch.requestTimeout: | Default: 30000 Time in milliseconds to wait for responses from the back end or Elasticsearch. This value must be a positive integer。Es響應超時時間,單位毫秒,該值必須是正整數。默認是3000 |
elasticsearch.shardTimeout: | Default: 0 Time in milliseconds for Elasticsearch to wait for responses from shards. Set to 0 to disable. |
shard的響應超時時間。默認為0,不設置 | |
logging.dest: | Default: stdout Enables you specify a file where Kibana stores log output。kibana日志輸出文件。默認是stdout |
logging.silent: | Default: false Set the value of this setting to true to suppress all logging output。設置該配置,所有日志都輸出。默認為false |
更多配置可查看:https://www.elastic.co/guide/en/kibana/current/settings.html
啟動
$KIBANA_HOME/bin/kibana
訪問:localhost:5601或者http://YOUDOMAIN.com:5601
訪問配置
當第一次訪問kibana時候需要指定一個或多個Elasticsearch已經存的索引,支持模式匹配。之后可以通過Management導入索引。
比如你的es中已經有了一個blog索引,你可以輸入blog*將以blog開頭的索引導入進來。如果你的索引中有時間戳字段,可以通過選中:Index contains time-based events,然后在下面的Time-field name填寫字段名稱。如果索引沒有時間戳字段的話,可以取消上面選中的。
點擊Create創建,Kibana會以只讀的形式展示你所配置的索引。
查看Kibana狀態
可以通過localhost:5601/status查看kibana狀體,這個頁面也包括了所有安裝的插件列表。
使用
搜索和展示信息,可以查看Discover頁面。
圖表和地圖展示,可以查看Visualize。
創建一個儀表盤,可以使用Dashboard
配置動態映射
默認情況下es是動態mapping信息,.kibana索引存放了kibana的搜索、展現、dashboard信息。為了kibana正常展現,可以通過修改.kibana索引修改為動態mapping映射。
PUT .kibana{
"index.mapper.dynamic": true
}