@@ -32,6 +32,7 @@ import (
3232
3333	"github.com/elastic/beats/v7/filebeat/input/file" 
3434	loginp "github.com/elastic/beats/v7/filebeat/input/filestream/internal/input-logfile" 
35+ 	commonfile "github.com/elastic/beats/v7/libbeat/common/file" 
3536	"github.com/elastic/beats/v7/libbeat/common/match" 
3637	conf "github.com/elastic/elastic-agent-libs/config" 
3738	"github.com/elastic/elastic-agent-libs/logp" 
@@ -406,7 +407,7 @@ type ingestTarget struct {
406407	filename          string 
407408	originalFilename  string 
408409	symlink           bool 
409- 	info              os. FileInfo 
410+ 	info              commonfile. ExtendedFileInfo 
410411}
411412
412413func  (s  * fileScanner ) getIngestTarget (filename  string ) (it  ingestTarget , err  error ) {
@@ -421,10 +422,11 @@ func (s *fileScanner) getIngestTarget(filename string) (it ingestTarget, err err
421422	it .filename  =  filename 
422423	it .originalFilename  =  filename 
423424
424- 	it . info , err  =  os .Lstat (it .filename ) // to determine if it's a symlink 
425+ 	info , err  : =  os .Lstat (it .filename ) // to determine if it's a symlink 
425426	if  err  !=  nil  {
426427		return  it , fmt .Errorf ("failed to lstat %q: %w" , it .filename , err )
427428	}
429+ 	it .info  =  commonfile .ExtendFileInfo (info )
428430
429431	if  it .info .IsDir () {
430432		return  it , fmt .Errorf ("file %q is a directory" , it .filename )
@@ -438,10 +440,11 @@ func (s *fileScanner) getIngestTarget(filename string) (it ingestTarget, err err
438440		}
439441
440442		// now we know it's a symlink, we stat with link resolution 
441- 		it . info , err  =  os .Stat (it .filename )
443+ 		info , err  : =  os .Stat (it .filename )
442444		if  err  !=  nil  {
443445			return  it , fmt .Errorf ("failed to stat the symlink %q: %w" , it .filename , err )
444446		}
447+ 		it .info  =  commonfile .ExtendFileInfo (info )
445448
446449		it .originalFilename , err  =  filepath .EvalSymlinks (it .filename )
447450		if  err  !=  nil  {
0 commit comments