You can separate different flows as per their needs using tags and apply operations to them accordingly. A sample code is mentioned below:
input {
beats { port => 2200 tag => apache }
tcp { port => 9999 tag => firewall }
}
filter {
if "apache" in [tags] {
<someoperation> { ... }
} else if "firewall" in [tags] {
grok { ... }
}
}
output {
if "apache" in [tags] {
elasticsearch { ... }
} else if "firewall" in [tags] {
tcp { ... }
}
}
Explanation :
In the input plugin, all the events flowing from port 2200 and 9999 are added with tags apache and firewall respectively. This will be used to apply separate filter operations to each of the event based on the tag added in the input plugin.
Now, In the same way these events can be separately sent to different or same endpoint (be it a log file, a console output, an Elasticsearch storage etc.)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…