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.

rotate 7
dateformat -%Y-%m-%d-%s
   day=$(date +%Y-%m-%d-%s)
   cp /usr/local/apacheHttpServer/logs/mod_jk.log-$day  /tmp/truncate/log/

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

  • 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. – Ahmet Karakaya 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 :) – Ahmet Karakaya 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
  • I was about to come back here, and try again to convince you to accept viable answers to your questions, only to find that you changed your mind. So, what changed, if I may ask? – Daedalus Sep 17 '12 at 2:31

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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