FreeSWITCH環境日誌優化和管理

概述:FreeSWITCH在大量呼叫的情況下,會產生大量的日誌文件,佔用許多磁盤空間,影響環境運行效率,因此需要進行日誌管理。
以下簡述方法。

以freeswitch的日誌模塊爲基礎,藉助linux自啓動、logrotate和cron來實現和完善。

一、FreeSWITCH控制檯日誌:

配置文件默認的路徑: /usr/local/freeswitch/conf/autoload_configs/logfile.conf.xml

  <configuration name="logfile.conf" description="File Logging">
    <settings>
     <!-- true to auto rotate on HUP, false to open/close -->
     <param name="rotate-on-hup" value="true"/>
    </settings>
    <profiles>
      <profile name="default">
        <settings>
          <!-- File to log to -->
          <param name="logfile" value="/var/log/freeswitch/freeswitch.log"/>
          <!-- At this length in bytes rotate the log file (0 for never) -->
          <!-- <param name="rollover" value="1048576000"/>-->
          <param name="rollover" value="120971520"/>
                  <!-- Maximum number of log files to keep before wrapping -->
                  <!-- If this parameter is enabled, the log filenames will not include a date stamp -->
                  <!-- <param name="maximum-rotate" value="32"/> -->
          <!-- Prefix all log lines by the session's uuid  -->
          <param name="uuid" value="true" />
        </settings>
        <mappings>
          <!-- 
               name can be a file name, function name or 'all' 
               value is one or more of debug,info,notice,warning,err,crit,alert,all
               Please see comments in console.conf.xml for more information
          -->
          <map name="all" value="console,debug,info,notice,warning,err,crit,alert"/>
        </mappings>
      </profile>
    </profiles>
  </configuration>

二、設置自啓動

編輯/etc/rc.d/rc.local文件

echo "freeswitch stats start"
/usr/local/freeswitch/bin/top-stats &
/usr/local/freeswitch/bin/ctl-stats &
echo "freeswitch stats end"

FreeSWITCH狀態日誌

日誌存儲路徑:

/var/log/freeswitch/ctl/ctl.log

top日誌

日誌存儲路徑:

/var/log/freeswitch/top/top.log

三、配置logrotate和cron

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章