Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ProcessorParseContainerLogNative #1374

Merged
Show file tree
Hide file tree
Changes from 113 commits
Commits
Show all changes
120 commits
Select commit Hold shift + click to select a range
a0a73b4
add-ProcessorMergeMultilineLogNative
quzard Feb 5, 2024
7e8f079
fix PipelineUnittest
quzard Feb 5, 2024
955c7ae
We should clear the log from `multiBeginIndex` to `size`.
quzard Feb 5, 2024
2dea799
fix test
quzard Feb 5, 2024
5bc0fe4
fix SenderQueueUnittest
quzard Feb 5, 2024
750a6ab
add ProcessorSplitNativeUnittest
quzard Feb 5, 2024
5c9c77f
fix
quzard Feb 5, 2024
d6f5adc
fix
quzard Feb 5, 2024
5bd2530
fix cmakelists
quzard Feb 5, 2024
1229920
fix
quzard Feb 5, 2024
328d956
fix
quzard Feb 5, 2024
41fe02f
fix
quzard Feb 5, 2024
d0bd55a
add ProcessEventsWithPartLog
quzard Feb 6, 2024
a2b3ec5
fix
quzard Feb 6, 2024
226fe8b
add PARTLOGFLAG
quzard Feb 6, 2024
0e37990
ContainerdLogLineParser
quzard Feb 18, 2024
e75937d
add DockerJsonLogLineParser
quzard Feb 18, 2024
e1f0b14
add AddDockerJsonLog
quzard Feb 19, 2024
f19e788
fix
quzard Feb 19, 2024
cb2d8f5
Merge branch 'add-ProcessorMergeMultilineLogNative' into add-Processo…
quzard Feb 19, 2024
6282038
RegisterProcessorCreator
quzard Feb 19, 2024
34ea3b7
去除docker末尾的回车
quzard Feb 19, 2024
76c402b
modify TestDockerJsonLogLineParserWithSplit
quzard Feb 19, 2024
20c5198
containerd-text
quzard Feb 19, 2024
4b1748e
containerd-text
quzard Feb 19, 2024
5b25a73
containerd-text
quzard Feb 19, 2024
71986e3
FILE_ENCODING
quzard Feb 19, 2024
76b8d0c
PARAM_ERROR_RETURN
quzard Feb 20, 2024
71818fb
Merge remote-tracking branch 'origin/add-ProcessorMergeMultilineLogNa…
quzard Feb 20, 2024
e930b95
参数放到常量里
quzard Feb 20, 2024
e15c3ed
delete ProcessorSplitNative
quzard Feb 21, 2024
37ac40b
Merge branch 'add-ProcessorMergeMultilineLogNative' into add-Processo…
quzard Feb 21, 2024
06976ea
MergeType
quzard Feb 21, 2024
4ebafa8
MergeType
quzard Feb 21, 2024
7448b0c
Merge branch 'add-ProcessorMergeMultilineLogNative' into add-Processo…
quzard Feb 21, 2024
d15e357
默认regex
quzard Feb 21, 2024
5f38ad2
Merge branch 'add-ProcessorMergeMultilineLogNative' into add-Processo…
quzard Feb 21, 2024
9cf4516
MergeType
quzard Feb 21, 2024
d351883
modify
quzard Feb 21, 2024
be91a2a
rm
quzard Feb 22, 2024
73802ad
PartLogFlag
quzard Feb 22, 2024
2983765
PartLogFlag
quzard Feb 22, 2024
aa62fbc
isPartialLog
quzard Feb 23, 2024
d40d5e2
const StringView
quzard Feb 23, 2024
98259d1
优化json find逻辑
quzard Feb 23, 2024
6c29586
Merge branch 'add-ProcessorMergeMultilineLogNative' into add-Processo…
quzard Feb 23, 2024
3418315
modify AddDockerJsonLog
quzard Feb 23, 2024
64f7696
std::find
quzard Feb 23, 2024
ca7b42f
AddContainerdTextLog
quzard Feb 23, 2024
7ea34b9
update case
quzard Feb 23, 2024
23f7a4f
beginIndex
quzard Feb 23, 2024
57b6150
endIndex
quzard Feb 23, 2024
e0bd7ea
modify
quzard Feb 26, 2024
53c416b
modify
quzard Feb 26, 2024
3219e81
Merge branch 'add-ProcessorMergeMultilineLogNative' into add-Processo…
quzard Feb 26, 2024
025df42
modify
quzard Feb 26, 2024
0392288
modify
quzard Feb 26, 2024
fcfc3ce
Merge remote-tracking branch 'alibaba/main' into feat/stdout/Processo…
quzard Feb 27, 2024
73966ea
Merge remote-tracking branch 'alibaba/main' into add-ProcessorParseCo…
quzard Feb 27, 2024
63ba69f
Merge remote-tracking branch 'alibaba/main' into add-ProcessorMergeMu…
quzard Feb 27, 2024
09f7401
Merge branch 'feat/stdout/ProcessorMergeMultilineLogNative' into feat…
quzard Feb 27, 2024
4740a84
Merge branch 'add-ProcessorMergeMultilineLogNative' into feat/stdout/…
quzard Feb 27, 2024
31991a0
fix
SteveYitao Feb 27, 2024
26435d6
Merge branch 'add-ProcessorMergeMultilineLogNative' into feat/stdout/…
quzard Feb 27, 2024
f70ba54
Polish
quzard Feb 29, 2024
782f06d
fix
quzard Mar 1, 2024
305123f
Merge remote-tracking branch 'alibaba/main' into add-ProcessorMergeMu…
quzard Mar 1, 2024
2700e9a
fix
quzard Mar 1, 2024
437296a
handle SupportedEvent
quzard Mar 1, 2024
4899759
add test
quzard Mar 1, 2024
2d601fb
fix
quzard Mar 1, 2024
9e969c2
Merge branch 'add-ProcessorMergeMultilineLogNative' into feat/stdout/…
quzard Mar 1, 2024
959857d
fix
quzard Mar 1, 2024
7b65f03
rm
quzard Mar 2, 2024
464bf12
rm
quzard Mar 2, 2024
7797842
LOG_ERROR
quzard Mar 2, 2024
b2f4772
modify MergeLogsByRegex
quzard Mar 4, 2024
781299d
fix
quzard Mar 4, 2024
68f809e
IsSupportedEvent
quzard Mar 5, 2024
9aad542
add mIgnoreWarning
quzard Mar 5, 2024
9cb7feb
add test
quzard Mar 5, 2024
820e868
fix
quzard Mar 5, 2024
4a41244
Merge branch 'add-ProcessorMergeMultilineLogNative' into feat/stdout/…
quzard Mar 5, 2024
8455943
Merge branch 'add-ProcessorMergeMultilineLogNative' into feat/stdout/…
quzard Mar 5, 2024
5dbab82
Merge branch 'feat/stdout/ProcessorMergeMultilineLogNative' into feat…
quzard Mar 5, 2024
5f8c112
fix test
quzard Mar 5, 2024
779be47
fix test
quzard Mar 5, 2024
a805a70
fix
quzard Mar 5, 2024
f6f564a
fix
quzard Mar 5, 2024
0bdb9cf
fix
quzard Mar 5, 2024
a841418
add ProcessEventsWithPartLogUnittest
quzard Mar 5, 2024
ed9aafa
add teset
quzard Mar 5, 2024
6836737
fix TestProcess
quzard Mar 5, 2024
233de69
fix TestProcessEventsWithPartLog
quzard Mar 5, 2024
b03f776
fix
quzard Mar 5, 2024
f5bde6d
modify
quzard Mar 5, 2024
82d1ddb
add UnmatchedContentTreatmentToString
quzard Mar 5, 2024
ed87135
Merge branch 'add-ProcessorMergeMultilineLogNative' into feat/stdout/…
quzard Mar 5, 2024
e70e10c
Merge remote-tracking branch 'alibaba/feat/stdout/ProcessorMergeMulti…
quzard Mar 5, 2024
1cbbabd
fix
quzard Mar 5, 2024
5de9cc2
fix
quzard Mar 6, 2024
2044378
fix
quzard Mar 6, 2024
88fe737
Merge branch 'feat/input_container_stdout' into add-ProcessorMergeMul…
quzard Mar 6, 2024
4516a37
Merge branch 'add-ProcessorMergeMultilineLogNative' into feat/stdout/…
quzard Mar 6, 2024
b74904c
Merge branch 'feat/stdout/ProcessorMergeMultilineLogNative' into feat…
quzard Mar 6, 2024
88c222b
fix
quzard Mar 6, 2024
37d9bf7
Merge branch 'add-ProcessorMergeMultilineLogNative' into feat/stdout/…
quzard Mar 6, 2024
466a27e
Merge branch 'feat/stdout/ProcessorMergeMultilineLogNative' into feat…
quzard Mar 6, 2024
1180966
fix
quzard Mar 6, 2024
6dc3fbe
指标
quzard Mar 7, 2024
a727803
指标
quzard Mar 7, 2024
220c418
fix
quzard Mar 7, 2024
1b3ae9d
fix
quzard Mar 7, 2024
374215a
Merge branch 'feat/input_container_stdout' into feat/stdout/Processor…
quzard Mar 7, 2024
90323cb
fix
quzard Mar 7, 2024
3bfa633
fix
quzard Mar 8, 2024
4a22153
fix
quzard Mar 8, 2024
3d0258a
add mKeepingSourceWhenParseFail
quzard Mar 11, 2024
5621947
add test
quzard Mar 11, 2024
7d14fb3
fix
quzard Mar 11, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 31 additions & 1 deletion core/file_server/MultilineOptions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,24 @@ bool MultilineOptions::Init(const Json::Value& config, const PipelineContext& ct
ctx.GetProjectName(),
ctx.GetLogstoreName(),
ctx.GetRegion());
} else if (mStartPatternRegPtr || mEndPatternRegPtr) {
} else if (mStartPatternRegPtr && mContinuePatternRegPtr && mEndPatternRegPtr) {
mContinuePatternRegPtr.reset();
LOG_WARNING(
ctx.GetLogger(),
("problem encountered in config parsing",
"none of param Multiline.StartPattern, Multiline.ContinuePattern and Multiline.EndPattern are empty")(
"action", "ignore param Multiline.ContinuePattern")("module", pluginName)("config",
ctx.GetConfigName()));
ctx.GetAlarm().SendAlarm(
CATEGORY_CONFIG_ALARM,
"none of param Multiline.StartPattern, Multiline.ContinuePattern and Multiline.EndPattern are empty: "
"ignore param Multiline.ContinuePattern, module: "
+ pluginName + ", config: " + ctx.GetConfigName(),
ctx.GetProjectName(),
ctx.GetLogstoreName(),
ctx.GetRegion());
}
if (mStartPatternRegPtr || mEndPatternRegPtr) {
mIsMultiline = true;
}
}
Expand Down Expand Up @@ -181,4 +198,17 @@ bool MultilineOptions::ParseRegex(const string& pattern, shared_ptr<boost::regex
return true;
}

