Пример #1
0
        /// <summary>
        /// Add a log event to the ElasticSearch Repo
        /// </summary>
        /// <param name="loggingEvent"></param>
        protected override void Append(LoggingEvent loggingEvent)
        {
            if (_client == null || loggingEvent == null)
            {
                return;
            }

            if (HasOverflowState())
            {
                ReportOverflow();
                return;
            }

            var logEvent = _logEventConverter.ConvertLogEventToDictionary(loggingEvent);

            PrepareAndAddToBulk(logEvent);

            if (HasOverflowState())
            {
                ReportOverflow();
            }
            else if (BulkSize > 0)
            {
                DoIndexNow();
            }
        }
Пример #2
0
        /// <summary>
        /// Add a log event to the ElasticSearch Repo
        /// </summary>
        /// <param name="loggingEvent"></param>
        protected override void Append(LoggingEvent loggingEvent)
        {
            if (_client == null || loggingEvent == null)
            {
                return;
            }

            if (DropEventsOverBulkLimit && _bulk.Count >= BulkSize)
            {
                _tolerateCalls.Call(() =>
                                    _eventWriter.Warn(GetType(),
                                                      "Message lost due to bulk overflow! Set DropEventsOverBulkLimit to false in order to prevent that."),
                                    GetType(), 0);
                return;
            }

            var logEvent = _logEventConverter.ConvertLogEventToDictionary(loggingEvent);

            PrepareAndAddToBulk(logEvent);

            if (!DropEventsOverBulkLimit && _bulk.Count >= BulkSize && BulkSize > 0)
            {
                DoIndexNow();
            }
        }