@@ -99,6 +99,7 @@ var logInputExclusiveKeys = []string{
9999 "close_removed" ,
100100 "close_renamed" ,
101101 "close_timeout" ,
102+ "docker-json" ,
102103 "exclude_files" ,
103104 "harvester_buffer_size" ,
104105 "json" ,
@@ -329,6 +330,57 @@ func handleJSON(logger *logp.Logger, cfg *config.C, parsers *[]any) error {
329330 return nil
330331}
331332
333+ func handleDockerJson (logger * logp.Logger , cfg , newCfg * config.C , parsers * []any ) error {
334+ hasDockerJson , err := cfg .Has ("docker-json" , - 1 )
335+ if err != nil {
336+ return fmt .Errorf ("cannot read 'docker-json': %w" , err )
337+ }
338+
339+ if ! hasDockerJson {
340+ return nil
341+ }
342+
343+ dockerJson , err := cfg .Child ("docker-json" , - 1 )
344+ if err != nil {
345+ logger .Warnf ("cannot read 'docker-json' as map: %s, ignoring malformed config entry " , err )
346+ return nil
347+ }
348+
349+ newContainerCfg := config .NewConfig ()
350+ for _ , key := range []string {"stream" , "format" } {
351+ has , err := dockerJson .Has (key , - 1 )
352+ if err != nil {
353+ return fmt .Errorf ("cannot read 'docker-json.%s': %w" , key , err )
354+ }
355+
356+ if ! has {
357+ continue
358+ }
359+
360+ child , err := dockerJson .String (key , - 1 )
361+ if err != nil {
362+ return fmt .Errorf ("cannot read 'docker-json.%s as string: %w" , key , err )
363+ }
364+
365+ newContainerCfg .SetString (key , - 1 , child )
366+ }
367+
368+ * parsers = append (* parsers , map [string ]any {
369+ "container" : newContainerCfg ,
370+ })
371+
372+ symlinks , err := dockerJson .Bool ("symlinks" , - 1 )
373+ if err != nil {
374+ return fmt .Errorf ("cannot read 'docker-json.symlinks as boolean: %w" , err )
375+ }
376+
377+ if err := newCfg .SetBool ("prospector.scanner.symlinks" , - 1 , symlinks ); err != nil {
378+ return fmt .Errorf ("cannot set 'prospector.scanner.symlinks': %w" , err )
379+ }
380+
381+ return nil
382+ }
383+
332384// copyParsers copies any existing 'parsers' from cfg into parsersCfg.
333385// offset is the offset in parsersCfg to start adding the new ones.
334386func copyParsers (cfg , parsersCfg * config.C , offset int ) error {
@@ -370,6 +422,10 @@ func handleParsers(logger *logp.Logger, cfg, newCfg *config.C) error {
370422 return err
371423 }
372424
425+ if err := handleDockerJson (logger , cfg , newCfg , & parsers ); err != nil {
426+ return err
427+ }
428+
373429 // If no parsers were created, return. Any pre-existing parsers
374430 // entry will be maintained and passed as is to Filestream.
375431 if len (parsers ) <= 0 {
0 commit comments