}
static void
-cmd_log_find_syslog_files(struct log_find_context *ctx, const char *path)
+cmd_log_find_syslog_files(struct log_find_context *ctx, const char *path,
+ struct event *event)
{
struct log_find_file *file;
DIR *dir;
dir = opendir(path);
if (dir == NULL) {
- i_error("opendir(%s) failed: %m", path);
+ e_error(event, "opendir(%s) failed: %m", path);
return;
}
if (S_ISDIR(st.st_mode)) {
/* recursively go through all subdirectories */
- cmd_log_find_syslog_files(ctx, str_c(full_path));
+ cmd_log_find_syslog_files(ctx, str_c(full_path), event);
} else if (hash_table_lookup(ctx->files,
str_c(full_path)) == NULL) {
file = p_new(ctx->pool, struct log_find_file, 1);
return;
printf("Looking for log files from %s\n", log_dir);
- cmd_log_find_syslog_files(ctx, log_dir);
+ cmd_log_find_syslog_files(ctx, log_dir, cctx->event);
cmd_log_test(cctx);
/* give syslog some time to write the messages to files */
return orig[pos] == '\0' ? orig : t_strndup(orig, pos);
}
-static void cmd_log_error_write(const char *const *args, time_t min_timestamp)
+static void cmd_log_error_write(const char *const *args, time_t min_timestamp,
+ struct event *event)
{
/* <type> <timestamp> <prefix> <text> */
const char *type_prefix = "?";
}
if (str_to_time(args[1], &t) < 0) {
- i_error("Invalid timestamp: %s", args[1]);
+ e_error(event, "Invalid timestamp: %s", args[1]);
t = 0;
}
if (t >= min_timestamp) {
while ((line = i_stream_read_next_line(input)) != NULL) T_BEGIN {
args = t_strsplit_tabescaped(line);
if (str_array_length(args) == 4)
- cmd_log_error_write(args, min_timestamp);
+ cmd_log_error_write(args, min_timestamp, cctx->event);
else {
- i_error("Invalid input from log: %s", line);
+ e_error(cctx->event, "Invalid input from log: %s", line);
doveadm_exit_code = EX_PROTOCOL;
}
} T_END;