const std::string& MultilineOptions::UnmatchedContentTreatmentToString() {
switch (mUnmatchedContentTreatment) {
case UnmatchedContentTreatment::DISCARD:
static std::string discardStr = "discard";
return discardStr;
case UnmatchedContentTreatment::SINGLE_LINE:
static std::string singleLine = "single line";
return singleLine;
default:
static std::string unkonwn = "";
return unkonwn;
}
}
} // namespace logtail
1 change: 1 addition & 0 deletions core/file_server/MultilineOptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ namespace logtail {

class MultilineOptions {
public:
const std::string& UnmatchedContentTreatmentToString();
enum class Mode { CUSTOM, JSON };
enum class UnmatchedContentTreatment { DISCARD, SINGLE_LINE };

Expand Down
2 changes: 1 addition & 1 deletion core/models/LogEvent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ bool LogEvent::FromJson(const Json::Value& root) {
if (root.isMember("contents")) {
Json::Value contents = root["contents"];
for (const auto& key : contents.getMemberNames()) {
SetContent(key, contents[key].asString());
SetContent(GetSourceBuffer()->CopyString(key), contents[key].asString());
}
}
return true;
Expand Down
3 changes: 3 additions & 0 deletions core/models/PipelineEventGroup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ const std::string EVENT_GROUP_META_LOG_FILE_PATH_RESOLVED = "log.file.path_resol
const std::string EVENT_GROUP_META_LOG_FILE_INODE = "log.file.inode";
const std::string EVENT_GROUP_META_LOG_FILE_OFFSET = "log.file.offset";
const std::string EVENT_GROUP_META_LOG_FILE_LENGTH = "log.file.length";
const std::string EVENT_GROUP_META_CONTAINER_TYPE = "container.type";

const std::string EVENT_GROUP_META_K8S_CLUSTER_ID = "k8s.cluster.id";
const std::string EVENT_GROUP_META_K8S_NODE_NAME = "k8s.node.name";
Expand Down Expand Up @@ -189,6 +190,8 @@ const std::string& EventGroupMetaKeyToString(EventGroupMetaKey key) {
return EVENT_GROUP_META_LOG_FILE_OFFSET;
case EventGroupMetaKey::LOG_READ_LENGTH:
return EVENT_GROUP_META_LOG_FILE_LENGTH;
case EventGroupMetaKey::LOG_FORMAT:
return EVENT_GROUP_META_CONTAINER_TYPE;
default:
static std::string sEmpty = "unknown";
return sEmpty;
Expand Down
1 change: 1 addition & 0 deletions core/models/PipelineEventGroup.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ enum class EventGroupMetaKey {
LOG_FILE_INODE,
LOG_READ_OFFSET,
LOG_READ_LENGTH,
LOG_FORMAT,

K8S_CLUSTER_ID,
K8S_NODE_NAME,
Expand Down
1 change: 1 addition & 0 deletions core/monitor/MetricConstants.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ const std::string METRIC_PROC_PARSE_IN_SIZE_BYTES = "proc_parse_in_size_bytes";
const std::string METRIC_PROC_PARSE_OUT_SIZE_BYTES = "proc_parse_out_size_bytes";

const std::string METRIC_PROC_PARSE_ERROR_TOTAL = "proc_parse_error_total";
const std::string METRIC_PROC_PARSE_SUCCESS_TOTAL = "proc_parse_success_total";
const std::string METRIC_PROC_KEY_COUNT_NOT_MATCH_ERROR_TOTAL = "proc_key_count_not_match_error_total";
const std::string METRIC_PROC_HISTORY_FAILURE_TOTAL = "proc_history_failure_total";

Expand Down
1 change: 1 addition & 0 deletions core/monitor/MetricConstants.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ extern const std::string METRIC_PROC_TIME_MS;
extern const std::string METRIC_PROC_PARSE_IN_SIZE_BYTES;
extern const std::string METRIC_PROC_PARSE_OUT_SIZE_BYTES;
extern const std::string METRIC_PROC_PARSE_ERROR_TOTAL;
extern const std::string METRIC_PROC_PARSE_SUCCESS_TOTAL;
extern const std::string METRIC_PROC_KEY_COUNT_NOT_MATCH_ERROR_TOTAL;
extern const std::string METRIC_PROC_HISTORY_FAILURE_TOTAL;

Expand Down
4 changes: 4 additions & 0 deletions core/plugin/PluginRegistry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@
#include "plugin/creator/StaticProcessorCreator.h"
#include "processor/ProcessorDesensitizeNative.h"
#include "processor/ProcessorFilterNative.h"
#include "processor/ProcessorMergeMultilineLogNative.h"
#include "processor/ProcessorParseApsaraNative.h"
#include "processor/ProcessorParseContainerLogNative.h"
#include "processor/ProcessorParseDelimiterNative.h"
#include "processor/ProcessorParseJsonNative.h"
#include "processor/ProcessorParseRegexNative.h"
Expand Down Expand Up @@ -259,6 +261,8 @@ void PluginRegistry::LoadStaticPlugins() {
RegisterProcessorCreator(new StaticProcessorCreator<ProcessorParseTimestampNative>());
RegisterProcessorCreator(new StaticProcessorCreator<ProcessorTagNative>());
RegisterProcessorCreator(new StaticProcessorCreator<ProcessorFilterNative>());
RegisterProcessorCreator(new StaticProcessorCreator<ProcessorMergeMultilineLogNative>());
RegisterProcessorCreator(new StaticProcessorCreator<ProcessorParseContainerLogNative>());
#if defined(__linux__) && !defined(__ANDROID__)
if (BOOL_FLAG(enable_processor_spl)) {
RegisterProcessorCreator(new StaticProcessorCreator<ProcessorSPL>());
Expand Down
Loading
Loading