Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-85124

Embedded Elasticsearch logging should be minimal by default

    Details

      Description

      Steps to reproduce:

      1. Start up portal
      2. Observe Elasticsearch log messages

      Reproduced on master - 0b5611e

      Expected

      During Portal startup OOTB, console should display Portal generated log messages only. No Elasticsearch log generated messages of informational nature; warnings and errors only. Non-Portal log messages on startup are expected to be opt-in, enabled via configuration.

      Portal generated log message
       
      2018-09-13 16:49:24.442 WARN [Elasticsearch initialization thread][EmbeddedElasticsearchConnection:315] Liferay is configured to use embedded Elasticsearch as its search engine. Do NOT use embedded Elasticsearch in production. Embedded Elasticsearch is useful for development and demonstration purposes. Remote Elasticsearch connections can be configured in the Control Panel.  
      

      Observed

      Non-Portal log messages OOTB.

      Slowlog
       
      [2018-09-05T17:25:13,294][TRACE][i.i.s.index ] [DXxAEeh] [liferay-0/3sUnJXPUTU6O-oU_0mS01g] took[1s], took_millis[1005], type[LiferayDocumentType], id[com_liferay_configuration_admin_web_portlet_SystemSettingsPortlet_PORTLET_ 
      com.liferay.portal.osgi.web.wab.extender.internal.configuration.WabExtenderConfiguration], routing[], source[{"uid":"com_liferay_configuration_admin_web_portlet_SystemSettingsPortlet_PORTLET_ 
      com.liferay.portal.osgi.web.wab.extender.internal.configuration.WabExtenderConfiguration", 
      "companyId":"0","configurationModelId": 
      "com.liferay.portal.osgi.web.wab.extender.internal.configuration.WabExtenderConfiguration", 
      "entryClassName":"com.liferay.configuration.admin.web.internal.model.ConfigurationModel", 
      "configurationModelFactoryPid": 
      "com.liferay.portal.osgi.web.wab.extender.internal.configuration.WabExtenderConfiguration","title_zh_CN":"WAB扩展器","title_es_ES":"Extensor WAB","title_iw_IL":"מרחיב WAB","title_ja_JP":"WAB エクステンダー","title_ca_ES":"Estensor WAB","title_nl_NL":"WAB-verlenger","title_fi_FI":"WAB Extender -laite","title_hu_HU":"WAB bővítő","title_fr_FR":"Extendeur WAB","title":"WAB Extender","title_en_US":"WAB Extender","title_pt_BR":"Extensor WAB","title_de_DE":"WAB-Extender","configurationModelAttributeName":"stop-timeout"}] 
      
      JVM GC monitor
       
      [2018-09-05T17:25:15,955][INFO ][o.e.m.j.JvmGcMonitorService] [DXxAEeh] [gc][12] overhead, spent [1.8s] collecting in the last [2.4s] 
      
      Incorrect mappings
       
      [2018-09-05T17:25:30,107][WARN ][o.e.d.i.m.MapperService ] [unmapped_type:string] should be replaced with [unmapped_type:keyword] 
      

      Solution

      Default Elasticsearch log level OOTB will be ERROR. Can still enable INFO or lower via configuration, if finer detail is needed.

      Specific purpose Elasticsearch features (Slowlog, JVM GC monitor) will not anymore be enabled OOTB; Elasticsearch itself comes with these features disabled OOTB. Can still opt-in via configuration.

      How to enable Elasticsearch logs with INFO or lower

      Create a /config directory in the liferay.home/data/elasticsearch6/ directory with a log4j2.properties file, like this:

       
      appender.console.layout.pattern=[%d{ISO8601}][%-5p][%-25c{1.}] %marker%m%n 
      appender.console.layout.type=PatternLayout 
      appender.console.name=console 
      appender.console.type=Console 
      logger.action.level=info 
      logger.action.name=org.elasticsearch.action 
      rootLogger.appenderRef.console.ref=console 
      rootLogger.level=info 
      status=error 
      

      Restart Portal, or embedded Elasticsearch.

      How to restart embedded Elasticsearch

      Stop the elasticsearch bundle by creating a com.liferay.portal.bundle.blacklist.internal.BundleBlacklistConfiguration.config file in the liferay.home/osgi/configs/ directory with the line:

       
      blacklistBundleSymbolicNames="com.liferay.portal.search.elasticsearch6.impl" 
      

      Once you have seen the message in the logs that the bundle has been stopped, restart the bundle by commenting the line out and saving the file:

       
      #blacklistBundleSymbolicNames="com.liferay.portal.search.elasticsearch6.impl" 
      

      How to opt-in to Slowlog

      Additional Index Configurations in the Elasticsearch 6 System Settings:

       
      index.indexing.slowlog.threshold.index.debug: 2s 
      index.indexing.slowlog.threshold.index.info: 5s 
      index.indexing.slowlog.threshold.index.trace: 500ms 
      index.indexing.slowlog.threshold.index.warn: 10s 
      
      index.search.slowlog.threshold.fetch.debug: 500ms 
      index.search.slowlog.threshold.fetch.info: 800ms 
      index.search.slowlog.threshold.fetch.trace: 200ms 
      index.search.slowlog.threshold.fetch.warn: 1s 
      
      index.search.slowlog.threshold.query.debug: 2s 
      index.search.slowlog.threshold.query.info: 5s 
      index.search.slowlog.threshold.query.trace: 500ms 
      index.search.slowlog.threshold.query.warn: 10s 
      

      How to opt-in to JVM GC monitoring

      Additional Configurations in the Elasticsearch 6 System Settings:

       
      monitor.jvm.gc.enabled: true 
      monitor.jvm.gc.overhead.debug: 40 
      monitor.jvm.gc.overhead.info: 70 
      monitor.jvm.gc.overhead.warn: 90 
      

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Days since last comment:
                  50 weeks, 5 days ago

                  Packages

                  Version Package
                  7.0.0 DXP FP80
                  7.0.10.11 DXP SP11
                  7.0.X
                  7.1.10 DXP FP3
                  7.1.10.1 SP1
                  7.1.X
                  Master