Amarisoft

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)

NOTE : The order of the configuration parameters in the extracted configuration would not be exactly same as you used in the original configuration file. so if you want to compare the extracted config and original config file with text diff software, it may not work very well.  However, you should be able to run the test with the extracted config file in the same way as the original configuration file.

 

Table of Contents

 

Where is the tool ?

You can find the extraction tool (json_util) at /root/ots directory as shown below.

ExtractConfigFromLog Tool 01

 

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.

ExtractConfigFromLog ConfigInLog 01

 

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.

ExtractConfigFromLog ConfigInExtract 01

You will get the extracted configuration as follows.

ExtractConfigFromLog ConfigInExtract 02

 

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

Configuration extraction from log file illustration related to ConfigFromLog ConfigInExtractFile 01

Open the saved file and confirm.

ExtractConfigFromLog ConfigInExtractFile 02