I am using ubuntu 14.04. I have to change the path of syslog file from /var/log to /opt/log. I have changed the path in 50-default.conf file from /var/log to /opt/log. I have restarted the rsyslog service also still it is not working. So how can I change the path?

  • Why would you want to change a standard location for syslog to /opt? – heynnema Jun 1 '17 at 18:21
  • That is one of my requirement that's why I have to change the location. – ams Jun 4 '17 at 7:40
  • Why do you have a requirement to change the location to /opt? I suspect that others will ask the same question. You really shouldn't tamper with how the system is put together. – heynnema Jun 4 '17 at 13:13
  • maybe if you tell your requirement, the community can give you a better solution. Never hesitate to share your problem, there are always smart solutions. – luv.preet Jul 26 '17 at 10:33
  • Thanks @luv.preet. Next time I will definitely tell my requirement with more information. I got the solution for the asked question. I will share the answer soon. – ams Jul 26 '17 at 10:41

Thanks for your help.

I found the solution for this question. It is as follows :

In 50-default.conf file. I added following lines at the end so that most of the messages get logged in the mylog.log file.

    *.=notice;*.=warn   -/opt/log/mylog.log

After this in opt folder I created a log folder and changed the permission as below:

sudo mkdir /opt/log

sudo chmod -c 777 /opt/log

Then in /opt/log folder I created a mylog.log file and here also I changed the permission as below:

sudo touch mylog.log

sudo chmod -c 777 mylog.log

And then I restarted the rsyslog service as follows :

sudo service rsyslog restart

Hope this will be helpful for some people.

Thank You.

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.