#include "utils_cmd_putval.h"
#include "utils_format_graphite.h"
#include "utils_format_json.h"
+#include "utils_random.h"
#include <errno.h>
#include <librdkafka/rdkafka.h>
#define KAFKA_RANDOM_KEY_BUFFER \
(char[KAFKA_RANDOM_KEY_SIZE]) { "" }
static char *kafka_random_key(char buffer[static KAFKA_RANDOM_KEY_SIZE]) {
- ssnprintf(buffer, KAFKA_RANDOM_KEY_SIZE, "%08lX", (unsigned long)mrand48());
+ ssnprintf(buffer, KAFKA_RANDOM_KEY_SIZE, "%08" PRIX32, cdrand_u());
return buffer;
}
rd_kafka_topic_conf_t *topic_conf;
if (ctx->kafka != NULL && ctx->topic != NULL)
- return (0);
+ return 0;
if (ctx->kafka == NULL) {
if ((conf = rd_kafka_conf_dup(ctx->kafka_conf)) == NULL) {
ERROR("write_kafka plugin: cannot duplicate kafka config");
- return (1);
+ return 1;
}
if ((ctx->kafka = rd_kafka_new(RD_KAFKA_PRODUCER, conf, errbuf,
rd_kafka_topic_name(ctx->topic));
}
- return (0);
+ return 0;
} /* }}} int kafka_handle */
}
if (conf != NULL)
rd_kafka_conf_destroy(conf);
- return (0);
+ return 0;
errout:
if (conf != NULL)
rd_kafka_conf_destroy(conf);