How to log in json format?

I found these topics:

https://community.openhab.org/t/logging-to-filebeat-elasticsearch-kibana/79544

https://community.openhab.org/t/how-to-setup-remote-logging-elk-stack-and-reduce-microsd-writes/60828

But I got error when I set layout.type to ‘JSONLayout’.

Great!
Well… if you don’t share the error message how are we supposed to help you :thinking:

Did you figure this out?
As I am maybe facing the same issue.

The error message is:

org.ops4j.pax.logging.pax-logging-api [log4j2] ERROR : Log4J2 configuration problem: com/fasterxml    /jackson/databind/ser/FilterProvider Ignored FQCN: org.apache.logging.log4j.spi.AbstractLogger
openhab    | java.lang.NoClassDefFoundError: com/fasterxml/jackson/databind/ser/FilterProvider
openhab    | 	at org.apache.logging.log4j.core.layout.JsonLayout.<init>(JsonLayout.java:158)
openhab    | 	at org.apache.logging.log4j.core.layout.JsonLayout.<init>(JsonLayout.java:69)
openhab    | 	at org.apache.logging.log4j.core.layout.JsonLayout$Builder.build(JsonLayout.java:102)
openhab    | 	at org.apache.logging.log4j.core.layout.JsonLayout$Builder.build(JsonLayout.java:77)
openhab    | 	at org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.build(PluginBuilder.java:122)
openhab    | 	at org.apache.logging.log4j.core.config.AbstractConfiguration.createPluginObject(AbstractConfiguration.java:1002)
openhab    | 	at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:942)
openhab    | 	at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:934)
openhab    | 	at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:934)
openhab    | 	at org.apache.logging.log4j.core.config.AbstractConfiguration.doConfigure(AbstractConfiguration.java:552)
openhab    | 	at org.apache.logging.log4j.core.config.AbstractConfiguration.initialize(AbstractConfiguration.java:241)
openhab    | 	at org.apache.logging.log4j.core.config.AbstractConfiguration.start(AbstractConfiguration.java:288)
openhab    | 	at org.apache.logging.log4j.core.LoggerContext.setConfiguration(LoggerContext.java:579)
openhab    | 	at org.apache.logging.log4j.core.LoggerContext.start(LoggerContext.java:285)
openhab    | 	at org.ops4j.pax.logging.log4j2.internal.PaxLoggingServiceImpl.configureLog4J2(PaxLoggingServiceImpl.java:409)
openhab    | 	at org.ops4j.pax.logging.log4j2.internal.PaxLoggingServiceImpl.updated(PaxLoggingServiceImpl.java:272)
openhab    | 	at org.ops4j.pax.logging.log4j2.internal.PaxLoggingServiceImpl$1ManagedPaxLoggingService.updated(PaxLoggingServiceImpl.java:569)
openhab    | 	at org.apache.felix.cm.impl.helper.ManagedServiceTracker.updated(ManagedServiceTracker.java:189)
openhab    | 	at org.apache.felix.cm.impl.helper.ManagedServiceTracker.updateService(ManagedServiceTracker.java:152)
openhab    | 	at org.apache.felix.cm.impl.helper.ManagedServiceTracker.provideConfiguration(ManagedServiceTracker.java:85)
openhab    | 	at org.apache.felix.cm.impl.ConfigurationManager$ManagedServiceUpdate.provide(ConfigurationManager.java:1118)
openhab    | 	at org.apache.felix.cm.impl.ConfigurationManager$ManagedServiceUpdate.run(ConfigurationManager.java:1074)
openhab    | 	at org.apache.felix.cm.impl.UpdateThread.run0(UpdateThread.java:138)
openhab    | 	at org.apache.felix.cm.impl.UpdateThread.run(UpdateThread.java:105)
openhab    | 	at java.lang.Thread.run(Thread.java:748)
openhab    | Caused by: java.lang.ClassNotFoundException: com.fasterxml.jackson.databind.ser.FilterProvider cannot be found by org.ops4j.pax.logging.pax-logging-log4j2_1.11.2
openhab    | 	at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:484)
openhab    | 	at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:395)
openhab    | 	at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:387)
openhab    | 	at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:150)
openhab    | 	at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
openhab    | 	... 25 more