</term>
<listitem>
<para>
- Specify a path to a file where the console output will
- be written.
+ Specify a path to a file where the console output will be written.
+ Note that in contrast to the on-disk ringbuffer logfile this file
+ will keep growing potentially filling up the users disks if not
+ rotated and deleted. This problem can also be avoided by using the
+ in-memory ringbuffer options
+ <option>lxc.console.buffer.size</option> and
+ <option>lxc.console.buffer.logfile</option>.
</para>
</listitem>
</varlistentry>
+
+ <varlistentry>
+ <term>
+ <option>lxc.console.rotate</option>
+ </term>
+ <listitem>
+ <para>
+ Whether to rotate the console logfile specified in
+ <option>lxc.console.logfile</option>. Users can send an API
+ request to rotate the logfile. Note that the old logfile will have
+ the same name as the original with the suffix ".1" appended.
+
+ Users wishing to prevent the console log file from filling the
+ disk should rotate the logfile and delete it if unneeded. This
+ problem can also be avoided by using the in-memory ringbuffer
+ options <option>lxc.console.buffer.size</option> and
+ <option>lxc.console.buffer.logfile</option>.
+ </para>
+ </listitem>
+ </varlistentry>
+
<varlistentry>
<term>
<option>lxc.console.path</option>
lxc_config_define(cgroup_controller);
lxc_config_define(cgroup_dir);
lxc_config_define(console_logfile);
+lxc_config_define(console_rotate);
lxc_config_define(console_buffer_logfile);
lxc_config_define(console_buffer_size);
lxc_config_define(console_path);
{ "lxc.console.buffer.size", false, set_config_console_buffer_size, get_config_console_buffer_size, clr_config_console_buffer_size, },
{ "lxc.console.logfile", false, set_config_console_logfile, get_config_console_logfile, clr_config_console_logfile, },
{ "lxc.console.path", false, set_config_console_path, get_config_console_path, clr_config_console_path, },
+ { "lxc.console.rotate", false, set_config_console_rotate, get_config_console_rotate, clr_config_console_rotate, },
{ "lxc.environment", false, set_config_environment, get_config_environment, clr_config_environment, },
{ "lxc.ephemeral", false, set_config_ephemeral, get_config_ephemeral, clr_config_ephemeral, },
{ "lxc.execute.cmd", false, set_config_execute_cmd, get_config_execute_cmd, clr_config_execute_cmd, },
return set_config_path_item(&lxc_conf->console.path, value);
}
+static int set_config_console_rotate(const char *key, const char *value,
+ struct lxc_conf *lxc_conf, void *data)
+{
+ if (lxc_config_value_empty(value)) {
+ lxc_conf->console.log_rotate = 0;
+ return 0;
+ }
+
+ if (lxc_safe_uint(value, &lxc_conf->console.log_rotate) < 0)
+ return -1;
+
+ if (lxc_conf->console.log_rotate > 1)
+ return -1;
+
+ return 0;
+}
+
static int set_config_console_logfile(const char *key, const char *value,
struct lxc_conf *lxc_conf, void *data)
{
return lxc_get_conf_str(retv, inlen, c->console.log_path);
}
+static int get_config_console_rotate(const char *key, char *retv, int inlen,
+ struct lxc_conf *c, void *data)
+{
+ return lxc_get_conf_int(c, retv, inlen, c->console.log_rotate);
+}
+
+
static int get_config_console_buffer_size(const char *key, char *retv,
int inlen, struct lxc_conf *c,
void *data)
return 0;
}
+static inline int clr_config_console_rotate(const char *key, struct lxc_conf *c,
+ void *data)
+{
+ c->console.log_rotate = 0;
+ return 0;
+}
+
static inline int clr_config_console_buffer_size(const char *key,
struct lxc_conf *c, void *data)
{