Re: get the timestamp as a log filename

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Jan 22, 2004 at 02:08:56PM -0500, Genti A. Hila wrote:
> 
> I think I didn't explain it quite well:
> I have some log files that are saved from logrotate  hourly.
> But what i get is something like message.1 messages.2 etc
> Instead of this i would like to have something like
> mesagges_04\01\21_14\00
> So to follow the format  messages_yy\mm\dd\_hour\minute

Make sure you are not using meta characters in ways the hurt you.
Commonly \ is used to escape the next character.
In windowZ  the \ is used as a file separator.
Same is true of dots '.' which matches any single character.
Spaces are a bugger in file names too.

Now I wonder if you intended to build a directory tree:
with the format  messages_yy/mm/dd/_hour/minute

> > cp -a file.log intrusion-`date +"%Y.%m.%d_%X"`.log && > file.log

I have not tried this but I suspect your logrotate configuration file
could have a postrotate line that in addition to sending a signal to
the process did something like:

	mv logfile.1 logfile-ending-on-`date +"%Y-%m-%d_%R`

This will cause side effects.  You are no longer rotating the files.
If you only want 28/29/30/31 files a month then you need log.1 log.2
...log.31. type stuff.

i.e. Now you can run out of space which logrotate is to avoid.

Compressed files are good, make sure the compression suffix hint is
not lost.


-- 
	T o m  M i t c h e l l 
	mitch48-at-sbcglobal-dot-net




[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux