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

fix too long log split alarm #915

Merged
merged 1 commit into from Jun 12, 2023
Merged

fix too long log split alarm #915

merged 1 commit into from Jun 12, 2023

Conversation

Abingcbc
Copy link
Collaborator

@Abingcbc Abingcbc commented Jun 8, 2023

超长日志被截断可以分为两种情况:

  • 单行:e.g. xxxxxx。
    • 在 ReadUTF8 中,moreData 为 true,nBytes 为 0。
    • 在 ReadGBK 中,moreData 为 true,readCharCount 为 0。
  • 多行:e.g. Begin Reg\nxxxx\nxxxxx
    • 在 ReadUTF8 中,moreData 为 true,readCharCount 为 0(因为之前的日志被 LastMatchedLine 截断了,因此,如果需要匹配BeginReg,那么一定是在开头,所以 nBytes 为 0。)
    • 在 ReadGBK 中,moreData 为 true,resultCharCount 为 0。

@@ -90,7 +90,8 @@ enum LogtailAlarmType {
OBSERVER_INIT_ALARM = 61,
OBSERVER_RUNTIME_ALARM = 62,
OBSERVER_STOP_ALARM = 63,
ALL_LOGTAIL_ALARM_NUM = 64
ALL_LOGTAIL_ALARM_NUM = 64,
LOG_TOO_LONG_SPLIT_ALARM = 65
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

上面有SPLIT_LOG_FAIL_ALARM,这里是不是直接复用一下。
另外,增加ALARM类型的话,ALL_LOGTAIL_ALARM_NUM总应该在最后,表达ALARM类型总数

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@@ -1632,6 +1632,13 @@ void LogFileReader::ReadUTF8(char*& bufferptr, size_t* size, int64_t end, bool&
}

if (moreData && nbytes == 0) {
LOG_WARNING(sLogger, ("Log is too long and is splitted at position", mLastFilePos + nbytes));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个warning信息不全,最好加上文件名和inode信息
Log is too long and forced to be split at offset: xxx file: xxx inode: xxx log: xxx(前1024B)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@yyuuttaaoo yyuuttaaoo merged commit e792bbf into alibaba:main Jun 12, 2023
20 checks passed
Abingcbc added a commit to Abingcbc/ilogtail that referenced this pull request Jun 16, 2023
@yyuuttaaoo yyuuttaaoo added this to the v1.7 milestone Jul 2, 2023
@Abingcbc Abingcbc deleted the fix branch July 3, 2023 12:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants