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

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

Open
wangzan18 opened this issue Mar 16, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@wangzan18
Copy link

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 wangzan18 added the bug Something isn't working label Mar 16, 2024
@yyuuttaaoo
Copy link
Collaborator

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

@liangry
Copy link
Collaborator

liangry commented Mar 21, 2024

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

#1016

@nelsontang
Copy link

需要固定可以换成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
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants