diff options
author | epbugaev <epbugaev@yandex-team.com> | 2023-03-15 11:16:21 +0300 |
---|---|---|
committer | epbugaev <epbugaev@yandex-team.com> | 2023-03-15 11:16:21 +0300 |
commit | 107caf8ebd8673ad7b867bd4f673b5d9922a689c (patch) | |
tree | 3d615e902f37d637ac19c0d8b4c5476480fae27f | |
parent | 4f94beafb7da0a39f5289ccceee9b72c65de1aee (diff) | |
download | ydb-107caf8ebd8673ad7b867bd4f673b5d9922a689c.tar.gz |
Fix unparsed row errors in YT logging
Change YQL log parser regex so DateTime is never empty (fixes LogFeller unparsed log errors)
-rw-r--r-- | ydb/library/yql/utils/log/log.cpp | 30 | ||||
-rw-r--r-- | ydb/library/yql/utils/log/log.h | 2 |
2 files changed, 17 insertions, 15 deletions
diff --git a/ydb/library/yql/utils/log/log.cpp b/ydb/library/yql/utils/log/log.cpp index b08e3479ec0..c3739d052ef 100644 --- a/ydb/library/yql/utils/log/log.cpp +++ b/ydb/library/yql/utils/log/log.cpp @@ -22,21 +22,6 @@ static int g_LoggerInitialized = 0; namespace { -void WriteLocalTime(IOutputStream* out) { - struct timeval now; - gettimeofday(&now, nullptr); - - struct tm tm; - time_t seconds = static_cast<time_t>(now.tv_sec); - localtime_r(&seconds, &tm); - - char buf[sizeof("2016-01-02 03:04:05.006")]; - int n = strftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S.", &tm); - snprintf(buf + n, sizeof(buf) - n, "%03" PRIu32, static_cast<ui32>(now.tv_usec) / 1000); - - out->Write(buf, sizeof(buf) - 1); -} - class TLimitedLogBackend final : public TLogBackend { public: TLimitedLogBackend(TAutoPtr<TLogBackend> b, TAtomic& flag, ui64 limit) noexcept @@ -182,6 +167,21 @@ private: namespace NYql { namespace NLog { +void WriteLocalTime(IOutputStream* out) { + struct timeval now; + gettimeofday(&now, nullptr); + + struct tm tm; + time_t seconds = static_cast<time_t>(now.tv_sec); + localtime_r(&seconds, &tm); + + char buf[sizeof("2016-01-02 03:04:05.006")]; + int n = strftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S.", &tm); + snprintf(buf + n, sizeof(buf) - n, "%03" PRIu32, static_cast<ui32>(now.tv_usec) / 1000); + + out->Write(buf, sizeof(buf) - 1); +} + /** * TYqlLogElement * automaticaly adds new line char diff --git a/ydb/library/yql/utils/log/log.h b/ydb/library/yql/utils/log/log.h index 3b16b24e3a6..c6c19684f45 100644 --- a/ydb/library/yql/utils/log/log.h +++ b/ydb/library/yql/utils/log/log.h @@ -95,6 +95,8 @@ namespace NLog { using TComponentLevels = std::array<ELevel, EComponentHelpers::ToInt(EComponent::MaxValue)>; +void WriteLocalTime(IOutputStream* out); + /** * @brief Component based logger frontend. */ |