#include #include #include #include #include #include #include #include namespace DB { template <> struct NearestFieldTypeImpl { using Type = UInt64; }; Block TextLogElement::createBlock() { auto priority_datatype = std::make_shared( DataTypeEnum8::Values { {"FATAL", static_cast(Message::PRIO_FATAL)}, {"CRITICAL", static_cast(Message::PRIO_CRITICAL)}, {"ERROR", static_cast(Message::PRIO_ERROR)}, {"WARNING", static_cast(Message::PRIO_WARNING)}, {"NOTICE", static_cast(Message::PRIO_NOTICE)}, {"INFORMATION", static_cast(Message::PRIO_INFORMATION)}, {"DEBUG", static_cast(Message::PRIO_DEBUG)}, {"TRACE", static_cast(Message::PRIO_TRACE)} }); return { {std::make_shared(), "event_date"}, {std::make_shared(), "event_time"}, {std::make_shared(), "microseconds"}, {std::make_shared(std::make_shared()), "thread_name"}, {std::make_shared(), "thread_number"}, {std::make_shared(), "os_thread_id"}, {std::move(priority_datatype), "level"}, {std::make_shared(), "query_id"}, {std::make_shared(), "logger_name"}, {std::make_shared(), "message"}, {std::make_shared(), "revision"}, {std::make_shared(std::make_shared()), "source_file"}, {std::make_shared(), "source_line"} }; } void TextLogElement::appendToBlock(Block & block) const { MutableColumns columns = block.mutateColumns(); size_t i = 0; columns[i++]->insert(DateLUT::instance().toDayNum(event_time)); columns[i++]->insert(event_time); columns[i++]->insert(microseconds); columns[i++]->insertData(thread_name.data(), thread_name.size()); columns[i++]->insert(thread_number); columns[i++]->insert(os_thread_id); columns[i++]->insert(level); columns[i++]->insert(query_id); columns[i++]->insert(logger_name); columns[i++]->insert(message); columns[i++]->insert(ClickHouseRevision::get()); columns[i++]->insert(source_file); columns[i++]->insert(source_line); } }