herlesupreeth / docker_open5gs

Docker files to run open5gs + IMS + eNB + gNB + NR-UE in a docker
BSD 2-Clause "Simplified" License
311 stars 170 forks source link

fail to redirect logs to a specific file via rsyslog #328

Closed ll112138 closed 3 months ago

ll112138 commented 3 months ago

  hello!I hope you are well.   Thank you for providing the template that enabled me to successfully run IMS using Docker. However, I encountered some issues when attempting to redirect logs to a file. I would greatly appreciate any suggestions you may have. By reading the corebook, I got a way to write the log to a file. There are some jobs that I did:

  1. Change the cfg file.

    debug=3
    log_facility=LOG_LOCAL0
    log_stderror=no
    memdbg=5
    memlog=5
    log_prefix="{$mt $hdr(CSeq) $ci} "
  2. Create the file to be writed in the directory /var/log/ and change it mod to 777 in docker

  3. Download rsyslog in docker. Restart it after changing conf file   Upon completion of the download process, a file titled 50-default.conf was discovered within the directory /etc/rsyslog.d/. Some modifications were made in it.

    auth,authpriv.*                 /var/log/auth.log
    *.*;auth,authpriv.none,local0.none              -/var/log/syslog
    #cron.*                         /var/log/cron.log
    #daemon.*                       -/var/log/daemon.log
    kern.*                          -/var/log/kern.log
    #lpr.*                          -/var/log/lpr.log
    mail.*                          -/var/log/mail.log
    #user.*                         -/var/log/user.log
    local0.*                        -/var/log/kamailio.log
  4. Restart the docker

  the file is still empty. I have checked the status of rsyslog, which is running. The command logger -p local0.info "Test log message for Kamailio" has be executed to test. "Test log message for Kamailio" can be seen in kamailio.log.The console displays output upon executing "docker logs -tf CONTAIN_NAME".   I have no idea now. Can you give me some advice? If there are some examples that I can refer to, that would be great! Thank you once again! Best wishes to you!

herlesupreeth commented 3 months ago

If you could write to a file inside /mnt/pcscf folder of docker then you can access that file under pcscf folder outside the docker. Similarly for scscf (/mnt/scscf), icscf (/mnt/icscf) and smsc (/mnt/smsc)

ll112138 commented 3 months ago

Thank you for your help. I have found a way to achieve the goal by modifying the docker-compose configuration. Thank you once again!