Compute@Edge Tail logging from Javascript does not show anything
Based on these two docs:
- https://developer.fastly.com/learning/compute/javascript/
- https://www.fastly.com/blog/introducing-compute-edge-log-tailing-for-better-observability-and-easier-debugging
I am trying to tail logs from javascript. I tried two options:
// 1.
logger = fastly.getLogger("JavaScriptLog")
fastly.log("foo")
// 2.
console.log("foo")
Then running:
fastly log-tail --service-id=SERVICE_ID --verbose
However this does not show anything neither from fastly.log, nor from console.log. The examples are however mostly referring to Rust, is this expected to work in JS as well?
-
Hi Vojtech,
In your provided code, the correct implementation for log-tailing would be the 2nd option, using:
console.log("foo");
According to our documentation on live monitoring the 1st option would be incorrect: https://developer.fastly.com/learning/compute/testing/#live-log-monitoring-in-your-console
Data sent to named log endpoints is not included in log tailing output.
Please note that log-tailing only works on deployed services, they do not work on local testing as the local test server and Fastly Fiddle display all log output automatically.
The command you provided looks correct however log-tailing also requires a API token using the -t flag:
fastly log-tail --service-id=SERVICE_ID --verbose -t <API-TOKEN>
If you are seeing an output similar to this then the log-tail command is connecting correctly:
Fastly API token provided via --token
Fastly API endpoint: https://api.fastly.com
Service ID (via --service-id): <SERVICE-ID>
INFO: Managed logging enabled on service <SERVICE-ID>If you are still having trouble getting output using the log-tail command then please reach out to support@fastly.com and we'll be more than happy to troubleshoot this further.
Please sign in to leave a comment.
Comments
1 comment