Apache Mesos
Public Member Functions | Static Public Member Functions | List of all members
mesos::slave::ContainerLogger Class Referenceabstract

A containerizer component used to manage container logs. More...

#include <container_logger.hpp>

Inheritance diagram for mesos::slave::ContainerLogger:
mesos::internal::logger::LogrotateContainerLogger mesos::internal::slave::SandboxContainerLogger

Public Member Functions

virtual ~ContainerLogger ()
 
virtual Try< Nothinginitialize ()=0
 Initializes this container logger. More...
 
virtual process::Future
< ContainerIO
prepare (const ExecutorInfo &executorInfo, const std::string &sandboxDirectory, const Option< std::string > &user)=0
 Called before Mesos creates a container. More...
 

Static Public Member Functions

static Try< ContainerLogger * > create (const Option< std::string > &type)
 Create and initialize a container logger instance of the given type, specified by the container_logger agent flag. More...
 

Detailed Description

A containerizer component used to manage container logs.

The ContainerLogger is responsible for handling the stdout/stderr of containers. The stdout/stderr of tasks launched without can executor (that implicitly use the command executor) will also be handled by the container logger.

The container logger is also responsible for providing a public interface for retrieving the logs.

TODO(josephw): Provide an interface for exposing custom log-retrieval endpoints via the Mesos web UI.

Constructor & Destructor Documentation

virtual mesos::slave::ContainerLogger::~ContainerLogger ( )
inlinevirtual

Member Function Documentation

static Try<ContainerLogger*> mesos::slave::ContainerLogger::create ( const Option< std::string > &  type)
static

Create and initialize a container logger instance of the given type, specified by the container_logger agent flag.

If the type is not specified, a default container logger instance will be created.

See ContainerLogger::initialize.

virtual Try<Nothing> mesos::slave::ContainerLogger::initialize ( )
pure virtual

Initializes this container logger.

This method must be called before any other member function is called.

The container logger module should return an error if the particular module is not supported. For example, if the module implements log rotation via the logrotate utility, the module can return an error if the utility is not found.

Implemented in mesos::internal::logger::LogrotateContainerLogger, and mesos::internal::slave::SandboxContainerLogger.

virtual process::Future<ContainerIO> mesos::slave::ContainerLogger::prepare ( const ExecutorInfo &  executorInfo,
const std::string &  sandboxDirectory,
const Option< std::string > &  user 
)
pure virtual

Called before Mesos creates a container.

The container logger is given some of the arguments which the containerizer will use to launch a container. The container logger should return a ContainerIO which tells the containerizer how to handle the stdout and stderr of the container. The container logger can modify the fields within the ContainerIO as much as necessary, with some exceptions; see the struct ContainerIO above.

NOTE: The container logger should not lose stdout/stderr if the agent fails over. Additionally, if the container logger is stateful, the logger should be capable of recovering managed executors during the agent recovery process. See ContainerLogger::recover.

Parameters
executorInfoProvided for the container logger to track logs.
sandboxDirectoryAn absolute path to the executor's sandbox. This is provided in case the container logger needs to store files in the executor's sandbox, such as persistent state between agent failovers. NOTE: All files in the sandbox are exposed via the /files endpoint.

Implemented in mesos::internal::logger::LogrotateContainerLogger, and mesos::internal::slave::SandboxContainerLogger.


The documentation for this class was generated from the following file: