Hi All,
In my lab environment I have a 2 Wazuh manager, 5-node ELK cluster (with Wazuh app) with 2 of those nodes being data nodes. As I'm learning Elastic via Wazuh I've been following the Wazuh documentation on the ELK, Wazuh area. During the installation and configuration, I've just gone with the default shard information. But now I find a very large number of shards on my cluster and have been reading that shards could/should be several GB in size for best searching results and too many shards introduces too much overhead. So I'm trying to learn how to reduce the number of shards in the Wazuh/ELK setup, apparently with the logstash template. Could anyone advise how to change the number of shards to 1 primary and 1 replica, instead of 5 primary and 1 replica.
My current cluster health shows almost a thousand shards for less than 40 days of indices/data.
# curl -X GET "localhost:9200/_cluster/health?pretty"
{
"cluster_name" : "ELK-cluster",
"status" : "green",
"timed_out" : false,
"number_of_nodes" : 5,
"number_of_data_nodes" : 2,
"active_primary_shards" : 426,
"active_shards" : 852,
"relocating_shards" : 0,
"initializing_shards" : 0,
"unassigned_shards" : 0,
"delayed_unassigned_shards" : 0,
"number_of_pending_tasks" : 0,
"number_of_in_flight_fetch" : 0,
"task_max_waiting_in_queue_millis" : 0,
"active_shards_percent_as_number" : 100.0
}
///////////////
If changing the number of shards using the logstash templates, where I modify it as indicated below? Also, how would the monitor index be changed as I don't see included in the template below?
# cat /etc/logstash/conf.d/01-wazuh.conf
# Wazuh - Logstash configuration file
## Remote Wazuh Manager - Filebeat input
input {
beats {
port => 5000
codec => "json_lines"
# ssl => true
# ssl_certificate => "/etc/logstash/logstash.crt"
# ssl_key => "/etc/logstash/logstash.key"
}
}
filter {
if [data][srcip] {
mutate {
add_field => [ "@src_ip", "%{[data][srcip]}" ]
}
}
if [data][aws][sourceIPAddress] {
mutate {
add_field => [ "@src_ip", "%{[data][aws][sourceIPAddress]}" ]
}
}
}
filter {
geoip {
source => "@src_ip"
target => "GeoLocation"
fields => ["city_name", "country_name", "region_name", "location"]
}
date {
match => ["timestamp", "ISO8601"]
target => "@timestamp"
}
mutate {
remove_field => [ "timestamp", "beat", "input_type", "tags", "count", "@version", "log", "offset", "type", "@src_ip", "host"]
}
}
output {
elasticsearch {
hosts => ["localhost:9200"]
index => "wazuh-alerts-3.x-%{+YYYY.MM.dd}"
"number_of_shards" : 1 <-- here?
"number_of_replicas" : 1 <-- here? document_type => "wazuh"
}
}
Thanks,
Robert