This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const sleep = ms => { | |
return new Promise(resolve => { | |
setTimeout(resolve, ms) | |
}) | |
} | |
const makeid = length => { | |
let text = "" | |
const possible = "ABCDEFGHIJKLMNPQRSTUVWXYZ0123456789" | |
for (let i = 0; i < length; i += 1) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"logflare_worker": { | |
"version": "1.0.2", | |
"worker_id": "RXJD9X", | |
"worker_started": "2021-04-13T13:36:18.848Z" | |
}, | |
"request": { | |
"cf": { | |
"asn": 15169, | |
"clientAcceptEncoding": "gzip,deflate,br", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl -X "POST" "https://api.logflare.app/logs?source=YOUR_SOURCE_UUID" \ | |
-H 'Content-Type: application/json' \ | |
-H 'X-Api-Key: YOUR_INGEST_KEY' \ | |
-d $'{ | |
"batch": [ | |
{ | |
"message": "This is another log message.", | |
"metadata": { | |
"ip_address": "100.100.100.100", | |
"request_method": "POST", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const makeid = length => { | |
let text = "" | |
const possible = "ABCDEFGHIJKLMNPQRSTUVWXYZ0123456789" | |
for (let i = 0; i < length; i += 1) { | |
text += possible.charAt(Math.floor(Math.random() * possible.length)) | |
} | |
return text | |
} | |
const buildMetadataFromHeaders = headers => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl -X "POST" "https://api.logflare.app/logs?source=2fd57445-1da3-4f3b-aa29-73da06ed7e67" \ | |
-H 'Content-Type: application/json' \ | |
-H 'X-API-KEY: YOUR_KEY' \ | |
-d $'{ | |
"message": "This is another log message.", | |
"metadata": { | |
"ip_address": "100.100.100.100", | |
"request_method": "POST", | |
"custom_user_data": { | |
"vip": true, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl -X "POST" "https://api.logflare.app/logs/json?source=2fd57445-1da3-4f3b-aa29-73da06ed7e67" \ | |
-H 'Content-Type: application/json; charset=utf-8' \ | |
-H 'X-API-KEY: YOUR_KEY' \ | |
-d $'[ | |
{ | |
"yellow": true, | |
"tags": [ | |
"popular, tropical, organic" | |
], | |
"store": { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT * FROM `logflare-232118.[ID]_prod.[SOURCE_UUID_UNDERSCORE]` | |
WHERE DATE(_PARTITIONTIME) | |
BETWEEN PARSE_DATE('%Y%m%d', @DS_START_DATE) | |
AND PARSE_DATE('%Y%m%d', @DS_END_DATE) | |
OR _PARTITIONTIME IS null |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"deploymentId": "dpl_8zVeEFAnYTXLoBT8XYMgLVbc1Rpi", | |
"host": "pino-logflare-nextjs-vercel-example-7duieexku.vercel.app", | |
"id": "1595492268532915653954269765", | |
"message": "START RequestId: 4148955a-4bf6-4ae9-8736-95826ac8a414 Version: $LATEST\n{\"metadata\":{\"env\":\"production\",\"request\":{\"headers\":{\"host\":\"pino-logflare-nextjs-vercel-example.now.sh\",\"x_forwarded_host\":\"pino-logflare-nextjs-vercel-example.now.sh\",\"accept\":\"*/*\",\"x_vercel_deployment_url\":\"pino-logflare-nextjs-vercel-example-7duieexku.vercel.app\",\"x_forwarded_proto\":\"https\",\"x_real_ip\":\"54.36.148.90\",\"accept_encoding\":\"deflate, gzip, br\",\"user_agent\":\"Mozilla/5.0 (compatible; AhrefsBot/6.1; +http://ahrefs.com/robot/)\",\"x_vercel_forwarded_for\":\"54.36.148.90\",\"x_forwarded_for\":\"54.36.148.90\",\"x_nextjs_page\":\"/index\",\"x_vercel_id\":\"lhr1::95xl7-1595492267523-aebd6fdc73fb\",\"connection\":\"close\"},\"url\":\"/\",\"method\":\"GET\"},\"response\":{\"statusCode\":200},\"context\":{},\"level |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[INPUT] | |
Name tail | |
Path /var/log/system.log | |
[OUTPUT] | |
Name http | |
Match * | |
tls On | |
tls.verify Off | |
Host api.logflare.app |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def event(conn, params) do | |
user_token = params["authentications"]["account"]["token"]["token"] | |
response = | |
build_response(conn, user_token) | |
|> Jason.encode!() | |
conn | |
|> put_resp_content_type("application/json") | |
|> send_resp(200, response) |