diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 3cd911ce4b..ca59fb2811 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -247,7 +247,7 @@ jobs: - name: Build run: | mkdir -p build - cd build && cmake -Wno-dev -DBUILD_DRIVER=OFF .. + cd build && cmake -Wno-dev .. cmake --build . --target package --config Release - name: Upload artifacts uses: actions/upload-artifact@v3 diff --git a/cmake/modules/driver.cmake b/cmake/modules/driver.cmake index a6665be0ed..3cfa7d7335 100644 --- a/cmake/modules/driver.cmake +++ b/cmake/modules/driver.cmake @@ -31,8 +31,8 @@ else() # In case you want to test against another driver version (or branch, or commit) just pass the variable - # ie., `cmake -DDRIVER_VERSION=dev ..` if(NOT DRIVER_VERSION) - set(DRIVER_VERSION "6.0.1+driver") - set(DRIVER_CHECKSUM "SHA256=2b4412b5053c8ed5bd1a9de745faa16ec0210dc65dc858af65951d4c8d22207c") + set(DRIVER_VERSION "ace53901af1aae25365b1302c0fa7c7ed69821ea") + set(DRIVER_CHECKSUM "SHA256=80e04cc3400b3b8e22bddad6b663adff311ab51a19b04baee1e49b06d3860c00") endif() # cd /path/to/build && cmake /path/to/source diff --git a/cmake/modules/falcosecurity-libs.cmake b/cmake/modules/falcosecurity-libs.cmake index 2e3f84f67d..837c7fc22f 100644 --- a/cmake/modules/falcosecurity-libs.cmake +++ b/cmake/modules/falcosecurity-libs.cmake @@ -32,8 +32,8 @@ else() # In case you want to test against another falcosecurity/libs version (or branch, or commit) just pass the variable - # ie., `cmake -DFALCOSECURITY_LIBS_VERSION=dev ..` if(NOT FALCOSECURITY_LIBS_VERSION) - set(FALCOSECURITY_LIBS_VERSION "0.13.1") - set(FALCOSECURITY_LIBS_CHECKSUM "SHA256=2be42a27be3ffe6bd7e53eaa5d8358cab05a0dca821819c6e9059e51b9786219") + set(FALCOSECURITY_LIBS_VERSION "ace53901af1aae25365b1302c0fa7c7ed69821ea") + set(FALCOSECURITY_LIBS_CHECKSUM "SHA256=80e04cc3400b3b8e22bddad6b663adff311ab51a19b04baee1e49b06d3860c00") endif() # cd /path/to/build && cmake /path/to/source diff --git a/cmake/modules/tinydir-internal.cmake b/cmake/modules/tinydir-internal.cmake deleted file mode 100644 index 8a01f0cc8d..0000000000 --- a/cmake/modules/tinydir-internal.cmake +++ /dev/null @@ -1,49 +0,0 @@ -# -# Copyright (C) 2023 The Falco Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the -# specific language governing permissions and limitations under the License. -# - -# -# Tinydir (https://github.com/cxong/tinydir/) -# - -option(USE_BUNDLED_TINYDIR "Enable building of the bundled tinydir" ${USE_BUNDLED_DEPS}) - -if(TINYDIR_INCLUDE) - # we already have tinydir - message(STATUS "Using tinydir: include: ${TINYDIR_INCLUDE}") -elseif(NOT USE_BUNDLED_TINYDIR) - find_path(TINYDIR_INCLUDE tinydir.h) - if(TINYDIR_INCLUDE) - message(STATUS "Found tinydir: include: ${TINYDIR_INCLUDE}") - else() - message(FATAL_ERROR "Couldn't find system tinydir") - endif() -else() - set(TINYDIR_SRC "${PROJECT_BINARY_DIR}/tinydir-prefix/src/tinydir") - set(TINYDIR_INCLUDE "${TINYDIR_SRC}") - - message(STATUS "Using bundled tinydir in '${TINYDIR_SRC}'") - - ExternalProject_Add(tinydir-internal - PREFIX "${PROJECT_BINARY_DIR}/tinydir-prefix" - URL "https://github.com/cxong/tinydir/archive/refs/tags/1.2.5.tar.gz" - URL_HASH "SHA256=7ab150a16fa78ea76e9fd58ef88922c03eca2334c023b8d9bc94755fdde522c7" - CONFIGURE_COMMAND "" - BUILD_COMMAND "" - INSTALL_COMMAND "") -endif() - -if(NOT TARGET tinydir-internal) - add_custom_target(tinydir-internal) -endif() - -include_directories("${TINYDIR_INCLUDE}") diff --git a/userspace/sinspui/cursescomponents.cpp b/userspace/sinspui/cursescomponents.cpp index 6d0ecf77db..7af505e3cf 100644 --- a/userspace/sinspui/cursescomponents.cpp +++ b/userspace/sinspui/cursescomponents.cpp @@ -67,7 +67,6 @@ spy_text_renderer::spy_text_renderer(sinsp* inspector, m_inspector = inspector; m_viz_type = viz_type; m_linecnt = 0; - g_filterchecks_force_raw_times = false; // // visualization-type inits @@ -89,21 +88,6 @@ spy_text_renderer::spy_text_renderer(sinsp* inspector, s_filterlist); } } - else if(sotype == spy_text_renderer::OT_LATENCY_APP) - { - if(print_containers) - { - m_formatter = new sinsp_evt_formatter(m_inspector, - "*(latency=%tracer.latency.human) %evt.num %evt.time %evt.cpu %container.name (%container.id) %proc.name (%thread.tid:%thread.vtid) %evt.dir %evt.type %evt.info", - s_filterlist); - } - else - { - m_formatter = new sinsp_evt_formatter(m_inspector, - "*(latency=%tracer.latency.human) %evt.num %evt.time %evt.cpu %proc.name %thread.tid %evt.dir %evt.type %evt.info", - s_filterlist); - } - } else { if(print_containers) diff --git a/userspace/sinspui/cursesspectro.cpp b/userspace/sinspui/cursesspectro.cpp index 4c246ba548..dd3dec2851 100644 --- a/userspace/sinspui/cursesspectro.cpp +++ b/userspace/sinspui/cursesspectro.cpp @@ -123,7 +123,7 @@ inline void ansi_clearscreen() /////////////////////////////////////////////////////////////////////////////// // curses_spectro implementation /////////////////////////////////////////////////////////////////////////////// -curses_spectro::curses_spectro(sinsp_cursesui* parent, sinsp* inspector, bool is_tracer) +curses_spectro::curses_spectro(sinsp_cursesui* parent, sinsp* inspector) { m_tblwin = NULL; m_data = NULL; @@ -147,7 +147,6 @@ curses_spectro::curses_spectro(sinsp_cursesui* parent, sinsp* inspector, bool is m_prev_sel_y1 = -1; m_prev_sel_y2 = -1; m_scroll_paused = false; - m_is_tracer = is_tracer; m_selecting = false; // @@ -512,22 +511,11 @@ chisel_table_action curses_spectro::handle_input(int ch) break; } - string lat_fld_name; - - if(m_is_tracer) - { - lat_fld_name = "span.duration"; - } - else - { - lat_fld_name = "evt.latency"; - } - - m_selection_filter = + m_selection_filter = "(evt.rawtime>=" + to_string(start_row->m_ts - m_table->m_refresh_interval_ns) + " and evt.rawtime<=" + to_string(end_row->m_ts) + - ") and (" + lat_fld_name + ">=" + to_string(start_latency) + - " and " + lat_fld_name + "<" + to_string(end_latency) + ")"; + ") and (evt.latency>=" + to_string(start_latency) + + " and evt.latency<" + to_string(end_latency) + ")"; g_logger.format("spectrogram drill down"); g_logger.format("filter: %s", m_selection_filter.c_str()); @@ -537,14 +525,7 @@ chisel_table_action curses_spectro::handle_input(int ch) ansi_reset_color(); - if(m_is_tracer) - { - return STA_DRILLDOWN; - } - else - { - return STA_DIG; - } + return STA_DIG; } } } diff --git a/userspace/sinspui/cursesspectro.h b/userspace/sinspui/cursesspectro.h index 2ddb5cc3b5..a1739de979 100644 --- a/userspace/sinspui/cursesspectro.h +++ b/userspace/sinspui/cursesspectro.h @@ -60,7 +60,7 @@ class curses_spectro : ALIGN_RIGHT, }; - curses_spectro(sinsp_cursesui* parent, sinsp* inspector, bool is_tracer); + curses_spectro(sinsp_cursesui* parent, sinsp* inspector); ~curses_spectro(); void configure(chisel_table* table); @@ -127,7 +127,6 @@ class curses_spectro : int32_t m_selstart_x, m_selstart_y; int32_t m_prev_sel_x1, m_prev_sel_x2; int32_t m_prev_sel_y1, m_prev_sel_y2; - bool m_is_tracer; bool m_selecting; friend class curses_spectro_sidemenu; diff --git a/userspace/sinspui/cursestable.cpp b/userspace/sinspui/cursestable.cpp index 4ffb82da8e..7059d27b85 100644 --- a/userspace/sinspui/cursestable.cpp +++ b/userspace/sinspui/cursestable.cpp @@ -280,43 +280,26 @@ glogf("2, %d %s\n", spos, ss.c_str()); void curses_table::print_wait() { string wstr; - bool is_tracer_view = false; chisel_view_info* vinfo = m_parent->get_selected_view(); - if(vinfo) - { - if(vinfo->m_id == "tracers" || - vinfo->m_id == "tracer_ids") - { - is_tracer_view = true; - } - } - else + if(!vinfo) { ASSERT(false); } - if(is_tracer_view) + if(m_inspector->is_live()) { - print_line_centered("No data for this view."); - print_line_centered("Note: in order to see any data here, you need to push tracers to sysdig from your app as described here: XXX.", 2); + wstr = "Collecting Data"; } else { - if(m_inspector->is_live()) - { - wstr = "Collecting Data"; - } - else + if(m_parent->is_eof()) { - if(m_parent->is_eof()) - { - wstr = "No Data For This View"; - } + wstr = "No Data For This View"; } - - print_line_centered(wstr); } + + print_line_centered(wstr); } void curses_table::print_error(string wstr) diff --git a/userspace/sinspui/cursesui.cpp b/userspace/sinspui/cursesui.cpp index 34efc51c9f..1afe7eb07e 100644 --- a/userspace/sinspui/cursesui.cpp +++ b/userspace/sinspui/cursesui.cpp @@ -36,8 +36,8 @@ limitations under the License. #include "ctext.h" #include "cursesui.h" -extern int32_t g_screen_w; -extern bool g_filterchecks_force_raw_times; +int32_t g_screen_w; +bool g_filterchecks_force_raw_times; using namespace std; @@ -275,11 +275,6 @@ sinsp_cursesui::sinsp_cursesui(sinsp* inspector, m_json_spy_renderer = NULL; m_json_spy_text_fmt = json_spy_text_fmt; - if(output_type == chisel_table::OT_JSON) - { - g_filterchecks_force_raw_times = true; - } - #ifndef NOCURSESUI m_viz = NULL; m_spectro = NULL; @@ -677,9 +672,7 @@ void sinsp_cursesui::start(bool is_drilldown, bool is_spy_switch) if(wi != NULL && wi->m_type == chisel_view_info::T_SPECTRO) { ASSERT(ty == chisel_table::TT_TABLE); - m_spectro = new curses_spectro(this, - m_inspector, - m_views.at(m_selected_view)->m_id == "spectro_traces"); + m_spectro = new curses_spectro(this, m_inspector); m_viz = NULL; m_chart = m_spectro; } @@ -1874,10 +1867,7 @@ bool sinsp_cursesui::do_drilldown(string field, string val, if(m_views.at(m_selected_view)->m_drilldown_increase_depth) { - if(m_views.at(new_view_num)->m_id != "spectro_tracers") - { - m_view_depth++; - } + m_view_depth++; } string vfilter; @@ -1996,20 +1986,13 @@ bool sinsp_cursesui::spectro_selection(string field, string val, uint32_t j = 0; string spectro_name; - if(m_views.at(m_selected_view)->m_spectro_type == "tracers") - { - spectro_name = "spectro_traces"; - } - else - { - if(ta == STA_SPECTRO) - { - spectro_name = "spectro_all"; - } - else - { - spectro_name = "spectro_file"; - } + if(ta == STA_SPECTRO) + { + spectro_name = "spectro_all"; + } + else + { + spectro_name = "spectro_file"; } for(j = 0; j < m_views.size(); ++j) @@ -2042,12 +2025,6 @@ bool sinsp_cursesui::drillup() sinsp_ui_selection_info* psinfo = NULL; sinsp_ui_selection_info* sinfo = m_sel_hierarchy.at(m_sel_hierarchy.size() - 1); - bool is_spctro_app = false; - - if(m_selected_view > 0 && m_views.at(m_selected_view)->m_id == "spectro_tracers") - { - is_spctro_app = true; - } m_manual_filter = ""; @@ -2062,8 +2039,7 @@ bool sinsp_cursesui::drillup() m_selected_view = sinfo->m_prev_selected_view; m_selected_view_sidemenu_entry = sinfo->m_prev_selected_sidemenu_entry; - if(m_views.at(m_selected_view)->m_drilldown_increase_depth && - !is_spctro_app) + if(m_views.at(m_selected_view)->m_drilldown_increase_depth) { if(sinfo != NULL && sinfo->m_is_drilldown) { diff --git a/userspace/sysdig/CMakeLists.txt b/userspace/sysdig/CMakeLists.txt index ac6056211c..99da7a3f96 100644 --- a/userspace/sysdig/CMakeLists.txt +++ b/userspace/sysdig/CMakeLists.txt @@ -22,7 +22,7 @@ endif() # NOT WIN32 include(libscap) include(libsinsp) -include(tinydir-internal) +include(zlib) include_directories("${LIBSINSP_INCLUDE_DIRS}") include_directories("${PROJECT_BINARY_DIR}/userspace/sinspui") @@ -122,6 +122,8 @@ if(NOT WIN32) else() include(luajit) + add_definitions(-DNOCURSESUI) + target_link_libraries(sysdig sinsp "${YAMLCPP_LIB}") diff --git a/userspace/sysdig/chisels/flame.lua b/userspace/sysdig/chisels/flame.lua index 4e087e4b75..7f4724080f 100644 --- a/userspace/sysdig/chisels/flame.lua +++ b/userspace/sysdig/chisels/flame.lua @@ -91,6 +91,10 @@ end -- Initialization callback function on_init() + print("This chisel uses tracers and is deprecated.") + require ("os") + os.exit() + -- Request the fields needed for this chisel for j = 0, MAX_DEPTH do local fname = "span.tag[" .. j .. "]" diff --git a/userspace/sysdig/chisels/tracers_2_statsd.lua b/userspace/sysdig/chisels/tracers_2_statsd.lua index c1a840eb42..9309a5b311 100644 --- a/userspace/sysdig/chisels/tracers_2_statsd.lua +++ b/userspace/sysdig/chisels/tracers_2_statsd.lua @@ -57,6 +57,10 @@ end -- Initialization callback function on_init() + print("This chisel uses tracers and is deprecated") + require ("os") + os.exit() + -- Initialize statsd statsd = lstatsd({host = "127.0.0.1"}) diff --git a/userspace/sysdig/chisels/v_spans_list.lua b/userspace/sysdig/chisels/v_spans_list.lua index 288279e550..1f57589475 100644 --- a/userspace/sysdig/chisels/v_spans_list.lua +++ b/userspace/sysdig/chisels/v_spans_list.lua @@ -77,3 +77,9 @@ view_info = }, } } + +function on_init() + print("This chisel uses tracers and is deprecated.") + require ("os") + os.exit() +end diff --git a/userspace/sysdig/chisels/v_spans_summary.lua b/userspace/sysdig/chisels/v_spans_summary.lua index b39690ddbf..e6df86e0d4 100644 --- a/userspace/sysdig/chisels/v_spans_summary.lua +++ b/userspace/sysdig/chisels/v_spans_summary.lua @@ -86,3 +86,9 @@ view_info = }, } } + +function on_init() + print("This chisel uses tracers and is deprecated.") + require ("os") + os.exit() +end diff --git a/userspace/sysdig/chisels/v_spectro_traces.lua b/userspace/sysdig/chisels/v_spectro_traces.lua index 4483bcd0be..799c64b335 100644 --- a/userspace/sysdig/chisels/v_spectro_traces.lua +++ b/userspace/sysdig/chisels/v_spectro_traces.lua @@ -52,3 +52,9 @@ view_info = } } } + +function on_init() + print("This chisel uses tracers and is deprecated.") + require ("os") + os.exit() +end diff --git a/userspace/sysdig/chisels/v_traces_list.lua b/userspace/sysdig/chisels/v_traces_list.lua index e0fcf0890f..2cf263ae7c 100644 --- a/userspace/sysdig/chisels/v_traces_list.lua +++ b/userspace/sysdig/chisels/v_traces_list.lua @@ -78,3 +78,9 @@ view_info = }, } } + +function on_init() + print("This chisel uses tracers and is deprecated.") + require ("os") + os.exit() +end diff --git a/userspace/sysdig/chisels/v_traces_summary.lua b/userspace/sysdig/chisels/v_traces_summary.lua index f6308d7a06..1e1bab082c 100644 --- a/userspace/sysdig/chisels/v_traces_summary.lua +++ b/userspace/sysdig/chisels/v_traces_summary.lua @@ -87,3 +87,9 @@ view_info = }, } } + +function on_init() + print("This chisel uses tracers and is deprecated.") + require ("os") + os.exit() +end diff --git a/userspace/sysdig/csysdig.cpp b/userspace/sysdig/csysdig.cpp index 75a4d6e926..68f077fe99 100644 --- a/userspace/sysdig/csysdig.cpp +++ b/userspace/sysdig/csysdig.cpp @@ -151,15 +151,15 @@ static void usage() " -h, --help Print this page\n" #ifndef MINIMAL_BUILD " -k , --k8s-api=\n" -" Enable Kubernetes support by connecting to the API server\n" +" [DEPRECATED] Enable Kubernetes support by connecting to the API server\n" " specified as argument. E.g. \"http://admin:password@127.0.0.1:8080\".\n" " The API server can also be specified via the environment variable\n" " SYSDIG_K8S_API.\n" " --node-name=\n" -" The node name is used as a filter when requesting metadata of pods\n" +" [DEPRECATED] The node name is used as a filter when requesting metadata of pods\n" " to the API server; if empty, no filter is set\n" " -K | :[:], --k8s-api-cert= | :[:]\n" -" Use the provided files names to authenticate user and (optionally) verify the K8S API\n" +" [DEPRECATED] Use the provided files names to authenticate user and (optionally) verify the K8S API\n" " server identity.\n" " Each entry must specify full (absolute, or relative to the current directory) path\n" " to the respective file.\n" @@ -198,7 +198,7 @@ static void usage() " By default, the first 80 bytes are captured. Use this\n" " option with caution, it can generate huge trace files.\n" " -T, --force-tracers-capture\n" -" Tell the driver to make sure full buffers are captured from\n" +" [DEPRECATED] Tell the driver to make sure full buffers are captured from\n" " /dev/null, to make sure that tracers are completely\n" " captured. Note that sysdig will enable extended /dev/null\n" " capture by itself after detecting that tracers are written\n" @@ -382,13 +382,11 @@ sysdig_init_res csysdig_init(int argc, char **argv) chisel_table::output_type output_type = chisel_table::OT_JSON; #endif #ifndef MINIMAL_BUILD - std::string* k8s_api = 0; - std::string* node_name = 0; - std::string* k8s_api_cert = 0; - std::string* mesos_api = 0; + bool k8s = false; + bool mesos = false; #endif // MINIMAL_BUILD + bool tracers = false; bool terminal_with_mouse = false; - bool force_tracers_capture = false; bool force_term_compat = false; sinsp_evt::param_fmt event_buffer_format = sinsp_evt::PF_NORMAL; plugin_utils plugins; @@ -410,11 +408,6 @@ sysdig_init_res csysdig_init(int argc, char **argv) {"exclude-users", no_argument, 0, 'E' }, {"from", required_argument, 0, 0 }, {"help", no_argument, 0, 'h' }, -#ifndef MINIMAL_BUILD - {"k8s-api", required_argument, 0, 'k'}, - {"node-name", required_argument, 0, 'N'}, - {"k8s-api-cert", required_argument, 0, 'K' }, -#endif // MINIMAL_BUILD {"json", no_argument, 0, 'j' }, {"interactive", optional_argument, 0, 0 }, {"large-environment", no_argument, 0, 0 }, @@ -515,13 +508,16 @@ sysdig_init_res csysdig_init(int argc, char **argv) return sysdig_init_res(EXIT_SUCCESS); #ifndef MINIMAL_BUILD case 'k': - k8s_api = new std::string(optarg); + //TODO(therealbobo): remove this on 0.36.0 + k8s = true; break; case 'N': - node_name = new std::string(optarg); + //TODO(therealbobo): remove this on 0.36.0 + k8s = true; break; case 'K': - k8s_api_cert = new std::string(optarg); + //TODO(therealbobo): remove this on 0.36.0 + k8s = true; break; #endif // MINIMAL_BUILD case 'j': @@ -532,7 +528,8 @@ sysdig_init_res csysdig_init(int argc, char **argv) break; #ifndef MINIMAL_BUILD case 'm': - mesos_api = new std::string(optarg); + //TODO(therealbobo): remove this on 0.36.0 + mesos = true; break; #endif // MINIMAL_BUILD case 'n': @@ -565,16 +562,13 @@ sysdig_init_res csysdig_init(int argc, char **argv) break; case 'r': infiles.push_back(optarg); -#ifndef MINIMAL_BUILD - k8s_api = new std::string(); - mesos_api = new std::string(); -#endif // MINIMAL_BUILD break; case 's': snaplen = atoi(optarg); break; case 'T': - force_tracers_capture = true; + //TODO(therealbobo): remove this on 0.36.0 + tracers = true; break; case 'v': display_view = optarg; @@ -927,72 +921,35 @@ sysdig_init_res csysdig_init(int argc, char **argv) inspector->set_snaplen(snaplen); } - // - // If required, tell the driver to enable tracers capture - // - if(force_tracers_capture) - { - inspector->enable_tracers_capture(); - } - #ifndef MINIMAL_BUILD // // run k8s, if required // - if(k8s_api) + if (k8s || getenv("SYSDIG_K8S_API") != NULL || + getenv("SYSDIG_K8S_API_CERT") != NULL) { - if(!k8s_api_cert) - { - if(char* k8s_cert_env = getenv("SYSDIG_K8S_API_CERT")) - { - k8s_api_cert = new std::string(k8s_cert_env); - } - } - inspector->init_k8s_client(k8s_api, k8s_api_cert, node_name); - k8s_api = 0; - k8s_api_cert = 0; - } - else if(char* k8s_api_env = getenv("SYSDIG_K8S_API")) - { - if(k8s_api_env != NULL) - { - if(!k8s_api_cert) - { - if(char* k8s_cert_env = getenv("SYSDIG_K8S_API_CERT")) - { - k8s_api_cert = new std::string(k8s_cert_env); - } - } - k8s_api = new std::string(k8s_api_env); - inspector->init_k8s_client(k8s_api, k8s_api_cert, node_name); - } - else - { - delete k8s_api; - delete k8s_api_cert; - } - k8s_api = 0; - k8s_api_cert = 0; + throw sinsp_exception(std::string("the k8s client is deprecated!")); + res.m_res = EXIT_FAILURE; + goto exit; } // // run mesos, if required // - if(mesos_api) + if(mesos || getenv("SYSDIG_MESOS_API") != NULL) { - inspector->init_mesos_client(mesos_api); + throw sinsp_exception(std::string("the mesos client is deprecated!")); + res.m_res = EXIT_FAILURE; + goto exit; } - else if(char* mesos_api_env = getenv("SYSDIG_MESOS_API")) +#endif // MINIMAL_BUILD + + if(tracers) { - if(mesos_api_env != NULL) - { - mesos_api = new std::string(mesos_api_env); - inspector->init_mesos_client(mesos_api); - } + throw sinsp_exception(std::string("tracers are deprecated!")); + res.m_res = EXIT_FAILURE; + goto exit; } - delete mesos_api; - mesos_api = 0; -#endif // MINIMAL_BUILD if(output_type == chisel_table::OT_JSON) { diff --git a/userspace/sysdig/sysdig.cpp b/userspace/sysdig/sysdig.cpp index af02475128..fd975321bc 100644 --- a/userspace/sysdig/sysdig.cpp +++ b/userspace/sysdig/sysdig.cpp @@ -242,15 +242,15 @@ static void usage() " print format selected.\n" #ifndef MINIMAL_BUILD " -k , --k8s-api=\n" -" Enable Kubernetes support by connecting to the API server\n" +" [DEPRECATED] Enable Kubernetes support by connecting to the API server\n" " specified as argument. E.g. \"http://admin:password@127.0.0.1:8080\".\n" " The API server can also be specified via the environment variable\n" " SYSDIG_K8S_API.\n" " --node-name=\n" -" The node name is used as a filter when requesting metadata of pods\n" +" [DEPRECATED] The node name is used as a filter when requesting metadata of pods\n" " to the API server; if empty, no filter is set\n" " -K | :[:], --k8s-api-cert= | :[:]\n" -" Use the provided files names to authenticate user and (optionally) verify the K8S API\n" +" [DEPRECATED] Use the provided files names to authenticate user and (optionally) verify the K8S API\n" " server identity.\n" " Each entry must specify full (absolute, or relative to the current directory) path\n" " to the respective file.\n" @@ -277,7 +277,7 @@ static void usage() " Select log level. Useful together with --debug.\n" " --list-markdown like -l, but produces markdown output\n" " -m , --mesos-api=\n" -" Enable Mesos support by connecting to the API server\n" +" [DEPRECATED] Enable Mesos support by connecting to the API server\n" " specified as argument. E.g. \"http://admin:password@127.0.0.1:5050\".\n" " Marathon url is optional and defaults to Mesos address, port 8080.\n" " The API servers can also be specified via the environment variable\n" @@ -299,8 +299,8 @@ static void usage() " -p , --print=\n" " Specify the format to be used when printing the events.\n" " With -pc or -pcontainer will use a container-friendly format.\n" -" With -pk or -pkubernetes will use a kubernetes-friendly format.\n" -" With -pm or -pmesos will use a mesos-friendly format.\n" +" [DEPRECATED] With -pk or -pkubernetes will use a kubernetes-friendly format.\n" +" [DEPRECATED] With -pm or -pmesos will use a mesos-friendly format.\n" " See the examples section below for more info.\n" " --plugin-info \n" " Print info for a single plugin. This includes name, author,\n" @@ -330,7 +330,7 @@ static void usage() " capture, d for delta between event enter and exit, and\n" " D for delta from the previous event.\n" " -T, --force-tracers-capture\n" -" Tell the driver to make sure full buffers are captured from\n" +" [DEPRECATED] Tell the driver to make sure full buffers are captured from\n" " /dev/null, to make sure that tracers are completely\n" " captured. Note that sysdig will enable extended /dev/null\n" " capture by itself after detecting that tracers are written\n" @@ -385,9 +385,9 @@ static void usage() "fields listed by 'sysdig -l'.\n\n" "Using -pc or -pcontainer, the default format will be changed to a container-friendly one:\n\n" "%%evt.num %%evt.outputtime %%evt.cpu %%container.name (%%container.id) %%proc.name (%%thread.tid:%%thread.vtid) %%evt.dir %%evt.type %%evt.info\n\n" -"Using -pk or -pkubernetes, the default format will be changed to a kubernetes-friendly one:\n\n" +"[DEPRECATED] Using -pk or -pkubernetes, the default format will be changed to a kubernetes-friendly one:\n\n" "%%evt.num %%evt.outputtime %%evt.cpu %%k8s.pod.name (%%container.id) %%proc.name (%%thread.tid:%%thread.vtid) %%evt.dir %%evt.type %%evt.info\n\n" -"Using -pm or -pmesos, the default format will be changed to a mesos-friendly one:\n\n" +"[DEPRECATED] Using -pm or -pmesos, the default format will be changed to a mesos-friendly one:\n\n" "%%evt.num %%evt.outputtime %%evt.cpu %%mesos.task.name (%%container.id) %%proc.name (%%thread.tid:%%thread.vtid) %%evt.dir %%evt.type %%evt.info\n\n" "Examples:\n\n" " Capture all the events from the live system and print them to screen\n" @@ -1011,12 +1011,10 @@ sysdig_init_res sysdig_init(int argc, char **argv) std::string cname; std::vector summary_table; #ifndef MINIMAL_BUILD - std::string* k8s_api = 0; - std::string* node_name = 0; - std::string* k8s_api_cert = 0; - std::string* mesos_api = 0; + bool k8s = false; + bool mesos = false; #endif // MINIMAL_BUILD - bool force_tracers_capture = false; + bool tracers = false; std::set suppress_comms; #ifdef HAS_CAPTURE std::string cri_socket_path; @@ -1067,20 +1065,12 @@ sysdig_init_res sysdig_init(int argc, char **argv) #endif {"file-size", required_argument, 0, 'C' }, {"json", no_argument, 0, 'j' }, -#ifndef MINIMAL_BUILD - {"k8s-api", required_argument, 0, 'k'}, - {"node-name", required_argument, 0, 'N'}, - {"k8s-api-cert", required_argument, 0, 'K' }, -#endif // MINIMAL_BUILD {"large-environment", no_argument, 0, 0 }, {"list", optional_argument, 0, 'l' }, {"list-events", no_argument, 0, 'L' }, {"list-markdown", optional_argument, 0, 0 }, {"libs-version", no_argument, 0, 0}, {"log-level", required_argument, 0, 0 }, -#ifndef MINIMAL_BUILD - {"mesos-api", required_argument, 0, 'm'}, -#endif // MINIMAL_BUILD #ifdef HAS_MODERN_BPF {"modern-bpf", no_argument, 0, 0 }, #endif @@ -1317,13 +1307,16 @@ sysdig_init_res sysdig_init(int argc, char **argv) break; #ifndef MINIMAL_BUILD case 'k': - k8s_api = new std::string(optarg); + //TODO(therealbobo): remove this on 0.36.0 + k8s = true; break; case 'N': - node_name = new std::string(optarg); + //TODO(therealbobo): remove this on 0.36.0 + k8s = true; break; case 'K': - k8s_api_cert = new std::string(optarg); + //TODO(therealbobo): remove this on 0.36.0 + k8s = true; break; #endif // MINIMAL_BUILD case 'h': @@ -1342,7 +1335,7 @@ sysdig_init_res sysdig_init(int argc, char **argv) return sysdig_init_res(EXIT_SUCCESS); #ifndef MINIMAL_BUILD case 'm': - mesos_api = new std::string(optarg); + mesos = true; break; #endif // MINIMAL_BUILD case 'M': @@ -1426,10 +1419,6 @@ sysdig_init_res sysdig_init(int argc, char **argv) break; case 'r': infiles.emplace_back(optarg); -#ifndef MINIMAL_BUILD - k8s_api = new std::string(); - mesos_api = new std::string(); -#endif // MINIMAL_BUILD break; case 'S': for(uint32_t j = 0; j < PPM_EVENT_MAX; j++) @@ -1462,12 +1451,14 @@ sysdig_init_res sysdig_init(int argc, char **argv) } break; case 'T': - force_tracers_capture = true; + //TODO(therealbobo): remove this on 0.36.0 + tracers = true; break; case 'U': suppress_comms.insert(std::string(optarg)); break; case 'u': + //TODO(therealbobo): remove this on 0.36.0 opener.udig.enabled = true; break; case 'v': @@ -1886,9 +1877,8 @@ sysdig_init_res sysdig_init(int argc, char **argv) { if (!inspector->suppress_events_comm(comm)) { - fprintf(stderr, "Could not add %s to the set of suppressed comms--did you specify more than %d values?\n", - comm.c_str(), - SCAP_MAX_SUPPRESSED_COMMS); + fprintf(stderr, "Could not add %s to the set of suppressed comms.\n", + comm.c_str()); res.m_res = EXIT_FAILURE; goto exit; } @@ -1923,14 +1913,6 @@ sysdig_init_res sysdig_init(int argc, char **argv) inspector->set_snaplen(snaplen); } - // - // If required, tell the driver to enable tracers capture - // - if(force_tracers_capture) - { - inspector->enable_tracers_capture(); - } - duration = ((double)clock()) / CLOCKS_PER_SEC; if(outfile != "") @@ -1948,60 +1930,38 @@ sysdig_init_res sysdig_init(int argc, char **argv) // // run k8s, if required // - if(k8s_api) + if (k8s || getenv("SYSDIG_K8S_API") != NULL || + getenv("SYSDIG_K8S_API_CERT") != NULL) { - if(!k8s_api_cert) - { - if(char* k8s_cert_env = getenv("SYSDIG_K8S_API_CERT")) - { - k8s_api_cert = new std::string(k8s_cert_env); - } - } - inspector->init_k8s_client(k8s_api, k8s_api_cert, node_name, verbose); - k8s_api = 0; - k8s_api_cert = 0; - } - else if(char* k8s_api_env = getenv("SYSDIG_K8S_API")) - { - if(k8s_api_env != NULL) - { - if(!k8s_api_cert) - { - if(char* k8s_cert_env = getenv("SYSDIG_K8S_API_CERT")) - { - k8s_api_cert = new std::string(k8s_cert_env); - } - } - k8s_api = new std::string(k8s_api_env); - inspector->init_k8s_client(k8s_api, k8s_api_cert, node_name, verbose); - } - else - { - delete k8s_api; - delete k8s_api_cert; - } - k8s_api = 0; - k8s_api_cert = 0; + throw sinsp_exception(std::string("the k8s client is deprecated!")); + res.m_res = EXIT_FAILURE; + goto exit; } // // run mesos, if required // - if(mesos_api) + if(mesos || getenv("SYSDIG_MESOS_API") != NULL) { - inspector->init_mesos_client(mesos_api, verbose); + throw sinsp_exception(std::string("the mesos client is deprecated!")); + res.m_res = EXIT_FAILURE; + goto exit; } - else if(char* mesos_api_env = getenv("SYSDIG_MESOS_API")) +#endif + if(opener.udig.enabled) { - if(mesos_api_env != NULL) - { - mesos_api = new std::string(mesos_api_env); - inspector->init_mesos_client(mesos_api, verbose); - } + throw sinsp_exception(std::string("the udig engine is deprecated!")); + res.m_res = EXIT_FAILURE; + goto exit; } - delete mesos_api; - mesos_api = 0; -#endif + + if(tracers) + { + throw sinsp_exception(std::string("tracers are deprecated!")); + res.m_res = EXIT_FAILURE; + goto exit; + } + #ifndef _WIN32 // Sysdig does not accept user input during the inspect loop // If the user stops the program with Ctrl-C disabling input would prevent the echoed ^C diff --git a/userspace/sysdig/utils/sinsp_opener.cpp b/userspace/sysdig/utils/sinsp_opener.cpp index 7315b99c7d..3ff32c57f3 100644 --- a/userspace/sysdig/utils/sinsp_opener.cpp +++ b/userspace/sysdig/utils/sinsp_opener.cpp @@ -58,12 +58,6 @@ void sinsp_opener::open(sinsp* inspector) const sc_of_interest.remove(ppm_sc_code::PPM_SC_PAGE_FAULT_KERNEL); } - if(udig.enabled) - { - inspector->open_udig(); - return; - } - if(gvisor.enabled) { inspector->open_gvisor(gvisor.config, gvisor.root);