17 #ifndef __SLAVE_CONTAINER_LOGGER_LIB_LOGROTATE_HPP__
18 #define __SLAVE_CONTAINER_LOGGER_LIB_LOGROTATE_HPP__
41 class LogrotateContainerLoggerProcess;
54 "Maximum size, in bytes, of a single stdout log file.\n"
55 "Defaults to 10 MB. Must be at least 1 (memory) page.",
60 "logrotate_stdout_options",
61 "Additional config options to pass into 'logrotate' for stdout.\n"
62 "This string will be inserted into a 'logrotate' configuration file.\n"
64 " /path/to/stdout {\n"
65 " <logrotate_stdout_options>\n"
66 " size <max_stdout_size>\n"
68 "NOTE: The 'size' option will be overridden by this module.");
72 "Maximum size, in bytes, of a single stderr log file.\n"
73 "Defaults to 10 MB. Must be at least 1 (memory) page.",
78 "logrotate_stderr_options",
79 "Additional config options to pass into 'logrotate' for stderr.\n"
80 "This string will be inserted into a 'logrotate' configuration file.\n"
82 " /path/to/stderr {\n"
83 " <logrotate_stderr_options>\n"
84 " size <max_stderr_size>\n"
86 "NOTE: The 'size' option will be overridden by this module.");
93 "Expected --max_stdout_size and --max_stderr_size of "
113 "environment_variable_prefix",
114 "Prefix for environment variables meant to modify the behavior of\n"
115 "the logrotate logger for the specific executor being launched.\n"
116 "The logger will look for four prefixed environment variables in the\n"
117 "'ExecutorInfo's 'CommandInfo's 'Environment':\n"
118 " * MAX_STDOUT_SIZE\n"
119 " * LOGROTATE_STDOUT_OPTIONS\n"
120 " * MAX_STDERR_SIZE\n"
121 " * LOGROTATE_STDERR_OPTIONS\n"
122 "If present, these variables will overwrite the global values set\n"
123 "via module parameters.",
124 "CONTAINER_LOGGER_");
128 "Directory path of Mesos binaries. The logrotate container logger\n"
130 "binary file under this directory.",
133 std::string executablePath =
137 return Error(
"Cannot find: " + executablePath);
145 "If specified, the logrotate container logger will use the specified\n"
146 "'logrotate' instead of the system's 'logrotate'.",
156 "Failed to check logrotate: " + helpCommand.
error());
163 "libprocess_num_worker_threads",
164 "Number of Libprocess worker threads.\n"
165 "Defaults to 8. Must be at least 1.",
170 "Expected --libprocess_num_worker_threads of at least 1");
201 const ExecutorInfo& executorInfo,
202 const std::string& sandboxDirectory,
214 #endif // __SLAVE_CONTAINER_LOGGER_LIB_LOGROTATE_HPP__
bool exists(const std::string &path)
Definition: exists.hpp:26
LogrotateContainerLogger(const Flags &_flags)
Definition: errorbase.hpp:35
static Option< Error > validateSize(const Bytes &value)
Definition: lib_logrotate.hpp:89
std::string logrotate_path
Definition: lib_logrotate.hpp:180
virtual Try< Nothing > initialize()
Initializes this container logger.
Definition: lib_logrotate.hpp:190
size_t pagesize()
Definition: pagesize.hpp:24
constexpr Bytes Megabytes(uint64_t value)
Definition: bytes.hpp:123
Result< std::string > user(Option< uid_t > uid=None())
Definition: su.hpp:277
const std::string NAME
Definition: logrotate.hpp:38
std::string join(const std::string &path1, const std::string &path2, const char _separator=os::PATH_SEPARATOR)
Definition: path.hpp:56
virtual ~LogrotateContainerLogger()
size_t libprocess_num_worker_threads
Definition: lib_logrotate.hpp:182
Option< std::string > logrotate_stderr_options
Definition: lib_logrotate.hpp:104
process::Owned< LogrotateContainerLoggerProcess > process
Definition: lib_logrotate.hpp:207
virtual process::Future< mesos::slave::ContainerIO > prepare(const ExecutorInfo &executorInfo, const std::string &sandboxDirectory, const Option< std::string > &user)
Called before Mesos creates a container.
Bytes max_stdout_size
Definition: lib_logrotate.hpp:100
static Try error(const E &e)
Definition: try.hpp:42
Try< std::string > shell(const std::string &fmt, const T &...t)
Runs a shell command with optional arguments.
Definition: shell.hpp:71
bool isError() const
Definition: try.hpp:71
LoggerFlags()
Definition: lib_logrotate.hpp:50
Flags()
Definition: lib_logrotate.hpp:110
Flags flags
Definition: lib_logrotate.hpp:206
constexpr char DEV_NULL[]
Definition: constants.hpp:30
uint64_t bytes() const
Definition: bytes.hpp:79
Option< std::string > logrotate_stdout_options
Definition: lib_logrotate.hpp:101
void add(T1 Flags::*t1, const Name &name, const Option< Name > &alias, const std::string &help, const T2 *t2, F validate)
Definition: flags.hpp:333
A containerizer component used to manage container logs.
Definition: container_logger.hpp:54
Definition: lib_logrotate.hpp:48
std::string environment_variable_prefix
Definition: lib_logrotate.hpp:177
Definition: lib_logrotate.hpp:108
std::string stringify(int flags)
std::string launcher_dir
Definition: lib_logrotate.hpp:179
Bytes max_stderr_size
Definition: lib_logrotate.hpp:103
Definition: future.hpp:57