/// <summary> /// Construct a sink posting to the specified database. /// </summary> /// <param name="options">Options for configuring how the sink behaves, may NOT be null.</param> /// <param name="kinesisClient"></param> public KinesisSink(KinesisStreamSinkOptions options, IAmazonKinesis kinesisClient) : base(options.BatchPostingLimit, options.Period) { _state = new KinesisSinkState(options, kinesisClient); _minimumAcceptedLevel = _state.Options.MinimumLogEventLevel; }
internal KinesisSinkState(KinesisStreamSinkOptions options, IAmazonKinesis kinesisClient) : base(options) { if (options == null) throw new ArgumentNullException("options"); if (kinesisClient == null) throw new ArgumentNullException("kinesisClient"); KinesisClient = kinesisClient; Options = options; }
/// <summary> /// Construct a sink posting to the specified database. /// </summary> /// <param name="options">Options for configuring how the sink behaves, may NOT be null.</param> /// <param name="kinesisClient"></param> public KinesisSink(KinesisStreamSinkOptions options,IAmazonKinesis kinesisClient) : base(options.BatchPostingLimit, options.Period) { _state = new KinesisSinkState(options,kinesisClient); _minimumAcceptedLevel = _state.Options.MinimumLogEventLevel; }
public KinesisSinkState(KinesisStreamSinkOptions options, IAmazonKinesis kinesisClient) : base(options) { if (kinesisClient == null) { throw new ArgumentNullException("kinesisClient"); } KinesisClient = kinesisClient; }
/// <summary> /// Adds a sink that writes log events as documents to Amazon Kinesis. /// </summary> /// <param name="loggerConfiguration">The logger configuration.</param> /// <param name="options"></param> /// <param name="kinesisClient"></param> /// <returns>Logger configuration, allowing configuration to continue.</returns> /// <exception cref="ArgumentNullException">A required parameter is null.</exception> public static LoggerConfiguration AmazonKinesis( this LoggerSinkConfiguration loggerConfiguration, KinesisStreamSinkOptions options,IAmazonKinesis kinesisClient) { if (loggerConfiguration == null) throw new ArgumentNullException("loggerConfiguration"); if (options == null) throw new ArgumentNullException("options"); if (kinesisClient == null) throw new ArgumentNullException("kinesisClient"); ILogEventSink sink; if (options.BufferBaseFilename == null) { sink = new KinesisSink(options, kinesisClient); } else { sink = new DurableKinesisSink(options, kinesisClient); } return loggerConfiguration.Sink(sink, options.MinimumLogEventLevel ?? LevelAlias.Minimum); }
public DurableKinesisSink(KinesisStreamSinkOptions options, IAmazonKinesis kinesisClient) { var state = new KinesisSinkState(options, kinesisClient); if (string.IsNullOrWhiteSpace(options.BufferBaseFilename)) { throw new ArgumentException("Cannot create the durable Amazon Kinesis sink without a buffer base file name."); } _sink = new RollingFileSink( options.BufferBaseFilename + "-{Date}.json", state.DurableFormatter, options.BufferFileSizeLimitBytes, null); _shipper = new HttpLogShipper(state); if (options.OnLogSendError != null) { _shipper.LogSendError += options.OnLogSendError; } }
public DurableKinesisSink(KinesisStreamSinkOptions options, IAmazonKinesis kinesisClient) { var state = new KinesisSinkState(options, kinesisClient); if (string.IsNullOrWhiteSpace(options.BufferBaseFilename)) { throw new ArgumentException("Cannot create the durable Amazon Kinesis sink without a buffer base file name."); } _sink = new RollingFileSink( options.BufferBaseFilename + "-{Date}.json", state.DurableFormatter, options.BufferFileSizeLimitBytes, null); _shipper = new HttpLogShipper(state); _logSendErrorHandler = options.OnLogSendError; if (_logSendErrorHandler != null) { _shipper.LogSendError += _logSendErrorHandler; } }
public KinesisSinkState(KinesisStreamSinkOptions options, IAmazonKinesis kinesisClient) : base(options) { if (kinesisClient == null) throw new ArgumentNullException("kinesisClient"); KinesisClient = kinesisClient; }
/// <summary> /// Adds a sink that writes log events as documents to Amazon Kinesis. /// </summary> /// <param name="loggerConfiguration">The logger configuration.</param> /// <param name="kinesisClient"></param> /// <param name="streamName"></param> /// <param name="shardCount"></param> /// <param name="bufferBaseFilename"></param> /// <param name="bufferFileSizeLimitBytes"></param> /// <param name="batchPostingLimit"></param> /// <param name="period"></param> /// <param name="minimumLogEventLevel"></param> /// <param name="onLogSendError"></param> /// <returns>Logger configuration, allowing configuration to continue.</returns> /// <exception cref="ArgumentNullException"></exception> public static LoggerConfiguration AmazonKinesis( this LoggerSinkConfiguration loggerConfiguration, IAmazonKinesis kinesisClient, string streamName, int? shardCount = null, string bufferBaseFilename = null, int? bufferFileSizeLimitBytes = null, int? batchPostingLimit = null, TimeSpan? period = null, LogEventLevel? minimumLogEventLevel = null, EventHandler<LogSendErrorEventArgs> onLogSendError = null) { if (streamName == null) throw new ArgumentNullException("streamName"); var options = new KinesisStreamSinkOptions(streamName: streamName, shardCount: shardCount) { BufferFileSizeLimitBytes = bufferFileSizeLimitBytes, BufferBaseFilename = bufferBaseFilename, Period = period ?? KinesisStreamSinkOptions.DefaultPeriod, BatchPostingLimit = batchPostingLimit ?? KinesisStreamSinkOptions.DefaultBatchPostingLimit, MinimumLogEventLevel = minimumLogEventLevel ?? LevelAlias.Minimum, OnLogSendError = onLogSendError }; return AmazonKinesis(loggerConfiguration, options, kinesisClient); }