public override bool Init(ICollectFilterOptions options)
        {
            _tidyFields = new List <TidyOptions>();

            var json = options.ToString();

            var root = JObject.Parse(json);

            var p = root.First;

            while (p != null)
            {
                foreach (JProperty c in root[p.Path].Children())
                {
                    var fo = new TidyOptions();
                    fo.Type     = p.Path;
                    fo.DstField = c.Name;
                    fo.SrcField = c.Value.ToString();

                    _tidyFields.Add(fo);
                }

                p = p.Next;
            }

            return(true);
        }
Example #2
0
        public override bool Init(ICollectFilterOptions options)
        {
            _options = options.ConvertTo <FileInputFilterOptions>();

            _watcher  = new DFileSystemWatcher(_loggerFactory.CreateLogger <DFileSystemWatcher>(), _options);
            _analyser = new FileAnalyser(_loggerFactory.CreateLogger <FileAnalyser>(), _options);

            _watcher.SetFileChangeAction((file) =>
            {
                _analyser.Analyse(file);
            });

            _analyser.SetDealContextAction((collectContext) =>
            {
                if (!OutputContext(collectContext))
                {
                    this.Pause();
                }
            });

            return(true);
        }
        public override bool Init(ICollectFilterOptions options)
        {
            _options = options.ConvertTo <ElasticsearchOutputFilterOptions>();

            return(true);
        }