There are several ways to collect and analyze logs from the Ad Hoc workers running in Kubernetes. These logs are useful in case certain Ad Hoc views are causing errors. Setting log levels and searching for log messages can help debug the cause.
Log levels using Log4j2 can be set in values.yaml or on the command line as follows:
Aggregate to File
The scalable query engine can use fluentd to collect logs from all running workers and make them available on machine where JasperReports Server is running. By default, the scalable query engine uses one fluentd instance per physical node (or virtual machine) for collecting log messages in text format from the workers in Kubernetes. There are then two possible ways to access the logs:
|•||Fluentbit on each physical node or VM forwards text logs to the fluentd aggregator, and aggregate logs can be viewed on the same machine as JasperReports Server.|
|•||Fluentbit is set to JSON format on each physical node or VM and accessed directly by Elasticsearch and Kibana (ELK) to view logs. Alternatively, you can use ELK to view the aggregate text log file in the first case.|
First you should download the fluentd package with the following commands:
git clone \ --depth 1 \ --filter=blob:none \ --no-checkout \ https://github.com/fluent/fluentd-kubernetes-daemonset/tree/master/docker-image/v1.11/debian-s3 \ ; mv debian-s3 docker-fluentd-file cd docker-fluentd-file git checkout master -- d1
To enable the fluentd aggregator set logging.enabled=true and configure the fluentd.* properties in values.yaml.
Elasticsearch Kibana (ELK)
Elasticsearch is an analytics engine from distributed sources, Kibana is a graphing package for Elasticsearch, and together they can be used to access logs from the Ad Hoc workers.
TIBCO provides no support for Elasticsearch and Kibana, only a basic configuration for demonstration and a collector (fluentd).
|1.||Configure the elasticsearch.* properties in values.yaml.|
|2.||Install Kibana with the following command:|
Note that the resources values (1Gi) is an example that should be modified for your own usage. The Kibana index pattern is scalable-adhoc-<ReleaseName>-*, where <ReleaseName> is the helm release name.
|3.||The default output format is text. If you want to log directly to ELK, you can set the output format to JSON with the following helm setting:|
Depending on the log driver being used, JSON output may require you to configure merging and indexing on Kubernetes. It is also possible to use ELK for the visualization of text output from the fluentd aggregator.
The JSON output may require you to configure merging and indexing on K8s (depending on log driver used). The main use case would be to configure the Scalable Query Engine to log directly to ELK. For more information, see https://docs.fluentbit.io/manual/pipeline/outputs.