Skip to content

Commit

Permalink
[Feature] Add elasticsearch authentication option in Filebeat output …
Browse files Browse the repository at this point in the history
…config (#124)
  • Loading branch information
dipiazzg authored Dec 9, 2022
1 parent 01d85f8 commit 92c3d72
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 9 deletions.
2 changes: 1 addition & 1 deletion EXAMPLE/cluster_defs/aws/cluster_vars__cloud.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ cluster_vars:

# Some of the regions are not available for aws module boto.ec2. If the region definitely exists, you may need to upgrade boto or extend with endpoints_path
# Adding the below to ec2 invocation fixes the issue
aws_endpoint_url: https://ec2.{{region}}.amazonaws.com
aws_endpoint_url: https://ec2.{{region}}.amazonaws.com
2 changes: 1 addition & 1 deletion config/tasks/filebeat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@

- deprecate_str: { msg: "beats_target_hosts is deprecated. Please use beats_config.filebeat.output_logstash_hosts in future", version: "6" }
when: (beats_target_hosts is defined and (beats_target_hosts | length))
when: (beats_target_hosts is defined and (beats_target_hosts | length)) or (beats_config.filebeat.output_logstash_hosts is defined and (beats_config.filebeat.output_logstash_hosts | length))
when: (beats_target_hosts is defined and (beats_target_hosts | length)) or (beats_config.filebeat.output_logstash_hosts is defined and (beats_config.filebeat.output_logstash_hosts | length)) or (beats_config.filebeat.output_elasticsearch_hosts is defined and (beats_config.filebeat.output_elasticsearch_hosts | length))
2 changes: 1 addition & 1 deletion config/tasks/metricbeat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,4 @@

- deprecate_str: { msg: "beats_target_hosts is deprecated. Please use beats_config.metricbeat.output_logstash_hosts in future", version: "6" }
when: (beats_target_hosts is defined and (beats_target_hosts | length))
when: (beats_target_hosts is defined and (beats_target_hosts | length)) or (beats_config.metricbeat.output_logstash_hosts is defined and (beats_config.metricbeat.output_logstash_hosts | length))
when: (beats_target_hosts is defined and (beats_target_hosts | length)) or (beats_config.metricbeat.output_logstash_hosts is defined and (beats_config.metricbeat.output_logstash_hosts | length)) or (beats_config.filebeat.output_elasticsearch_hosts is defined and (beats_config.filebeat.output_elasticsearch_hosts | length))
17 changes: 14 additions & 3 deletions config/templates/etc/filebeat/filebeat.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -165,12 +165,23 @@ setup.kibana:
output.elasticsearch:
# Array of hosts to connect to.
hosts: {{ beats_config.filebeat.output_elasticsearch_hosts | default(beats_target_hosts) }}
{% endif %}

# Optional protocol and basic auth credentials.
#protocol: "https"
#username: "elastic"
#password: "changeme"
{% if beats_config.filebeat.es_username is defined and beats_config.filebeat.es_password is defined %}
username: "{{ beats_config.filebeat.es_username }}"
password: "{{ beats_config.filebeat.es_password }}"
{% endif %}

{% if beats_config.filebeat.ssl_enabled is defined %}
ssl.enabled: {{ beats_config.filebeat.ssl_enabled | bool }}
{% endif %}

{% if beats_config.filebeat.ssl_verification_mode is defined %}
ssl.verification_mode: {{ beats_config.filebeat.ssl_verification_mode }}
{% endif %}

{% endif %}
#----------------------------- Logstash output --------------------------------
{% if (beats_target_hosts is defined and (beats_target_hosts | length)) or (beats_config.filebeat.output_logstash_hosts is defined and (beats_config.filebeat.output_logstash_hosts | length)) %}
output.logstash:
Expand Down
16 changes: 13 additions & 3 deletions config/templates/etc/metricbeat/metricbeat.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,23 @@ setup.kibana:
output.elasticsearch:
# Array of hosts to connect to.
hosts: {{ beats_config.metricbeat.output_elasticsearch_hosts | default(beats_target_hosts) }}
{% endif %}

# Optional protocol and basic auth credentials.
#protocol: "https"
#username: "elastic"
#password: "changeme"
{% if beats_config.filebeat.es_username is defined and beats_config.filebeat.es_password is defined %}
username: "{{ beats_config.filebeat.es_username }}"
password: "{{ beats_config.filebeat.es_password }}"
{% endif %}

{% if beats_config.filebeat.ssl_enabled is defined %}
ssl.enabled: {{ beats_config.filebeat.ssl_enabled | bool }}
{% endif %}

{% if beats_config.filebeat.ssl_verification_mode is defined %}
ssl.verification_mode: {{ beats_config.filebeat.ssl_verification_mode }}
{% endif %}

{% endif %}
#----------------------------- Logstash output --------------------------------
{% if (beats_target_hosts is defined and (beats_target_hosts | length)) or (beats_config.metricbeat.output_logstash_hosts is defined and (beats_config.metricbeat.output_logstash_hosts | length)) %}
output.logstash:
Expand Down

0 comments on commit 92c3d72

Please sign in to comment.