elk2
(piter)
May 2, 2018, 5:56pm
1
It 's possible to tag multiple input file name ?
I have many txt file and I want to tag all file maybe with name file if it's possible.
input {
file {
path => "/var/log/testing/*.txt"
start_position => "beginning"
sincedb_path => "/dev/null"
ignore_older => "0"
tags => ["events"]
}
}
Logstash already adds a field with the path to the input file from which the event was read.
elk2
(piter)
May 3, 2018, 10:51am
3
Thanks Magnusbaeck. I solved with this logstash conf.
input {
file {
path => "/var/log/testing/*.txt"
start_position => "beginning"
sincedb_path => "/dev/null"
ignore_older => "0"
tags => ["events"]
}
}
filter {
if "events" in [tags]{
grok {
match => { "path" => "%{UNIXPATH:path_tag}/%{GREEDYDATA:namefile_tag}\.txt\.*" }
}
mutate {
add_tag => [ "%{namefile_tag}" ]
}
}
output {
stdout {}
file {
path => "/var/log/logstash/tagged_stdout.log"
}
}
Now ,I have some _groktimeout tag on tags. Maybe is wrong the grok parser.
Don't use UNIXPATH. There was a recent thread about this not 24 hours ago.
system
(system)
Closed
June 1, 2018, 7:50am
6
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.