I have written a custom logger plugin for linux pl...
# general
k
I have written a custom logger plugin for linux platform. But when I perform a complete cmake build (cmake --build . -j10), it does not generate library for the logger plugin. Also, there are no errors in the build and osquery executables are generated successfully. (Followed the build steps as per : https://osquery.readthedocs.io/en/stable/development/building/#linux-ubuntu-18) I have added the following code to /plugins/logger/CMakeLists.txt : -------------------------------------
generatePluginsLoggerShhlogger()
function(generatePluginsLoggerShhlogger)
add_osquery_library(plugins_logger_shhlogger EXCLUDE_FROM_ALL
shh_logger_linux.cpp
)
enableLinkWholeArchive(plugins_logger_shhlogger)
target_link_libraries(plugins_logger_shhlogger PUBLIC
osquery_cxx_settings
plugins_logger_commondeps
osquery_filesystem
osquery_utils_config
osquery_utils_conversions
)
set(public_header_files
shh_logger_linux.h
)
generateIncludeNamespace(plugins_logger_shhlogger "plugins/logger" "FILE_ONLY" ${public_header_files})
endfunction()
------------------------------------ I have observed that, it does generate some cmake artifacts related to this plugin in the "build" folder. Eg: "/build/plugins/logger/CMakeFiles/plugins_logger_shhlogger.dir". But, the cmake build does not generate symbolic link for the header file "shh_logger_linux.h" under "build" folder. For eg, I was expecting following symlink to be generated: /build/ns_plugins_logger_shhlogger/plugins/logger/shh_logger_linux.h. But 'ns_plugins_logger_shhlogger' was not generated. However, other default logger plugins do generate such symlink, eg "tls" logger plugin generates (/build/ns_plugins_logger_tlslogger/plugins/logger/tls_logger.h). Somehow, the cmake build is not building this plugin. Does anybody have any suggestions to resolve this ? (PS: I have observed the same behavior with plugins_logger_windowseventlog. Though, it produces some artifacts in "/build/plugins/logger/CMakeFiles/", it does not get built) Thanks Kunal
s
Hello @Kunal, have you specified in CMake that the plugin should be linked against osquery? Otherwise it won’t get built and linked: https://github.com/osquery/osquery/blob/d2be385d71f401c85872f00d479df8f499164c5a/osquery/main/CMakeLists.txt#L55
k
Hello Stefano, No I had not done that. I will try this. Thanks for suggesting.