Skip to content

Commit c886b24

Browse files
authored
Merge pull request #8 from m-kress/master
Add examples for time format and remote logging to config file
2 parents 508870e + 7aefbae commit c886b24

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

metalog.conf

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,16 @@ maxsize = 1048576 # size in bytes (1048576 = 1 megabyte)
44
maxtime = 86400 # time in seconds (86400 = 1 day)
55
maxfiles = 5 # num files per directory
66

7+
# Format of the timestamp: YYYY-MM-DD HH:MM:SS.NNN
8+
#stamp_fmt = "%F %T.%3N"
9+
10+
# Configures a remote log server
11+
#remote_host = 192.168.1.2
12+
#remote_port = 514
13+
14+
# Send all logs via UDP to a remote log server
15+
#remote_log = 1
16+
717
# This will capture all of the internal log messages that metalog itself
818
# generates. If you use any "command" options below, you will want this
919
# as metalog generates a lot of status messages whenever it executes a
@@ -52,6 +62,8 @@ Kernel messages :
5262
facility = "kern"
5363
logdir = "/var/log/kernel"
5464
break = 1
65+
# Additionally send this log entries via UDP to a remote log server
66+
# remote_log = 1
5567

5668
Crond :
5769

src/metalog.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1287,6 +1287,9 @@ static int log_udp(char *buf, int bsize)
12871287
buf[bsize] = '\0';
12881288
if (write(1, buf, strlen(buf)) != (ssize_t) strlen(buf))
12891289
return -1;
1290+
if (write(1, "\n", 1) != 1)
1291+
return -1;
1292+
12901293
return log_line(LOGLINETYPE_SYSLOG, buf);
12911294
}
12921295

0 commit comments

Comments
 (0)