Update index.js

This commit is contained in:
tiennm99 committed 2025-11-15 21:37:54 +07:00
1 parent 1089d1f4e2
commit 279e271594
1 file changed
+7 -1
+7 -1
View File
@@ -42,12 +42,18 @@ async function handleRequest(request, env) {
});
}
// Get client IP from Cloudflare headers
const clientIP = request.headers.get('CF-Connecting-IP') ||
request.headers.get('X-Forwarded-For') ||
'unknown';
// Create Loki payload from plain text message
const lokiPayload = {
streams: [
{
stream: {
source: 'miti-loki'
source: 'miti-loki',
ip: clientIP
},
values: [
[(Date.now() * 1000000).toString(), message]