Skip to content

Commit

Permalink
Remove logs-management plugin. (netdata#18186)
Browse files Browse the repository at this point in the history
It’s not been supported properly pretty much since it was introduced.
  • Loading branch information
Ferroin committed Jul 17, 2024
1 parent e908d3b commit 16750ea
Show file tree
Hide file tree
Showing 71 changed files with 7 additions and 13,958 deletions.
1 change: 0 additions & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ system/ @netdata/agent-sre
tests/ @netdata/agent-sre @vkalintiris
src/web/ @thiagoftsm @vkalintiris
src/web/gui/ @novykh
src/logsmanagement/ @thiagoftsm

# Ownership by filetype (overwrites ownership by directory)
*.md @Ancairon
Expand Down
6 changes: 0 additions & 6 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -289,9 +289,3 @@ area/web:
- changed-files:
- any-glob-to-any-file:
- src/web/**

area/logs-management:
- any:
- changed-files:
- any-glob-to-any-file:
- src/logsmanagement/**
2 changes: 1 addition & 1 deletion .github/scripts/pkg-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ esac
trap dump_log EXIT

export NETDATA_LIBEXEC_PREFIX=/usr/libexec/netdata
export NETDATA_SKIP_LIBEXEC_PARTS="logs-management|freeipmi|xenstat|nfacct|cups"
export NETDATA_SKIP_LIBEXEC_PARTS="freeipmi|xenstat|nfacct|cups"

if [ -n "${NETDATA_SKIP_EBPF}" ]; then
export NETDATA_SKIP_LIBEXEC_PARTS="${NETDATA_SKIP_LIBEXEC_PARTS}|ebpf"
Expand Down
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,6 @@ src/collectors/ioping.plugin/ioping.plugin
src/collectors/go.d.plugin
src/web/netdata-switch-dashboard.sh

src/logsmanagement/stress_test/stress_test

# installer generated files
/netdata-uninstaller.sh
/netdata-updater.sh
Expand Down
88 changes: 0 additions & 88 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ set(OS_FREEBSD False)
set(OS_LINUX False)
set(OS_MACOS False)
set(OS_WINDOWS False)
set(ALLOW_PLATFORM_SENSITIVE_OPTIONS True)

set(NETDATA_RUNTIME_PREFIX "${CMAKE_INSTALL_PREFIX}")
set(BINDIR usr/sbin)
Expand All @@ -107,11 +106,6 @@ elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
set(OS_LINUX True)
add_definitions(-D_GNU_SOURCE)
message(INFO " Compiling for Linux... ")
include(NetdataUtil)
netdata_identify_libc(LIBC_IMPLEMENTATION)
if(CMAKE_C_COMPILER_ID STREQUAL "Clang" AND LIBC_IMPLEMENTATION STREQUAL "musl")
set(ALLOW_PLATFORM_SENSITIVE_OPTIONS False)
endif()
elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "CYGWIN" OR "${CMAKE_SYSTEM_NAME}" STREQUAL "MSYS" OR "${CMAKE_SYSTEM_NAME}" STREQUAL "Windows")
set(OS_WINDOWS True)

Expand Down Expand Up @@ -170,7 +164,6 @@ cmake_dependent_option(ENABLE_PLUGIN_EBPF "Enable Linux eBPF metric collection"
cmake_dependent_option(ENABLE_LEGACY_EBPF_PROGRAMS "Enable eBPF programs for kernels without BTF support" True "ENABLE_PLUGIN_EBPF" False)
mark_as_advanced(ENABLE_LEGACY_EBPF_PROGRAMS)
cmake_dependent_option(ENABLE_PLUGIN_LOCAL_LISTENERS "Enable local listening socket tracking (including service auto-discovery support)" ${DEFAULT_FEATURE_STATE} "OS_LINUX" False)
cmake_dependent_option(ENABLE_PLUGIN_LOGS_MANAGEMENT "Enable log collection and monitoring based on Fluent Bit" False "OS_LINUX AND ALLOW_PLATFORM_SENSITIVE_OPTIONS" False)
cmake_dependent_option(ENABLE_PLUGIN_NETWORK_VIEWER "Enable network viewer functionality" ${DEFAULT_FEATURE_STATE} "OS_LINUX" False)
cmake_dependent_option(ENABLE_PLUGIN_NFACCT "Enable Linux NFACCT metric collection" ${DEFAULT_FEATURE_STATE} "OS_LINUX" False)
cmake_dependent_option(ENABLE_PLUGIN_PERF "Enable Linux performance counter monitoring" ${DEFAULT_FEATURE_STATE} "OS_LINUX" False)
Expand All @@ -187,10 +180,6 @@ option(ENABLE_BUNDLED_JSONC "Force use of a vendored copy of JSON-C" False)
option(ENABLE_BUNDLED_YAML "Force use of a vendored copy of libyaml" False)
option(ENABLE_BUNDLED_PROTOBUF "Use a vendored copy of protobuf" False)

# Optional test code
cmake_dependent_option(ENABLE_LOGS_MANAGEMENT_TESTS "Enable test code for logs-management plugin." True "ENABLE_PLUGIN_LOGS_MANAGEMENT" False)
mark_as_advanced(ENABLE_LOGS_MANAGEMENT_TESTS)

# Experimental features
option(ENABLE_WEBRTC "Enable WebRTC dashboard communications (experimental)" False)
mark_as_advanced(ENABLE_WEBRTC)
Expand Down Expand Up @@ -1355,44 +1344,6 @@ set(TC_PLUGIN_FILES
src/collectors/tc.plugin/plugin_tc.c
)

set(LOGS_MANAGEMENT_PLUGIN_FILES
src/logsmanagement/circular_buffer.c
src/logsmanagement/circular_buffer.h
src/logsmanagement/db_api.c
src/logsmanagement/db_api.h
src/logsmanagement/defaults.h
src/logsmanagement/file_info.h
src/logsmanagement/flb_plugin.c
src/logsmanagement/flb_plugin.h
src/logsmanagement/functions.c
src/logsmanagement/functions.h
src/logsmanagement/helper.h
src/logsmanagement/logsmanag_config.c
src/logsmanagement/logsmanag_config.h
src/logsmanagement/logsmanagement.c
src/logsmanagement/parser.c
src/logsmanagement/parser.h
src/logsmanagement/query.c
src/logsmanagement/query.h
src/logsmanagement/rrd_api/rrd_api_docker_ev.c
src/logsmanagement/rrd_api/rrd_api_docker_ev.h
src/logsmanagement/rrd_api/rrd_api_generic.c
src/logsmanagement/rrd_api/rrd_api_generic.h
src/logsmanagement/rrd_api/rrd_api_kernel.c
src/logsmanagement/rrd_api/rrd_api_kernel.h
src/logsmanagement/rrd_api/rrd_api_mqtt.c
src/logsmanagement/rrd_api/rrd_api_mqtt.h
src/logsmanagement/rrd_api/rrd_api_stats.c
src/logsmanagement/rrd_api/rrd_api_stats.h
src/logsmanagement/rrd_api/rrd_api_systemd.c
src/logsmanagement/rrd_api/rrd_api_systemd.h
src/logsmanagement/rrd_api/rrd_api_web_log.c
src/logsmanagement/rrd_api/rrd_api_web_log.h
src/logsmanagement/rrd_api/rrd_api.h
src/database/sqlite/sqlite3.c
src/database/sqlite/sqlite3.h
)

set(NETDATA_FILES
src/collectors/all.h
${DAEMON_FILES}
Expand Down Expand Up @@ -1934,45 +1885,6 @@ if(ENABLE_PLUGIN_SLABINFO)
endif()
endif()

if(ENABLE_PLUGIN_LOGS_MANAGEMENT)
set(ENABLE_LOGSMANAGEMENT True)

if(ENABLE_LOGS_MANAGEMENT_TESTS)
list(APPEND LOGS_MANAGEMENT_PLUGIN_FILES src/logsmanagement/unit_test/unit_test.c
src/logsmanagement/unit_test/unit_test.h)
set(ENABLE_LOGSMANAGEMENT_TESTS True)
endif()

add_executable(logs-management.plugin ${LOGS_MANAGEMENT_PLUGIN_FILES})
target_link_libraries(logs-management.plugin libnetdata)

install(TARGETS logs-management.plugin
COMPONENT plugin-logs-management
DESTINATION usr/libexec/netdata/plugins.d)

install(DIRECTORY src/logsmanagement/stock_conf/logsmanagement.d
COMPONENT plugin-logs-management
DESTINATION usr/lib/netdata/conf.d)

install(DIRECTORY
COMPONENT plugin-logs-management
DESTINATION etc/netdata/logsmanagement.d)

configure_file(src/logsmanagement/stock_conf/logsmanagement.d.conf.in
src/logsmanagement/stock_conf/logsmanagement.d.conf
@ONLY)

install(FILES ${CMAKE_BINARY_DIR}/src/logsmanagement/stock_conf/logsmanagement.d.conf
COMPONENT plugin-logs-management
DESTINATION usr/lib/netdata/conf.d)

if(BUILD_FOR_PACKAGING)
install(FILES
${PKG_FILES_PATH}/copyright
COMPONENT plugin-logs-management
DESTINATION usr/share/doc/netdata-plugin-logs-management)
endif()
endif()

if(ENABLE_PLUGIN_CUPS)
pkg_check_modules(CUPS libcups)
Expand Down
158 changes: 0 additions & 158 deletions netdata-installer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -240,8 +240,6 @@ USAGE: ${PROGRAM} [options]
have a broken pkg-config. Use this option to proceed without checking pkg-config.
--disable-telemetry Opt-out from our anonymous telemetry program. (DISABLE_TELEMETRY=1)
--skip-available-ram-check Skip checking the amount of RAM the system has and pretend it has enough to build safely.
--disable-logsmanagement Disable the logs management plugin. Default: autodetect.
--enable-logsmanagement-tests Enable the logs management tests. Default: disabled.
HEREDOC
}

Expand All @@ -260,8 +258,6 @@ ENABLE_DBENGINE=1
ENABLE_GO=1
ENABLE_H2O=1
ENABLE_CLOUD=1
ENABLE_LOGS_MANAGEMENT=1
ENABLE_LOGS_MANAGEMENT_TESTS=0
FORCE_LEGACY_CXX=0
NETDATA_CMAKE_OPTIONS="${NETDATA_CMAKE_OPTIONS-}"

Expand Down Expand Up @@ -318,9 +314,6 @@ while [ -n "${1}" ]; do
"--enable-lto")
# TODO: Needs CMake support
;;
"--enable-logs-management") ENABLE_LOGS_MANAGEMENT=1 ;;
"--disable-logsmanagement") ENABLE_LOGS_MANAGEMENT=0 ;;
"--enable-logsmanagement-tests") ENABLE_LOGS_MANAGEMENT_TESTS=1 ;;
"--disable-lto")
# TODO: Needs CMake support
;;
Expand Down Expand Up @@ -555,105 +548,6 @@ fi

trap build_error EXIT

# -----------------------------------------------------------------------------
build_fluentbit() {
env_cmd="env CFLAGS='-w' CXXFLAGS='-w' LDFLAGS="

if [ -z "${DONT_SCRUB_CFLAGS_EVEN_THOUGH_IT_MAY_BREAK_THINGS}" ]; then
env_cmd="env CFLAGS='-fPIC -pipe -w' CXXFLAGS='-fPIC -pipe -w' LDFLAGS="
fi

mkdir -p src/fluent-bit/build || return 1
cd src/fluent-bit/build > /dev/null || return 1

rm CMakeCache.txt > /dev/null 2>&1

if ! run eval "${env_cmd} $1 -C ../../logsmanagement/fluent_bit_build/config.cmake -B./ -S../"; then
cd - > /dev/null || return 1
rm -rf src/fluent-bit/build > /dev/null 2>&1
return 1
fi

if ! run eval "${env_cmd} ${make} ${MAKEOPTS}"; then
cd - > /dev/null || return 1
rm -rf src/fluent-bit/build > /dev/null 2>&1
return 1
fi

cd - > /dev/null || return 1
}

detect_libc() {
libc=
if ldd --version 2>&1 | grep -q -i glibc; then
echo >&2 " Detected GLIBC"
libc="glibc"
elif ldd --version 2>&1 | grep -q -i 'gnu libc'; then
echo >&2 " Detected GLIBC"
libc="glibc"
elif ldd --version 2>&1 | grep -q -i musl; then
echo >&2 " Detected musl"
libc="musl"
else
cmd=$(ldd /bin/sh | grep -w libc | cut -d" " -f 3)
if bash -c "${cmd}" 2>&1 | grep -q -i "GNU C Library"; then
echo >&2 " Detected GLIBC"
libc="glibc"
fi
fi

if [ -z "$libc" ]; then
warning "Cannot detect a supported libc on your system, eBPF support will be disabled."
return 1
fi

echo "${libc}"
}

bundle_fluentbit() {
progress "Prepare Fluent-Bit"

if [ "${ENABLE_LOGS_MANAGEMENT}" = 0 ]; then
warning "You have explicitly requested to disable Netdata Logs Management support, Fluent-Bit build is skipped."
return 0
fi

if [ ! -d "src/fluent-bit" ]; then
warning "Missing submodule Fluent-Bit. The install process will continue, but Netdata Logs Management support will be disabled."
ENABLE_LOGS_MANAGEMENT=0
return 0
fi

patch -N -p1 src/fluent-bit/CMakeLists.txt -i src/logsmanagement/fluent_bit_build/CMakeLists.patch
patch -N -p1 src/fluent-bit/src/flb_log.c -i src/logsmanagement/fluent_bit_build/flb-log-fmt.patch

# If musl is used, we need to patch chunkio, providing fts has been previously installed.
libc="$(detect_libc)"
if [ "${libc}" = "musl" ]; then
patch -N -p1 src/fluent-bit/lib/chunkio/src/CMakeLists.txt -i src/logsmanagement/fluent_bit_build/chunkio-static-lib-fts.patch
patch -N -p1 src/fluent-bit/cmake/luajit.cmake -i src/logsmanagement/fluent_bit_build/exclude-luajit.patch
patch -N -p1 src/fluent-bit/src/flb_network.c -i src/logsmanagement/fluent_bit_build/xsi-strerror.patch
fi

[ -n "${GITHUB_ACTIONS}" ] && echo "::group::Bundling Fluent-Bit."

if build_fluentbit "$cmake"; then
# If Fluent-Bit built with inotify support, use it.
if [ "$(grep -o '^FLB_HAVE_INOTIFY:INTERNAL=.*' src/fluent-bit/build/CMakeCache.txt | cut -d '=' -f 2)" ]; then
CFLAGS="${CFLAGS} -DFLB_HAVE_INOTIFY"
fi
FLUENT_BIT_BUILD_SUCCESS=1
run_ok "Fluent-Bit built successfully."
else
warning "Failed to build Fluent-Bit, Netdata Logs Management support will be disabled in this build."
ENABLE_LOGS_MANAGEMENT=0
fi

[ -n "${GITHUB_ACTIONS}" ] && echo "::endgroup::"
}

bundle_fluentbit

# -----------------------------------------------------------------------------
# If we’re installing the Go plugin, ensure a working Go toolchain is installed.
if [ "${ENABLE_GO}" -eq 1 ]; then
Expand Down Expand Up @@ -965,21 +859,6 @@ if [ "$(id -u)" -eq 0 ]; then
fi
fi

if [ -f "${NETDATA_PREFIX}/usr/libexec/netdata/plugins.d/logs-management.plugin" ]; then
run chown "root:${NETDATA_GROUP}" "${NETDATA_PREFIX}/usr/libexec/netdata/plugins.d/logs-management.plugin"
capabilities=0
if ! iscontainer && command -v setcap 1> /dev/null 2>&1; then
run chmod 0750 "${NETDATA_PREFIX}/usr/libexec/netdata/plugins.d/logs-management.plugin"
if run setcap cap_dac_read_search,cap_syslog+ep "${NETDATA_PREFIX}/usr/libexec/netdata/plugins.d/logs-management.plugin"; then
capabilities=1
fi
fi

if [ $capabilities -eq 0 ]; then
run chmod 4750 "${NETDATA_PREFIX}/usr/libexec/netdata/plugins.d/logs-management.plugin"
fi
fi

if [ -f "${NETDATA_PREFIX}/usr/libexec/netdata/plugins.d/perf.plugin" ]; then
run chown "root:${NETDATA_GROUP}" "${NETDATA_PREFIX}/usr/libexec/netdata/plugins.d/perf.plugin"
capabilities=0
Expand Down Expand Up @@ -1086,43 +965,6 @@ fi

[ -n "${GITHUB_ACTIONS}" ] && echo "::endgroup::"

should_install_fluentbit() {
if [ "$(uname -s)" = "Darwin" ]; then
return 1
fi
if [ "${ENABLE_LOGS_MANAGEMENT}" = 0 ]; then
warning "netdata-installer.sh run with --disable-logsmanagement, Fluent-Bit installation is skipped."
return 1
elif [ "${FLUENT_BIT_BUILD_SUCCESS:=0}" -eq 0 ]; then
run_failed "Fluent-Bit was not built successfully, Netdata Logs Management support will be disabled in this build."
return 1
elif [ ! -f src/fluent-bit/build/lib/libfluent-bit.so ]; then
run_failed "libfluent-bit.so is missing, Netdata Logs Management support will be disabled in this build."
return 1
fi

return 0
}

install_fluentbit() {
if ! should_install_fluentbit; then
enable_feature PLUGIN_LOGS_MANAGEMENT 0
return 0
fi

[ -n "${GITHUB_ACTIONS}" ] && echo "::group::Installing Fluent-Bit."

run chown "root:${NETDATA_GROUP}" src/fluent-bit/build/lib
run chmod 0644 src/fluent-bit/build/lib/libfluent-bit.so

run cp -a -v src/fluent-bit/build/lib/libfluent-bit.so "${NETDATA_PREFIX}"/usr/lib/netdata

[ -n "${GITHUB_ACTIONS}" ] && echo "::endgroup::"
}

progress "Installing Fluent-Bit plugin"
install_fluentbit

# -----------------------------------------------------------------------------
progress "Telemetry configuration"

Expand Down
Loading

0 comments on commit 16750ea

Please sign in to comment.