Giter Club home page Giter Club logo

nginx-kafka-log-module's Introduction

Send Kafka messages from Nginx

Adds the ability to send Kafka message from nginx, using librdkafka. The code of this module was based on nginx-json-log

Build

To link statically against nginx, cd to nginx source directory and execute:

./configure --add-module=/path/to/nginx-kafka-log-module

To compile as a dynamic module (nginx 1.9.11+), use:

./configure --add-dynamic-module=/path/to/nginx-kafka-log-module

In this case, the load_module directive should be used in nginx.conf to load the module.

Configuration

kafka_log

  • syntax: kafka_log kafka:topic body message_id
  • default: none
  • context: location

Enables Kafka logging on the specified location. topic, body and message_id can contain nginx variables.

kafka_log_kafka_client_id

  • syntax: kafka_log_kafka_client_id client_id
  • default: nginx
  • context: main

Sets the Kafka client id.

kafka_log_kafka_debug

  • syntax: kafka_log_kafka_debug context_list
  • default: nginx
  • context: main

Sets the list of debug contexts, use comma to separate multiple values.

kafka_log_kafka_brokers

  • syntax: kafka_log_kafka_brokers broker_list
  • default: nginx
  • context: main

Sets the list of bootstrap Kafka brokers, use comma to separate multiple values.

kafka_log_kafka_compression

  • syntax: kafka_log_kafka_compression type
  • default: snappy
  • context: main

Sets the message compression format.

kafka_log_kafka_partition

  • syntax: kafka_log_kafka_partition id
  • default: auto
  • context: main

Sets the topic partition id, the default is to automatically assign a partition according to the message id.

kafka_log_kafka_log_level

  • syntax: kafka_log_kafka_log_level level
  • default: 6
  • context: main

Sets the logging level of librdkafka (syslog(3) levels)

kafka_log_kafka_max_retries

  • syntax: kafka_log_kafka_max_retries retries
  • default: 0
  • context: main

Defines how many times to retry sending a failed MessageSet. Note: retrying may cause reordering.

kafka_log_kafka_buffer_max_messages

  • syntax: kafka_log_kafka_buffer_max_messages count
  • default: 100000
  • context: main

Maximum number of messages allowed on the producer queue.

kafka_log_kafka_backoff_ms

  • syntax: kafka_log_kafka_backoff_ms millis
  • default: 10
  • context: main

The backoff time in milliseconds before retrying a message send.

Sample configuration

http {
	kafka_log_kafka_brokers 192.168.0.1:9092,192.168.0.2:9092;
	
	server {
		location /log/ {
			kafka_log kafka:sometopic $args $arg_msgId;
			return 200;
		}
	}

Hitting http://domain/log/ will send a message with all query parameters to the Kafka topic sometopic.

Copyright & License

All code in this project is released under the BSD license unless a different license for a particular library is specified in the applicable library path.

Copyright © 2016 Paulo Pacheco. Copyright © Kaltura Inc. All rights reserved.

nginx-kafka-log-module's People

Contributors

erankor avatar catwoolfii avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.