summaryrefslogtreecommitdiffstats
path: root/vespalog
diff options
context:
space:
mode:
authorTor Egge <Tor.Egge@broadpark.no>2019-03-26 12:00:00 +0100
committerTor Egge <Tor.Egge@broadpark.no>2019-03-26 12:00:00 +0100
commit2cdf5cb6d9b176a49b1f3588ca55c241f6a6c3e3 (patch)
tree3a3c6c3c2496c3f66571595ddc373c0f29302df8 /vespalog
parent6876175881d55e89ff4bf7ce912ddbf88314697f (diff)
Stop checking for too old or too new timestamp.
Don't allow pid field to end with trailing slash when no thread id is present.
Diffstat (limited to 'vespalog')
-rw-r--r--vespalog/src/vespa/log/log_message.cpp21
1 files changed, 8 insertions, 13 deletions
diff --git a/vespalog/src/vespa/log/log_message.cpp b/vespalog/src/vespa/log/log_message.cpp
index 6e3584bafc3..ec734747dbc 100644
--- a/vespalog/src/vespa/log/log_message.cpp
+++ b/vespalog/src/vespa/log/log_message.cpp
@@ -4,6 +4,7 @@
#include "exceptions.h"
#include <locale>
#include <sstream>
+#include <iostream>
namespace ns_log {
@@ -41,17 +42,6 @@ parse_time_field(std::string time_field)
os << "Bad time field: " << time_field;
throw BadLogLineException(os.str());
}
- time_t now = time(nullptr);
- if (logtime - 864000 > now) {
- std::ostringstream os;
- os << "time > 10 days in the future: " << time_field;
- throw BadLogLineException(os.str());
- }
- if (logtime + 8640000 < now) {
- std::ostringstream os;
- os << "time > 100 days in the past: " << time_field;
- throw BadLogLineException(os.str());
- }
return logtime * 1000000000;
}
@@ -70,11 +60,16 @@ PidFieldParser::PidFieldParser(std::string pid_field)
std::istringstream pid_stream(pid_field);
pid_stream.imbue(clocale);
pid_stream >> _process_id;
+ bool badField = false;
if (!pid_stream.eof() && pid_stream.good() && pid_stream.peek() == '/') {
pid_stream.get();
- pid_stream >> _thread_id;
+ if (pid_stream.eof()) {
+ badField = true;
+ } else {
+ pid_stream >> _thread_id;
+ }
}
- if (!pid_stream.eof() || pid_stream.fail() || pid_stream.bad()) {
+ if (!pid_stream.eof() || pid_stream.fail() || pid_stream.bad() || badField) {
std::ostringstream os;
os << "Bad pid field: " << pid_field;
throw BadLogLineException(os.str());