Skip to content

Instantly share code, notes, and snippets.

@merlin-quix
Last active January 22, 2023 16:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save merlin-quix/a3452acc4a22982fa749038176968a35 to your computer and use it in GitHub Desktop.
Save merlin-quix/a3452acc4a22982fa749038176968a35 to your computer and use it in GitHub Desktop.
import json
from kafka import KafkaProducer
file = 'access.log'
producer_compression = KafkaProducer(bootstrap_servers=['localhost:9092'],
value_serializer=lambda x:json.dumps(x, default=str).encode('utf-8'),
key_serializer=lambda y:str(y).encode("utf-8"),
compression_type="gzip")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment