2019-07-22 13:54:08 +00:00
|
|
|
#pragma once
|
2022-01-10 19:01:41 +00:00
|
|
|
|
2019-07-22 13:54:08 +00:00
|
|
|
#include <Interpreters/SystemLog.h>
|
2022-01-10 19:01:41 +00:00
|
|
|
#include <Core/NamesAndTypes.h>
|
|
|
|
#include <Core/NamesAndAliases.h>
|
|
|
|
#include <Poco/Message.h>
|
2024-01-12 15:39:22 +00:00
|
|
|
#include <Storages/ColumnsDescription.h>
|
2019-07-22 13:54:08 +00:00
|
|
|
|
2019-07-22 15:09:33 +00:00
|
|
|
namespace DB
|
|
|
|
{
|
2019-07-22 13:54:08 +00:00
|
|
|
|
|
|
|
using Poco::Message;
|
|
|
|
|
|
|
|
struct TextLogElement
|
|
|
|
{
|
|
|
|
time_t event_time{};
|
2020-11-03 13:59:17 +00:00
|
|
|
Decimal64 event_time_microseconds{};
|
2019-07-22 13:54:08 +00:00
|
|
|
|
|
|
|
String thread_name;
|
2021-05-08 15:20:40 +00:00
|
|
|
UInt64 thread_id{};
|
2019-07-22 13:54:08 +00:00
|
|
|
|
2019-07-22 15:09:33 +00:00
|
|
|
Message::Priority level = Message::PRIO_TRACE;
|
2019-07-22 13:54:08 +00:00
|
|
|
|
|
|
|
String query_id;
|
|
|
|
String logger_name;
|
|
|
|
String message;
|
|
|
|
|
|
|
|
String source_file;
|
2021-05-08 15:20:40 +00:00
|
|
|
UInt64 source_line{};
|
2019-07-22 13:54:08 +00:00
|
|
|
|
2022-12-23 14:06:30 +00:00
|
|
|
std::string_view message_format_string;
|
2024-02-05 22:43:39 +00:00
|
|
|
String value1;
|
|
|
|
String value2;
|
|
|
|
String value3;
|
|
|
|
String value4;
|
|
|
|
String value5;
|
|
|
|
String value6;
|
|
|
|
String value7;
|
|
|
|
String value8;
|
|
|
|
String value9;
|
|
|
|
String value10;
|
2022-12-23 14:06:30 +00:00
|
|
|
|
2019-07-22 13:54:08 +00:00
|
|
|
static std::string name() { return "TextLog"; }
|
2024-01-12 15:39:22 +00:00
|
|
|
static ColumnsDescription getColumnsDescription();
|
2021-06-28 11:42:21 +00:00
|
|
|
static NamesAndAliases getNamesAndAliases() { return {}; }
|
2020-05-21 20:15:18 +00:00
|
|
|
void appendToBlock(MutableColumns & columns) const;
|
2019-07-22 13:54:08 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class TextLog : public SystemLog<TextLogElement>
|
|
|
|
{
|
2020-01-31 15:45:58 +00:00
|
|
|
public:
|
2023-07-20 05:41:39 +00:00
|
|
|
using Queue = SystemLogQueue<TextLogElement>;
|
|
|
|
|
2023-07-28 07:23:34 +00:00
|
|
|
explicit TextLog(ContextPtr context_, const SystemLogSettings & settings);
|
|
|
|
|
|
|
|
static std::shared_ptr<Queue> getLogQueue(const SystemLogQueueSettings & settings)
|
2023-07-12 15:48:09 +00:00
|
|
|
{
|
2023-07-28 07:23:34 +00:00
|
|
|
static std::shared_ptr<Queue> queue = std::make_shared<Queue>(settings);
|
2023-07-12 15:48:09 +00:00
|
|
|
return queue;
|
|
|
|
}
|
2023-07-28 07:23:34 +00:00
|
|
|
|
|
|
|
static consteval bool shouldTurnOffLogger() { return true; }
|
2019-07-22 13:54:08 +00:00
|
|
|
};
|
|
|
|
|
2019-07-22 15:09:33 +00:00
|
|
|
}
|