@@ -381,16 +381,14 @@ def convert_old_config(filename, newfilename=None):
381381 'environments' : [],
382382 'logging' : [],
383383 }
384- perflogdir = None
384+ perflogdir = {}
385385 old_systems = old_config .site_configuration ['systems' ].items ()
386386 for sys_name , sys_spec in old_systems :
387387 sys_dict = {'name' : sys_name }
388388
389- # FIXME: We pick the perflogdir that we first find we use it as
390- # filelog's basedir for all systems. This is not correct since
391- # per-system customizations of perflogdir will be lost
392- if perflogdir is None :
393- perflogdir = sys_spec .pop ('perflogdir' , None )
389+ system_perflogdir = sys_spec .pop ('perflogdir' , None )
390+ perflogdir .setdefault (system_perflogdir , [])
391+ perflogdir [system_perflogdir ].append (sys_name )
394392
395393 sys_dict .update (sys_spec )
396394
@@ -482,34 +480,40 @@ def convert_old_config(filename, newfilename=None):
482480
483481 converted ['modes' ].append (new_mode )
484482
485- def handler_list (handler_config ):
483+ def handler_list (handler_config , basedir = None ):
486484 ret = []
487485 for h in handler_config :
488- new_h = h
486+ new_h = h . copy ()
489487 new_h ['level' ] = h ['level' ].lower ()
490488 if h ['type' ] == 'graylog' :
491489 # `host` and `port` attribute are converted to `address`
492490 new_h ['address' ] = h ['host' ]
493491 if 'port' in h :
494492 new_h ['address' ] += ':' + h ['port' ]
495- elif h ['type' ] == 'filelog' and perflogdir is not None :
496- new_h ['basedir' ] = perflogdir
493+ elif h ['type' ] == 'filelog' and basedir is not None :
494+ new_h ['basedir' ] = basedir
497495
498496 ret .append (new_h )
499497
500498 return ret
501499
502- converted ['logging' ].append (
503- {
504- 'level' : old_config .logging_config ['level' ].lower (),
505- 'handlers' : handler_list (
506- old_config .logging_config ['handlers' ]
507- ),
508- 'handlers_perflog' : handler_list (
509- old_config .perf_logging_config ['handlers' ]
510- )
511- }
512- )
500+ for basedir , target_systems in perflogdir .items ():
501+ converted ['logging' ].append (
502+ {
503+ 'level' : old_config .logging_config ['level' ].lower (),
504+ 'handlers' : handler_list (
505+ old_config .logging_config ['handlers' ]
506+ ),
507+ 'handlers_perflog' : handler_list (
508+ old_config .perf_logging_config ['handlers' ],
509+ basedir = basedir
510+ ),
511+ 'target_systems' : target_systems
512+ }
513+ )
514+ if basedir is None :
515+ del converted ['logging' ][- 1 ]['target_systems' ]
516+
513517 converted ['general' ] = [{}]
514518 if hasattr (old_config , 'checks_path' ):
515519 converted ['general' ][0 ][
0 commit comments