Apex serverless logging and metrics
When working with serverless functions such as Lambda, it is valuable to have portable, structured logs. In addition, you can combine earlier recipes dealing with logging to this recipe. The recipes covered in Chapter 4, Error Handling in Go, are just as relevant. Because we're using Apex to handle our lambda functions, we chose to use the Apex logger for this recipe. We'll also rely on metrics provided by Apex as well as the AWS console. The earlier recipes explored more complex logging and metrics examples, and those still apply--the Apex logger can easily be configured to aggregate logs using something like Amazon Kinesis or Elasticsearch.
Getting ready
Configure your environment according to these steps:
- Refer to the Getting ready section of the Go programming on Lambda with Apex recipe in this chapter.
- Run the
go get github.com/apex/log
command.
How to do it...
These steps cover writing and running your application:
- From your terminal/console application...