0

I have a quick question. We want to put the asterisk logs in multiple directories.

Is this possible with an asterisk server?

We were thinking about something like this. (our example)

astlogdir => /var/log/asterisk, /var/log/remote-asterisk

right now it is this;

astlogdir => /var/log/asterisk

Anybody got any ideas if this is possible and what would be the right way? Thank you in advance.

Wesley Schravendijk
  • 483
  • 2
  • 6
  • 21

2 Answers2

1

I use a symlink. The logger sees the link as a file, and the file system is responsible for writing the data to the linked location instead. The link is not a copy of the log, but just a pointer to another path on the file system.

Go to your logging folder:

cd /var/log/asterisk/

Make a link to a new file in /var/log/asterisk-remote (adjust the target path to your needs).

sudo ln -s /var/log/asterisk-remote/other-log /var/log/asterisk/link-log

View the link:

ls -ll
lrwxrwxrwx 1 root root    34 Oct  2 16:12 link-log -> /var/log/asterisk-remote/other-log

Then in /etc/asterisk/logger.conf just add the link's name (with whatever types of log messages you want it to receive):

[logfiles]
messages => notice,warning,error
link-log => notice,warning,error

Be sure to reload your config to apply the changes (this is done in the Asterisk CLI, which you can access via asterisk -r in the shell):

core reload

QuickDanger
  • 1,032
  • 11
  • 18
0

Yes, it is possible.

You just have open logger.c and write needed code

No, at current moment it not do so, nobody need it.

As second option you always can do symlink

arheops
  • 15,544
  • 1
  • 21
  • 27