Hi All,
I have two config files under the /etc/logstash/conf.d directory.
Each config is listening to a different HTTP port.
When I run the logstash as a daemon(systemctl start logstash) with both config files, I see this Warning: Only String and Array types are splittable. field:items is of type = Hash
However, if i run the logstash with just one config file, I don't see any Warning. It's working well. What is the wrong configuration with multi config files?
This my simple Json Array;
{
"items": [
{
"name": "alican",
"surname": "uzunhan",
"displayName": "sample-Mas1s6"
},
{
"name": "bruce",
"surname": "lee",
"displayName": "sample-Cas1s3"
},
{
"name": "brandon",
"surname": "lee",
"displayName": "sample-MAS-astr-2"
}
]
}
my content of the /etc/logstash/conf.d/north.conf file
input {
http {
port => 9605
type => "north"
codec => "json"
}
}
filter {
json {
source => "messages"
}
split {
field => "items"
}
mutate {
remove_field => ["headers", "host", "@version"]
}
if [items][displayName] =~ /([M-m]as|MAS)[\d]*/ or [items][displayName] =~ /([E-e]lk|ELK)/ {
mutate {
add_field => {"regex" => "Matched"}
}
}
else {
mutate {
add_field => {"regex" => "NOT Matched"}
}
}
}
output {
if[type] == "north" {
elasticsearch {
hosts => ["http://<masterIP>:9200"]
user => "XXXX"
password => "XXXXXX"
index => "nort-logstash-%{+YYYY.MM.dd}"
}
}
stdout { codec => rubydebug }
}
my content of the /etc/logstash/conf.d/south.conf file
input {
http {
port => 9608
type => "south"
codec => "json"
}
}
filter {
json {
source => "messages"
}
split {
field => "items"
}
mutate {
remove_field => ["headers", "host", "@version"]
}
if [items][displayName] =~ /([M-m]as|MAS)[\d]*/ or [items][displayName] =~ /([E-e]lk|ELK)/ {
mutate {
add_field => {"regex" => "Matched"}
}
}
else {
mutate {
add_field => {"regex" => "NOT Matched"}
}
}
}
output {
if [type] => "south" {
elasticsearch {
hosts => ["http://<masterIP>:9200"]
user => "XXXX"
password => "XXXXXXX"
index => "south-logstash-%{+YYYY.MM.dd}"
}
}
stdout { codec => rubydebug }
}
content of /etc/logstash/pipelines.yml
- pipeline.id: north
path.config: "/etc/logstash/conf.d/north.conf"
- pipeline.id: south
path.config: "/etc/logstash/conf.d/south.conf"
content of /etc/logstash/logstash.yml
path.data: /var/lib/logstash
pipeline.ordered: auto
path.config: /etc/logstash/conf.d
http.host: "127.0.0.1"
http.port: 9600-9700
path.logs: /var/log/logstash
Sending Json Array on 9605 HTTP port to point "north.conf";
curl -XPOST http://<logstashIP>:9605 -d '{"items": [{"name": "alican","surname": "uzunhan","displayName": "sample-Mas1s6"},{"name": "bruce","surname": "lee","displayName": "sample-Cas1s3"},{"name": "brandon","surname": "lee","displayName": "sample-MAS-astr-2"}]}'
Warning Messages tail -f /var/log/logstash/logstash-plain.log
[2021-02-24T19:32:27,082][WARN ][logstash.filters.split ][main][57ad9cac6065ceff5c766fdf2db03131bcea3316edc24480866722690ae98c7d] Only String and Array types are splittable. field:items is of type = Hash
[2021-02-24T19:32:27,097][WARN ][logstash.filters.split ][main][57ad9cac6065ceff5c766fdf2db03131bcea3316edc24480866722690ae98c7d] Only String and Array types are splittable. field:items is of type = Hash
[2021-02-24T19:32:27,101][WARN ][logstash.filters.split ][main][57ad9cac6065ceff5c766fdf2db03131bcea3316edc24480866722690ae98c7d] Only String and Array types are splittable. field:items is of type = Hash
However, if i set single conf rather then multi conf, there is no WARN as above. it's working well.
Please show me where is the mistake? Many thanks.