projects
/
collectd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
redis plugin: Fixed bug of Timeout option
[collectd.git]
/
src
/
log_logstash.c
diff --git
a/src/log_logstash.c
b/src/log_logstash.c
index
28cc34c
..
8f3063f
100644
(file)
--- a/
src/log_logstash.c
+++ b/
src/log_logstash.c
@@
-49,7
+49,7
@@
static int log_level = LOG_INFO;
static pthread_mutex_t file_lock = PTHREAD_MUTEX_INITIALIZER;
static pthread_mutex_t file_lock = PTHREAD_MUTEX_INITIALIZER;
-static char *log_file
= NULL
;
+static char *log_file;
static const char *config_keys[] = {"LogLevel", "File"};
static int config_keys_num = STATIC_ARRAY_SIZE(config_keys);
static const char *config_keys[] = {"LogLevel", "File"};
static int config_keys_num = STATIC_ARRAY_SIZE(config_keys);
@@
-75,7
+75,7
@@
static int log_logstash_config(const char *key, const char *value) {
static void log_logstash_print(yajl_gen g, int severity,
cdtime_t timestamp_time) {
FILE *fh;
static void log_logstash_print(yajl_gen g, int severity,
cdtime_t timestamp_time) {
FILE *fh;
-
_Bool do_close = 0
;
+
bool do_close = false
;
struct tm timestamp_tm;
char timestamp_str[64];
const unsigned char *buf;
struct tm timestamp_tm;
char timestamp_str[64];
const unsigned char *buf;
@@
-150,19
+150,18
@@
static void log_logstash_print(yajl_gen g, int severity,
fh = stderr;
} else if (strcasecmp(log_file, "stdout") == 0) {
fh = stdout;
fh = stderr;
} else if (strcasecmp(log_file, "stdout") == 0) {
fh = stdout;
- do_close =
0
;
+ do_close =
false
;
} else if (strcasecmp(log_file, "stderr") == 0) {
fh = stderr;
} else if (strcasecmp(log_file, "stderr") == 0) {
fh = stderr;
- do_close =
0
;
+ do_close =
false
;
} else {
fh = fopen(log_file, "a");
} else {
fh = fopen(log_file, "a");
- do_close =
1
;
+ do_close =
true
;
}
if (fh == NULL) {
}
if (fh == NULL) {
- char errbuf[1024];
fprintf(stderr, "log_logstash plugin: fopen (%s) failed: %s\n", log_file,
fprintf(stderr, "log_logstash plugin: fopen (%s) failed: %s\n", log_file,
-
sstrerror(errno, errbuf, sizeof(errbuf))
);
+
STRERRNO
);
} else {
fprintf(fh, "%s\n", buf);
if (do_close) {
} else {
fprintf(fh, "%s\n", buf);
if (do_close) {