Gordon  Matlala

Gordon Matlala

1626436140

Node.js Serverless Functions on Red Hat OpenShift, Part 1: Logging

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 kn.

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.

Prerequisites

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.

Getting started with serverless functions

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 package.json and 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.

#serverless #node

Node.js Serverless Functions on Red Hat OpenShift, Part 1: Logging