Application Configuration
JSON
It would be very easy to use JSON for configuration files, JSON files are very portable and readable. Write the variable - value in the key - value format, and use json
module in our Python code to load them into a dictionary for later usage.
Directory
The configuration files are stored in $Visor_HOME/config
.
- fake_log_gen.json: Used to configure the fake log generator, such as the types of logs, the intervals between log generations, and the content of fields in different logs.
- log_monitor.json:
...
- log_db.json:
...
Examples
Take the fake log generator as an example, we need to be able to configure the desired log patterns, the number and names of fields, and the available contents of the fields:
"heartbeat": {
"interval": "3",
"message": "HEARBEAT"
},
"access": {
"interval": {
"min": 3,
"max": 10
},
"user_id": [
"Frank","Addison","Alden","Baird","Bradley","Bud","Chapman","Curt","Galvin"
],
"method": [
"GET", "POST", "PUT", "DELETE"
],
"code": [
"200", "301"
],
"resource": [
"/image/kitty.png", "/doc/readme.txt", "/doc/charge.txt", "/app/main", "/list"
],
"version": [
"HTTP/1.1", "HTTP/2.0"
]