stratosphereips / AIP

The Attacker IP Prioritizer(AIP) dynamically generates resource-friendly IPv4 blocklists from Zeek network flows.
https://www.stratosphereips.org
GNU General Public License v3.0
30 stars 9 forks source link

Unify logging levels to be consistent #47

Open verovaleros opened 2 days ago

verovaleros commented 2 days ago

Review that the logging is done consistently across all AIP functions and libraries.

verovaleros commented 1 day ago

There are four lines of logging, only.

./bin/aip:        logging.info(f"{aip_model_name} model completed successfully.")
./bin/aip:        logging.error(f"Error running {aip_model_name} model: {e}", exc_info=True)
./lib/aip/utils/date_utils.py:        logging.error(f"Invalid date format for '{date_str}', expected YYYY-MM-DD")
./lib/aip/data/access.py:        logging.debug(f'Downloading data for {date}')
verovaleros commented 1 day ago

There are more print() commands than logging; which should be probably migrated:

./lib/aip/models/prioritize.py:    print(f'DEBUG: PROCESSING DATE {day}')
./lib/aip/models/prioritize.py:    print(f'DEBUG: PROCESSED IN {(time.time() - st_time)/60} MINUTES.')
./lib/aip/models/prioritize.py:            print('Knowledge exists already. Use force=True to rebuild it')
./lib/aip/utils/run_models.py:            print(f'making dir {output_dir}')
./lib/aip/utils/run_models.py:            print(blocklist, day, model)
./lib/aip/utils/run_models.py:        print(day, end='\r')
./lib/aip/utils/run_models.py:                #print(str(model.__name__))
./lib/aip/utils/run_models.py:        print(day, end='\r')
./lib/aip/utils/run_models.py:        #print(results)
./lib/aip/utils/run_models.py:    print('Running models')
./lib/aip/utils/run_models.py:    print()
./lib/aip/utils/run_models.py:    print(f'Models run after {(time.time() - st_time)/60} minutes.')
./lib/aip/utils/run_models.py:    print('Evaluating models')
./lib/aip/utils/run_models.py:    print()
./lib/aip/utils/run_models.py:    print(f'Metrics taken after {(time.time() - st_time)/60} minutes.')
./lib/aip/utils/run_models.py:        print(f'making dir {metrics_output_dir}')
./lib/aip/utils/generate_historical_blocklists.py:        print(day)
./lib/aip/utils/generate_historical_blocklists.py:    #print(f'Creating knowledgebase from {str(dates[0])} to the present')
./lib/aip/utils/generate_historical_blocklists.py:    #print(f'Knowledge created in {(time.time() - st_time)/60} minutes.')
./lib/aip/utils/generate_historical_blocklists.py:    print('Running models')
./lib/aip/utils/generate_historical_blocklists.py:    print(f'Models run after {(time.time() - st_time)/60} minutes.')