Пример #1
0
 /// <summary>
 /// Creates a new ElasticsearchSink instance with the provided options
 /// </summary>
 /// <param name="options">Options configuring how the sink behaves, may NOT be null</param>
 public ElasticsearchSink(ElasticsearchSinkOptions options)
     : base(options.BatchPostingLimit, options.Period, options.QueueSizeLimit)
 {
     _state = ElasticsearchSinkState.Create(options);
     _state.DiscoverClusterVersion();
     _state.RegisterTemplateIfNeeded();
 }
Пример #2
0
        public static ElasticsearchSinkState Create(ElasticsearchSinkOptions options)
        {
            if (options == null)
            {
                throw new ArgumentNullException("options");
            }
            var state = new ElasticsearchSinkState(options);

            if (state.Options.AutoRegisterTemplate)
            {
                state.RegisterTemplateIfNeeded();
            }
            return(state);
        }
        internal ElasticsearchLogShipper(ElasticsearchSinkState state)
        {
            _state = state;
            _period = _state.Options.BufferLogShippingInterval ?? TimeSpan.FromSeconds(5);
            _batchPostingLimit = _state.Options.BatchPostingLimit;
            _bookmarkFilename = Path.GetFullPath(_state.Options.BufferBaseFilename + ".bookmark");
            _logFolder = Path.GetDirectoryName(_bookmarkFilename);
            _candidateSearchPath = Path.GetFileName(_state.Options.BufferBaseFilename) + "*.json";

            _timer = new Timer(s => OnTick());

            AppDomain.CurrentDomain.DomainUnload += OnAppDomainUnloading;
            AppDomain.CurrentDomain.ProcessExit += OnAppDomainUnloading;

            SetTimer();
        }
Пример #4
0
        internal ElasticsearchLogShipper(ElasticsearchSinkState state)
        {
            _state               = state;
            _period              = _state.Options.BufferLogShippingInterval ?? TimeSpan.FromSeconds(5);
            _batchPostingLimit   = _state.Options.BatchPostingLimit;
            _bookmarkFilename    = Path.GetFullPath(_state.Options.BufferBaseFilename + ".bookmark");
            _logFolder           = Path.GetDirectoryName(_bookmarkFilename);
            _candidateSearchPath = Path.GetFileName(_state.Options.BufferBaseFilename) + "*.json";

            _timer = new Timer(s => OnTick());

            AppDomain.CurrentDomain.DomainUnload += OnAppDomainUnloading;
            AppDomain.CurrentDomain.ProcessExit  += OnAppDomainUnloading;

            SetTimer();
        }
        public DurableElasticsearchSink(ElasticsearchSinkOptions options)
        {
            _state = ElasticsearchSinkState.Create(options);

            if (string.IsNullOrWhiteSpace(options.BufferBaseFilename))
            {
                throw new ArgumentException("Cannot create the durable ElasticSearch sink without a buffer base file name!");
            }

            _sink = new RollingFileSink(
                options.BufferBaseFilename + FileNameSuffix,
                _state.DurableFormatter,
                options.BufferFileSizeLimitBytes,
                null);

            _shipper = new ElasticsearchLogShipper(_state);
        }
        public DurableElasticsearchSink(ElasticsearchSinkOptions options)
        {
            _state = ElasticsearchSinkState.Create(options);

            if (string.IsNullOrWhiteSpace(options.BufferBaseFilename))
            {
                throw new ArgumentException("Cannot create the durable ElasticSearch sink without a buffer base file name!");
            }

            _sink = new RollingFileSink(
                options.BufferBaseFilename + FileNameSuffix,
                _state.DurableFormatter,
                options.BufferFileSizeLimitBytes,
                null);

            _shipper = new ElasticsearchLogShipper(_state);
        }
        internal ElasticsearchLogShipper(ElasticsearchSinkState state)
        {
            _state = state;
            _connectionSchedule = new ExponentialBackoffConnectionSchedule(_state.Options.BufferLogShippingInterval ?? TimeSpan.FromSeconds(5));

            _batchPostingLimit   = _state.Options.BatchPostingLimit;
            _bookmarkFilename    = Path.GetFullPath(_state.Options.BufferBaseFilename + ".bookmark");
            _logFolder           = Path.GetDirectoryName(_bookmarkFilename);
            _candidateSearchPath = Path.GetFileName(_state.Options.BufferBaseFilename) + "*.json";

#if NO_TIMER
            _timer = new PortableTimer(cancel => OnTick());
#else
            _timer = new Timer(s => OnTick(), null, -1, -1);
#endif
            SetTimer();
        }
 public static ElasticsearchSinkState Create(ElasticsearchSinkOptions options)
 {
     if (options == null) throw new ArgumentNullException("options");
     var state = new ElasticsearchSinkState(options);
     if (state.Options.AutoRegisterTemplate)
         state.RegisterTemplateIfNeeded();
     return state;
 }
        /// <summary>
        /// Creates a new ElasticsearchSink instance with the provided options
        /// </summary>
        /// <param name="options">Options configuring how the sink behaves, may NOT be null</param>
        public ElasticsearchSink(ElasticsearchSinkOptions options)
            : base(options.BatchPostingLimit, options.Period)
        {
	        _state = ElasticsearchSinkState.Create(options);
            _state.RegisterTemplateIfNeeded();
        }
 /// <summary>
 /// Creates a new ElasticsearchSink instance with the provided options
 /// </summary>
 /// <param name="options">Options configuring how the sink behaves, may NOT be null</param>
 public ElasticsearchSink(ElasticsearchSinkOptions options)
     : base(options.BatchPostingLimit, options.Period)
 {
     _state = ElasticsearchSinkState.Create(options);
     _state.RegisterTemplateIfNeeded();
 }
Пример #11
0
 /// <summary>
 /// Creates a new ElasticsearchSink instance with the provided options
 /// </summary>
 /// <param name="options">Options configuring how the sink behaves, may NOT be null</param>
 public ElasticsearchSink(ElasticsearchSinkOptions options)
     : base(options.BatchPostingLimit, options.Period)
 {
     _state = ElasticsearchSinkState.Create(options);
 }
 /// <summary>
 /// Creates a new ElasticsearchSink instance with the provided options
 /// </summary>
 /// <param name="options">Options configuring how the sink behaves, may NOT be null</param>
 public ElasticsearchSink(ElasticsearchSinkOptions options)
     : base(options.BatchPostingLimit, options.Period)
 {
     _state = ElasticsearchSinkState.Create(options);
 }