mirror of
https://github.com/tiennm99/miti-loki.git
synced 2026-10-11 03:13:40 +00:00
Update index.js
This commit is contained in:
1 parent
1089d1f4e2
commit
279e271594
1 file changed
+7
-1
@@ -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]
|
||||
|
||||
Reference in new issue
Block a user