What is logs/mylog (mine is 1.7GB!)

Discussion of the Meteohub software package

Moderator: Mattk

Post Reply
skyewright
Platinum Boarder
Platinum Boarder
Posts: 873
Joined: Fri Jan 25, 2008 6:27 pm
Location: Isle of Skye, Scotland

What is logs/mylog (mine is 1.7GB!)

Post by skyewright »

I just discovered that one of my two ALIX-1D meteohubs had stopped logging data at least 19 hours previously.

No warning were issued. System loads were normal. The other meteohub was happily reading data from a weather station attached to the one that stopped logging.

A simple stop and restart of logging seemed to get things going (and at that point 2 "Logging of Weather Data aborted" e-mails with a time of 0330 this morning were sent out).

The alarm and meteohub logs don't seem to contain anythig useful (indeed they contain very little at all)

A little later I noticed that on the System page, Data was showing as 100% full!

On the other meteohub, which is almost identical, but is used for development work too and thus records more sensors, Data is only at 44%.

Taking a look around the system I discovered that the logs folder on the affected meteohub contains a file called "mylogs" which is 1.7GB in size! :blink:

Checking the other meteohub, there is a mylogs there too, but it is only 34MB.

The affected meteohub is very rarely rebooted (an uptime of ~50 days, running 4.5h (Build 450)). I rebooted and that brought data down to 93% but the massive mylogs is still there.

So:
a) What is mylogs?
b) How best to reduce it?

PS. Should there maybe be some sort of alarm for an about to become full system?
User avatar
YJB
Platinum Boarder
Platinum Boarder
Posts: 387
Joined: Thu Feb 19, 2009 5:53 pm
Location: Venhuizen, Netherlands
Contact:

Re:What is logs/mylog (mine is 1.7GB!)

Post by YJB »

I just checked my system, but can't find anything like a mylogs file.

Have you looked inside the file to see what it is logging?
skyewright
Platinum Boarder
Platinum Boarder
Posts: 873
Joined: Fri Jan 25, 2008 6:27 pm
Location: Isle of Skye, Scotland

Re:What is logs/mylog (mine is 1.7GB!)

Post by skyewright »

YJB wrote:I just checked my system, but can't find anything like a mylogs file.

Have you looked inside the file to see what it is logging?
I'd already tried looking at the big file but my editor baulked at the idea! However I have the smaller one too, so I just looked in that and found:
18:30:02 up 0 min, 0 users, load average: 2.94, 0.85, 0.29
to
17:16:01 up 29 days, 1:23, 0 users, load average: 1.28, 1.68, 1.69
and that's on a system with an uptime of just over 29 days.

That data makes it look as though it may be a file associated with a "system" station?

However I don't have a system station set up on the affected system, only on the one that was fine. :S

Do you have a "system" station set up?

It at least looks like some thing that should be okay to just delete, but it would be nice to know...
skyewright
Platinum Boarder
Platinum Boarder
Posts: 873
Joined: Fri Jan 25, 2008 6:27 pm
Location: Isle of Skye, Scotland

Re:What is logs/mylog (mine is 1.7GB!)

Post by skyewright »

skyewright wrote:It at least looks like some thing that should be okay to just delete, but it would be nice to know...
I just took the plunge and deleted it (having made a copy to a PC first).
That too Data down to 30%. :cheer:

At the next change of minute mylog started to regenerate. It doesn't see to be the same as on the other meteohub.

On this system, in addition to the "one line" system symmary there are also ~70 other lines of data in columns headed:
PID TTY STAT TIME COMMAND
The result is that as each minute passes the file grows by ~5KB.
skyewright
Platinum Boarder
Platinum Boarder
Posts: 873
Joined: Fri Jan 25, 2008 6:27 pm
Location: Isle of Skye, Scotland

Re:What is logs/mylog (mine is 1.7GB!)

Post by skyewright »

I have found the source, if not an explanation, by looking at the crontab settings:

The meteohub with the smaller file has:
* * * * * uptime >>/data/log/mylog
The meteohub that filled up has:
* * * * * uptime >>/data/log/mylog; ps ax >>/data/log/mylog
User avatar
YJB
Platinum Boarder
Platinum Boarder
Posts: 387
Joined: Thu Feb 19, 2009 5:53 pm
Location: Venhuizen, Netherlands
Contact:

Re:What is logs/mylog (mine is 1.7GB!)

Post by YJB »

Hmm, that explains the growth of your logfile; logging every minute the uptime of the system into a file.

Anyways, looked at mine:
meteoplug:~# crontab -l |grep uptime
*/1 * * * * /bin/cat /proc/uptime >/var/run/meteohub/alive

And yes, I'm collecting systemdata as well , but only 4 sensors: system load, system used, swap used and data used.
skyewright
Platinum Boarder
Platinum Boarder
Posts: 873
Joined: Fri Jan 25, 2008 6:27 pm
Location: Isle of Skye, Scotland

Re:What is logs/mylog (mine is 1.7GB!)

Post by skyewright »

YJB wrote: Anyways, looked at mine:
meteoplug:~# crontab -l |grep uptime
*/1 * * * * /bin/cat /proc/uptime >/var/run/meteohub/alive
Yes that looks similar, though what you've found uses >, and so starts the file fresh each time, but what I found uses >>, and so accumulates.

There will be a reason somewhere...

PS. I've now found that though the sensors stopped being read at around 2000 on the 21st, data stopped being written to raw over 24hrs before that. I hadn't noticed because it's the other meteohub that I actually look at regularly. The affected meteohub feeds WD, but the "logging protocol" kept feeding data till the sensors stopped, so it wasn't until I happened to look at WD graph earlier today that I spotted the straight lining... :(
However I was able to revert WD to a backup, and it now has a full set of data picked up from the "other" meteohub.:)

At some stage I'll want to fill in the gap in raw on the affected meteohub, but I may leave that till after the end of the month (in which case I won't need to stop logging while I repair).
User avatar
admin
Platinum Boarder
Platinum Boarder
Posts: 7879
Joined: Mon Oct 01, 2007 10:51 pm

Re:What is logs/mylog (mine is 1.7GB!)

Post by admin »

I fear the mylogs file is something I added on your specific machine when we tried to find out reasons for system freezes some months ago (turned out to be a power supply issue). Logging system load and all running processes every minute does make sense, when trying to spot a reason for freeze.

However, I should have removed that from your crontab again. Sorry for that. Please just purge this line from your crontab. You can edit crontab in a vi-like mode by "crontab -e" ("dd" removes the line your cursor points to).
skyewright
Platinum Boarder
Platinum Boarder
Posts: 873
Joined: Fri Jan 25, 2008 6:27 pm
Location: Isle of Skye, Scotland

Re:What is logs/mylog (mine is 1.7GB!)

Post by skyewright »

admin wrote:Sorry for that.
No worries. I did wonder if it might have been a debug thing, but I couldn't think what for.
You can edit crontab in a vi-like mode by "crontab -e" ("dd" removes the line your cursor points to).
Will do.

Thanks for the confirmation.

Maybe it was a useful exercise in what happens when a disk fills up?

Is there perhaps scope for periodic warning e-mails if Data has exceeded, say, 95% of capacity?
Post Reply