Repository navigation
|
Coming from promtail/alloy world, I have the following use case, Given logs from an incoming source containing logs from multiple services, I want to do two things,
What's the best way to do this in vector? For use case 1, I had to do multiple things,
Is this the best approach? Seems very inconvenient when I have >100 such sampling rules. In promtail/alloy, I can do I'm looking at all these transforms and seeing that they only support one liner boolean expressions. Are there any plans to add support for more verbose VRL functions that can return true/false or other values according to the transform?
After a second look at the docs, it seems like it makes more sense to use remap transforms to filter logs since they support the |
Replies: 2 comments 1 reply
|
I think a bigger distinction that I see here is that promtail/alloy handles processing in a tree like manner i.e. branch out to process selectively and then merge back into a single stream at the end. But in vector, it seems like implementing this kind of branching is very verbose and leads to a ton of output streams that need to be handled carefully to maintain order and de-duplication. |
|
For the This pipeline drops messages containing sources:
logs:
type: stdin
decoding:
codec: json
transforms:
drop_health_checks:
type: filter
inputs: [logs]
condition: |
message = string(.message) ?? ""
!contains(message, "/health")
sample_bar:
type: sample
inputs: [drop_health_checks]
rate: 4
exclude: |
service = string(.service) ?? ""
service != "bar"
sinks:
output:
type: console
inputs: [sample_bar]
encoding:
codec: jsonThere is one output stream, so no branching or deduplication is needed. Tested locally with Vector 0.59.0: 10 of 40 For many rules with different sampling rates, current Vector also supports Please don't hesitate to followup in this thread if you have further questions. |
For the
service = "bar"example, usesample.exclude: events matchingexcludepass through unchanged. Conditions can also contain multiline VRL, as long as the final expression returns a boolean.This pipeline drops messages containing
/health, keeps one in four remainingbarlogs, and keeps all other logs: