Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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 work for a small software company. We have a product that by default writes to a logs directory inside the installation directory (I know, this may not be the best way, but it's fixed as of now): /opt/<program>/logs

I have a user that wants each of his users (on Linux) when running our program, to have logs written to their user directory per session, like /home/<user>/<program>/logs. Is there a good way to set this up, relying on my program always writing to /opt/<program>/logs by default?

I'm no Linux expert but I'm thinking this could be done.

Would this be better asked on the Linux SE board?

Any help is appreciated!

NOTE - These logs are created for the program when it runs, no matter who is logged in to use it. They all go to the same directory: /opt/<program>/logs. If I create a symlink, then all that does it duplicate the logs into another directory. What I need is each user's logs for their session into their respective /home/<user>/<program>/logs directory.

share|improve this question

Create a link from the /opt/program/logs folder and point it to /home/user/logs:

ln -s /home/user/logs /opt/program/logs
share|improve this answer
See note above - not sure this get's me what I need. – nicorellius May 16 '11 at 21:33

Try removing the /logs/ directory, and navigating to /opt/program and typing

ln -s ~/logs

However, you will need to add a

mkdir ~/logs

to each users startup script.

share|improve this answer

How does the log look like? Is there a possibility to check which user created an entry?
You could use the syslog-ng to watch for the files in /opt/<program>/logs and depending on the entry (e.g. a regular expression) writing a second logfile to $USERHOME/logs.

If just one user is using your program you may give him read-permissions to this directory and its files. But if there are sensible entries from other users this is a bad idea.

share|improve this answer
No way to see which user created the entry, as the logs are somewhat non-specific. Multiple users will be using this program, hence the need for separate logs... Thanks! I wonder if you could parse based on time, and connect that to the user login time... – nicorellius May 16 '11 at 21:39

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.