When I start logstash with -f
, everything works perfectly. If I start logstash with --path.settings
, logstash deletes events received from the input. Does anyone know why?
Here's how to reproduce the issue...i start with a success case followed by a failed case.
Scenario 1: -f works perfectly
I have an index called my-alerts
with a simple mapping like this:
{
"properties": {
"alert_type": {
"type": "keyword"
},
"hits": {
"type": "keyword"
}
}
}
I created a file called /etc/logstash/conf.d/my-alerts.conf
like this:
input {
elasticsearch {
schedule => "* * * * *"
hosts => "${ES_HOST}"
user => "${ES_USER}"
password => "${ES_PASS}"
index => "my-alerts"
query => '{"query":{"bool":{"must":[{"match":{"alert_type":"changes"}}]}}}'
ssl_enabled => true
ssl_certificate_authorities => "${ES_CA_FILE}"
ssl_verification_mode => "full"
}
}
filter {
json {
source => "hits"
target => "hitsjson"
}
}
output {
stdout {}
}
I created a run.sh
like this:
ES_HOST="es01"
ES_USER="elastic"
ES_PASS="changeme"
ES_CA_FILE="/etc/certs/es/ca.crt"
export ES_HOST
export ES_USER
export ES_PASS
export ES_CA_FILE
/usr/share/logstash/bin/logstash -f /etc/logstash/conf.d/my-alerts.conf --config.reload.automatic
When I run the command ~/run.sh
everything works perfectly.
Scenario 2: --path.settings deletes the hits/hitsjson fields
However, if I replace the line
/usr/share/logstash/bin/logstash -f /etc/logstash/conf.d/my-alerts.conf --config.reload.automatic
with this line:
/usr/share/logstash/bin/logstash --path.settings /etc/logstash --config.reload.automatic
then I will not see the events/fields hits
or hitsjson
. Why does using /usr/share/logstash/bin/logstash --path.settings /etc/logstash --config.reload.automatic
delete the hits/hitsjson
fields?
Also this is my /etc/logstash/pipelines.yml
# This file is where you define your pipelines. You can define multiple.
# For more information on multiple pipelines, see the documentation:
# https://www.elastic.co/guide/en/logstash/current/multiple-pipelines.html
- pipeline.id: main
path.config: "/etc/logstash/conf.d/*.conf"