authentication - Logstash can't communicate with elasticsearch through readonly rest elasticsearch plugin. -
i trying connect logstash elasticsearch through authentication configuration gives me following error : [401] forbidden readonlyrest es plugin {:class=>"elasticsearch::transport::transport::errors::unauthorized", :level=>:error}
configuration files given below:
[elasticsearch conf file]
http.cors.enabled: true http.cors.allow-origin: /https?:\/\/localhost(:[0-9]+)?/ readonlyrest: enable: true response_if_req_forbidden: forbidden readonlyrest es plugin access_control_rules: - name: "logstash can write , create 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>"] - name: kibana server (we trust server side component, full access granted via http authentication) auth_key: admin:pass3 type: allow - name: developer (reads logstash indices, can create new charts/dashboards) auth_key: dev:dev type: allow kibana_access: ro+ indices: ["<no-index>", ".kibana*", "logstash*", "default"]
[logstash conf file]
input { file { path =>"/var/log/site.log" start_position => beginning } } filter { grok { match => { "message" => "%{combinedapachelog}"} } geoip { source => "clientip" } } output { elasticsearch { user => "logstash" password => "logstash" } }
mention output in logstash config file below :-
output { elasticsearch { hosts => ["localhost:9200"] user => ["logstash"] password => ["logstash"] }