diff options
Diffstat (limited to '')
-rw-r--r-- | src/log_format_ext.hh | 50 |
1 files changed, 44 insertions, 6 deletions
diff --git a/src/log_format_ext.hh b/src/log_format_ext.hh index f1022b7..35361b3 100644 --- a/src/log_format_ext.hh +++ b/src/log_format_ext.hh @@ -52,7 +52,7 @@ public: struct value_def { value_def(intern_string_t name, value_kind_t kind, - int col, + logline_value_meta::column_t col, log_format* format) : vd_meta(name, kind, col, format) { @@ -68,7 +68,6 @@ public: logline_value_meta vd_meta; std::string vd_collate; - bool vd_foreign_key{false}; intern_string_t vd_unit_field; std::map<const intern_string_t, scaling_factor> vd_unit_scaling; bool vd_internal{false}; @@ -104,12 +103,14 @@ public: int>::with_default_args<PCRE2_DOTALL> p_pcre; std::vector<indexed_value_def> p_value_by_index; + std::map<intern_string_t, int> p_value_name_to_index; std::vector<int> p_numeric_value_indexes; int p_timestamp_field_index{-1}; int p_time_field_index{-1}; int p_level_field_index{-1}; int p_module_field_index{-1}; int p_opid_field_index{-1}; + int p_subid_field_index{-1}; int p_body_field_index{-1}; int p_timestamp_end{-1}; bool p_module_format{false}; @@ -141,8 +142,6 @@ public: bool match_name(const std::string& filename) override; - bool match_mime_type(const file_format_t ff) const override; - scan_result_t scan(logfile& lf, std::vector<logline>& dst, const line_info& offset, @@ -171,6 +170,17 @@ public: bool hide_field(const intern_string_t field_name, bool val) override; + std::map<intern_string_t, logline_value_meta> get_field_states() override + { + std::map<intern_string_t, logline_value_meta> retval; + + for (const auto& vd : this->elf_value_defs) { + retval.emplace(vd.first, vd.second->vd_meta); + } + + return retval; + } + std::shared_ptr<log_format> specialized(int fmt_lock) override; const logline_value_stats* stats_for_value( @@ -220,6 +230,7 @@ public: ABBREV, TRUNCATE, DOTDOT, + LASTWORD, }; enum class transform_t { @@ -313,7 +324,6 @@ public: std::vector<ghc::filesystem::path> elf_format_source_order; std::map<intern_string_t, int> elf_format_sources; std::list<intern_string_t> elf_collision; - std::set<file_format_t> elf_mime_types; factory_container<lnav::pcre2pp::code> elf_filename_pcre; std::map<std::string, std::shared_ptr<pattern>> elf_patterns; std::vector<std::shared_ptr<pattern>> elf_pattern_order; @@ -331,19 +341,37 @@ public: std::vector<std::shared_ptr<value_def>> elf_value_def_order; std::vector<std::shared_ptr<value_def>> elf_numeric_value_defs; - int elf_column_count{0}; + size_t elf_column_count{0}; double elf_timestamp_divisor{1.0}; intern_string_t elf_level_field; factory_container<lnav::pcre2pp::code> elf_level_pointer; intern_string_t elf_body_field; intern_string_t elf_module_id_field; intern_string_t elf_opid_field; + intern_string_t elf_subid_field; std::map<log_level_t, level_pattern> elf_level_patterns; std::vector<std::pair<int64_t, log_level_t>> elf_level_pairs; bool elf_container{false}; bool elf_has_module_format{false}; bool elf_builtin_format{false}; + struct header_exprs { + std::map<std::string, std::string> he_exprs; + }; + + struct header { + header_exprs h_exprs; + size_t h_size{32}; + }; + + struct converter { + std::string c_type; + header c_header; + positioned_property<std::string> c_command; + }; + + converter elf_converter; + using search_table_pcre2pp = factory_container<lnav::pcre2pp::code, int>::with_default_args< log_search_table_ns::PATTERN_OPTIONS>; @@ -365,6 +393,16 @@ public: elf_type_t elf_type{elf_type_t::ELF_TYPE_TEXT}; + void update_op_description( + const std::map<intern_string_t, opid_descriptors>& desc_def, + log_op_description& lod, + const pattern* fpat, + const lnav::pcre2pp::match_data& md); + + void update_op_description( + const std::map<intern_string_t, opid_descriptors>& desc_def, + log_op_description& lod); + void json_append_to_cache(const char* value, ssize_t len) { if (len <= 0) { |