We are using rdkb-2019q4 with openBFC 20.1, where some times the PAM logs are coming on console and in some cases the logs are logging under /rdklogs/logs.

Is there way to log the PAM logs every time to /rdklogs/logs ?

  • No labels

2 Comments

  1. Hi Z-Ravindra Reddy Gundam ,

    CcspPandm component routes the logs to /rdklogs/logs/PAMlog.txt.0 .For this you need to convert all C/C++ logging statements(like printf) to use standard logging functions CcspTraceInfo, CcspTraceWarning,CcspTraceError etc. CcspTraceXxxx functions are based on open-source 'log4c'.By using the above apis the logs are automatically written to logfiles. After conversion to standard logging functions ,you can verify the logs under /rdklogs/logs/PAMlog.txt.0.

    You can also confirm that the log rotation service in your device is active and working as expected  by using the command ' systemctl status rdkbLogMonitor ' .Sample output from rpi:

    root@RaspberryPi-Gateway:~# systemctl status rdkbLogMonitor
    ● rdkbLogMonitor.service - rdkbLogMonitor service
       Loaded: loaded (/lib/systemd/system/rdkbLogMonitor.service; disabled; vendor preset: enabled)
       Active: active (exited) since Thu 2020-12-10 07:20:12 UTC; 1s ago
      Process: 7367 ExecStart=/bin/sh -c /rdklogger/rdkbLogMonitor.sh & (code=exited, status=0/SUCCESS)
     Main PID: 7367 (code=exited, status=0/SUCCESS)
       CGroup: /system.slice/rdkbLogMonitor.service
               ├─7368 /bin/sh /rdklogger/rdkbLogMonitor.sh
               └─7564 /bin/sh /rdklogger/rdkbLogMonitor.sh

    Dec 10 07:20:12 RaspberryPi-Gateway systemd[1]: Starting rdkbLogMonitor service...
    Dec 10 07:20:12 RaspberryPi-Gateway systemd[1]: Started rdkbLogMonitor service.


    If Logrotation is not working ,then you can add the following code changes in uploadSTBLogs.sh file by replacing the mv command with cp:


    diff --git a/lib/rdk/uploadSTBLogs.sh b/lib/rdk/uploadSTBLogs.sh
    index fef8e10..284eac6 100644
    --- a/lib/rdk/uploadSTBLogs.sh
    +++ b/lib/rdk/uploadSTBLogs.sh
    
    @@ -76,8 +76,8 @@
         	if [ ! -d $LOG_PATH/PreviousLogs_backup ]; then mkdir -p $LOG_PATH/PreviousLogs_backup; fi
         	rm -rf $LOG_PATH/PreviousLogs_backup/*
     
    -	backupSystemLogFiles mv $LOG_PATH $PREV_LOG_PATH
    -        backupAppBackupLogFiles mv $LOG_PATH $PREV_LOG_PATH
    +	backupSystemLogFiles cp $LOG_PATH $PREV_LOG_PATH
    +        backupAppBackupLogFiles cp $LOG_PATH $PREV_LOG_PATH
     
           #fi
     else
    @@ -86,8 +86,8 @@
          #else
     
         	rm -rf $LOG_PATH/PreviousLogs_backup/*
    -	backupSystemLogFiles mv $LOG_PATH $PREV_LOG_PATH
    -        backupAppBackupLogFiles mv $LOG_PATH $PREV_LOG_PATH
    +	backupSystemLogFiles cp $LOG_PATH $PREV_LOG_PATH
    +        backupAppBackupLogFiles cp $LOG_PATH $PREV_LOG_PATH
          	#cp $PREV_LOG_BACKUP_PATH/* $PREV_LOG_PATH/
          #fi
     fi


     

    Regards

    Karthika

  2. Thanks Karthika.

    We didn't have PAMlog.txt.0 file created in /rdklogs/logs/ folder. Once PAM process restarts the log file was getting created.

    We observed during bootup PAM was waiting for psm to be initialized because of which log file was not getting created. Hence we do not start PAM until psm_intialized is not created in /tmp folder.