Redirect astlogdir => /run/log/asterisk

I’m running Asterisk 13.23.0 on an RPi 3B. I want to direct the logs that usually end up in /var/log/asterisk to /run/log/asterisk to reduce SD card writes.

I changed the value of astlogdir in /etc/asterisk.conf to point to /run/log/asterisk and restarted asterisk. The log files still end up in /var/log/asterisk. I then added a line to /etc/tmpfiles.d/asterisk to create the asterisk subdirectory under /run/log at boot time, in case this was necessary. After asterisk restart, logs still end up in /var/log/asterisk.

Have I missed something or is the asterisk.conf setting for astlogdir not being honored?

An alternative solution is to mount a RAM file system on /var/log/asterisk.

Or you could make /var/log/asterisk a symbolic link.

@david551, I realize that I could do one of the things that you suggest, but I am focused on what is preventing the astlogdir setting in asterisk.conf from being honored. Since this is documented functionality I ought not have to get creative. :smile:

What is the actual configuration? Have you removed the template part of the context name so that it becomes a real context, and isn’t ignored?

@jcolp, thank you…that was it. I have to remove the (!) from the context name, which I suppose negates it?

Essentially yes, it turns it into a template which can be included in other contexts.