The article Create your first serverless function with Red Hat OpenShift Serverless Functions showed how to get started with a Node.js function application. You saw how to create a simple function application and deploy it to Red Hat OpenShift. It also covered basic usage of the Knative command-line tool
This series of articles offers a deeper dive into Node.js serverless functions on OpenShift. In Part 1, we’ll look at how logging works and how to customize what is logged in a Node.js function application.
Note: If you are not familiar with serverless functions in Node.js, we recommend reading Create your first serverless function with Red Hat OpenShift Serverless Functions.
To follow along with the examples, you’ll need to install Docker and the kn command-line interface (CLI).
It is not necessary to have access to a Red Hat OpenShift cluster, but if you would like to test one out for free, check out the Developer Sandbox for Red Hat OpenShift. For more information on setting up your environment for Red Hat OpenShift Serverless Functions, see the OpenShift Serverless Functions Quick Start guide.
As a quick refresher, we can use the
kn func create command to scaffold out a new Node.js functions application that responds to simple HTTP requests. Along with the
func.yaml files, this application includes a very basic
index.js that exports a single function, which is the “function” part of Serverless Functions. We will extend this to show the different logging options available.