Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I can produce file truncated from original log file with timestamp extention (%y%m%d%s). How can I get the name of created file in order to use this name in 'postrotate'. The following conf file does not work at a time when rotation takes time.

/usr/local/apacheHttpServer/logs/mod_jk.log{
missingok
copytruncate
rotate 7
notifempty
sharedscripts
dateext
dateformat -%Y-%m-%d-%s
postrotate
   day=$(date +%Y-%m-%d-%s)
   cp /usr/local/apacheHttpServer/logs/mod_jk.log-$day  /tmp/truncate/log/
endscript
}

Actually there may be several ways to detect the created file. But I assume there should be simple variable keeping this name. Thanks in advance

share|improve this question

migrated from stackoverflow.com Oct 17 '12 at 23:10

This question came from our site for professional and enthusiast programmers.

2  
If you want people to more readily help you, I would work on improving your accept rate.. currently, it is 0, which means that out of 8 eligible questions, you have not deemed any of the given answers to 'answer' the given question. You can do this by clicking on the green checkmark below the vote-down arrow on any answer. –  Daedalus Jul 3 '12 at 6:03
1  
Actually I have voted all valuable answers clicking up button. Some of them have not been answered yet, some of them has answered only by myself therefore I could not voted it. I believe feedback is the key point of keeping and extending the quality of this web site. I am aware of it. Thanks. –  mmc18 Jul 3 '12 at 6:22
    
I honestly forget when this permission comes, since it isn't listed, but you should be able to accept your own answers. –  Daedalus Jul 3 '12 at 6:25
    
ok lets talk about my current question :) –  mmc18 Jul 3 '12 at 6:28
1  
I wish I could, but I can't. I am unfamiliar with this language; I only commented to assist you in a feature which it appeared you were unaware of. –  Daedalus Jul 3 '12 at 6:30

1 Answer 1

up vote 0 down vote accepted

I have found a wordaround problem that if dateformat is as follows (does not contain seconds). File name can be predicted. But I still do not know if dateformat contains seconds (%s) as well

dateformat -%Y-%m-%d
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.