Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

share|improve this question

migrated from Oct 17 '12 at 23:10

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

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
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
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
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


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.