mirror of
https://github.com/tstack/lnav.git
synced 2024-08-17 00:40:30 +03:00
[log_format] the access_log format wasn't picking up the timestamp range correctly
This commit is contained in:
parent
53ce768b9d
commit
d72cab0c1e
@ -48,8 +48,8 @@
|
|||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
static const size_t DEFAULT_LINE_BUFFER_SIZE = 256 * 1024;
|
static const size_t DEFAULT_LINE_BUFFER_SIZE = 256 * 1024;
|
||||||
static const size_t MAX_LINE_BUFFER_SIZE = 16 * DEFAULT_LINE_BUFFER_SIZE;
|
static const size_t MAX_LINE_BUFFER_SIZE = 4 * DEFAULT_LINE_BUFFER_SIZE;
|
||||||
static const size_t DEFAULT_INCREMENT = 1024;
|
static const size_t DEFAULT_INCREMENT = 128 * 1024;
|
||||||
static const size_t MAX_COMPRESSED_BUFFER_SIZE = 32 * 1024 * 1024;
|
static const size_t MAX_COMPRESSED_BUFFER_SIZE = 32 * 1024 * 1024;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
21
src/lnav.cc
21
src/lnav.cc
@ -540,20 +540,25 @@ void rebuild_indexes(bool force)
|
|||||||
|
|
||||||
for (iter = tss->tss_files.begin();
|
for (iter = tss->tss_files.begin();
|
||||||
iter != tss->tss_files.end(); ) {
|
iter != tss->tss_files.end(); ) {
|
||||||
(*iter)->rebuild_index(&obs);
|
try {
|
||||||
if ((*iter)->get_format() != NULL) {
|
(*iter)->rebuild_index(&obs);
|
||||||
logfile *lf = *iter;
|
if ((*iter)->get_format() != NULL) {
|
||||||
|
logfile *lf = *iter;
|
||||||
|
|
||||||
if (lnav_data.ld_log_source.insert_file(lf)) {
|
if (lnav_data.ld_log_source.insert_file(lf)) {
|
||||||
iter = tss->tss_files.erase(iter);
|
iter = tss->tss_files.erase(iter);
|
||||||
force = true;
|
force = true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
++iter;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
++iter;
|
++iter;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
catch (const line_buffer::error &e) {
|
||||||
++iter;
|
iter = tss->tss_files.erase(iter);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,7 +79,7 @@ class access_log_format : public log_format {
|
|||||||
static pcrepp &value_pattern(void)
|
static pcrepp &value_pattern(void)
|
||||||
{
|
{
|
||||||
static pcrepp VALUE_PATTERN(
|
static pcrepp VALUE_PATTERN(
|
||||||
"^([\\w\\.-]+) [\\w\\.-]+ ([\\w\\.-]+) "
|
"^([\\w\\.\\-]+) [\\w\\.\\-]+ ([\\w\\.\\-]+) "
|
||||||
"\\[([^\\]]+)\\] \"(?:\\-|(\\w+) ([^ \\?]+)(\\?[^ ]+)? "
|
"\\[([^\\]]+)\\] \"(?:\\-|(\\w+) ([^ \\?]+)(\\?[^ ]+)? "
|
||||||
"([\\w/\\.]+))\" (\\d+) "
|
"([\\w/\\.]+))\" (\\d+) "
|
||||||
"(\\d+|-)(?: \"([^\"]+)\" \"([^\"]+)\")?.*");
|
"(\\d+|-)(?: \"([^\"]+)\" \"([^\"]+)\")?.*");
|
||||||
@ -180,9 +180,10 @@ class access_log_format : public log_format {
|
|||||||
pcre_context::iterator iter;
|
pcre_context::iterator iter;
|
||||||
struct line_range lr;
|
struct line_range lr;
|
||||||
|
|
||||||
iter = pc.begin() + 3;
|
iter = pc.begin() + 2;
|
||||||
lr.lr_start = iter->c_begin;
|
lr.lr_start = iter->c_begin;
|
||||||
lr.lr_end = iter->c_end;
|
lr.lr_end = iter->c_end;
|
||||||
|
assert(lr.lr_start != -1);
|
||||||
sa[lr].insert(make_string_attr("timestamp", 0));
|
sa[lr].insert(make_string_attr("timestamp", 0));
|
||||||
|
|
||||||
lr.lr_start = 0;
|
lr.lr_start = 0;
|
||||||
@ -739,9 +740,9 @@ class strace_log_format : public log_format {
|
|||||||
static pcrepp &value_pattern(void)
|
static pcrepp &value_pattern(void)
|
||||||
{
|
{
|
||||||
static pcrepp VALUE_PATTERN(
|
static pcrepp VALUE_PATTERN(
|
||||||
"[0-9:.]* ([a-zA-Z_][a-zA-Z_0-9]*)\\("
|
"([0-9:.]*) ([a-zA-Z_][a-zA-Z_0-9]*)\\("
|
||||||
"(.*)\\)"
|
"(.*)\\)"
|
||||||
"\\s+= ([-xa-fA-F\\d\\?]+).*(?:<(\\d+\\.\\d+)>)?");
|
"\\s+= ([-xa-fA-F\\d\\?]+)[^<]+(?:<(\\d+\\.\\d+)>)?");
|
||||||
|
|
||||||
return VALUE_PATTERN;
|
return VALUE_PATTERN;
|
||||||
};
|
};
|
||||||
@ -823,10 +824,11 @@ class strace_log_format : public log_format {
|
|||||||
const char * name;
|
const char * name;
|
||||||
logline_value::kind_t kind;
|
logline_value::kind_t kind;
|
||||||
} columns[] = {
|
} columns[] = {
|
||||||
|
{ "", logline_value::VALUE_TEXT },
|
||||||
{ "funcname", logline_value::VALUE_TEXT },
|
{ "funcname", logline_value::VALUE_TEXT },
|
||||||
{ "args", logline_value::VALUE_TEXT },
|
{ "args", logline_value::VALUE_TEXT },
|
||||||
{ "result", logline_value::VALUE_TEXT },
|
{ "result", logline_value::VALUE_TEXT },
|
||||||
{ "duration", logline_value::VALUE_TEXT },
|
{ "duration", logline_value::VALUE_FLOAT },
|
||||||
|
|
||||||
{ NULL },
|
{ NULL },
|
||||||
};
|
};
|
||||||
@ -834,10 +836,12 @@ class strace_log_format : public log_format {
|
|||||||
pcre_context::iterator iter;
|
pcre_context::iterator iter;
|
||||||
struct line_range lr;
|
struct line_range lr;
|
||||||
|
|
||||||
iter = pc.begin() + 3;
|
iter = pc.begin();
|
||||||
lr.lr_start = iter->c_begin;
|
if (iter->c_begin != -1) {
|
||||||
lr.lr_end = iter->c_end;
|
lr.lr_start = iter->c_begin;
|
||||||
sa[lr].insert(make_string_attr("timestamp", 0));
|
lr.lr_end = iter->c_end;
|
||||||
|
sa[lr].insert(make_string_attr("timestamp", 0));
|
||||||
|
}
|
||||||
|
|
||||||
lr.lr_start = 0;
|
lr.lr_start = 0;
|
||||||
lr.lr_end = line.length();
|
lr.lr_end = line.length();
|
||||||
|
@ -229,7 +229,7 @@ throw (line_buffer::error)
|
|||||||
st.st_size);
|
st.st_size);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The file can still grow between the above fstat and when we're
|
* The file can still grow between the above fstat and when we're
|
||||||
* doing the scanning, so use the line buffer's notion of the file
|
* doing the scanning, so use the line buffer's notion of the file
|
||||||
|
@ -173,6 +173,7 @@ dist_noinst_DATA = \
|
|||||||
listview_output.5 \
|
listview_output.5 \
|
||||||
listview_output.6 \
|
listview_output.6 \
|
||||||
logfile_access_log.0 \
|
logfile_access_log.0 \
|
||||||
|
logfile_access_log.1 \
|
||||||
logfile_empty.0 \
|
logfile_empty.0 \
|
||||||
logfile_generic.0 \
|
logfile_generic.0 \
|
||||||
logfile_glog.0 \
|
logfile_glog.0 \
|
||||||
|
@ -747,6 +747,7 @@ dist_noinst_DATA = \
|
|||||||
listview_output.5 \
|
listview_output.5 \
|
||||||
listview_output.6 \
|
listview_output.6 \
|
||||||
logfile_access_log.0 \
|
logfile_access_log.0 \
|
||||||
|
logfile_access_log.1 \
|
||||||
logfile_empty.0 \
|
logfile_empty.0 \
|
||||||
logfile_generic.0 \
|
logfile_generic.0 \
|
||||||
logfile_glog.0 \
|
logfile_glog.0 \
|
||||||
|
1
test/logfile_access_log.1
Normal file
1
test/logfile_access_log.1
Normal file
@ -0,0 +1 @@
|
|||||||
|
10.112.81.15 - - [15/Feb/2013:06:00:31 +0000] "-" 400 0 "-" "-"
|
Loading…
Reference in New Issue
Block a user