LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 09-12-2011, 04:21 PM   #1
imoncloud
LQ Newbie
 
Registered: Sep 2011
Posts: 1

Rep: Reputation: Disabled
Tomcat log file in date format


Hi all,

I was asked to write a new logrotate file for tomcat logs..in which one
of the requirement is to have date and time appended at the end of
the file name.

I have tried dateext and dateformat-%Y-%m-%d-%s but these directives
didn't have the option for HH:MM.

I am very new to this logrotate... I think some scripting in logrotate
might be needed but I am very bad at scripting. Can anyone please tell
me how to get the requirement satisfied.
 
Old 09-16-2011, 12:00 PM   #2
jason_not
Member
 
Registered: Aug 2010
Location: Beaverton, Oregon, USA
Distribution: Pfsense, Ubuntu, Centos, Fedora, Redhat, Scientfic, MacOS
Posts: 76

Rep: Reputation: 19
Hello,

Take a look at the manpage for the date command. You can do quite a bit in terms of filename generation, date conversion, etc. For instance:

date +"%Y-%m-%d" returns:

2011-09-16

and
date +"%Y-%m-%d-%H:%M" returns:
2011-09-16-09:59


--jason
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
In Apache server, How to change log file location and log format for access log fil? since1993 Linux - Server 1 08-19-2009 04:14 PM
script help - pull date format out of file name and compare to today MaureenT Linux - General 5 11-06-2008 11:14 AM
Log File Date Oddness iamryman Linux - Server 1 05-22-2007 01:39 AM
Date in Log file name Runningonair Linux - General 8 06-02-2006 09:45 AM
loading data from a flat file with a date and time having a different format spyghost Programming 2 11-02-2003 04:40 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 07:47 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration