mirror of https://github.com/tstack/lnav.git
[afl] some more fixes for fuzzer bugs
Fixes #987 Fixes #986 Fixes #985 Fixes #984 Fixes #982
This commit is contained in:
parent
2bc258e621
commit
2e20195b99
|
@ -137,14 +137,16 @@ intern_string::startswith(const char* prefix) const
|
|||
return *prefix == '\0';
|
||||
}
|
||||
|
||||
void
|
||||
string_fragment::trim(const char* tokens)
|
||||
string_fragment
|
||||
string_fragment::trim(const char* tokens) const
|
||||
{
|
||||
while (this->sf_begin < this->sf_end) {
|
||||
string_fragment retval = *this;
|
||||
|
||||
while (retval.sf_begin < retval.sf_end) {
|
||||
bool found = false;
|
||||
|
||||
for (int lpc = 0; tokens[lpc] != '\0'; lpc++) {
|
||||
if (this->sf_string[this->sf_begin] == tokens[lpc]) {
|
||||
if (retval.sf_string[retval.sf_begin] == tokens[lpc]) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
|
@ -153,13 +155,13 @@ string_fragment::trim(const char* tokens)
|
|||
break;
|
||||
}
|
||||
|
||||
this->sf_begin += 1;
|
||||
retval.sf_begin += 1;
|
||||
}
|
||||
while (this->sf_begin < this->sf_end) {
|
||||
while (retval.sf_begin < retval.sf_end) {
|
||||
bool found = false;
|
||||
|
||||
for (int lpc = 0; tokens[lpc] != '\0'; lpc++) {
|
||||
if (this->sf_string[this->sf_end - 1] == tokens[lpc]) {
|
||||
if (retval.sf_string[retval.sf_end - 1] == tokens[lpc]) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
|
@ -168,8 +170,16 @@ string_fragment::trim(const char* tokens)
|
|||
break;
|
||||
}
|
||||
|
||||
this->sf_end -= 1;
|
||||
retval.sf_end -= 1;
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
string_fragment
|
||||
string_fragment::trim() const
|
||||
{
|
||||
return this->trim(" \t\r\n");
|
||||
}
|
||||
|
||||
nonstd::optional<string_fragment>
|
||||
|
|
|
@ -145,7 +145,7 @@ struct string_fragment {
|
|||
{
|
||||
const auto* iter = this->begin();
|
||||
|
||||
while (*prefix != '\0' && *prefix == *iter && iter < this->end()) {
|
||||
while (*prefix != '\0' && iter < this->end() && *prefix == *iter) {
|
||||
prefix += 1;
|
||||
iter += 1;
|
||||
}
|
||||
|
@ -296,7 +296,8 @@ struct string_fragment {
|
|||
this->sf_end = -1;
|
||||
}
|
||||
|
||||
void trim(const char* tokens);
|
||||
string_fragment trim(const char* tokens) const;
|
||||
string_fragment trim() const;
|
||||
|
||||
string_fragment prepend(const char* str, int amount) const
|
||||
{
|
||||
|
|
|
@ -35,6 +35,14 @@
|
|||
#include "config.h"
|
||||
#include "doctest/doctest.h"
|
||||
|
||||
TEST_CASE("string_fragment::startswith")
|
||||
{
|
||||
std::string empty;
|
||||
auto sf = string_fragment{empty};
|
||||
|
||||
CHECK_FALSE(sf.startswith("abc"));
|
||||
}
|
||||
|
||||
TEST_CASE("split_lines")
|
||||
{
|
||||
std::string in1 = "Hello, World!";
|
||||
|
|
|
@ -92,7 +92,7 @@ enum exttm_flags_t {
|
|||
};
|
||||
|
||||
struct exttm {
|
||||
struct tm et_tm;
|
||||
struct tm et_tm {};
|
||||
int32_t et_nsec{0};
|
||||
unsigned int et_flags{0};
|
||||
long et_gmtoff{0};
|
||||
|
@ -105,7 +105,7 @@ struct exttm {
|
|||
bool operator==(const exttm& other) const
|
||||
{
|
||||
return memcmp(this, &other, sizeof(exttm)) == 0;
|
||||
};
|
||||
}
|
||||
|
||||
struct timeval to_timeval() const;
|
||||
};
|
||||
|
|
|
@ -387,14 +387,20 @@ log_format::check_for_new_year(std::vector<logline>& dst,
|
|||
struct tm otm;
|
||||
|
||||
gmtime_r(&ot, &otm);
|
||||
otm.tm_year -= off_year;
|
||||
if (otm.tm_year < off_year) {
|
||||
otm.tm_year = 0;
|
||||
} else {
|
||||
otm.tm_year -= off_year;
|
||||
}
|
||||
otm.tm_mon -= off_month;
|
||||
otm.tm_mday -= off_day;
|
||||
otm.tm_hour -= off_hour;
|
||||
if (otm.tm_mon < 0) {
|
||||
otm.tm_mon += 12;
|
||||
}
|
||||
auto new_time = tm2sec(&otm);
|
||||
if (new_time == -1) {
|
||||
continue;
|
||||
}
|
||||
new_time -= (off_day * 24 * 60 * 60) + (off_hour * 60 * 60);
|
||||
ll.set_time(new_time);
|
||||
}
|
||||
}
|
||||
|
@ -403,10 +409,7 @@ log_format::check_for_new_year(std::vector<logline>& dst,
|
|||
* XXX This needs some cleanup.
|
||||
*/
|
||||
struct json_log_userdata {
|
||||
json_log_userdata(shared_buffer_ref& sbr)
|
||||
: jlu_shared_buffer(sbr){
|
||||
|
||||
};
|
||||
json_log_userdata(shared_buffer_ref& sbr) : jlu_shared_buffer(sbr) {}
|
||||
|
||||
external_log_format* jlu_format{nullptr};
|
||||
const logline* jlu_line{nullptr};
|
||||
|
|
|
@ -388,13 +388,12 @@ public:
|
|||
struct field_def {
|
||||
logline_value_meta fd_meta;
|
||||
std::string fd_collator;
|
||||
int fd_numeric_index;
|
||||
nonstd::optional<size_t> fd_numeric_index;
|
||||
|
||||
explicit field_def(const intern_string_t name,
|
||||
int col,
|
||||
log_format* format)
|
||||
: fd_meta(name, value_kind_t::VALUE_TEXT, col, format),
|
||||
fd_numeric_index(-1)
|
||||
: fd_meta(name, value_kind_t::VALUE_TEXT, col, format)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -408,7 +407,7 @@ public:
|
|||
return *this;
|
||||
}
|
||||
|
||||
field_def& with_numeric_index(int index)
|
||||
field_def& with_numeric_index(size_t index)
|
||||
{
|
||||
this->fd_numeric_index = index;
|
||||
return *this;
|
||||
|
@ -484,7 +483,7 @@ public:
|
|||
opid = hash_str(sf.data(), sf.length());
|
||||
}
|
||||
|
||||
if (fd.fd_numeric_index >= 0) {
|
||||
if (fd.fd_numeric_index) {
|
||||
switch (fd.fd_meta.lvm_kind) {
|
||||
case value_kind_t::VALUE_INTEGER:
|
||||
case value_kind_t::VALUE_FLOAT: {
|
||||
|
@ -494,8 +493,8 @@ public:
|
|||
|
||||
if (sscanf(sf.to_string(field_copy), "%lf", &val) == 1)
|
||||
{
|
||||
this->lf_value_stats[fd.fd_numeric_index].add_value(
|
||||
val);
|
||||
this->lf_value_stats[fd.fd_numeric_index.value()]
|
||||
.add_value(val);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -583,7 +582,7 @@ public:
|
|||
} else if (directive == "#path") {
|
||||
auto full_name = fmt::format(FMT_STRING("bro_{}_log"), *iter);
|
||||
this->blf_format_name = intern_string::lookup(full_name);
|
||||
} else if (directive == "#fields") {
|
||||
} else if (directive == "#fields" && this->blf_field_defs.empty()) {
|
||||
do {
|
||||
this->blf_field_defs.emplace_back(
|
||||
intern_string::lookup("bro_" + sql_safe_ident(*iter)),
|
||||
|
@ -715,10 +714,11 @@ public:
|
|||
|
||||
for (const auto& blf_field_def : this->blf_field_defs) {
|
||||
if (blf_field_def.fd_meta.lvm_name == name) {
|
||||
if (blf_field_def.fd_numeric_index < 0) {
|
||||
if (!blf_field_def.fd_numeric_index) {
|
||||
break;
|
||||
}
|
||||
retval = &this->lf_value_stats[blf_field_def.fd_numeric_index];
|
||||
retval = &this->lf_value_stats[blf_field_def.fd_numeric_index
|
||||
.value()];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -911,16 +911,17 @@ public:
|
|||
const intern_string_t fd_name;
|
||||
logline_value_meta fd_meta;
|
||||
std::string fd_collator;
|
||||
int fd_numeric_index;
|
||||
nonstd::optional<size_t> fd_numeric_index;
|
||||
|
||||
explicit field_def(const intern_string_t name)
|
||||
: fd_name(name), fd_meta(intern_string::lookup(sql_safe_ident(
|
||||
name.to_string_fragment())),
|
||||
value_kind_t::VALUE_TEXT),
|
||||
fd_numeric_index(-1){};
|
||||
value_kind_t::VALUE_TEXT)
|
||||
{
|
||||
}
|
||||
|
||||
field_def(const intern_string_t name, logline_value_meta meta)
|
||||
: fd_name(name), fd_meta(meta), fd_numeric_index(-1)
|
||||
: fd_name(name), fd_meta(meta)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -934,7 +935,7 @@ public:
|
|||
intern_string::lookup(sql_safe_ident(string_fragment(name))),
|
||||
kind,
|
||||
col),
|
||||
fd_collator(std::move(coll)), fd_numeric_index(-1)
|
||||
fd_collator(std::move(coll))
|
||||
{
|
||||
this->fd_meta.lvm_identifier = ident;
|
||||
}
|
||||
|
@ -1031,12 +1032,11 @@ public:
|
|||
= sbr.to_string_fragment().consume_n(sf.length());
|
||||
|
||||
if (sbr_sf_opt) {
|
||||
auto sbr_sf = sbr_sf_opt.value();
|
||||
auto sbr_sf = sbr_sf_opt.value().trim();
|
||||
date_time_scanner dts;
|
||||
struct exttm tm;
|
||||
struct timeval tv;
|
||||
|
||||
sbr_sf.trim(" \t");
|
||||
if (dts.scan(sbr_sf.data(),
|
||||
sbr_sf.length(),
|
||||
nullptr,
|
||||
|
@ -1052,7 +1052,7 @@ public:
|
|||
return SCAN_MATCH;
|
||||
}
|
||||
|
||||
sf.trim("\" \t");
|
||||
sf = sf.trim("\" \t");
|
||||
if (F_DATE == fd.fd_name || F_DATE_LOCAL == fd.fd_name
|
||||
|| F_DATE_UTC == fd.fd_name)
|
||||
{
|
||||
|
@ -1076,7 +1076,7 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
if (fd.fd_numeric_index >= 0) {
|
||||
if (fd.fd_numeric_index) {
|
||||
switch (fd.fd_meta.lvm_kind) {
|
||||
case value_kind_t::VALUE_INTEGER:
|
||||
case value_kind_t::VALUE_FLOAT: {
|
||||
|
@ -1085,8 +1085,8 @@ public:
|
|||
|
||||
if (sscanf(sf.to_string(field_copy), "%lf", &val) == 1)
|
||||
{
|
||||
this->lf_value_stats[fd.fd_numeric_index].add_value(
|
||||
val);
|
||||
this->lf_value_stats[fd.fd_numeric_index.value()]
|
||||
.add_value(val);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -1179,13 +1179,13 @@ public:
|
|||
this->lf_date_time.set_base_time(tv.tv_sec);
|
||||
this->wlf_time_scanner.set_base_time(tv.tv_sec);
|
||||
}
|
||||
} else if (directive == "#Fields:") {
|
||||
} else if (directive == "#Fields:" && this->wlf_field_defs.empty())
|
||||
{
|
||||
int numeric_count = 0;
|
||||
|
||||
do {
|
||||
string_fragment sf = *iter;
|
||||
auto sf = (*iter).trim(")");
|
||||
|
||||
sf.trim(")");
|
||||
auto field_iter = std::find_if(
|
||||
begin(KNOWN_FIELDS),
|
||||
end(KNOWN_FIELDS),
|
||||
|
@ -1308,10 +1308,11 @@ public:
|
|||
|
||||
for (const auto& wlf_field_def : this->wlf_field_defs) {
|
||||
if (wlf_field_def.fd_meta.lvm_name == name) {
|
||||
if (wlf_field_def.fd_numeric_index < 0) {
|
||||
if (!wlf_field_def.fd_numeric_index) {
|
||||
break;
|
||||
}
|
||||
retval = &this->lf_value_stats[wlf_field_def.fd_numeric_index];
|
||||
retval = &this->lf_value_stats[wlf_field_def.fd_numeric_index
|
||||
.value()];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -110,8 +110,8 @@ convert(const std::string& filename)
|
|||
lb.read_range(li.li_file_range)
|
||||
.then([error_queue, child_pid](auto sbr) {
|
||||
auto line_str = string_fragment(
|
||||
sbr.get_data(), 0, sbr.length());
|
||||
line_str.trim("\n");
|
||||
sbr.get_data(), 0, sbr.length())
|
||||
.trim("\n");
|
||||
if (error_queue->size() < 5) {
|
||||
error_queue->emplace_back(line_str.to_string());
|
||||
}
|
||||
|
|
|
@ -73,8 +73,8 @@ read_err_pipe(const std::string& netloc,
|
|||
} else {
|
||||
lb.read_range(li.li_file_range).then([netloc, &eq](auto sbr) {
|
||||
auto line_str
|
||||
= string_fragment(sbr.get_data(), 0, sbr.length());
|
||||
line_str.trim("\n");
|
||||
= string_fragment(sbr.get_data(), 0, sbr.length())
|
||||
.trim("\n");
|
||||
if (eq.size() < 10) {
|
||||
eq.template emplace_back(line_str.to_string());
|
||||
}
|
||||
|
|
|
@ -117,7 +117,7 @@ void yajl_string_decode(yajl_buf buf, const unsigned char * str,
|
|||
size_t len)
|
||||
{
|
||||
size_t beg = 0;
|
||||
size_t end = 0;
|
||||
size_t end = 0;
|
||||
|
||||
while (end < len) {
|
||||
if (str[end] == '\\') {
|
||||
|
@ -139,14 +139,14 @@ void yajl_string_decode(yajl_buf buf, const unsigned char * str,
|
|||
end+=3;
|
||||
/* check if this is a surrogate */
|
||||
if ((codepoint & 0xFC00) == 0xD800) {
|
||||
end++;
|
||||
if (str[end] == '\\' && str[end + 1] == 'u') {
|
||||
if (str[end + 1] == '\\' && str[end + 2] == 'u') {
|
||||
end += 1;
|
||||
unsigned int surrogate = 0;
|
||||
hexToDigit(&surrogate, str + end + 2);
|
||||
codepoint =
|
||||
(((codepoint & 0x3F) << 10) |
|
||||
((((codepoint >> 6) & 0xF) + 1) << 16) |
|
||||
(surrogate & 0x3FF));
|
||||
codepoint
|
||||
= (((codepoint & 0x3F) << 10)
|
||||
| ((((codepoint >> 6) & 0xF) + 1) << 16)
|
||||
| (surrogate & 0x3FF));
|
||||
end += 5;
|
||||
} else {
|
||||
unescaped = "?";
|
||||
|
|
|
@ -62,11 +62,39 @@ read_const(yajlpp_parse_context* ypc, long long value)
|
|||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
dummy_string_handler(void* ctx, const unsigned char* s, size_t len)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char* argv[])
|
||||
{
|
||||
static const auto TEST_SRC = intern_string::lookup("test_data");
|
||||
|
||||
{
|
||||
struct dummy {};
|
||||
|
||||
typed_json_path_container<dummy> dummy_handlers = {
|
||||
|
||||
};
|
||||
|
||||
std::string in1 = "{\"#\":{\"";
|
||||
auto parse_res = dummy_handlers.parser_for(TEST_SRC).of(in1);
|
||||
}
|
||||
|
||||
{
|
||||
static const char UNICODE_BARF[] = "\"\\udb00\\\\0\"\n";
|
||||
|
||||
yajl_callbacks cbs;
|
||||
memset(&cbs, 0, sizeof(cbs));
|
||||
cbs.yajl_string = dummy_string_handler;
|
||||
auto handle = yajl_alloc(&cbs, nullptr, nullptr);
|
||||
auto rc = yajl_parse(handle, (const unsigned char*) UNICODE_BARF, 12);
|
||||
assert(rc == yajl_status_ok);
|
||||
}
|
||||
|
||||
struct json_path_container test_obj_handler = {
|
||||
json_path_handler("foo", read_foo),
|
||||
};
|
||||
|
|
|
@ -512,30 +512,24 @@ yajlpp_parse_context::map_key(void* ctx, const unsigned char* key, size_t len)
|
|||
if (ypc->ypc_path.back() != '/') {
|
||||
ypc->ypc_path.push_back('/');
|
||||
}
|
||||
if (ypc->ypc_handlers != nullptr) {
|
||||
for (size_t lpc = 0; lpc < len; lpc++) {
|
||||
switch (key[lpc]) {
|
||||
case '~':
|
||||
ypc->ypc_path.push_back('~');
|
||||
ypc->ypc_path.push_back('0');
|
||||
break;
|
||||
case '/':
|
||||
ypc->ypc_path.push_back('~');
|
||||
ypc->ypc_path.push_back('1');
|
||||
break;
|
||||
case '#':
|
||||
ypc->ypc_path.push_back('~');
|
||||
ypc->ypc_path.push_back('2');
|
||||
break;
|
||||
default:
|
||||
ypc->ypc_path.push_back(key[lpc]);
|
||||
break;
|
||||
}
|
||||
for (size_t lpc = 0; lpc < len; lpc++) {
|
||||
switch (key[lpc]) {
|
||||
case '~':
|
||||
ypc->ypc_path.push_back('~');
|
||||
ypc->ypc_path.push_back('0');
|
||||
break;
|
||||
case '/':
|
||||
ypc->ypc_path.push_back('~');
|
||||
ypc->ypc_path.push_back('1');
|
||||
break;
|
||||
case '#':
|
||||
ypc->ypc_path.push_back('~');
|
||||
ypc->ypc_path.push_back('2');
|
||||
break;
|
||||
default:
|
||||
ypc->ypc_path.push_back(key[lpc]);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
size_t start = ypc->ypc_path.size();
|
||||
ypc->ypc_path.resize(ypc->ypc_path.size() + len);
|
||||
memcpy(&ypc->ypc_path[start], key, len);
|
||||
}
|
||||
ypc->ypc_path.push_back('\0');
|
||||
|
||||
|
|
|
@ -254,10 +254,14 @@ EXPECTED_FILES = \
|
|||
$(srcdir)/%reldir%/test_json_format.sh_c60050b3469f37c5b0864e1dc7eb354e91d6ec81.out \
|
||||
$(srcdir)/%reldir%/test_json_format.sh_fe19b7ebd349cd689b3f5c22618eab5ce995e68e.err \
|
||||
$(srcdir)/%reldir%/test_json_format.sh_fe19b7ebd349cd689b3f5c22618eab5ce995e68e.out \
|
||||
$(srcdir)/%reldir%/test_logfile.sh_08d731a04c877a34819b35de185e30a74c9fd497.err \
|
||||
$(srcdir)/%reldir%/test_logfile.sh_08d731a04c877a34819b35de185e30a74c9fd497.out \
|
||||
$(srcdir)/%reldir%/test_logfile.sh_09bd16e044302f6b121092534708594bdad11b5a.err \
|
||||
$(srcdir)/%reldir%/test_logfile.sh_09bd16e044302f6b121092534708594bdad11b5a.out \
|
||||
$(srcdir)/%reldir%/test_logfile.sh_0bba304f34ae07c4fa9e91e0b42f5fe98654a6a8.err \
|
||||
$(srcdir)/%reldir%/test_logfile.sh_0bba304f34ae07c4fa9e91e0b42f5fe98654a6a8.out \
|
||||
$(srcdir)/%reldir%/test_logfile.sh_290a3c49e53c2229a7400c107338fa0bb38375e2.err \
|
||||
$(srcdir)/%reldir%/test_logfile.sh_290a3c49e53c2229a7400c107338fa0bb38375e2.out \
|
||||
$(srcdir)/%reldir%/test_logfile.sh_4a2a907fcb069b8d6e65961a7b2e796d6c3a87b1.err \
|
||||
$(srcdir)/%reldir%/test_logfile.sh_4a2a907fcb069b8d6e65961a7b2e796d6c3a87b1.out \
|
||||
$(srcdir)/%reldir%/test_logfile.sh_a7037efd0c4bbf51940137a44e57d94e9307e83e.err \
|
||||
$(srcdir)/%reldir%/test_logfile.sh_a7037efd0c4bbf51940137a44e57d94e9307e83e.out \
|
||||
$(srcdir)/%reldir%/test_logfile.sh_c18e14a26d8261c9f72747118a469266121d5459.err \
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
2600-12-03 09:23:00.000000 0:
|
||||
2600-12-03 09:23:00.000000 0:
|
||||
2600-12-03 09:23:00.000000 0:
|
|
@ -1 +0,0 @@
|
|||
1970-01-01 00:00:00.000000
|
|
@ -0,0 +1 @@
|
|||
0
|
|
@ -0,0 +1,2 @@
|
|||
0 #
|
||||
0
|
|
@ -1,2 +0,0 @@
|
|||
[31m✘ error[0m: regex “[1mstd[0m” of format “[1msyslog_log[0m” has not been pushed to regex101.com
|
||||
[36m =[0m [36mhelp[0m: use the “[1m[34mpush[0m” subcommand to create the regex on regex101.com for easy editing
|
|
@ -1,3 +0,0 @@
|
|||
[31m✘ error[0m: unable to import: [1mhttps://regex101.com/r/zpEnjV/1[0m
|
||||
[31mreason[0m: format file already exists: [1mregex101-home/.lnav/formats/installed/unit_test_log.json[0m
|
||||
[36m =[0m [36mhelp[0m: delete the existing file to continue
|
|
@ -1,3 +0,0 @@
|
|||
[33m⚠ warning[0m: not deleting regex101 entry “[1mzpEnjV[0m”
|
||||
[33mreason[0m: delete code is not known for this entry
|
||||
[36m =[0m [36mnote[0m: formats created by importing a regex101.com entry will not have a delete code
|
|
@ -1 +0,0 @@
|
|||
[1m[32m✔ [0mdeleted regex101 entry: [1mzpEnjV[0m
|
|
@ -1 +0,0 @@
|
|||
[31m✘ error[0m: expecting a regex101.com URL to import
|
|
@ -1,4 +0,0 @@
|
|||
[1m[32m✔ [0mconverted regex101 entry to format file: [1mregex101-home/.lnav/formats/installed/unit_test_log.json[0m
|
||||
[36m =[0m [36mnote[0m: the converted format may still have errors
|
||||
[36m =[0m [36mhelp[0m: use the following command to patch the regex as more changes are made on regex101.com:
|
||||
lnav -m format unit_test_log regex std regex101 pull
|
|
@ -1,10 +0,0 @@
|
|||
{
|
||||
"$schema": "https://lnav.org/schemas/format-v1.schema.json",
|
||||
"unit_test_log": {
|
||||
"regex": {
|
||||
"std": {
|
||||
"pattern": "\\[(?<timestamp>\\d+\\/\\d+\\/\\d+ \\d+:\\d+:\\d+) (?<jobserver>[\\w.]+) (?<workqueue>[\\w.]+) (?<processid>\\d+)\\] (?<body>.*)$"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,12 +0,0 @@
|
|||
[31m✘ error[0m: invalid sample log message: "[03/22/2021 02:00:02 job1074.example.com db.db81.example_events 54026] {\"ELAPSED\":\"0.011\",\"LEVEL\":\"info\",\"MESSAGE\":\"finished in 0.011\\n\",\"PREFIX\":\"YFgyWQriCmsAAofJAAAAHg\",\"ROUTINGKEY\":\"EXAMPLE1366.Example.Events._Publish\"}"
|
||||
[31mreason[0m: sample does not match any patterns
|
||||
[36m --> [0m[1mregex101-home/.lnav/formats/installed/unit_test_log.json[0m:29
|
||||
[36m =[0m [36mnote[0m: the following shows how each pattern matched this sample:
|
||||
[03/22/2021 02:00:02 job1074.example.com db.db81.example_events 54026] {"ELAPSED":"0.011","LEVEL":"info","MESSAGE":"finished in 0.011\n","PREFIX":"YFgyWQriCmsAAofJAAAAHg","ROUTINGKEY":"EXAMPLE1366.Example.Events._Publish"}
|
||||
[36m =[0m [36mnote[0m: [1mstd[0m = “”
|
||||
[31m✘ error[0m: invalid sample log message: "[03/22/2021 02:00:02 job1074.example.com db.db81.example_events 54026] {\"ELAPSED\":\"0.011\",\"LEVEL\":\"info\",\"MESSAGE\":\"finished in 0.011\\n\",\"PREFIX\":\"YFgyWQriCmsAAofJAAAAHg\",\"ROUTINGKEY\":\"EXAMPLE1366.Example.Events._Publish\"}"
|
||||
[31mreason[0m: sample does not match any patterns
|
||||
[36m --> [0m[1mregex101-home/.lnav/formats/installed/unit_test_log.json[0m:33
|
||||
[36m =[0m [36mnote[0m: the following shows how each pattern matched this sample:
|
||||
[03/22/2021 02:00:02 job1074.example.com db.db81.example_events 54026] {"ELAPSED":"0.011","LEVEL":"info","MESSAGE":"finished in 0.011\n","PREFIX":"YFgyWQriCmsAAofJAAAAHg","ROUTINGKEY":"EXAMPLE1366.Example.Events._Publish"}
|
||||
[36m =[0m [36mnote[0m: [1mstd[0m = “”
|
|
@ -1,3 +0,0 @@
|
|||
[1m[32m✔ [0mformat patch file written to: [1mregex101-home/.lnav/formats/installed/unit_test_log.regex101-zpEnjV.json[0m
|
||||
[36m =[0m [36mhelp[0m: once the regex has been found to be working correctly, move the contents of the patch file to the original file at:
|
||||
[1mregex101-home/.lnav/formats/installed/unit_test_log.json[0m
|
|
@ -1,2 +0,0 @@
|
|||
regex101-home/.lnav/formats/installed/unit_test_log.json
|
||||
regex101-home/.lnav/formats/installed/unit_test_log.regex101-zpEnjV.json
|
|
@ -1 +0,0 @@
|
|||
[1m[32m✔ [0mno regex101 entries found
|
|
@ -1,3 +0,0 @@
|
|||
[31m✘ error[0m: cannot delete regex101 entry while patch file exists
|
||||
[36m =[0m [36mnote[0m: [1mregex101-home/.lnav/formats/installed/unit_test_log.regex101-zpEnjV.json[0m
|
||||
[36m =[0m [36mhelp[0m: move the contents of the patch file to the main log format and then delete the file to continue
|
|
@ -1,2 +0,0 @@
|
|||
[31m✘ error[0m: invalid regex “[1mabc(def)[0m” from “[1mhttps://regex101.com/r/cvCJNP/1[0m”
|
||||
[31mreason[0m: only the “[1mpcre[0m” flavor of regexes are supported
|
|
@ -1,4 +0,0 @@
|
|||
[1m[32m✔ [0mconverted regex101 entry to format file: [1mregex101-home/.lnav/formats/installed/unit_test_log.regex101-hGiqBL.json[0m
|
||||
[36m =[0m [36mnote[0m: the converted format may still have errors
|
||||
[36m =[0m [36mhelp[0m: use the following command to patch the regex as more changes are made on regex101.com:
|
||||
lnav -m format unit_test_log regex alt regex101 pull
|
|
@ -1 +0,0 @@
|
|||
[31m✘ error[0m: unknown regex: [1mnon-existent[0m
|
|
@ -1,3 +0,0 @@
|
|||
[31m✘ error[0m: expecting an operation to perform on the [1mstd[0m regex
|
||||
[36m =[0m [36mhelp[0m: the available subcommands are:
|
||||
• [1m[34mregex101[0m: use regex101.com to edit this regular expression
|
|
@ -1,2 +0,0 @@
|
|||
[1m[32m✔ [0mlocal regex is in sync with entry “[1mzpEnjV[0m” on regex101.com
|
||||
[36m =[0m [36mhelp[0m: make edits on “[1mhttps://regex101.com/r/zpEnjV[0m” and then run this command again to update the local values
|
|
@ -1,3 +0,0 @@
|
|||
[31m✘ error[0m: unknown regex: [1ms[0m
|
||||
[36m =[0m [36mnote[0m: did you mean one of the following?
|
||||
[1mstd[0m
|
|
@ -1,2 +0,0 @@
|
|||
[1m[32m✔ [0mthe following regex101 entries were found:
|
||||
format unit_test_log regex std regex101
|
|
@ -1,5 +0,0 @@
|
|||
[31m✘ error[0m: expecting an operation to perform on the [1mstd[0m regular expression using regex101.com
|
||||
[36m =[0m [36mhelp[0m: the available subcommands are:
|
||||
• [1m[34mpush[0m: create/update an entry for this regex on regex101.com
|
||||
• [1m[34mpull[0m: create a patch format file for this regular expression based on the entry in regex101.com
|
||||
• [1m[34mdelete[0m: delete the entry regex101.com that was created by a push operation
|
|
@ -1,4 +0,0 @@
|
|||
[31m✘ error[0m: unable to import: [1mabc[0m
|
||||
[31mreason[0m: expecting a format name that matches the regular expression “^\w+$”
|
||||
[36m =[0m [36mnote[0m: “def-jkl”
|
||||
[36m^ matched up to here[0m
|
|
@ -1 +0,0 @@
|
|||
[31m✘ error[0m: no regex101 entry for [1msyslog_log[0m/[1mstd[0m
|
|
@ -1,2 +0,0 @@
|
|||
[31m✘ error[0m: unable to get entry “[1mbadregex123[0m” on regex101.com
|
||||
[31mreason[0m: received response code [1m400[0m content “{"error":"Invalid permalink id",}”
|
|
@ -1,37 +0,0 @@
|
|||
{
|
||||
"$schema": "https://lnav.org/schemas/format-v1.schema.json",
|
||||
"unit_test_log": {
|
||||
"description": "Format file generated from regex101 entry -- https://regex101.com/r/zpEnjV/2",
|
||||
"regex": {
|
||||
"std": {
|
||||
"pattern": "\\[(?<timestamp>\\d+\\/\\d+\\/\\d+ \\d+:\\d+:\\d+) (?<jobserver>[\\w.]+) (?<workqueue>[\\w.]+) (?<processid>\\d+)\\] (?<body>.*)$"
|
||||
}
|
||||
},
|
||||
"value": {
|
||||
"body": {
|
||||
"kind": "string"
|
||||
},
|
||||
"jobserver": {
|
||||
"kind": "string"
|
||||
},
|
||||
"processid": {
|
||||
"kind": "string"
|
||||
},
|
||||
"timestamp": {
|
||||
"kind": "string"
|
||||
},
|
||||
"workqueue": {
|
||||
"kind": "string"
|
||||
}
|
||||
},
|
||||
"sample": [
|
||||
{
|
||||
"line": "[03/22/2021 02:00:02 job1074.example.com db.db81.example_events 54026] {\"ELAPSED\":\"0.011\",\"LEVEL\":\"info\",\"MESSAGE\":\"finished in 0.011\\n\",\"PREFIX\":\"YFgyWQriCmsAAofJAAAAHg\",\"ROUTINGKEY\":\"EXAMPLE1366.Example.Events._Publish\"}"
|
||||
},
|
||||
{
|
||||
"description": "sample 1",
|
||||
"line": "[03/22/2021 02:00:02 job1074.example.com db.db81.example_events 54026] {\"ELAPSED\":\"0.011\",\"LEVEL\":\"info\",\"MESSAGE\":\"finished in 0.011\\n\",\"PREFIX\":\"YFgyWQriCmsAAofJAAAAHg\",\"ROUTINGKEY\":\"EXAMPLE1366.Example.Events._Publish\"}"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
[31m✘ error[0m: unknown format: [1mnon-existent[0m
|
|
@ -1,5 +0,0 @@
|
|||
[31m✘ error[0m: expecting an operation to perform on the [1mstd[0m regex
|
||||
[36m =[0m [36mnote[0m: this regex is currently associated with the following regex101.com entry:
|
||||
[1mhttps://regex101.com/r/zpEnjV[0m
|
||||
[36m =[0m [36mhelp[0m: the available subcommands are:
|
||||
• [1m[34mregex101[0m: use regex101.com to edit this regular expression
|
|
@ -1,15 +0,0 @@
|
|||
{
|
||||
"$schema": "https://lnav.org/schemas/format-v1.schema.json",
|
||||
"unit_test_log": {
|
||||
"regex": {
|
||||
"alt": {
|
||||
"pattern": "^\\[(?<timestamp>\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(?:\\.\\d{3,6})?)Z?\\](?<body>.*)$"
|
||||
}
|
||||
},
|
||||
"sample": [
|
||||
{
|
||||
"line": "[2021-05-21T21:58:57.022497Z]"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
[31m✘ error[0m: “[1mbro[0m” is an internal format that is not defined in a configuration file
|
|
@ -1,5 +0,0 @@
|
|||
\a
|
||||
esc ^^
|
||||
eval -- a
|
||||
split:
|
||||
0 -- a
|
|
@ -1,2 +0,0 @@
|
|||
Row 0:
|
||||
Column realpath('sql_fs_realpath_test.lnk'): {builddir}/drive_sql
|
|
@ -3,6 +3,21 @@
|
|||
echo ${top_srcdir}
|
||||
echo ${top_builddir}
|
||||
|
||||
cat > rollover_in.0 <<EOF
|
||||
2600/2 0 00:00:00 0:
|
||||
00:2 0 00:00:00 0:
|
||||
00:2 0 00:00:00 0:
|
||||
EOF
|
||||
touch -t 200711030923 rollover_in.0
|
||||
|
||||
run_cap_test env TEST_COMMENT="invalid date rollover" ${lnav_test} -n rollover_in.0
|
||||
|
||||
printf '#Fields: 0\tcs-bytes\n#Fields: 0\n\t0 #\n0' | run_cap_test \
|
||||
env TEST_COMMENT="w3c with dupe #Fields" ${lnav_test} -n
|
||||
|
||||
printf '#Fields: \xf9\t)\n0\n' | run_cap_test \
|
||||
env TEST_COMMENT="garbage w3c fields #1" ${lnav_test} -n
|
||||
|
||||
run_cap_test env TEST_COMMENT="w3c with bad header" ${lnav_test} -n <<EOF
|
||||
#Fields: 0 time
|
||||
00:00
|
||||
|
|
Loading…
Reference in New Issue