コード例 #1
0
        /// <summary>
        /// Creates an instance of the Splunk TCP Sink
        /// </summary>
        /// <param name="hostAddress">The Splunk Host</param>
        /// <param name="port">The UDP port configured in Splunk</param>
        /// <param name="formatProvider">Optional format provider</param>
        public SplunkViaTcpSink(
            IPAddress hostAddress,
            int port,
            IFormatProvider formatProvider = null)
        {
            var reconnectionPolicy = new ExponentialBackoffTcpReconnectionPolicy();

            _writer = new TcpSocketWriter(hostAddress, port, reconnectionPolicy, 10000);

            _jsonFormatter = new JsonFormatter(renderMessage: true, formatProvider: formatProvider);
        }
コード例 #2
0
        /// <summary>
        /// Creates an instance of the Splunk TCP Sink
        /// </summary>
        /// <param name="host">The Splunk Host</param>
        /// <param name="port">The UDP port configured in Splunk</param>
        /// <param name="formatProvider">Optional format provider</param>
        /// <param name="renderTemplate">If true, the message template will be rendered</param>
        public SplunkViaTcpSink(
            string host,
            int port,
            IFormatProvider formatProvider = null,
            bool renderTemplate            = true)
        {
            var reconnectionPolicy = new ExponentialBackoffTcpReconnectionPolicy();
            var ipAddress          = IPAddress.Parse(host);

            _writer = new TcpSocketWriter(ipAddress, port, reconnectionPolicy, 10000);

            _jsonFormatter = new SplunkJsonFormatter(renderMessage: true, formatProvider: formatProvider, renderTemplate: renderTemplate);
        }
コード例 #3
0
        private static TcpSocketWriter CreateSocketWriter(SplunkTcpSinkConnectionInfo connectionInfo)
        {
            var reconnectionPolicy = new ExponentialBackoffTcpReconnectionPolicy();

            return(new TcpSocketWriter(connectionInfo.Host, connectionInfo.Port, reconnectionPolicy, connectionInfo.MaxQueueSize));
        }