You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by be...@apache.org on 2016/01/25 05:13:47 UTC
[05/11] mesos git commit: Wire up the rotating container logger
module and test.
Wire up the rotating container logger module and test.
Creates a new binary "mesos-rotate-logger" for use by the non-default
"Rotating" ContainerLogger module.
Adds the RotatingContainerLogger to the test module configuration.
Review: https://reviews.apache.org/r/41782/
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/a355f438
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/a355f438
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/a355f438
Branch: refs/heads/master
Commit: a355f43843204db21156f239de44f3592270f3bb
Parents: 0f20d5e
Author: Joseph Wu <jo...@mesosphere.io>
Authored: Wed Jan 20 16:48:58 2016 -0800
Committer: Benjamin Hindman <be...@gmail.com>
Committed: Sun Jan 24 20:13:22 2016 -0800
----------------------------------------------------------------------
src/Makefile.am | 16 ++++++++++++++++
src/tests/module.cpp | 40 +++++++++++++++++++++++++++++++++++++---
src/tests/module.hpp | 1 +
3 files changed, 54 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/a355f438/src/Makefile.am
----------------------------------------------------------------------
diff --git a/src/Makefile.am b/src/Makefile.am
index 19bf3a7..8657a86 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1101,6 +1101,13 @@ mesos_containerizer_SOURCES = slave/containerizer/mesos/main.cpp
mesos_containerizer_CPPFLAGS = $(MESOS_CPPFLAGS)
mesos_containerizer_LDADD = libmesos.la $(LDADD)
+pkglibexec_PROGRAMS += mesos-logrotate-logger
+mesos_logrotate_logger_SOURCES = \
+ slave/container_loggers/logrotate.hpp \
+ slave/container_loggers/logrotate.cpp
+mesos_logrotate_logger_CPPFLAGS = $(MESOS_CPPFLAGS)
+mesos_logrotate_logger_LDADD = libmesos.la $(LDADD)
+
if WITH_NETWORK_ISOLATOR
pkglibexec_PROGRAMS += mesos-network-helper
mesos_network_helper_SOURCES = slave/containerizer/mesos/isolators/network/helper.cpp
@@ -1641,6 +1648,15 @@ check_PROGRAMS += mesos-tests
# LDFLAGS to be used for the module libraries.
MESOS_MODULE_LDFLAGS = -release $(PACKAGE_VERSION) -shared
+# Library containing the logrotate container logger.
+lib_LTLIBRARIES += liblogrotate_container_logger.la
+liblogrotate_container_logger_la_SOURCES = \
+ slave/container_loggers/logrotate.hpp \
+ slave/container_loggers/lib_logrotate.hpp \
+ slave/container_loggers/lib_logrotate.cpp
+liblogrotate_container_logger_la_CPPFLAGS = $(MESOS_CPPFLAGS)
+liblogrotate_container_logger_la_LDFLAGS = $(MESOS_MODULE_LDFLAGS)
+
# Library containing the fixed resource estimator.
lib_LTLIBRARIES += libfixed_resource_estimator.la
libfixed_resource_estimator_la_SOURCES = slave/resource_estimators/fixed.cpp
http://git-wip-us.apache.org/repos/asf/mesos/blob/a355f438/src/tests/module.cpp
----------------------------------------------------------------------
diff --git a/src/tests/module.cpp b/src/tests/module.cpp
index f0e64f7..246f3a4 100644
--- a/src/tests/module.cpp
+++ b/src/tests/module.cpp
@@ -16,9 +16,11 @@
#include <string>
+#include <stout/bytes.hpp>
#include <stout/hashmap.hpp>
#include <stout/os.hpp>
#include <stout/path.hpp>
+#include <stout/stringify.hpp>
#include "messages/messages.hpp"
#include "module/manager.hpp"
@@ -101,21 +103,53 @@ static void addContainerLoggerModules(Modules* modules)
{
CHECK_NOTNULL(modules);
- const string libraryPath = path::join(
+ const string libraryDirectory = path::join(
tests::flags.build_dir,
"src",
- ".libs",
+ ".libs");
+
+ const string sandboxLoggerPath = path::join(
+ libraryDirectory,
os::libraries::expandName("testcontainer_logger"));
// Add our test container logger module.
Modules::Library* library = modules->add_libraries();
- library->set_file(libraryPath);
+ library->set_file(sandboxLoggerPath);
// To add a new module from this library, create a new ModuleID enum
// and tie it with a module name.
addModule(library,
TestSandboxContainerLogger,
"org_apache_mesos_TestSandboxContainerLogger");
+
+ const string logrotateLoggerPath = path::join(
+ libraryDirectory,
+ os::libraries::expandName("logrotate_container_logger"));
+
+ // Add the second container logger module.
+ library = modules->add_libraries();
+ library->set_file(logrotateLoggerPath);
+
+ addModule(library,
+ LogrotateContainerLogger,
+ "org_apache_mesos_LogrotateContainerLogger");
+
+ // Pass in the directory for the binary test sources.
+ Modules::Library::Module* module = library->mutable_modules(0);
+ mesos::Parameter* moduleParameter = module->add_parameters();
+ moduleParameter->set_key("launcher_dir");
+ moduleParameter->set_value(path::join(tests::flags.build_dir, "src"));
+
+ // Set the size and number of log files to keep.
+ moduleParameter = module->add_parameters();
+ moduleParameter->set_key("max_stdout_size");
+ moduleParameter->set_value(stringify(Megabytes(2)));
+
+ // NOTE: This is a 'logrotate' configuration option.
+ // It means to "rotate" a file 4 times before removal.
+ moduleParameter = module->add_parameters();
+ moduleParameter->set_key("logrotate_stdout_options");
+ moduleParameter->set_value("rotate 4");
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/a355f438/src/tests/module.hpp
----------------------------------------------------------------------
diff --git a/src/tests/module.hpp b/src/tests/module.hpp
index 49a9203..4b32f29 100644
--- a/src/tests/module.hpp
+++ b/src/tests/module.hpp
@@ -49,6 +49,7 @@ enum ModuleID
TestNoopResourceEstimator,
TestLocalAuthorizer,
TestSandboxContainerLogger,
+ LogrotateContainerLogger,
TestHttpBasicAuthenticator
};