5 Using Logs to Monitor Components
Learn how to use log files to monitor your Oracle Communications Billing and Revenue Management (BRM) system.
Topics in this document:
Using Logs to Monitor Components
BRM records system activity in log files. One log file is generated for each component or application. Review these files daily to monitor your system and detect and diagnose system problems. You can also:
-
Write scripts to look for certain conditions, such as types or numbers of errors, and to notify you when these conditions occur.
-
Record opcode calls in the CM log file. See "Recording Opcode Calls in the CM Log File".
BRM generates log files for system components, applications, and client applications.
For system processes (or threads) such as CMs and DMs, BRM uses two types of log files:
-
Those that record normal startup activity are named program.log (for example, cm.log, js.log, and dm.log).
-
Those that record activity, such as error conditions, while the system is running. These pinlogs are named program.pinlog (for example, cm.pinlog, js.pinlog, and dm_oracle.pinlog).
For BRM applications, log files are named program.pinlog (for example, pin_billd.pinlog). If an application is missing a configuration file (pin.conf) or if the application fails before it can read the configuration file, it records errors in the default.pinlog log file.
Note:
Calls made by opcodes to get data from objects are not recorded in log files.
BRM Java-based applications, such as Customer Center and Configuration Center, by default do not use log files. However, you can enable error logging by adding entries to the Infranet.properties file that provide configuration information when the application starts.
Log files for system components are stored in BRM_home/sys/component. For example, the CM log file is in BRM_home/sys/cm.
If there is no log file in BRM_home/var/component, the default.pinlog file is used instead. It is stored in BRM_home/sys/component. For example, the CM pinlog file is BRM_home/sys/cm/default.pinlog.
For an application or client application log file, the default location is the directory from which the program was started.
You can leave log files in their default locations or move them.
Large log files degrade system performance. Check the sizes of log files periodically and delete or archive large files. When you delete or rename a log file, a new empty file is created as soon as a new log entry is created and either a maximum of four hours have elapsed or the application is stopped and restarted. Be especially vigilant when using new custom applications, which commonly makes log files grow quickly.
Log files should be archived weekly to a safe storage area.
Changing the Name or Location of a Log File
To change the name or location of the pinlog file for a component or application:
-
Open the configuration file (pin.conf or Infranet.properties) for the component or application.
-
Change the relevant entry:
-
logfile: Applications
-
cm_logfile: CM
-
dm_logfile: DM
-
-
Enter the desired name and directory for the log file.
-
Save and close the file.
-
Stop and restart the component or application.
Note:
You can change the name of the default application's log file by using the PIN_ERR_SET_LOGFILE function. See "PIN_ERR_SET_LOGFILE" in BRM Developer's Reference.
Setting the Reporting Level for Logging Messages
By default, BRM components report error messages, and BRM applications report both error and warning messages. You can set BRM to report debugging messages or not to report errors. The four levels of error reporting are:
-
0 = No logging
-
1 = (Default) Log error messages only
-
2 = Log error messages and warnings
-
3 = Log error, warning, and debugging messages
Note:
To avoid performance degradation, use only level 3 logging for debugging.
A common implementation is to set the error-level reporting to 2 and use a script to detect and act on warning messages.
To change the severity level for logging:
-
Open the component's or application's configuration file (pin.conf or .properties).
-
Edit the loglevel entry. The notes in the configuration file define the options.
-
Save and close the file.
-
Stop and restart the component or application.
Setting the Log Level for a Specific Opcode
You can record debug-level information for a specified opcode without having to reset the default system log level. This enables you to monitor the activity of a specific opcode (and any opcode it calls) without impacting system performance.
When you enable opcode logging, the logging level is increased to debug level 3 for the specified opcode only; all other opcodes are logged at the level specified in the CM pin.conf file.
You can define how many times during a CM session the debug-level reporting occurs for the specified opcode before the default reporting level is restored. This enables you to increase the logging level without having to stop and restart the CM to reset it to the default level.
-
Open the CM pin.conf file in BRM_home/sys/cm.
-
Set the pinlog_debug_opcode entry:
cm pinlog_debug_opcode opcode
where opcode is the opcode name or opcode number.
Note:
If this entry is not set, BRM uses the loglevel entry in the CM pin.conf file to determine the log level.
-
Set the pinlog_debug_op_count entry:
cm pinlog_debug_op_count number
where number is the number of times the opcode is recorded at the debug level before the default log level is restored.
-
Save and close the file.
-
Restart the CM.
Recording Opcode Calls in the CM Log File
You use the enable_pcm_op_call_stack and max_pcm_op_call_stack_entries CM pin.conf entries to record opcodes in the CM log file.
When enable_pcm_op_call_stack is enabled, the opcodes that are called by BRM clients are recorded in the CM log file.
About Formatting Log Files
You can format a log file to improve readability and traceability of errors by using the splitPinlog script. This script splits a log file into multiple files, one for each combination of process ID (PID) and thread ID (TID) based on the information in the header of the pinlog entries.
To format a log file:
-
Go to the BRM_home/bin directory.
-
Run the following Perl script:
splitPinlog original_pinlog_file
The Perl script creates a file with the name original_pinlog_file.pid.tid.pinlog.
For example, running the command:
splitPinlog cm.pinlog
results in these file names:
-
cm.pinlog.342353.12.pinlog
-
cm.pinlog.342353.13.pinlog
Rotating Log Files for C/C++Based Applications
By default, BRM applications do not rotate pinlog files, but you can configure individual C-based BRM applications to rotate them. The list of C-based BRM applications that support log rotation can be found in "C-Based Applications and Utilities that Support Log Rotation".
-
The length of time the pinlog file has been open, such as every 3 days at 05:00
-
The pinlog file’s size, such as 50 MB
You can also combine the rotation schemes (use time and file size to rotate files), such as 50 MB files open for 3 days closed at 5:00.
If you have a service that generates a consistent volume of logs, you can configure the log rotation on a consistent schedule. But you may have to configure size limits for services that experience periodic spikes in activity or generate large volumes of logs to ensure that the log files do not consume too much disk space. If your service is a combination of both, where the application generates a consistent volume of logs but you expect sudden spikes during unexpected scenarios, you can configure the log rotation based on both day- and size-based rotations.
When configured to rotate pinlog files, the application creates a pinlog file using the following file naming convention and writes it to the specified logfile directory:
name.time
where name is the name of the file as seen in the logfile pin.conf entry, and time is the time that the file was created, in the format specified by the log_rotate_file_name_format pin.conf entry.
When the file’s configured time or size is reached, the application closes the pinlog file and moves it to a rotate backup directory. Then, the application creates a new pinlog file in the logfile directory.
Note:
You can also configure custom C-based applications to rotate pinlog files by customizing the application to call the PIN_ERR_SET_LOG_ROTATE_CONFIGURATION macro (See "PIN_ERR_SET_LOG_ROTATE_CONFIGURATION" in the Developer's Reference for more information).
Configuring Applications to Rotate pinlog Files
-
logfile: Specifies the name and location in which to create pinlog files.
-
log_rotate_by_days_at_time: Specifies how often and when to rotate a pinlog file, such as daily at 03:00.
-
log_rotate_by_size_megabytes: Specifies the file size at which to rotate a pinlog file, such as 10 MB.
-
log_rotate_backup_dir: Specifies the path and name of the backup directory. The application moves the current pinlog files to this directory whenever a new file is created.
-
log_rotate_file_name_format: Specifies the format of the timestamp appended to the pinlog file name.This configuration should be compatible with the format passed to strftime.
-
Open the application’s pin.conf file. See "C-Based Applications and Utilities that Support Log Rotation" for the location of the application’s pin.conf file.
-
Specify the location of the logfile directory:
- programName logfile logPath
where programName is the program name listed in "Appendix", and logPath is the path to the program in the logfile directory.
-
To rotate files based on time, set this entry:
- programName log_rotate_by_days_at_time frequency HH:MM
where frequency is number of days after which you want the log rotation to take place, HH is an integer between 0 and 23 indicating the hour at which the rotation should take place, and MM is an integer between 0 and 59 indicating the minute at which the rotation should take place.
-
To rotate files based on file size, set this entry:
- - log_rotate_by_size_megabytes size
where size is the specific file size in megabytes.
Note:
The log rotation may not happen at the exact file size specified. The size of rotated file may be slightly higher than what is configured to prevent data loss.
-
Specify the location of the rotate backup directory:
- - log_rotate_backup_dir rotatePath
where rotatePath is the specific path to the rotate backup directory.
-
Specify the timestamp format appended to pinlog files compatible with the format passed to strftime:
- - log_rotate_file_name_format %d%m%Y:%H%M 1
-
Save and close the file.
-
Restart the application to initialize the changes.
Example 1: Enable Time-Based Rotation for EAI DM
-
Rotate its pinlog files daily at 10 am
-
Create pinlog files in BRM_home/logdir
-
Move closed pinlog files to BRM_home/sample/backupdir, where BRM_home is the directory in which the BRM software is installed
-
Use this pinlog file name format: dm_eai.pinlog.startTime_endTimewhere startTimeis the time when the log rotation is set to begin, and endTime is the time when the log rotation is set to end.
- dm logfile BRM_home/logdir
- dm log_rotate_by_days_at_time 1 10:00
- dm log_rotate_file_name_format %d%m%Y:%H%M 1
- dm log_rotate_backup_dir BRM_home/sample/backupdir
-
dm_eai.pinlog.12122024:1000_13122024:1000
-
dm_eai.pinlog.13122024:1000_14122024:1000
-
dm_eai.pinlog.14122024:1000_15122024:1000
Example 2: Enable Size-Based Rotation for Oracle DM
-
Rotate its pinlog files when they reach a file size of 50 MB
-
Create pinlog files in BRM_home/logdir
-
Move closed pinlog files to BRM_home/sample/backupdir, where BRM_home is the directory in which the BRM software is installed
-
Use this pinlog file name format: dm_eai.pinlog.seq_no where seq_nois the sequence number of the created pinlog file.
- dm logfile BRM_home/logdir
- dm log_rotate_by_size_megabytes 50
- dm log_rotate_backup_dir BRM_home/sample/backupdir
-
dm_eai.pinlog
-
dm_eai.pinlog.1
-
dm_eai.pinlog.2
-
dm_eai.pinlog.3
Example 3: Enable Both Time- and Size-Based Rotations for EAI DM
-
Rotate its pinlog files when they reach 50 MB, daily at 10 am
-
Create pinlog files in BRM_home/logdir
-
Move closed pinlog files to BRM_home/sample/backupdir, where BRM_home is the directory in which the BRM software is installed
-
Use this pinlog file name format: dm_eai.pinlog.startTime_endTimeseq_no where where startTimeis the time when the log rotation is set to begin, endTime is the time when the log rotation is set to end, and seq_nois the sequence number of the created pinlog file.
- dm logfile BRM_home/logdir
- dm log_rotate_by_days_at_time 1 10:00
- dm log_rotate_by_size_megabytes 50
- dm log_rotate_file_name_format %d%m%Y:%H%M 1
-
dm_eai.pinlog.12122024:1000_13122024:1000
-
dm_eai.pinlog.13122024:1000_13122024:1000.1
-
dm_eai.pinlog.14122024:1000_13122024:1000.2