X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Flog_logstash.c;h=8ff9045745c708afaec06f4f27e9334b1047eed2;hb=2700666217249cd4794dfc17b4ac3b28f3dca56b;hp=060593047d5d447db90f1843d7aa6c2dcfffd123;hpb=d492192a5ebb0042b8d2e8370d7789e049dfbb8d;p=collectd.git diff --git a/src/log_logstash.c b/src/log_logstash.c index 06059304..8ff90457 100644 --- a/src/log_logstash.c +++ b/src/log_logstash.c @@ -183,22 +183,14 @@ err: static void log_logstash_log(int severity, const char *msg, user_data_t __attribute__((unused)) * user_data) { - yajl_gen g; -#if !defined(HAVE_YAJL_V2) - yajl_gen_config conf = {}; - - conf.beautify = 0; -#endif - if (severity > log_level) return; #if HAVE_YAJL_V2 - g = yajl_gen_alloc(NULL); + yajl_gen g = yajl_gen_alloc(NULL); #else - g = yajl_gen_alloc(&conf, NULL); + yajl_gen g = yajl_gen_alloc(&(yajl_gen_config){0}, NULL); #endif - if (g == NULL) { fprintf(stderr, "Could not allocate JSON generator.\n"); return; @@ -236,7 +228,7 @@ static int log_logstash_notification(const notification_t *n, if (g == NULL) { fprintf(stderr, "Could not allocate JSON generator.\n"); - return (0); + return 0; } if (yajl_gen_map_open(g) != yajl_gen_status_ok) @@ -323,12 +315,12 @@ static int log_logstash_notification(const notification_t *n, } log_logstash_print(g, LOG_INFO, (n->time != 0) ? n->time : cdtime()); - return (0); + return 0; err: yajl_gen_free(g); fprintf(stderr, "Could not correctly generate JSON notification\n"); - return (0); + return 0; } /* int log_logstash_notification */ void module_register(void) {