5
responses

Hi,

Anyone can please help on this issue am facing, i'm new to nxlog and things, am getting error : "Cannot communicate with database server." in the nxlog-manager dashboard page.
this is my nxlog.conf file, please correct me if there are mistakes.

User nxlog
Group nxlog
Panic Soft

# default values:
# PidFile /opt/nxlog/var/run/nxlog/nxlog.pid
# CacheDir /opt/nxlog/var/spool/nxlog
# ModuleDir /opt/nxlog/lib/nxlog/modules
# SpoolDir /opt/nxlog/var/spool/nxlog

define CERTDIR /opt/nxlog/var/lib/nxlog/cert
define CONFDIR /opt/nxlog/var/lib/nxlog

# Note that these two lines define constants only; the log file location
# is ultimately set by the `LogFile` directive (see below). The
# `MYLOGFILE` define is also used to rotate the log file automatically
# (see the `_fileop` block).
define LOGDIR /opt/nxlog/var/log/nxlog
define MYLOGFILE %LOGDIR%/nxlog.log

# By default, `LogFile %MYLOGFILE%` is set in log4ensics.conf. This
# allows the log file location to be modified via NXLog Manager. If you
# are not using NXLog Manager, you can instead set `LogFile` below and
# disable the `include` line.
#LogFile %MYLOGFILE%
include %CONFDIR%/log4ensics.conf

<Extension _syslog>
Module xm_syslog
</Extension>

<Extension json>

Module xm_json

</Extension>

# This block rotates `%MYLOGFILE%` on a schedule. Note that if `LogFile`
# is changed in log4ensics.conf via NXLog Manager, rotation of the new
# file should also be configured there.
<Extension _fileop>
Module xm_fileop

# Check the size of our log file hourly, rotate if larger than 5MB
<Schedule>
Every 1 hour
<Exec>
if ( file_exists('%MYLOGFILE%') and
(file_size('%MYLOGFILE%') >= 5M) )
{
file_cycle('%MYLOGFILE%', 8);
}
</Exec>
</Schedule>

# Rotate our log file every week on Sunday at midnight
<Schedule>
When @weekly
Exec if file_exists('%MYLOGFILE%') file_cycle('%MYLOGFILE%', 8);
</Schedule>
</Extension>

<Input in_file>
Module im_file
File '/opt/nxlog/var/log/testing.txt'
SavePos TRUE
ReadFromLast TRUE
PollInterval 1

Exec $Message = $raw_event;
</Input>

<Output out_tcp>
Module om_tcp
Host 192.168.x.x
Port 9090
</Output>

<Route synot>
Path in_file => out_tcp
</Route>

AskedMay 15, 2020 - 4:18pm

Answer (1)

Hi Suresh

That error probably means your database is not running.

Can you please paste last lines in /opt/nxlog-manager/logs/nxlog-manager.log?

Can you please paste the output of running $ sudo systemctl status mysql?

