Hallo, I 'm using logstash 7.11 and my data have the following format:
{ field1: ...,
field2: ...,
aList: [
{ Id ... },
{ fielda1 ... },
{ fielda2 ... },
{ fielda2 ... },
...
]
fieldN:...,
fieldN1: ...
}
I only need data inside aList
so my pipeline is like so:
input {
file {
path => "/usr/local/Cellar/logstash-full/7.11.0/data/data.json"
codec => "json"
sincedb_path => "NULL"
}
}
filter {
json {
source => "message"
}
split {
field => "[aList]"
}
if [aList][fielda1] {
mutate {
add_field => {
"fielda1" => "[aList][fielda1]"
}
}
}
....
remove_field => ["path", "@version", "@timestamp", "host", "message", "field1", ..., "fieldN1"]
rename => { "[aList][Id]" => "[@metadata][Id]" }
...
}
output {
elasticsearch {
hosts => ["http://localhost:9200"]
index => "mydata"
document_id => "%{[@metadata][Id]}"
}
}
-
I 'm not sure if split filter is needed if I use input codec json. In any case, adding new fields at the root level keeps
aList
in the data. If I drop it, then it won't find anyaList
; I guess the code insidefilter
is not executed sequentially. In short, how do I get rid ofaList
once I have copied all its fields at the upper level? -
While logstash was processing data since yesterday, today it seems to be stalled and denies to process my conf file. I have removed any
sincedb*
files, even though there shouldn't be any since I usesincedb_path => "NULL"
. With--debug
I see that it has compiled the filters but then it repeats this:
[2021-02-20T11:20:59,870][DEBUG][org.logstash.execution.PeriodicFlush][main] Pushing flush onto pipeline.
[2021-02-20T11:21:01,243][DEBUG][logstash.instrument.periodicpoller.jvm] collector name {:name=>"ParNew"}
[2021-02-20T11:21:01,244][DEBUG][logstash.instrument.periodicpoller.jvm] collector name {:name=>"ConcurrentMarkSweep"}
[2021-02-20T11:21:02,148][DEBUG][filewatch.sincedbcollection][main][dfd2caffb9cafaaef3de80e622b99fe8bd7b28ce8d7353878192e580cdaf3cdd] writing sincedb (delta since last write = 15)
[2021-02-20T11:21:04,059][DEBUG][logstash.instrument.periodicpoller.cgroup] One or more required cgroup files or directories not found: /proc/self/cgroup, /sys/fs/cgroup/cpuacct, /sys/fs/cgroup/cpu
[2021-02-20T11:57:41,083][DEBUG][logstash.instrument.periodicpoller.jvm] collector name {:name=>"ParNew"}
[2021-02-20T11:57:41,085][DEBUG][logstash.instrument.periodicpoller.jvm] collector name {:name=>"ConcurrentMarkSweep"}
[2021-02-20T11:57:41,596][DEBUG][org.logstash.execution.PeriodicFlush][main] Pushing flush onto pipeline.
[2021-02-20T11:57:43,487][DEBUG][filewatch.sincedbcollection][main][038696e67175ced52e017c718a78d1c797905ce61b90eba968c0e2ce28cb4e63] writing sincedb (delta since last write = 15)
[2021-02-20T11:57:45,750][DEBUG][logstash.instrument.periodicpoller.cgroup] One or more required cgroup files or directories not found: /proc/self/cgroup, /sys/fs/cgroup/cpuacct, /sys/fs/cgroup/cpu
Any ideas? Thank you in advance.