[parser] fix some parser issues; and a fix for my last checkin

This commit is contained in:
Timothy Stack 2013-06-23 06:11:37 -07:00
parent db963c16cb
commit 8908e2569f
5 changed files with 13 additions and 6 deletions

View File

@ -712,6 +712,7 @@ private:
case DT_UUID:
case DT_URL:
case DT_PATH:
case DT_DATE:
case DT_TIME:
case DT_PERCENTAGE: {
element_list_t ELEMENT_LIST_T(pair_subs);

View File

@ -50,8 +50,10 @@ static struct {
},
{ "mac", pcrepp(
"\\A([0-9a-fA-F][0-9a-fA-F](?::[0-9a-fA-F][0-9a-fA-F]){5})"), },
{ "date",
pcrepp("\\A(\\d{4}/\\d{1,2}/\\d{1,2}|\\d{4}-\\d{1,2}-\\d{1,2})"), },
{ "time", pcrepp(
"\\A(\\d?\\d:\\d\\d(:\\d\\d)?(:\\d\\d)?([,.]\\d{3})?)\\b"), }, /* XXX be more specific */
"\\A(\\d?\\d:\\d\\d(:\\d\\d)?(:\\d\\d)?([,.]\\d{3,6})?)\\b"), }, /* XXX be more specific */
/* { "qual", pcrepp("\\A([^\\s:=]+:[^\\s:=,]+(?!,)(?::[^\\s:=,]+)*)"), }, */
{ "ipv6", pcrepp("\\A(::|[:\\da-fA-f\\.]+[a-fA-f\\d])"),
},
@ -130,7 +132,7 @@ const char *DNT_NAMES[DNT_MAX - DNT_KEY] = {
"meas",
"var",
"rang",
"date",
"dt",
"grp",
};

View File

@ -41,6 +41,7 @@ enum data_token_t {
DT_URL,
DT_PATH,
DT_MAC_ADDRESS,
DT_DATE,
DT_TIME,
DT_IPV6_ADDRESS,
/* DT_QUALIFIED_NAME, */

View File

@ -544,10 +544,13 @@ class generic_log_format : public log_format {
/* Try to pull out the milliseconds value. */
if (last_pos[0] == ',' || last_pos[0] == '.') {
sscanf(last_pos + 1, "%hd", &millis);
int subsec_len = 0;
sscanf(last_pos + 1, "%hd%n", &millis, &subsec_len);
if (millis >= 1000) {
millis = 0;
}
this->lf_time_fmt_len += 1 + subsec_len;
}
dst.push_back(logline(offset,
line_time,

View File

@ -416,10 +416,9 @@ bool logfile_sub_source::rebuild_index(observer *obs, bool force)
ld->ld_file->size());
}
ld->ld_indexing.ld_last = con_line;
if (!(lf_iter->get_level() & logline::LEVEL_CONTINUED)) {
if (action_for_prev_line == logfile_filter::INCLUDE) {
while (last_owner->ld_indexing.ld_start <
while (last_owner->ld_indexing.ld_start <=
last_owner->ld_indexing.ld_last) {
this->lss_index.push_back(last_owner->ld_indexing.ld_start);
++last_owner->ld_indexing.ld_start;
@ -431,6 +430,7 @@ bool logfile_sub_source::rebuild_index(observer *obs, bool force)
ld->ld_indexing.ld_start = con_line;
}
ld->ld_indexing.ld_last = con_line;
action_for_prev_line = ld->ld_file->check_filter(
lf_iter, this->lss_filter_generation, this->lss_filters);
@ -440,7 +440,7 @@ bool logfile_sub_source::rebuild_index(observer *obs, bool force)
}
if (action_for_prev_line == logfile_filter::INCLUDE) {
while (last_owner->ld_indexing.ld_start <
while (last_owner->ld_indexing.ld_start <=
last_owner->ld_indexing.ld_last) {
this->lss_index.push_back(last_owner->ld_indexing.ld_start);
++last_owner->ld_indexing.ld_start;