Enhance Host Identification and Metadata Fetching in MachineInfoUtil #1989
+192
−35
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request introduces several changes to the
MachineInfoUtil
module, focusing on enhancing the handling of host identification and metadata fetching. The key changes include the addition of new functions for serial number retrieval, improvements to the ECS metadata fetching process, and the introduction of a new host ID tag.Enhancements to host identification:
core/common/MachineInfoUtil.cpp
: Added functionsGetSerialNumberFromEcsAssist
,GetEcsAssistMachineIdFile
,GetLocalHostId
, andFetchHostId
to improve host identification and retrieval of the serial number from ECS assist.core/constants/Constants.cpp
,core/constants/Constants.h
: Introduced a new constantLOG_RESERVED_KEY_HOSTID
for logging the host ID. [1] [2]core/plugin/processor/inner/ProcessorTagNative.cpp
: Added a feature to enable host ID tagging in logs when theenable_host_id
flag is set. [1] [2]Improvements to metadata fetching:
core/common/MachineInfoUtil.cpp
: Enhanced theFetchECSMeta
function to include token-based authentication and improved error handling during metadata retrieval.Code organization and cleanup:
core/common/MachineInfoUtil.cpp
: Added missing includes forboost/filesystem.hpp
andcommon/FileSystemUtil.h
. [1] [2]core/common/MachineInfoUtil.h
: Reorganized includes forrapidjson
headers and added a declaration for the newFetchHostId
function. [1] [2]