General
This OpenSync manager is responsible for storing system generated logs through syslogs framework in the file system through configurable target option of device flash, rampoos or both. The rotational attribute can also be configured through kconfig.
Northbound API
FM uses Node_Config/Node_State tables. This is currently the default:
root@caesar:~# ovsh s Node_State -T -w module==FM +-----------+-----------+---------------+--------+---------+--------------+ | _uuid | _version | key | module | persist | value | +-----------+-----------+---------------+--------+---------+--------------+ | 6efd~9cb8 | 7115~f9e0 | FMLOG_options | FM | true | ramoops_only | +-----------+-----------+---------------+--------+---------+--------------+ |
FMLOG_options can have values:
flash_ramoops - full means logging to flash and ramoops enabled;
flash_only - flash means logging to flash only;
ramoops_only - ramoops means logging to ramoops only;
off - logging disabled.
Southbound API
We can configure FM via Kconfig:
config MANAGER_FM_CFG string "FM Startup configuration" default "fm;true;needs_plan_b=true" help Flash Manager startup configuration config FM_LOG_FILE string "Name of the log file to rotate" default "messages" help Name of the base log file to rotate config FM_LOG_ROTATED_FILE string "Name of the rotated log file" default "messages.0" help Name of the rotated log file config FM_LOG_PATH string "Path where FM_LOG_PATH and FM_LOG_ROTATED_FILE are stored" default "/var/log" help Path to log files config FM_LOG_FLASH_ARCHIVE_PATH string "Path where to keep archived syslogs on flash" default "$(INSTALL_PREFIX)/log_archive" help Path where to keep archived syslogs on flash when logging to flash is enabled config FM_LOG_RAM_ARCHIVE_PATH string "Path where to keep archived syslogs on RAM" default "/var/log/opensync/log_archive" help Path where to keep archived syslogs on RAM when logging to RAM is enabled config FM_LOG_ARCHIVE_SUBDIRECTORY string "Subdirectory in the archive directory to store syslogs" default "syslog" help Subdirectory in the archive directory to store syslogs config FM_LOG_TO_RAMOOPS bool "Logging to ramoops" default y help Logging to RAMOOPS config FM_LOG_TO_FLASH bool "Logging to flash" default n help Logging to flash only config FM_RAMOOPS_BUFFER string "Default path to ramoops buffer" default "/dev/pmsg0" help Path to a secured userspace-accessible pstore object config FM_BT_PATH string "Default path for backtrace syslogs" default "/var/log/opensync/crash" help Path to a destination directory for backtrace syslogs config FM_LOG_CRASH_ARCHIVE_PATH string "Path where to keep archived syslogs on RAM" default "/var/log/opensync/log_archive/crash" help Path where to keep archived syslogs on RAM when logging to RAM is enabled config FM_MAX_ROTATION_SYSLOG_FLASH_CNT int "Maximum number of syslog files in flash" default 8 help Maximum number of rotated syslog files to keep in flash config FM_MAX_ROTATION_SYSLOG_RAM_CNT int "Maximum number of syslog files in RAM" default 8 help Maximum number of rotated syslog files to keep in RAM config FM_USE_PERSIST bool "Use persist state by default" default n help Use persist state to keep data with logging type config FM_LOG_PERSISTENT_STATE string "Path to file with log state" default "$(INSTALL_PREFIX)/log_archive/fm_state" help "Path to the file with log state info" config FM_CRASH_COUNT_PATH string "Default filepath for crash file count" default "/tmp/crash_count.txt" help Path to a file destination for crash file count config FM_CRASH_FILE_COUNT int "Maximum number of syslog crash files" default 100 help Maximum number of rotated crash syslog files to keep
Log Roatation
FM rotates syslogs by count: FM_MAX_ROTATION_SYSLOG_FLASH_CNT and FM_MAX_ROTATION_SYSLOG_RAM_CNT. The rotated syslogs will be placed in FM_LOG_FLASH_ARCHIVE_PATH and/or FM_LOG_RAM_ARCHIVE_PATH with log rotation number and timestamp in the name.
Crash syslogs
FM manages crash syslogs on device. Crash syslogs can be found in FM_BT_PATH and after crash log count will be more than FM_CRASH_FILE_COUNT all crash syslogs will be placed in tar archive in FM_LOG_CRASH_ARCHIVE_PATH and FM_BT_PATH will be cleared. Crash syslogs also will be cleared after logpull.
Requirements
None