How do I drop logs that do not contain specific strings

Hi, I have an application that outputs logs. I use Alloy to send these logs to Loki.

How do I configure Alloy to send only the logs that contain the string TYPE=EXECUTION, or TYPE=APPLICATION or TYPE=SERVER to Loki and drop other logs?

  1. Use a filter to parse for the TYPE value.
  2. Use stage.match, match for everything that’s not EXECUTION, APPLICATION, or SERVER, then use stage.drop to drop the log.