Fixed issue where it would not parse subsequent requests coming from stdin.
Specifically requests with the same timestamp upon using --restore.
@@ -2702,8 +2702,6 @@ pre_process_log (GLog * glog, char *line, int dry_run) {
cleanup:
free_glog (logitem);
- ht_insert_last_parse (0, glog->lp);
-
return ret;
}
@@ -2884,6 +2882,23 @@ set_initial_persisted_data (GLog * glog, const char *fn) {
return 0;
}
+static void
+persist_last_parse (GLog * glog) {
+ /* insert last parsed data for the recently file parsed */
+ if (glog->inode && glog->size) {
+ glog->lp.line = glog->read;
+ glog->lp.mmapd_len = glog->mmapd_len;
+
+ memcpy (glog->lp.mmapd, glog->mmapd, glog->mmapd_len);
+
+ ht_insert_last_parse (glog->inode, glog->lp);
+ }
+ /* probably from a pipe */
+ else if (!glog->inode) {
+ ht_insert_last_parse (0, glog->lp);
+ }
+}
+
/* Read the given log line by line and process its data.
*
* On error, 1 is returned.
@@ -2921,15 +2936,7 @@ read_log (GLog ** glog, const char *fn, int dry_run) {
return 1;
}
- /* insert last parsed data for the recently file parsed */
- if ((*glog)->inode && (*glog)->size) {
- (*glog)->lp.line = (*glog)->read;
-
- (*glog)->lp.mmapd_len = (*glog)->mmapd_len;
- memcpy((*glog)->lp.mmapd, (*glog)->mmapd, (*glog)->mmapd_len);
-
- ht_insert_last_parse ((*glog)->inode, (*glog)->lp);
- }
+ persist_last_parse ((*glog));
/* close log file if not a pipe */
if (!piping)
