KasperskyOS Community Edition 1.3

Adding a log server and output channels to a solution

The LogrrServer program sends messages to one or more output channels. You can write log messages to files by using the output channel named FsOutputChannel.

Adding and configuring logging server

The command for creating and configuring the log server create_logrr_server() may contain the following parameters:

LOG_LEVEL
Sets the specified log level. The available values for LOG_LEVEL are CRITICAL, ERROR, WARNING, INFO, DEBUG and TRACE. By default, the log server handles messages with the Info level.
CONFIG_PATH
Specifies the path to the configuration file of the log server.
RECV_CORE_LOGS
Enables collection of kernel logs.
WRITE_TO_CORE
Enables forwarding of logs to the kernel. Does not exclude forwarding of logs to the log server or further to the output channel. Required for printing logs to UART.
OUTPUT_CHANNELS
Connects one or more specified output channels to the server.
DENY_DYNAMIC_CONN_TYPES
Enables rejection of dynamic connections to the log server.
DENY_STATIC_CONN_TYPES
Enables rejection of static connections to the log server.

To add the LogrrServer program to a solution:

Edit the root file containing the CMake commands for building the solution or the file containing the CMake commands for building the Einit initializing program:

CMakeLists.txt

find_package (logrr_server REQUIRED COMPONENTS ENTITY) # ... set (TASKS # ... ${logrr_server_ENTITY}) # ... # Add the server that uses the output channel FsOutputChannel create_logrr_server( LOG_LEVEL DEBUG WRITE_TO_CORE ON OUTPUT_CHANNELS logrr.FsOutputChannel) # Adding a server and output channel to a solution list(APPEND ENTITIES logrr_server::default_entity logrr_fs_output_channel::default_entity) # Create static IPC channels for source programs to connect to the server connect_to_logrr_server (ENTITIES ClientOne) build_kos_qemu_image (kos-qemu-image CONNECTIONS_CFG ${INIT_YAML_FILE} SECURITY_PSL ${SECURITY_PSL_FILE} PACK_DEPS ON ${TASKS})

The PACK_DEPS option must be included when calling the build_kos_qemu_image() or build_kos_hw_image() command to include an automatic build of the libraries in the disk image.

Adding and configuring output channels

The command for creating and configuring the channel for printing logs to files create_logrr_fs_output_channel() may contain the following parameters:

CONFIG_PATH
Specifies the path to the configuration file of the output channel.
SERVER_TARGET
Specifies the log server to which the created output channel must connect.
APP_LOG_DIR
Specifies the directory for storing log files for programs. Required parameter.
SYS_LOG_DIR
Specifies the directory for storing system log files. If this parameter is not defined, system log files are not saved.

To add the FsOutputChannel to a solution:

Edit the root file containing the CMake commands for building the solution or the file containing the CMake commands for building the Einit initializing program:

CMakeLists.txt

find_package (logrr_fs_output_channel REQUIRED COMPONENTS ENTITY) # Add the FsOutputChannel that writes to the file create_logrr_fs_output_channel ( APP_LOG_DIR "/log/apps" SYS_LOG_DIR "/log/sys")

Creating IPC channels and allowing interaction between programs

The build system automatically creates IPC channels required for the log system to work, and generates a security policy description that allows interaction between processes.

To create a static connection to the log server, you can use the CMake command connect_to_logrr_server (ENTITIES <names_of_programs_to_connect>).