- The default bond_mode changed from SLB to active-backup, to protect
unsuspecting users from the significant risks of SLB bonds (which are
documented in vswitchd/INTERNALS).
+ - Logging to console and file will have UTC timestamp as a default for all
+ the daemons. An example of the default format is 2012-01-27T16:35:17Z.
+ ovs-appctl can be used to change the default format as before.
v1.5.0 - xx xxx xxxx
}
}
+/* Writes the current time to 'string' based on 'template'.
+ * The current time is either localtime or UTC based on 'utc'. */
void
-ds_put_strftime(struct ds *ds, const char *template, const struct tm *tm)
+ds_put_strftime(struct ds *ds, const char *template, bool utc)
{
- if (!tm) {
- time_t now = time_wall();
+ const struct tm *tm;
+ time_t now = time_wall();
+ if (utc) {
+ tm = gmtime(&now);
+ } else {
tm = localtime(&now);
}
+
for (;;) {
size_t avail = ds->string ? ds->allocated - ds->length + 1 : 0;
size_t used = strftime(&ds->string[ds->length], avail, template, tm);
void ds_put_format_valist(struct ds *, const char *, va_list)
PRINTF_FORMAT(2, 0);
void ds_put_printable(struct ds *, const char *, size_t);
-void ds_put_strftime(struct ds *, const char *, const struct tm *)
+void ds_put_strftime(struct ds *, const char *, bool utc)
STRFTIME_FORMAT(2);
void ds_put_hex_dump(struct ds *ds, const void *buf_, size_t size,
uintptr_t ofs, bool ascii);
break;
case 'd':
p = fetch_braces(p, "%Y-%m-%d %H:%M:%S", tmp, sizeof tmp);
- ds_put_strftime(s, tmp, NULL);
+ ds_put_strftime(s, tmp, false);
+ break;
+ case 'D':
+ p = fetch_braces(p, "%Y-%m-%d %H:%M:%S", tmp, sizeof tmp);
+ ds_put_strftime(s, tmp, true);
break;
case 'm':
/* Format user-supplied log message and trim trailing new-lines. */
/* Facilities that we can log to. */
#define VLOG_FACILITIES \
VLOG_FACILITY(SYSLOG, "%05N|%c|%p|%m") \
- VLOG_FACILITY(CONSOLE, "%d{%b %d %H:%M:%S}|%05N|%c|%p|%m") \
- VLOG_FACILITY(FILE, "%d{%b %d %H:%M:%S}|%05N|%c|%p|%m")
+ VLOG_FACILITY(CONSOLE, "%D{%Y-%m-%dT%H:%M:%SZ}|%05N|%c|%p|%m") \
+ VLOG_FACILITY(FILE, "%D{%Y-%m-%dT%H:%M:%SZ}|%05N|%c|%p|%m")
enum vlog_facility {
#define VLOG_FACILITY(NAME, PATTERN) VLF_##NAME,
VLOG_FACILITIES
The current date and time in the specified \fIformat\fR, which takes
the same format as the \fItemplate\fR argument to \fBstrftime\fR(3).
.
+.IP \fB%D\fR
+The current UTC date and time in ISO 8601 format (YYYY\-MM\-DD HH:MM:SS).
+.
+.IP \fB%D{\fIformat\fB}\fR
+The current UTC date and time in the specified \fIformat\fR, which takes
+the same format as the \fItemplate\fR argument to \fBstrftime\fR(3).
+.
.IP \fB%m\fR
The message being logged.
.
.RE
.
.IP
-The default pattern for console and file output is \fB%d{%b %d
-%H:%M:%S}|%05N|%c|%p|%m\fR; for syslog output, \fB%05N|%c|%p|%m\fR.
+The default pattern for console and file output is \fB%D{%Y-%m-%dT
+%H:%M:%SZ}|%05N|%c|%p|%m\fR; for syslog output, \fB%05N|%c|%p|%m\fR.
.
.IP "\fBvlog/reopen\fR"
Causes the daemon to close and reopen its log file. (This