/* Copyright (c) 2010-2018 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "ioloop.h"
#include "istream.h"
#include "hash.h"
#include "str.h"
#include "strescape.h"
#include "time-util.h"
#include "master-service-private.h"
#include "master-service-settings.h"
#include "doveadm.h"
#include "doveadm-print.h"
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <dirent.h>
#include <signal.h>
extern struct doveadm_cmd doveadm_cmd_log[];
static void ATTR_NULL(2)
{
unsigned int i;
for (i = 0; i < LAST_LOG_TYPE; i++) {
/* add timestamp so that syslog won't just write
"repeated message" text */
(unsigned int)ioloop_time);
}
}
{
}
struct log_find_file {
const char *path;
/* 1 << enum log_type */
unsigned int mask;
};
struct log_find_context {
};
{
char *key;
}
}
static void
{
struct dirent *d;
char *key;
return;
}
if (d->d_name[0] == '.')
continue;
continue;
/* recursively go through all subdirectories */
}
}
}
{
unsigned int i;
for (i = 0; i < LAST_LOG_TYPE; i++) {
*type_r = i;
return TRUE;
}
}
return FALSE;
}
{
const char *line, *p;
int fd;
if (fd == -1)
return;
if (p == NULL)
continue;
p += strlen(TEST_LOG_MSG_PREFIX);
/* <type> log */
T_BEGIN {
} T_END;
}
}
{
char *key;
continue;
}
}
static void
{
const char *log_dir;
if (argc > 1)
else
return;
cmd_log_test(0, NULL);
/* give syslog some time to write the messages to files */
sleep(1);
}
{
const char *log_file_path;
unsigned int i;
/* first get the paths that we know are used */
log_file_path = "";
if (*log_file_path != '\0') {
}
if (*log_file_path != '\0')
}
if (*log_file_path != '\0')
}
/* at least some logs were logged via syslog */
}
/* print them */
for (i = 0; i < LAST_LOG_TYPE; i++) {
char *key;
}
}
if (!found)
}
}
{
/* Trim whitespace from suffix and remove ':' if it exists */
pos--;
break;
}
}
}
{
/* <type> <timestamp> <prefix> <text> */
unsigned int type;
time_t t;
/* find type's prefix */
break;
}
}
t = 0;
}
if (t >= min_timestamp) {
}
}
{
int c, fd;
switch (c) {
case 's':
break;
default:
}
}
if (fd == -1)
doveadm_print_formatted_set_format("%{timestamp} %{type}: %{prefix}: %{text}\n");
doveadm_print_header_simple("timestamp");
doveadm_print_header_simple("prefix");
doveadm_print_header_simple("type");
doveadm_print_header_simple("text");
else {
}
} T_END;
}
};
.name = "log errors",
.usage = "[-s <min_timestamp>]",
};
void doveadm_register_log_commands(void)
{
unsigned int i;
for (i = 0; i < N_ELEMENTS(doveadm_cmd_log); i++)
}