<% end %>
<%
-- 安全处理:确保syslog存在且为字符串
local log_content = self.syslog or ""
local row_count = 2
-- 安全检查:只有当log_content非空时才计算行数
if log_content and log_content ~= "" then
local newline_count = 0
for _ in string.gmatch(log_content, "\n") do
newline_count = newline_count + 1
end
row_count = newline_count + 2
if row_count < 5 then
row_count = 5
end
if row_count > 50 then
row_count = 50
end
end
%>
<% if log_content == "" then %>
<%:No events found in the last 24 hours.%>
<% elseif string.find(log_content, "^%[ERROR%]") then %>
<%:Docker Error:%> <%=log_content:pcdata()%>
<% elseif string.find(log_content, "^%[DEBUG%]") then %>
<%:Debug Info - Raw Response:%>
<% elseif string.find(log_content, "^%[INFO%]") then %>
<%:No events found in the last 24 hours.%>
<% else %>
<% end %>