Page 1 of 1

Command line to get audit logs from xi_auditlog

Posted: Mon Apr 05, 2021 9:43 pm
by xlin125
We have Nagios XI 2014R2.7 on RHEL6, and we also have Nagios XI 5.2.3 on RHEL6 and Nagios XI 5.4.8 on RHEL7.

On Nagios XI 2014R2.7, both MySQL and Postgres are used. We can run the command "echo 'select * from xi_auditlog;' | psql nagiosxi nagiosxi" to get the audit logs in the table "xi_auditlog".

On Nagios XI 5.2.3 and Nagios XI 5.4.8, MySQL is used but Postgres is not used. What is the equivalent command that can be used to get the audit logs in the table "xi_auditlog"?

Re: Command line to get audit logs from xi_auditlog

Posted: Tue Apr 06, 2021 10:05 am
by benjaminsmith
Hi

The table structre is the same, but connection commands will change from postgress to mysql.

Code: Select all

echo "select * from xi_auditlog;" | mysql -h 127.0.0.1 -uroot -pnagiosxi nagiosxi
Let us know if you need further assistance with the query.

Also, RHEL 6 is EOL and not supported at this time. I would recommend planning a migration for those systems. The Nagios XI license policy does allow for 3 separate activations (production, test and backup) to help make this a smooth transition.

Reference:
Migrating Nagios XI to a different Server

Regards,
Benjamin

Re: Command line to get audit logs from xi_auditlog

Posted: Tue Apr 06, 2021 8:09 pm
by xlin125
@Benjamin, thanks for the quick response.

I tried the command that you provided, and received an access denied error:
$ echo "select * from xi_auditlog;" | mysql -h 127.0.0.1 -uroot -pnagiosxi nagiosxi
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

Any suggestion to resolve this issue?

Re: Command line to get audit logs from xi_auditlog

Posted: Wed Apr 07, 2021 11:20 am
by benjaminsmith
Hi,

It looks like the default database passwords were changed on this system. You can retrieve this information by inspecting the following file.

Code: Select all

cat /usr/local/nagiosxi/html/config.inc.php
For more details, we have a useful guide with detailed instructions on changing the default passwords, take a look on page 3 for the database settings.

Nagios XI How to Change Default Passwords

If that's not it, try logging in directly and then running the query.

Code: Select all

mysql -u root -p 
use nagiosxi;
select * from xi_auditlog;
Let us know if you get it resolved.

Re: Command line to get audit logs from xi_auditlog

Posted: Fri Apr 30, 2021 1:07 pm
by xlin125
Yes, the default database password was changed during the Nagios XI installation on this system. I found the password, and all looks fine. Thanks!

Re: Command line to get audit logs from xi_auditlog

Posted: Fri Apr 30, 2021 2:17 pm
by benjaminsmith
Hello @xlin125,

Excellent! We'll go ahead and mark this as resolved.

Have a great weekend.