Page 1 of 2
$(data \format\)-01.log files
Posted: Wed Oct 29, 2014 2:59 am
by lethal
Hello.
I have Nagios® Core⢠Version 3.4.1 installed from debian repository. May be it's too old, but I don't want to reinstall it till I'll be sure that this is version issue.
The problem is that nagios can't find log files earlier than 3 days from now.
I mean that nagi is looking in that order:
today: /var/log/nagios3/nagios.log
yesterday: /var/log/nagios3/archives/nagios-10-29-2014-00.log
the day before yesterday: /var/log/nagios3/archives/nagios-10-28-2014-00.log
...
/var/log/nagios3/archives/nagios-10-26-2014-01.log
all previous logs are search with 01.log index. And I receive an error that this file can not be found. That's right! There is no such file over there... I have only
20K -rw-r--r-- 1 nagios adm 19K Oct 25 23:57 nagios-10-26-2014-00.log
Should I write a bash script that renames all old log files? Or may be I should install the last version? (I don't really want to do it)
I have nagios installed since 2012 and even first files has 00.log index. I don't use log reports very often, but some time ago I was able to watch all archive files for sure.
Thanks for help.
Re: $(data \format\)-01.log files
Posted: Wed Oct 29, 2014 10:25 am
by slansing
Interesting, so you are saying you cant even manually find the archived logs properly? Do you have something running on the system such as rsync, or a cron that moves .log files to a central location? Something that might explain this in that capacity?
Re: $(data \format\)-01.log files
Posted: Wed Oct 29, 2014 11:43 am
by lethal
I have only nagios logrotate configured that puts logs daily in archive folder. No problem with that.
Problem is that when I try to watch logs through web interface, it tries to find log file with this strange index. I don't have any files with ...-01.log index, in archive folder.
As an example
I want to see logs for 10-27-2014 through web interface. When I come to this date, nagi tries to find file with name nagios-10-27-2014-00.log. Here is no problem.
But when I want to see logs for 10-26-2014, web interface says that there is no nagios-10-27-2014-01.log file. And it's right! there is no such file. I have nagios-10-27-2014-00.log file.
Re: $(data \format\)-01.log files
Posted: Thu Oct 30, 2014 5:01 pm
by sreinhardt
I am going to have to look at the changelog and possibly how the code handles that portion of it. It sounds like logrotate moving them into the archive dir and not naming them in our convention is what is causing the issue though. Could you post the logrotate config you have, while I check a few things?
Re: $(data \format\)-01.log files
Posted: Thu Oct 30, 2014 7:09 pm
by lethal
Oh, that didn't cross my mind to look in to changelog. Thanks for clue.
logrotate option from nagios.cfg file
Code: Select all
# LOG ROTATION METHOD
# This is the log rotation method that Nagios should use to rotate
# the main log file. Values are as follows..
# n = None - don't rotate the log
# h = Hourly rotation (top of the hour)
# d = Daily rotation (midnight every day)
# w = Weekly rotation (midnight on Saturday evening)
# m = Monthly rotation (midnight last day of month)
log_rotation_method=d
# LOG ARCHIVE PATH
# This is the directory where archived (rotated) log files should be
# placed (assuming you've chosen to do log rotation).
log_archive_path=/var/log/nagios3/archives
Thank you.
Re: $(data \format\)-01.log files
Posted: Fri Oct 31, 2014 12:48 pm
by sreinhardt
Well that looks correct, but something in your rotation configs must be appending the date as well, unless its configured to remove the file, in which case nagios will probably create a new one and break the logging that way. Also out of curiosity, is there a reason you are not using the default nagios rotation within nagios.cfg and instead are using logrotate on its own?
Re: $(data \format\)-01.log files
Posted: Fri Oct 31, 2014 12:52 pm
by lmiltchev
Are you using anything else along with nagios, that can have impact on log rotation, i.e. mk_livestatus?
Re: $(data \format\)-01.log files
Posted: Sat Nov 01, 2014 4:28 am
by lethal
Code: Select all
$ sudo dpkg -L check-mk-livestatus
dpkg-query: package 'check-mk-livestatus' is not installed
Code: Select all
ls /etc/logrotate.d/
apache2 aptitude clamav-freshclam dpkg exim4-paniclog mysql-server nginx rsyslog
apt bacula-common consolekit exim4-base fail2ban nagiosgrapher php5-fpm
I dont think that I have something else configured to rotate logs, at least I didn't configure it.
As nagios documentation says daily rotation perform at midnight.
Code: Select all
ls -lsct /var/log/nagios3/archives
....
112 -rw-r--r-- 1 nagios adm 106906 Aug 4 00:00 nagios-08-04-2014-00.log
16 -rw-r--r-- 1 nagios adm 15883 Aug 3 00:00 nagios-08-03-2014-00.log
24 -rw-r--r-- 1 nagios adm 22000 Aug 2 00:00 nagios-08-02-2014-00.log
36 -rw-r--r-- 1 nagios adm 29527 Aug 1 00:00 nagios-08-01-2014-00.log
108 -rw-r--r-- 1 nagios adm 104737 Jul 31 00:00 nagios-07-31-2014-00.log
40 -rw-r--r-- 1 nagios adm 36418 Jul 30 00:00 nagios-07-30-2014-00.log
56 -rw-r--r-- 1 nagios adm 51044 Jul 29 00:00 nagios-07-29-2014-00.log
20 -rw-r--r-- 1 nagios adm 17050 Jul 28 00:00 nagios-07-28-2014-00.log
20 -rw-r--r-- 1 nagios adm 16583 Jul 27 00:00 nagios-07-27-2014-00.log
40 -rw-r--r-- 1 nagios adm 34769 Jul 26 00:00 nagios-07-26-2014-00.log
40 -rw-r--r-- 1 nagios adm 35305 Jul 25 00:00 nagios-07-25-2014-00.log
124 -rw-r--r-- 1 nagios adm 119318 Jul 24 00:00 nagios-07-24-2014-00.log
36 -rw-r--r-- 1 nagios adm 31932 Jul 23 00:00 nagios-07-23-2014-00.log
36 -rw-r--r-- 1 nagios adm 30890 Jul 22 00:00 nagios-07-22-2014-00.log
132 -rw-r--r-- 1 nagios adm 129710 Jul 21 00:00 nagios-07-21-2014-00.log
36 -rw-r--r-- 1 nagios adm 31185 Jul 20 00:00 nagios-07-20-2014-00.log
44 -rw-r--r-- 1 nagios adm 39958 Jul 19 00:00 nagios-07-19-2014-00.log
20 -rw-r--r-- 1 nagios adm 18265 Jul 18 00:00 nagios-07-18-2014-00.log
44 -rw-r--r-- 1 nagios adm 37128 Jul 17 00:00 nagios-07-17-2014-00.log
44 -rw-r--r-- 1 nagios adm 39004 Jul 16 00:00 nagios-07-16-2014-00.log
72 -rw-r--r-- 1 nagios adm 66197 Jul 15 00:00 nagios-07-15-2014-00.log
72 -rw-r--r-- 1 nagios adm 67458 Jul 14 00:00 nagios-07-14-2014-00.log
60 -rw-r--r-- 1 nagios adm 54869 Jul 13 00:00 nagios-07-13-2014-00.log
176 -rw-r--r-- 1 nagios adm 173669 Jul 12 00:00 nagios-07-12-2014-00.log
44 -rw-r--r-- 1 nagios adm 40018 Jul 11 00:00 nagios-07-11-2014-00.log
32 -rw-r--r-- 1 nagios adm 26301 Jul 10 00:00 nagios-07-10-2014-00.log
60 -rw-r--r-- 1 nagios adm 55238 Jul 9 00:00 nagios-07-09-2014-00.log
48 -rw-r--r-- 1 nagios adm 42294 Jul 8 00:00 nagios-07-08-2014-00.log
184 -rw-r--r-- 1 nagios adm 184089 Jul 7 00:00 nagios-07-07-2014-00.log
232 -rw-r--r-- 1 nagios adm 231965 Jul 6 00:00 nagios-07-06-2014-00.log
68 -rw-r--r-- 1 nagios adm 65133 Jul 5 00:00 nagios-07-05-2014-00.log
216 -rw-r--r-- 1 nagios adm 216140 Jul 4 00:00 nagios-07-04-2014-00.log
44 -rw-r--r-- 1 nagios adm 39421 Jul 3 00:00 nagios-07-03-2014-00.log
192 -rw-r--r-- 1 nagios adm 191312 Jul 2 00:00 nagios-07-02-2014-00.log
136 -rw-r--r-- 1 nagios adm 133264 Jul 1 00:00 nagios-07-01-2014-00.log
156 -rw-r--r-- 1 nagios adm 153351 Jun 30 00:00 nagios-06-30-2014-00.log
148 -rw-r--r-- 1 nagios adm 144516 Jun 29 00:00 nagios-06-29-2014-00.log
160 -rw-r--r-- 1 nagios adm 159313 Jun 28 00:00 nagios-06-28-2014-00.log
128 -rw-r--r-- 1 nagios adm 124536 Jun 27 00:00 nagios-06-27-2014-00.log
116 -rw-r--r-- 1 nagios adm 113249 Jun 26 00:00 nagios-06-26-2014-00.log
204 -rw-r--r-- 1 nagios adm 202387 Jun 25 00:00 nagios-06-25-2014-00.log
220 -rw-r--r-- 1 nagios adm 220757 Jun 24 00:00 nagios-06-24-2014-00.log
76 -rw-r--r-- 1 nagios adm 72971 Jun 23 00:00 nagios-06-23-2014-00.log
212 -rw-r--r-- 1 nagios adm 209793 Jun 22 00:00 nagios-06-22-2014-00.log
128 -rw-r--r-- 1 nagios adm 123601 Jun 21 00:00 nagios-06-21-2014-00.log
180 -rw-r--r-- 1 nagios adm 176495 Jun 20 00:00 nagios-06-20-2014-00.log
72 -rw-r--r-- 1 nagios adm 68200 Jun 19 00:00 nagios-06-19-2014-00.log
44 -rw-r--r-- 1 nagios adm 37783 Jun 18 00:00 nagios-06-18-2014-00.log
84 -rw-r--r-- 1 nagios adm 79122 Jun 17 00:00 nagios-06-17-2014-00.log
56 -rw-r--r-- 1 nagios adm 51543 Jun 16 00:00 nagios-06-16-2014-00.log
100 -rw-r--r-- 1 nagios adm 95447 Jun 15 00:00 nagios-06-15-2014-00.log
24 -rw-r--r-- 1 nagios adm 22237 Jun 14 00:00 nagios-06-14-2014-00.log
140 -rw-r--r-- 1 nagios adm 135917 Jun 13 00:00 nagios-06-13-2014-00.log
52 -rw-r--r-- 1 nagios adm 46233 Jun 12 00:00 nagios-06-12-2014-00.log
64 -rw-r--r-- 1 nagios adm 58391 Jun 11 00:00 nagios-06-11-2014-00.log
56 -rw-r--r-- 1 nagios adm 52466 Jun 10 00:00 nagios-06-10-2014-00.log
80 -rw-r--r-- 1 nagios adm 76007 Jun 9 00:00 nagios-06-09-2014-00.log
104 -rw-r--r-- 1 nagios adm 99238 Jun 8 00:00 nagios-06-08-2014-00.log
76 -rw-r--r-- 1 nagios adm 71620 Jun 7 00:00 nagios-06-07-2014-00.log
60 -rw-r--r-- 1 nagios adm 53661 Jun 6 00:00 nagios-06-06-2014-00.log
48 -rw-r--r-- 1 nagios adm 44282 Jun 5 00:00 nagios-06-05-2014-00.log
124 -rw-r--r-- 1 nagios adm 120217 Jun 4 00:00 nagios-06-04-2014-00.log
52 -rw-r--r-- 1 nagios adm 45743 Jun 3 00:00 nagios-06-03-2014-00.log
240 -rw-r--r-- 1 nagios adm 238439 Jun 2 00:00 nagios-06-02-2014-00.log
68 -rw-r--r-- 1 nagios adm 65160 Jun 1 00:00 nagios-06-01-2014-00.log
260 -rw-r--r-- 1 nagios adm 261241 May 31 00:00 nagios-05-31-2014-00.log
108 -rw-r--r-- 1 nagios adm 104823 May 30 00:00 nagios-05-30-2014-00.log
192 -rw-r--r-- 1 nagios adm 188738 May 29 00:00 nagios-05-29-2014-00.log
256 -rw-r--r-- 1 nagios adm 257545 May 28 00:00 nagios-05-28-2014-00.log
116 -rw-r--r-- 1 nagios adm 113107 May 27 00:00 nagios-05-27-2014-00.log
372 -rw-r--r-- 1 nagios adm 376654 May 26 00:00 nagios-05-26-2014-00.log
508 -rw-r--r-- 1 nagios adm 512672 May 25 00:00 nagios-05-25-2014-00.log
124 -rw-r--r-- 1 nagios adm 120230 May 24 00:00 nagios-05-24-2014-00.log
140 -rw-r--r-- 1 nagios adm 139005 May 23 00:00 nagios-05-23-2014-00.log
196 -rw-r--r-- 1 nagios adm 195985 May 22 00:00 nagios-05-22-2014-00.log
208 -rw-r--r-- 1 nagios adm 208306 May 21 00:00 nagios-05-21-2014-00.log
80 -rw-r--r-- 1 nagios adm 74831 May 20 00:00 nagios-05-20-2014-00.log
16 -rw-r--r-- 1 nagios adm 15010 May 19 00:00 nagios-05-19-2014-00.log
16 -rw-r--r-- 1 nagios adm 13775 May 18 00:00 nagios-05-18-2014-00.log
244 -rw-r--r-- 1 nagios adm 242140 May 17 00:00 nagios-05-17-2014-00.log
252 -rw-r--r-- 1 nagios adm 251027 May 16 00:00 nagios-05-16-2014-00.log
140 -rw-r--r-- 1 nagios adm 137478 May 15 00:00 nagios-05-15-2014-00.log
128 -rw-r--r-- 1 nagios adm 123767 May 14 00:00 nagios-05-14-2014-00.log
92 -rw-r--r-- 1 nagios adm 87089 May 13 00:00 nagios-05-13-2014-00.log
12 -rw-r--r-- 1 nagios adm 10118 May 12 00:00 nagios-05-12-2014-00.log
32 -rw-r--r-- 1 nagios adm 27036 May 11 00:00 nagios-05-11-2014-00.log
20 -rw-r--r-- 1 nagios adm 17490 May 10 00:00 nagios-05-10-2014-00.log
32 -rw-r--r-- 1 nagios adm 24728 May 9 00:00 nagios-05-09-2014-00.log
112 -rw-r--r-- 1 nagios adm 109103 May 8 00:00 nagios-05-08-2014-00.log
216 -rw-r--r-- 1 nagios adm 215258 May 7 00:00 nagios-05-07-2014-00.log
28 -rw-r--r-- 1 nagios adm 23767 May 6 00:00 nagios-05-06-2014-00.log
12 -rw-r--r-- 1 nagios adm 12106 May 5 00:00 nagios-05-05-2014-00.log
12 -rw-r--r-- 1 nagios adm 10814 May 4 00:00 nagios-05-04-2014-00.log
168 -rw-r--r-- 1 nagios adm 167697 May 3 00:00 nagios-05-03-2014-00.log
....
Creation time is midnight. But I guess another log rotate program create daily rotation at midnight too, and this doesn't proof anything.
My first log files ever created by nagios are
Code: Select all
12 -rw-r--r-- 1 nagios adm 10411 Dec 16 2012 nagios-12-16-2012-00.log
24 -rw-r--r-- 1 nagios adm 18813 Dec 15 2012 nagios-12-15-2012-00.log
24 -rw-r--r-- 1 nagios adm 17654 Dec 14 2012 nagios-12-14-2012-00.log
32 -rw-r--r-- 1 nagios adm 25896 Dec 13 2012 nagios-12-13-2012-00.log
28 -rw-r--r-- 1 nagios adm 22247 Dec 12 2012 nagios-12-12-2012-00.log
With this index 00 too. I read changelog and didn't find there any necessary information.
I can only guess where is the problem. Is it in nagi web interface scripts, that tries to parse wrong files? Or in is in log rotation from the very beginning? Do you have 01-index in your file names?
Re: $(data \format\)-01.log files
Posted: Mon Nov 03, 2014 4:51 pm
by abrist
None of the archived logs should include "01-index" ion the name. They should be named:
Re: $(data \format\)-01.log files
Posted: Tue Nov 04, 2014 5:26 am
by lethal
Thaks a lot. I'll try to find why nagios web interface is looking for index 01 file. If I'll succeed I'll answer here.