Skip to content

Commit

Permalink
skip parsing really long log messages
Browse files Browse the repository at this point in the history
  • Loading branch information
tstack committed Nov 20, 2024
1 parent 99dafd5 commit 512a8b7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
6 changes: 4 additions & 2 deletions src/log_data_helper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ log_data_helper::parse_line(content_line_t line, bool allow_middle)
this->ldh_line_attrs.clear();
} else {
auto format = this->ldh_file->get_format();
struct line_range body;
line_range body;
auto& sa = this->ldh_line_attrs;

this->ldh_line_attrs.clear();
Expand All @@ -98,7 +98,9 @@ log_data_helper::parse_line(content_line_t line, bool allow_middle)
= std::make_unique<data_parser>(this->ldh_scanner.get());
this->ldh_msg_format.clear();
this->ldh_parser->dp_msg_format = &this->ldh_msg_format;
this->ldh_parser->parse();
if (body.length() < 128 * 1024) {
this->ldh_parser->parse();
}
this->ldh_namer
= std::make_unique<column_namer>(column_namer::language::SQL);
this->ldh_extra_json.clear();
Expand Down
8 changes: 6 additions & 2 deletions src/logfile_sub_source.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2712,8 +2712,12 @@ logfile_sub_source::text_crumbs_for_line(int line,
if (this->lss_token_meta_line != file_line_number
|| this->lss_token_meta_size != sf.length())
{
this->lss_token_meta = lnav::document::discover_structure(
al, body_opt.value().saw_string_attr->sa_range);
if (body_opt->saw_string_attr->sa_range.length() < 128 * 1024) {
this->lss_token_meta = lnav::document::discover_structure(
al, body_opt.value().saw_string_attr->sa_range);
} else {
this->lss_token_meta = lnav::document::metadata{};
}
this->lss_token_meta_line = file_line_number;
this->lss_token_meta_size = sf.length();
}
Expand Down

0 comments on commit 512a8b7

Please sign in to comment.