We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
This code, gotten from the project examples, does not work. It does not produce any logs on Loki:
import logging.handlers import logging_loki from multiprocessing import Queue queue = Queue(-1) handler = logging.handlers.QueueHandler(queue) handler_loki = logging_loki.LokiHandler( url="http://localhost:3100/loki/api/v1/push", tags={"app": "none", "job": "testing-loki", "env": "dev"}, version="1", ) logging.handlers.QueueListener(queue, handler_loki) logger = logging.getLogger("my-logger") logger.addHandler(handler) if __name__ == '__main__': logger.info("Hello, world") logger.error("Something wrong...")
You may start Loki using Docker Compose docker-compose up -d in the same directory as the following docker-compose.ymlfile:
docker-compose up -d
docker-compose.yml
version: "3.7" services: loki: image: grafana/loki:2.6.0 ports: - "3100:3100"
The text was updated successfully, but these errors were encountered:
Explicitly starting the listener should do the trick:
logging.handlers.QueueListener(queue, handler_loki).start()
Sorry, something went wrong.
No branches or pull requests
This code, gotten from the project examples, does not work. It does not produce any logs on Loki:
You may start Loki using Docker Compose
docker-compose up -d
in the same directory as the followingdocker-compose.yml
file:The text was updated successfully, but these errors were encountered: