Skip to main content

Send Message To Cloud Kafka Topic

Project description

Kafka Package

This is a simple package which sends log messages to Cloud Kafka Topic.

Version

Python == 3.X

Dependency

confluent-kafka>=0.11.6

Installation

Run the following to install

pip install cloud-kafka-logger

Usage

import logging

from cloudKafkaLogger import KafkaHandler

logger = logging.getLogger(name)

logger.setLevel(logging.DEBUG)

conf = {

'bootstrap.servers': 'cloud-kafka-servers',

'session.timeout.ms': 6000,

'default.topic.config': {'auto.offset.reset': 'smallest'},

'security.protocol': 'your-protocol',

'sasl.mechanisms': 'your-mechanisms',

'sasl.username': 'your-username',

'sasl.password': 'your-password'

}

kh = KafkaHandler(conf=conf, topic='your-topic')

logger.addHandler(kh)

This will be written into Kafka Topic

logger.info(json.dumps({"app_name": "Test_Python_App", "message": "Am logging from application"}))

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for Cloud-Kafka-Logger, version 0.1.7
Filename, size File type Python version Upload date Hashes
Filename, size Cloud_Kafka_Logger-0.1.7-py3-none-any.whl (3.3 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size Cloud_Kafka_Logger-0.1.7.tar.gz (2.2 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page