Manually pushing to Loki

There’s a very under-documented sharp edge in Loki: you need to give it timestamps as a string, and they need to be a nanosecond epoch. Minimal example: #!/usr/bin/env python3 from json import dumps from requests import post from time import time loki_url = ‘http://localhost:3100/loki/api/v1/push’ def loki_timestamp(): return f”{(int(time() * 1_000_000_000))}” payload = { ‘streams’: [ […]