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 117 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
19 changes: 18 additions & 1 deletion core/models/PipelineEventGroup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

#include "models/PipelineEventGroup.h"

#include <processor/ProcessorParseContainerLogNative.h>

#include <sstream>

#include "logger/Logger.h"
Expand Down Expand Up @@ -157,6 +159,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 All @@ -169,6 +172,9 @@ const std::string EVENT_GROUP_META_CONTAINER_IP = "container.ip";
const std::string EVENT_GROUP_META_CONTAINER_IMAGE_NAME = "container.image.name";
const std::string EVENT_GROUP_META_CONTAINER_IMAGE_ID = "container.image.id";

const std::string EVENT_GROUP_META_CONTAINERD_TEXT = "containerd_text";
const std::string EVENT_GROUP_META_DOCKER_JSON_FILE = "docker_json-file";

const std::string& EventGroupMetaKeyToString(EventGroupMetaKey key) {
switch (key) {
case EventGroupMetaKey::AGENT_TAG:
Expand All @@ -189,12 +195,23 @@ 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;
}
}

const std::string EventGroupMetaValueToString(std::string value) {
if (value == ProcessorParseContainerLogNative::CONTAINERD_TEXT) {
return EVENT_GROUP_META_CONTAINERD_TEXT;
} else if (value == ProcessorParseContainerLogNative::DOCKER_JSON_FILE) {
return EVENT_GROUP_META_DOCKER_JSON_FILE;
}
return value;
}

EventGroupMetaKey StringToEventGroupMetaKey(const std::string& key) {
static std::unordered_map<std::string, EventGroupMetaKey> sStringToEnum
= {{EVENT_GROUP_META_AGENT_TAG, EventGroupMetaKey::AGENT_TAG},
Expand All @@ -218,7 +235,7 @@ Json::Value PipelineEventGroup::ToJson() const {
if (!mMetadata.empty()) {
Json::Value metadata;
for (const auto& meta : mMetadata) {
metadata[EventGroupMetaKeyToString(meta.first)] = meta.second.to_string();
metadata[EventGroupMetaKeyToString(meta.first)] = EventGroupMetaValueToString(meta.second.to_string());
}
root["metadata"] = metadata;
}
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
5 changes: 5 additions & 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 All @@ -62,4 +63,8 @@ const std::string METRIC_PROC_MERGE_MULTILINE_LOG_MERGED_RECORDS_TOTAL
const std::string METRIC_PROC_MERGE_MULTILINE_LOG_UNMATCHED_RECORDS_TOTAL
= "proc_merge_multiline_log_unmatched_records_total";

// processor parse container log native metrics
const std::string METRIC_PROC_PARSE_STDOUT_TOTAL = "proc_parse_stdout_total";
const std::string METRIC_PROC_PARSE_STDERR_TOTAL = "proc_parse_stderr_total";

} // namespace logtail
6 changes: 6 additions & 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 All @@ -56,4 +57,9 @@ extern const std::string METRIC_PROC_DESENSITIZE_RECORDS_TOTAL;
extern const std::string METRIC_PROC_MERGE_MULTILINE_LOG_MERGED_RECORDS_TOTAL;
extern const std::string METRIC_PROC_MERGE_MULTILINE_LOG_UNMATCHED_RECORDS_TOTAL;


// processor parse container log native metrics
extern const std::string METRIC_PROC_PARSE_STDOUT_TOTAL;
extern const std::string METRIC_PROC_PARSE_STDERR_TOTAL;

} // namespace logtail
2 changes: 2 additions & 0 deletions core/plugin/PluginRegistry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
#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 @@ -261,6 +262,7 @@ void PluginRegistry::LoadStaticPlugins() {
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
1 change: 1 addition & 0 deletions core/processor/ProcessorMergeMultilineLogNative.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ class ProcessorMergeMultilineLogNative : public Processor {
friend class ProcessorMergeMultilineLogNativeUnittest;
friend class ProcessorMergeMultilineLogDisacardUnmatchUnittest;
friend class ProcessorMergeMultilineLogKeepUnmatchUnittest;
friend class ProcessorParseContainerLogNativeUnittest;
#endif
};

Expand Down
Loading
Loading