簡體   English   中英

使用只讀rest插件訪問logstash

[英]logstash access with readonly rest plugin

我們對 elasticsearch 的 readonly rest 插件有一個問題:啟用插件后,我們沒有運行 logstash。 我們將 logstash 與 filebeat 一起使用。 這可能是問題嗎? logstash 配置如下。 錯誤信息:

[401] Forbidden {:class=>"Elasticsearch::Transport::Transport::Errors::Unauthorized", :level=>:error}

在 elasticsearch 中,我們定義了如下所示的角色。

readonlyrest:
   enable: true
   response_if_req_forbidden: <h1>Forbidden</h1>    
   access_control_rules:
    - name: Developer (reads only logstash indices, but can create new charts/dashboards)
      auth_key: dev:dev
      type: allow
      kibana_access: ro+
      indices: ["<no-index>", ".kibana*", "logstash*", "default"]
   - name: Kibana Server (we trust this server side component, full access granted via HTTP authentication)
     auth_key: admin:passwd1
     type: allow
   - name: "Logstash can write and create its own indices"
     auth_key: logstash:logstash
     type: allow
     actions: ["cluster:*", "indices:data/read/*","indices:data/write/*","indices:admin/*"]
     indices: ["logstash*", "filebeat-*", "<no_index>"]
the logstash config:

output{
    elasticsearch {      
    hosts => ["localhost:9200"]
        manage_template => true
        index => "%{[@metadata][beat]}-%{+YYYY.MM.dd}"
        document_type => "%{[@metadata][type]}"
        document_id => "%{fingerprint}"
    user => ["logstash"]
    password => ["logstash"]
    }
}

我相信您沒有賦予 logstash 使用您的設置創建索引的能力。 它可以讀寫,但我沒有看到創建。

從網站的示例中,您可以將您的 logstash 配置更改為:

-  name: "Logstash can write and create its own indices"
   auth_key: logstash:logstash
   type: allow
   actions: ["indices:data/read/*","indices:data/write/*","indices:admin/template/*","indices:admin/create"]
   indices: ["logstash-*", "<no_index>"]

這個設置對我有用。

我認為它與 filebeat 沒有任何關系,因為輸出實際上不再與 filebeat 對話了? 但話又說回來,我改用文件輸入。

希望能解決問題。

阿圖爾

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM