Extraction of Configuration from Log File
This tutorial shows how to extract configuration from the log file. Sometimes you may get confused with the configuration file that you think you used and the log file that is really used. It is getting more and more difficult to understand the configuration that is used for a specific test due to too many #if statements in the log. For all of these case, the configuration extracted from the log file would help.
When do you want to use this tool ? Following is the some of my cases : (In any of these cases, you may extract the configuration from the log and save it as a file if you want)
- I got a log and configuration file from somebody, but they don't seem to match. so I want to check out the configuration that are really used in the test
- I got a log from somebody without the configuration file and I want to duplicate the configuration and try the test in my system.
Table of Contents
- Extraction of Configuration from Log File
Where is the tool ?
You can find the extraction tool (json_util) at /root/ots directory as shown below.
Where is Configuration in the log ?
At the beginning of a log file, you will find the compressed text of the configuration as shown below.
Extracting the Configuration
There are a few different ways to extract the configuration contained in the log as shown below.
Extracting from the log file
you can extract the configuraion directly from the log file using the syntax : ./json_util config file:<filename>
./json_util config file:/tmp/gnb0.log |
If you want to save the extracted configuration into a file, you can do as shown below.
./json_util config file:/tmp/gnb0.log > /tmp/mygnb.cfg |
Extracting from the text
Run the json_util with the configuration text as shown below and hit enter.
You will get the extracted configuration as follows.
Extracting A Component from Configuration File
With this tool, you can dump a specific component from a configuration file using ./jason_util dump <configuration_file><component_name> as shown in the examples below.
[root@CBC-2021050100 ots]# ./json_util dump /root/enb/config/gnb-sa.cfg nr_cell_list
[ { "band": 78, "cell_id": 1, "dl_nr_arfcn": 632628, "rf_port": 0, "ssb_pos_bitmap": "10000000", "subcarrier_spacing": 30 } ] |
[root@CBC-2021050100 ots]# ./json_util dump /root/enb/config/gnb-sa.cfg rf_driver
{ "args": "dev0=/dev/sdr0", "name": "sdr", "rx_antenna": "rx" } |
Extracting the Configuration into a file
You can extract the log into a file as shown below
Open the saved file and confirm.