Comments (4)

  • sureshnakkina's picture

    Hi Munoz,

    Thank you for your response, i checked the database and all all seems to be okay, here am pasting nxlog-manager.log last lines.

    nxlog-manager.log ::::

    2020-05-15 22:52:47,912 WARN localhost.localdomain unknown [com.mchange.v2.resourcepool.BasicResourcePool] - Having failed to acquire a resource, com.mchange.v2.resourcepool.BasicResourcePool@cc42b44 is interrupting all Threads waiting on a resource to check out. Will try again in response to new client requests.
    2020-05-15 22:52:56,968 INFO localhost.localdomain unknown [com.nxsec.log4ensics.service.common.scheduling.concurrent.InheritableSecurityThreadPoolTaskExecutor] - Shutting down ExecutorService 'inheritableSecurityThreadPoolTaskExecutor'
    2020-05-15 22:52:56,971 INFO localhost.localdomain unknown [com.nxsec.log4ensics.service.common.scheduling.quartz.factory.L4ESchedulerFactoryBean] - Shutting down Quartz Scheduler
    2020-05-15 22:52:56,971 WARN localhost.localdomain unknown [org.springframework.beans.factory.support.DisposableBeanAdapter] - Invocation of destroy method failed on bean with name 'quartzScheduler': java.lang.NullPointerException
    2020-05-15 22:52:56,971 INFO localhost.localdomain unknown [com.nxsec.log4ensics.service.config.SchedulingConfig] - Shutting down scheduler.
    2020-05-15 22:53:27,111 WARN localhost.localdomain unknown [com.mchange.v2.resourcepool.BasicResourcePool] - com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask@5c0a89de -- Acquisition Attempt Failed!!! Clearing pending acquires. While trying to acquire a needed new resource, we failed to succeed more than the maximum number of allowed acquisition attempts (30). Last acquisition attempt exception:
    java.sql.SQLException: Could not connect: Access denied for user 'nxlog-manager5'@'localhost' (using password: YES)
    at org.mariadb.jdbc.internal.SQLExceptionMapper.get(SQLExceptionMapper.java:149)
    at org.mariadb.jdbc.internal.SQLExceptionMapper.throwException(SQLExceptionMapper.java:106)
    at org.mariadb.jdbc.Driver.connect(Driver.java:115)
    at com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:175)
    at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:220)
    at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:206)
    at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C3P0PooledConnectionPool.java:203)
    at com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:1138)
    at com.mchange.v2.resourcepool.BasicResourcePool.doAcquireAndDecrementPendingAcquiresWithinLockOnSuccess(BasicResourcePool.java:1125)
    at com.mchange.v2.resourcepool.BasicResourcePool.access$700(BasicResourcePool.java:44)
    at com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask.run(BasicResourcePool.java:1870)
    at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:696)
    Caused by: org.mariadb.jdbc.internal.common.QueryException: Could not connect: Access denied for user 'nxlog-manager5'@'localhost' (using password: YES)
    at org.mariadb.jdbc.internal.mysql.MySQLProtocol.checkErrorPacket(MySQLProtocol.java:571)
    at org.mariadb.jdbc.internal.mysql.MySQLProtocol.connect(MySQLProtocol.java:501)
    at org.mariadb.jdbc.internal.mysql.MySQLProtocol.connect(MySQLProtocol.java:722)
    at org.mariadb.jdbc.internal.mysql.MySQLProtocol.<init>(MySQLProtocol.java:281)
    at org.mariadb.jdbc.Driver.connect(Driver.java:111)
    ... 9 more

    mysql status::

    [root@localhost ~]# /etc/init.d/mysqld status
    mysqld (pid 3488) is running...

    And once check my nxlog.conf file also if there are any mistakes like port number etc etc.

    am using same machine as client and server installed nxlog and nxlog-manager in same machine, after this issue i installed nxlog-manager in different machine but still same.
    could you please correct me if i am wrong.

    Thanks,
    Suresh

  • sureshnakkina's picture

    And this is log when running jetty.sh file..

    [root@localhost bin]# ./jetty.sh
    OpenJDK 64-Bit Server VM warning: ignoring option PermSize=64m; support was removed in 8.0
    OpenJDK 64-Bit Server VM warning: ignoring option MaxPermSize=256m; support was removed in 8.0
    OpenJDK 64-Bit Server VM warning: If the number of processors is expected to increase from one, then you should configure the number of parallel GC threads appropriately using -XX:ParallelGCThreads=N
    2020-05-15 22:48:55.433:INFO:oejr.Runner:main: Runner
    2020-05-15 22:48:55.009:INFO:oejs.Server:main: jetty-9.0.7.v20131107
    SLF4J: Class path contains multiple SLF4J bindings.
    SLF4J: Found binding in [jar:file:/opt/nxlog-manager/webapps/nxlog-manager/WEB-INF/lib/slf4j-log4j12-1.7.21.jar!/org/slf4j/impl/StaticLoggerBinder.class]
    SLF4J: Found binding in [jar:file:/opt/nxlog-manager/lib/slf4j-log4j12-1.7.21.jar!/org/slf4j/impl/StaticLoggerBinder.class]
    SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
    SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]
    2020-05-15 22:49:33.206:INFO:/:main: 2 Spring WebApplicationInitializers detected on classpath
    2020-05-15 22:49:34.809:INFO:/:main: Initializing Spring root WebApplicationContext
    2020-05-15 22:50:49.290:INFO:/:main: Initializing Spring FrameworkServlet 'dispatcher'
    2020-05-15 22:51:39.850:INFO:oejsh.ContextHandler:main: Started o.e.j.w.WebAppContext@163e4e87{/nxlog-manager,[file:/opt/nxlog-manager/webapps/nxlog-manager/, jar:file:/opt/nxlog-manager/webapps/nxlog-manager/WEB-INF/lib/springfox-swagger-ui-2.9.2.jar!/META-INF/resources/],AVAILABLE}{/nxlog-manager/}
    2020-05-15 22:51:39.857:WARN:oejsh.RequestLogHandler:main: !RequestLog
    2020-05-15 22:51:39.926:INFO:oejs.ServerConnector:main: Started ServerConnector@52fd33fd{HTTP/1.1}{0.0.0.0:9090}
    2020-05-15 22:51:41.039:INFO:oejs.ServerConnector:main: Started ServerConnector@1bff188a{SSL-http/1.1}{0.0.0.0:9443}
    May 15, 2020 10:52:01 PM org.apache.jasper.compiler.JDTJavaCompiler setTargetVM
    WARNING: Unknown target VM 1.7 ignored.
    May 15, 2020 10:52:01 PM org.apache.jasper.compiler.JDTJavaCompiler setSourceVM
    WARNING: Unknown source VM 1.7 ignored.
    May 15, 2020 10:52:06 PM org.apache.jasper.compiler.JDTJavaCompiler setTargetVM
    WARNING: Unknown target VM 1.7 ignored.
    May 15, 2020 10:52:06 PM org.apache.jasper.compiler.JDTJavaCompiler setSourceVM
    WARNING: Unknown source VM 1.7 ignored.
    May 15, 2020 10:52:07 PM org.apache.jasper.compiler.JDTJavaCompiler setTargetVM
    WARNING: Unknown target VM 1.7 ignored.
    May 15, 2020 10:52:07 PM org.apache.jasper.compiler.JDTJavaCompiler setSourceVM
    WARNING: Unknown source VM 1.7 ignored.
    May 15, 2020 10:52:07 PM org.apache.jasper.compiler.JDTJavaCompiler setTargetVM
    WARNING: Unknown target VM 1.7 ignored.
    May 15, 2020 10:52:07 PM org.apache.jasper.compiler.JDTJavaCompiler setSourceVM
    WARNING: Unknown source VM 1.7 ignored.
    May 15, 2020 10:52:08 PM org.apache.jasper.compiler.JDTJavaCompiler setTargetVM
    WARNING: Unknown target VM 1.7 ignored.
    May 15, 2020 10:52:08 PM org.apache.jasper.compiler.JDTJavaCompiler setSourceVM
    WARNING: Unknown source VM 1.7 ignored.
    May 15, 2020 10:52:09 PM org.apache.jasper.compiler.JDTJavaCompiler setTargetVM
    WARNING: Unknown target VM 1.7 ignored.
    May 15, 2020 10:52:09 PM org.apache.jasper.compiler.JDTJavaCompiler setSourceVM
    WARNING: Unknown source VM 1.7 ignored.
    May 15, 2020 10:52:10 PM org.apache.jasper.compiler.JDTJavaCompiler setTargetVM
    WARNING: Unknown target VM 1.7 ignored.
    May 15, 2020 10:52:10 PM org.apache.jasper.compiler.JDTJavaCompiler setSourceVM
    WARNING: Unknown source VM 1.7 ignored.
    ^C2020-05-15 22:52:56.914:INFO:oejs.ServerConnector:Thread-1: Stopped ServerConnector@52fd33fd{HTTP/1.1}{0.0.0.0:9090}
    2020-05-15 22:52:56.920:INFO:oejs.ServerConnector:Thread-1: Stopped ServerConnector@1bff188a{SSL-http/1.1}{0.0.0.0:9443}
    2020-05-15 22:52:56.922:INFO:/:Thread-1: Destroying Spring FrameworkServlet 'dispatcher'
    2020-05-15 22:52:57.014:WARN:oejuc.AbstractLifeCycle:Thread-1: FAILED org.eclipse.jetty.server.session.HashSessionManager@77bde8df: org.springframework.beans.factory.BeanCreationNotAllowedException: Error creating bean with name 'licenseHolder': Singleton bean creation not allowed while singletons of this factory are in destruction (Do not request a bean from a BeanFactory in a destroy method implementation!)
    org.springframework.beans.factory.BeanCreationNotAllowedException: Error creating bean with name 'licenseHolder': Singleton bean creation not allowed while singletons of this factory are in destruction (Do not request a bean from a BeanFactory in a destroy method implementation!)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:216)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
    at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1081)
    at com.nxsec.log4ensics.service.common.context.AppContext.getBean(AppContext.java:34)
    at com.nxsec.log4ensics.web.listener.L4eHttpSessionListener.sessionDestroyed(L4eHttpSessionListener.java:43)
    at org.eclipse.jetty.server.session.AbstractSessionManager.removeSession(AbstractSessionManager.java:802)
    at org.eclipse.jetty.server.session.AbstractSession.invalidate(AbstractSession.java:369)
    at org.eclipse.jetty.server.session.HashSessionManager.invalidateSessions(HashSessionManager.java:411)
    at org.eclipse.jetty.server.session.AbstractSessionManager.doStop(AbstractSessionManager.java:274)
    at org.eclipse.jetty.server.session.HashSessionManager.doStop(HashSessionManager.java:139)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.stop(AbstractLifeCycle.java:90)

  • sureshnakkina's picture

    Hi,

    I am able to logged into dashboard now, i am pasting my config file here please correct me if there are any errors.

    I need to send syslogs into another nxlog-manager server dashboard, i mentioned nxlog server Host IP, what port we should use for that and how we can see these syslogs messages into nxlog-manager dashboard in linux platform.

    My nxlog-manager server dashboard is working fine i logged into dashboard, but am not able to send these logs into dashboard, could you please help me on this.

    nxlog.conf :

    User nxlog
    Group nxlog
    Panic Soft

    # default values:
    # PidFile /opt/nxlog/var/run/nxlog/nxlog.pid
    # CacheDir /opt/nxlog/var/spool/nxlog
    # ModuleDir /opt/nxlog/lib/nxlog/modules
    # SpoolDir /opt/nxlog/var/spool/nxlog

    define CERTDIR /opt/nxlog/var/lib/nxlog/cert
    define CONFDIR /opt/nxlog/var/lib/nxlog

    # Note that these two lines define constants only; the log file location
    # is ultimately set by the `LogFile` directive (see below). The
    # `MYLOGFILE` define is also used to rotate the log file automatically
    # (see the `_fileop` block).
    define LOGDIR /opt/nxlog/var/log/nxlog
    define MYLOGFILE %LOGDIR%/nxlog.log

    # By default, `LogFile %MYLOGFILE%` is set in log4ensics.conf. This
    # allows the log file location to be modified via NXLog Manager. If you
    # are not using NXLog Manager, you can instead set `LogFile` below and
    # disable the `include` line.
    #LogFile %MYLOGFILE%
    include %CONFDIR%/log4ensics.conf

    <Extension _syslog>
    Module xm_syslog
    </Extension>

    <Extension _json>
    Module xm_json
    </Extension>

    <Extension fileop>
    Module xm_fileop
    </Extension>

    <Input in>
    Module im_file
    File '/var/log/messages'
    Exec parse_syslog();
    </Input>

    <Output out>
    Module om_file
    Host 192.168.189.x
    Port 1514
    Exec $raw_event = to_json();
    </Output>

    <Route testing>
    Path in => out
    </Route>

    Thanks in advance.

  • Misaziv's picture
    (NXLog)

    Hi,

    Are you trying to see the logs in the nxlog-manager dashboard? Because that is not the function of the manager. It is used to push configuration to the agents, not to serve as a log collector. You can check the agent internal logs in the manager if you like by selecting the agent and then Agent management > Show Logs.

    ~MisaZ