Ai
1 Star 0 Fork 1

SmartSmallBoy/loongcollector_cpp

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
TagConstants.cpp 3.73 KB
一键复制 编辑 原始数据 按行查看 历史
// Copyright 2024 iLogtail Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "constants/TagConstants.h"
#include <unordered_map>
using namespace std;
namespace logtail {
const string& GetDefaultTagKeyString(TagKey key) {
static const unordered_map<TagKey, string> TagKeyDefaultValue = {
{TagKey::FILE_OFFSET_KEY, DEFAULT_LOG_TAG_FILE_OFFSET},
{TagKey::FILE_INODE_TAG_KEY, DEFAULT_LOG_TAG_FILE_INODE},
{TagKey::FILE_PATH_TAG_KEY, DEFAULT_LOG_TAG_FILE_PATH},
{TagKey::K8S_NAMESPACE_TAG_KEY, DEFAULT_LOG_TAG_NAMESPACE},
{TagKey::K8S_POD_NAME_TAG_KEY, DEFAULT_LOG_TAG_POD_NAME},
{TagKey::K8S_POD_UID_TAG_KEY, DEFAULT_LOG_TAG_POD_UID},
{TagKey::CONTAINER_NAME_TAG_KEY, DEFAULT_LOG_TAG_CONTAINER_NAME},
{TagKey::CONTAINER_IP_TAG_KEY, DEFAULT_LOG_TAG_CONTAINER_IP},
{TagKey::CONTAINER_IMAGE_NAME_TAG_KEY, DEFAULT_LOG_TAG_IMAGE_NAME},
{TagKey::HOST_NAME_TAG_KEY, DEFAULT_LOG_TAG_HOST_NAME},
{TagKey::HOST_ID_TAG_KEY, DEFAULT_LOG_TAG_HOST_ID},
{TagKey::CLOUD_PROVIDER_TAG_KEY, DEFAULT_LOG_TAG_CLOUD_PROVIDER},
#ifndef __ENTERPRISE__
{TagKey::HOST_IP_TAG_KEY, DEFAULT_LOG_TAG_HOST_IP},
#else
{TagKey::AGENT_TAG_TAG_KEY, DEFAULT_LOG_TAG_USER_DEFINED_ID},
#endif
};
static const string unknown = "unknown_tag_key";
auto iter = TagKeyDefaultValue.find(key);
if (iter != TagKeyDefaultValue.end()) {
return iter->second;
} else {
return unknown;
}
}
////////////////////////// COMMON ////////////////////////
const string DEFAULT_CONFIG_TAG_KEY_VALUE = "__default__";
////////////////////////// LOG ////////////////////////
const string DEFAULT_LOG_TAG_NAMESPACE = "_namespace_";
const string DEFAULT_LOG_TAG_POD_NAME = "_pod_name_";
const string DEFAULT_LOG_TAG_POD_UID = "_pod_uid_";
const string DEFAULT_LOG_TAG_CONTAINER_NAME = "_container_name_";
const string DEFAULT_LOG_TAG_CONTAINER_IP = "_container_ip_";
const string DEFAULT_LOG_TAG_IMAGE_NAME = "_image_name_";
const string DEFAULT_LOG_TAG_HOST_NAME = "__hostname__";
const string DEFAULT_LOG_TAG_FILE_OFFSET = "__file_offset__";
const string DEFAULT_LOG_TAG_FILE_INODE = "__inode__";
const string DEFAULT_LOG_TAG_FILE_PATH = "__path__";
const string DEFAULT_LOG_TAG_HOST_ID = "__host_id__";
const string DEFAULT_LOG_TAG_CLOUD_PROVIDER = "__cloud_provider__";
#ifndef __ENTERPRISE__
const string DEFAULT_LOG_TAG_HOST_IP = "__host_ip__";
#else
const string DEFAULT_LOG_TAG_USER_DEFINED_ID = "__user_defined_id__";
#endif
// only used in pipeline, not serialized
const string LOG_RESERVED_KEY_SOURCE = "__source__";
const string LOG_RESERVED_KEY_TOPIC = "__topic__";
const string LOG_RESERVED_KEY_MACHINE_UUID = "__machine_uuid__";
const string LOG_RESERVED_KEY_PACKAGE_ID = "__pack_id__";
////////////////////////// METRIC ////////////////////////
const string DEFAULT_METRIC_TAG_NAMESPACE = "namespace";
const string DEFAULT_METRIC_TAG_POD_NAME = "pod_name";
const string DEFAULT_METRIC_TAG_POD_UID = "pod_uid";
const string DEFAULT_METRIC_TAG_CONTAINER_NAME = "container_name";
const string DEFAULT_METRIC_TAG_CONTAINER_IP = "container_ip";
const string DEFAULT_METRIC_TAG_IMAGE_NAME = "image_name";
////////////////////////// TRACE ////////////////////////
} // namespace logtail
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/SmartSmallBoy/loongcollector_cpp.git
git@gitee.com:SmartSmallBoy/loongcollector_cpp.git
SmartSmallBoy
loongcollector_cpp
loongcollector_cpp
master

搜索帮助