In this recipe, we will learn how to configure the Fluentd plugin that we installed on Jenkins.
Let's perform the following steps to feed Jenkins logs to Elasticsearch:
- In the Manage Jenkins menu, click on the Configure System button.
- Scroll through the settings. Under the Logger for Fluentd settings, enter a logger name. The logger name is used as a prefix for Fluentd. In the Host field, enter the Service name of your Fluentd service and the exposed port number. In our example, in our Kubernetes cluster, we used the stable/fluentd Helm chart to install Fluentd. The service name is fluentd. This is exposed via port 24220. Save the changes:
- Select a job under the pipeline configuration.
- Click on the Add post-build action button and select the Send to Fluentd option from the drop-down menu.
Now, the Fluentd plugin will push the logs to Elasticsearch through the log collector.