Loki Alerting: Retrieving Contextual Log Lines (Before/After Error)

"I’m trying to set up Loki alerts that include the AKS pod log lines immediately before and after an error event (similar to the ‘context’ feature in Grafana Explore). Is this possible within Loki alerting rules? if possible give me sample query