ilogtail icon indicating copy to clipboard operation
ilogtail copied to clipboard

[BUG]:ilogtail 每次重启 app_info.json 里面的 instance_id 都会变动

Open wangzan18 opened this issue 11 months ago • 3 comments

Describe the bug A clear and concise description of what the bug is, ideally within 20 words. ilogtail 每次重启 app_info.json 里面的 instance_id 都会变动 iLogtail Running Environment Please provide the following information: Ubuntu 22.04 64位

  • ilogtail version: 2.0.0

  • Yaml configuration:

  • ilogtail.LOG:

  • logtail_plugin.LOG:

root@test-sre-zhangyuan:/usr/local/ilogtail# cat app_info.json { "UUID" : "", "build_date" : "20240111", "compiler" : "GCC 9.3.1", "git_hash" : "48473de035a796d8235c6beb92015096dd41f649", "hostname" : "test-sre-zhangyuan", "instance_id" : "EF18CA38-E353-11EE-BAED-05EDAC762978__1710566012", "ip" : "172.16.122.244", "logtail_version" : "2.0.0 Community Edition", "os" : "Linux; 5.15.0-56-generic; #62-Ubuntu SMP Tue Nov 22 19:54:14 UTC 2022; x86_64", "update_time" : "2024-03-16 13:13:32" } root@test-sre-zhangyuan:/usr/local/ilogtail# systemctl restart ilogtaild root@test-sre-zhangyuan:/usr/local/ilogtail# cat app_info.json { "UUID" : "", "build_date" : "20240111", "compiler" : "GCC 9.3.1", "git_hash" : "48473de035a796d8235c6beb92015096dd41f649", "hostname" : "test-sre-zhangyuan", "instance_id" : "40C67A10-E354-11EE-BAED-05EDAC762978__1710566149", "ip" : "172.16.122.244", "logtail_version" : "2.0.0 Community Edition", "os" : "Linux; 5.15.0-56-generic; #62-Ubuntu SMP Tue Nov 22 19:54:14 UTC 2022; x86_64", "update_time" : "2024-03-16 13:15:49" } root@test-sre-zhangyuan:/usr/local/ilogtail# systemctl restart ilogtaild root@test-sre-zhangyuan:/usr/local/ilogtail# cat app_info.json { "UUID" : "", "build_date" : "20240111", "compiler" : "GCC 9.3.1", "git_hash" : "48473de035a796d8235c6beb92015096dd41f649", "hostname" : "test-sre-zhangyuan", "instance_id" : "43E55E32-E354-11EE-BAED-05EDAC762978__1710566155", "ip" : "172.16.122.244", "logtail_version" : "2.0.0 Community Edition", "os" : "Linux; 5.15.0-56-generic; #62-Ubuntu SMP Tue Nov 22 19:54:14 UTC 2022; x86_64", "update_time" : "2024-03-16 13:15:55" }

使用 configServer 同一台机器出现多个 image

wangzan18 avatar Mar 16 '24 05:03 wangzan18

这个行为是by design的,目前开源的config server对此没有处理好。

yyuuttaaoo avatar Mar 20 '24 03:03 yyuuttaaoo

严格来说,不算是 bug,应该算主干分支 config server 没有实现的功能,没有心跳管理,已经离线的 agent 记录不能剔除。很久之前,已提交 PR

https://github.com/alibaba/ilogtail/pull/1016

liangry avatar Mar 21 '24 01:03 liangry

需要固定可以换成dmi-uuid,下面写了一个实现

optional GetSystemUUID() { #if defined(linux) { ifstream uuidFile("/sys/class/dmi/id/product_uuid"); string uuid; if (uuidFile.is_open()) { getline(uuidFile, uuid); uuidFile.close(); return uuid; } return nullopt; } #elif defined(_MSC_VER) { HKEY hKey; if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\Microsoft\Cryptography", 0, KEY_READ, &hKey) == ERROR_SUCCESS) { char uuidBuffer[255]; DWORD bufferSize = sizeof(uuidBuffer); if (RegQueryValueEx(hKey, "MachineGuid", nullptr, nullptr, (LPBYTE)uuidBuffer, &bufferSize) == ERROR_SUCCESS) { string uuid(uuidBuffer); return uuid; } RegCloseKey(hKey); } return nullopt; } #else return nullopt; #endif }

nelsontang avatar May 30 '24 15:05 nelsontang