Hello Wazuh community,
I want to monitor the logs of my GlassFish server using Wazuh. I added the following configuration in my Wazuh agent's /var/ossec/etc/ossec.conf:
<localfile>
<log_format>syslog</log_format>
<location>/home/user/server.log</location>
</localfile>
However, the logs from this file do not appear in the Wazuh dashboard, even though logs from other files are displayed correctly.
Could there be a log format issue preventing these logs from being processed?
Here is an example of a GlassFish log entry:
[2025-03-14T10:36:37.159846Z] [GF 7.0.12] [INFO] [] [jakarta.enterprise.logging.stdout] [tid: _ThreadID=1400 _ThreadName=http-listener-1(10)] [levelValue: 800] [[
67417556 [http-listener-1(10)] DEBUG ma.toto.server.DataObjectService - findDataObjectById 5300]]
Could you please help me identify the issue
GlassFish can generate Syslog-formatted logs, but it requires configuration changes. GlassFish uses Java Util Logging (JUL) by default, which can be redirected to a Syslog server.
You can configure GlassFish to send logs to a Syslog server via the logging.properties file.
Steps:
/glassfish/domains/your-domain/config/logging.properties
java.util.logging.FileHandler.pattern = /var/log/glassfish.logjava.util.logging.FileHandler.formatter = java.util.logging.SimpleFormatter handlers = java.util.logging.ConsoleHandler, com.sun.enterprise.server.logging.SyslogHandler com.sun.enterprise.server.logging.SyslogHandler.host = 192.168.1.100 com.sun.enterprise.server.logging.SyslogHandler.port = 514
asadmin restart-domain your-domain
If your application uses Log4j, you can configure SyslogAppender in log4j.xml or log4j.properties:
Example (log4j.properties):
log4j.rootLogger=INFO, SYSLOGlog4j.appender.SYSLOG=org.apache.log4j.net.SyslogAppender log4j.appender.SYSLOG.SyslogHost=192.168.1.100 log4j.appender.SYSLOG.Facility=LOCAL0 log4j.appender.SYSLOG.layout=org.apache.log4j.PatternLayout log4j.appender.SYSLOG.layout.ConversionPattern=%d{ISO8601} %p %c - %m%n
Example (log4j.xml):
<Appender name="SYSLOG" class="org.apache.log4j.net.SyslogAppender"><param name="SyslogHost" value="192.168.1.100"/> <param name="Facility" value="LOCAL0"/> <layout class="org.apache.log4j.PatternLayout"> <param name="ConversionPattern" value="%d{ISO8601} %p %c - %m%n"/> </layout> </Appender> <Root> <priority value ="info" /> <appender-ref ref="SYSLOG"/> </Root>
Restart your application for changes to take effect.
If your GlassFish logs are written to a file (server.log), you can configure rsyslog to forward them to a Syslog server.
Steps:
/etc/rsyslog.conf or create a new file in /etc/rsyslog.d/glassfish.conf:
$InputFileName /path/to/glassfish/server.log$InputFileTag glassfish $InputFileStateFile glassfish $InputFilePersistStateInterval 100 $InputRunFileMonitor *.* @192.168.1.100:514
systemctl restart rsyslog
--
You received this message because you are subscribed to the Google Groups "Wazuh | Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wazuh+un...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/wazuh/29fafab8-a2b6-4905-ae65-70a15a88bcedn%40googlegroups.com.
Thank you for your response, sir.
We have multiple production servers that we want to monitor with Wazuh, and we cannot restart GlassFish to apply the new configuration.
Is there a way to achieve this in Wazuh without restarting GlassFish? Perhaps by creating a custom decoder or using another method?
I appreciate your guidance.
To view this discussion visit https://groups.google.com/d/msgid/wazuh/f80d9652-80fa-43d9-bf07-1b76457b6043n%40googlegroups.com.