zoomdata-websocket.log and zoomdata-errors.log to a Fluentd server, you can add one of Fluentd’s plug-ins to write the log files to Elasticsearch to analyze web client errors for your environment.
Unified logging does not replace Self-Service Analytics’s default logging architecture. It only augments that experience with an option for those wanting additional logging control.
By default, unified logging is disabled and needs to be enabled for each microservice you want captured in Fluentd.
If written to a data store compatible with Self-Service Analytics’s connectors, Self-Service Analytics can then be used to analyze and visualize your logs. The selected data store must be supported by Self-Service Analytics’s connectors if you plan to view the log files in Self-Service Analytics dashboards. A list of supported data stores is provided in Data Connector Reference. The selected data store should be available and configured in conjunction with Fluentd to receive logs.
At a high level, the steps to set up Fluentd are as follows:
- Set up a database to store the Fluentd log files. Typically, customers store log files in a log capture service such as Elasticsearch or in a database server such as PostgreSQL.
- Configure Fluentd logging for your Self-Service Analytics installation. See Configure Unified Logging Using Fluentd. This includes configuring the Fluentd
td-agent.conffile to identify the Self-Service Analytics microservice log data you want logged. - Enable unified logging and configure the host and port information for your Fluentd server for each microservice log file from which you are extracting data for Fluentd logging. See Enable Unified Logging in Self-Service Analytics Using Fluentd.
Enable Unified Logging in Self-Service Analytics Using Fluentd
Identify the Self-Service Analytics microservices for which you want activity logged to Fluentd. A complete list of the Self-Service Analytics microservices is given in Self-Service Analytics Microservice Name Reference, but not all microservices support unified logging. You can enable unified logging for these microservices:- Web microservices (
zoomdata.properties) - Query engine (
query-engine.properties) - Data source connectors (see Connector Properties and Property Files for a list of property files)
- Data Writer framework (
data-writer-postgresql.properties)
-
On your Self-Service Analytics server, edit the
.propertiesfile for the microservice. For example,etc/zoomdata/query-engine.properties. -
Define the following parameters in the
.propertiesfile:Property Syntax Description logging.unified.level = <log-level>Specify one of the following log levels for <log-level>: ERROR, WARN, INFO, DEBUG, TRACE, or OFF. If set to OFF, Fluentd unified logging is disabled.logging.unified.tag = <service-tag>Specify the unique tag for the Self-Service Analytics microservice, used in grouping logs. This tag must be unique throughout Self-Service Analytics.
Supply the Self-Service Analytics microservice name for<service-tag>. For example,logging.unified.tag = query-engine. This is important because the tag identifies which microservice the log message applies to.
Valid values arequery-engine,zoomdata-server,data-writer-postgresql, andedc-<connector-name>(where<connector-name>is one of the names listed in Connector Properties and Property Files).logging.unified.label = <service-label>Specify a more verbose label for the Self-Service Analytics microservice. logging.unified.host = <yourFluentdServerIPaddress>Specify the IP address of the Fluentd logging server. logging.unified.port = <yourFluentdServerPort>Specify the port of the Fluentd logging server. -
Save your changes and exit the
.propertiesfile. - Restart the Self-Service Analytics server.
Configure Unified Logging Using Fluentd
For information and steps on installing Fluentd, refer to Fluentd’s installation documentation. If Fluentd is not installed on the same server as the Self-Service Analytics, you will need to obtain the host and port numbers for the Fluentd server. This section provides describes how to configure Fluentd to log Self-Service Analytics log data. Configure Fluentd for logging Self-Service Analytics log data-
Run the following command on the server where Self-Service Analytics is installed to install
td-agenton that server. -
Browse to the
/etcfolder on the Self-Service Analytics server to verify thattd-agentis installed in the/etc/td-agentfolder. -
Install the Fluentd plugin for the data store you are using to store your Fluentd logs. Refer to your Fluentd documentation for more information.
For example, if you are using an Elasticsearch database to store Fluentd logs. run the following command to install the Fluentd Elasticsearch plugin on the Self-Service Analytics server.
-
Modify the
td-agent.conffile in the/etc/td-agentfolder using the following template. The following is an example oftd-agent.confusing an Elasticsearch database for Fluentd logs. -
Restart
td-agent. - Complete the steps described in Enable Unified Logging in Self-Service Analytics Using Fluentd to enable Fluentd logging by Self-Service Analytics.
Configure Self-Service Analytics Logs
The microservices used in Self-Service Analytics write logs to their corresponding service’s log files by default. You can configure Self-Service Analytics to write these logs to the console only, or to write logs both to the console and the service’s log files. Structured logging is also supported. See Structured Logging. Every service config file includes two properties you can use to define where the logs are written:log.console.level- edit to define the types of logs to write to the consolelog.file.level- edit to define the types of logs to write to the files
Log Properties in Config Files
If you install using the bootstrap script, logging to files is enabled by default. You can reroute the logging to the console as needed to customize your installation.If the value of log properties is set to
OFF, Self-Service Analytics access logs are not written. For all other cases (ALL, ERROR, WARN, DEBUG, and INFO) access logs are written to the selected destination: file, console or both.- Bootstrap installation: The
*.jvmfile specifieslog.console.level=OFFandlog.file.level=ALLto support compatibility with earlier versions of Self-Service Analytics.
Values for log.file.level and log.console.level
The following table lists possible values forlog.file.level and log.console.level.
Enable Logging for a Service to the Console
Enable logging to the console and append the desired corresponding value of the properties to the appropriate service configuration file.- Use
log.console.level=ALLto route duplicates of all logs to the console. - Use
log.console.level=ERRORto route only duplicates of errors to the console. - Alternatively, use
log.console.level=ALLandlog.console.level=ERRORto have all logs in files and errors duplicated to the console.
Self-Service Analytics services have two config files,
*properties and *.jvm. If you add log configuration properties to both files, the priority of *.jvm is higher than *. properties.Consul Logging
By default, Consul writes logs to the console, but you can duplicate logs to files if needed. Configure Consul Logs to Duplicate to Files:-
Edit the Consul config file,
consul.json. For Linux installations, this is located in/opt/zoomdata/conf/consul.json. -
Add the following properties:
Adjust the path to your log file and other log configuration properties as needed for your environment. In Linux environments, the log is located in
/opt/zoomdata/logs, and in<install-path>/logsfor Windows environments. See Consul documentation for more information.
Structured Logging
Self-Service Analytics supports structured logging. You can enable for installations done via bootstrap, and is enabled by default for Kubernetes environments.Components Support for Structured Logging
- zoomdata-web
- query engine
- admin server
- screenshot service
- data writer
- data connectors
- self service reports
Enable Structured Logging
In bootstrap environments, set the propertylog.structured.enabled to true in the config files of your microservices to output logs in JSON format to the STDOUT destination. Logs output to the FILE logs destination are sent in plain text. See Configuration Property Files.
In Kubernetes environments, structured logging is enabled by default. To disable, use one of the following approaches:
- Set the environment variable
LOG_STRUCTURED_ENABLEDtofalseto disable logging for specific services. - Set
structuredLogsEnabledinvalues.yamltofalseto disable logging for all services. - For Consul, change the
log_jsonvalue tofalsein theconsul.server.extraConfigsection ofvalues.yaml.
Self-Service Analytics Log Files Reference
Self-Service Analytics uses the following log files. You can configure Self-Service Analytics to write these logs to the console in addition to or instead of the service files. See Configure Self-Service Analytics Logs.Log Unification
Self-Service Analytics has unified logback configuration throughout Self-Service Analytics microservices. You can configure Self-Service Analytics to write these logs to the console in addition to or instead of the service files. See Configure Self-Service Analytics Logs and Self-Service Analytics Log Files Reference.Log Configuration Properties
Adjust these properties to set up logging for your environment.| Name | Default Value | Description |
|---|---|---|
| install.dir | . | Use to evaluate the value of logs.dir. |
| logs.dir | ${install.dir}/logs | The location of the log file and error log file. |
| spring.application.name | zoomdata-service | Use to evaluate the default values of logs.file-name. |
| logs.file-name | ${spring.application.name} | Name of log file. Log file suffix: .log. Error log file suffix: error.log. |
| log.console.level | ALL | The maximum level of logs to print to stdout. See Log File Values. |
| log.file.level | ALL | The maximum level of logs to print to the log file. See Log File Values. |
| log.password.regex | (?i)PASSWORD=[a-zA-Z0-9!@#\$%\^\*\&]* | Regular expression used to detect passwords in log output. Replaces with PASSWORD=****. |
| log.url-password.regex | (?<=://)[^:]+:[^@]+@ | Regular expression used to detect and remove credential in URLs and remove the credentials. |
| log.sanitization.enabled | true | The default, true, is specified in logging.properties.Toggles sanitization of log message via org.apache.commons.text.StringEscapeUtils.escapeJava. |
| log.file.size | 20 | The maximum size of the log file in MB. When that size is reached, the file is renamed using this pattern: {log.file-name}.log.%i. |
| log.file.count | 5 | Maximum number of log files. |
| log.error.file.size | 5 | The maximum size of the error log file in MB. When that size is reached, the file is renamed using this pattern: {log.file-name}-error.log.%i. |
| log.error.file.count | 5 | Maximum number of error log files. |
| syslog.log.level | OFF | Syslog log level. See Log File Values. |
| syslog.host | 127.0.0.1 | Syslog host name. |
| syslog.port | 514 | Syslog port number. |
| syslog.suffix | ${spring.application.name} | Syslog suffix. Used to distinguish applications. |
| trace.requests | false | Adds the MDC value of requestId to log output. Propagate value using X-REQUEST-ID http header. |
Log File Values
Other Configuration Properties
Both Zoomdata-Web and Query Engine have properties you can adjust to suit your needs as well.Zoomdata-Web
Query Engine
Set Logging Levels
Every logging level can be changed using a standard spring boot approach. Specify the corresponding property, as shown below.The logback.zoomdata property, previously used to control the log level of some loggers, has been removed. Use a standard spring boot approach to specify appropriate properties.