1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86
|
# Kafka setup
* Download Kafka: [download link](https://www.apache.org/dyn/closer.cgi?path=/kafka/0.8.2.1/kafka-0.8.2.1-src.tgz)
* Extract the compressed file, step into the directory and run `gradle build`
# Start Kafka server
```
stentor@stentor-x201:~/work/kafka/kafka$ bin/zookeeper-server-start.sh config/zookeeper.properties
stentor@stentor-x201:~/work/kafka/kafka$ bin/kafka-server-start.sh config/server.properties
stentor@stentor-x201:~/work/kafka/kafka$ bin/kafka-topics.sh --create --zookeeper 127.0.0.1:2181 --replication-factor 1 --partitions 1 --topic mytopic
stentor@stentor-x201:~/work/kafka/kafka$ bin/kafka-console-consumer.sh --zookeeper localhost:2181 --topic mytopic --from-beginning
```
If you want to try it with the default test-producer:
```
bin/kafka-console-producer.sh --broker-list localhost:9092 --sync --topic mytopic
```
* build syslog-ng (from syslog-ng-core):
```
./sbuild.py make install
```
# Start syslog-ng
Sample config:
```
@version: 3.28
@include "scl.conf"
@module "mod-java"
source s_local {
# system();
internal();
};
source s_network {
tcp(port(1514));
};
destination d_local {
file("/tmp/messages");
};
destination d_java_0{
java(
class_name("org.syslog_ng.kafka.KafkaDestination")
class_path("/home/btibi/work/syslog-ng-pe-project-5.4/install/lib/syslog-ng/java-modules/kafka.jar")
option("kafka_bootstrap_servers", "127.0.0.1:9092")
option("topic", "mytopic")
option("key", "$HOST")
option("sync_send", "false")
option("template", "$MESSAGE")
option("properties_file", "/home/btibi/work/syslog-ng-pe-project-5.4/install/etc/kafka.properties")
);
};
log {
source(s_local);
source(s_network);
destination(d_java_0);
destination(d_local);
};
```
Properties file:
```
acks=all
metadata.fetch.timeout.ms=5000
retry.backoff.ms=1000
reconnect.backoff.ms=1000
```
Now you can use `loggen` to send messages into `syslog-ng`:
```
loggen -S -n 10 localhost 1514
```
## Other infos about gradle
[link](http://gitlab.syslog-ng.balabit/lbudai/internal-builder-repo-doc/wikis/home)
|