Beispiel #1
0
        public void Write(string url, dynamic requestObject, string applicationId, string clientId,
                          string traceId, IndexEventSplunkType indexEventSplunkType)
        {
            ValidateParams(url, requestObject, applicationId, clientId, traceId);

            var webEventBodyDocument = WebEventBodyDocumentFactory
                                       .Create(url, requestObject, clientId, traceId, applicationId);

            Write(webEventBodyDocument, applicationId, indexEventSplunkType);
        }
        protected virtual string GetIndexName(IndexEventSplunkType eventSplunkType)
        {
            if (CreateIndexName == null)
            {
                throw new NotImplementedException(nameof(CreateIndexName));
            }

            var indexName = Configuration.GetValue <string>(ConfigurationSelectors.HTTP_COLLECTOR_INDEX);

            switch (eventSplunkType)
            {
            case IndexEventSplunkType.RequestBody:
                return(CreateIndexName(indexName, Configuration
                                       .GetValue <string>(ConfigurationSelectors.HTTP_COLLECTOR_REQUESTS_INDEX_PREFIX)));

            case IndexEventSplunkType.ResponseBody:
                return(CreateIndexName(indexName, Configuration
                                       .GetValue <string>(ConfigurationSelectors.HTTP_COLLECTOR_RESPONSES_INDEX_PREFIX)));

            default: return(indexName);
            }
        }
        public IndexEventContainerDocument Create <TEventDocument>(TEventDocument eventDocument,
                                                                   string source, IndexEventSplunkType eventSplunkType,
                                                                   DateTime?time = null)
            where TEventDocument : SplunkEventDocument
        {
            if (eventDocument == null)
            {
                throw new ArgumentNullException(nameof(eventDocument));
            }

            if (string.IsNullOrEmpty(source))
            {
                throw new ArgumentNullException(nameof(source));
            }

            return(new IndexEventContainerDocument
            {
                Index = GetIndexName(eventSplunkType),
                Time = time,
                SourceType = SOURCE_TYPE,
                Source = source,
                Event = eventDocument
            });
        }
Beispiel #4
0
        public void Write(WebEventBodyDocument webEventBodyDocument, string applicationId, IndexEventSplunkType indexEventSplunkType)
        {
            if (webEventBodyDocument == null)
            {
                throw new ArgumentNullException(nameof(webEventBodyDocument));
            }

            if (string.IsNullOrEmpty(applicationId))
            {
                throw new ArgumentNullException(nameof(applicationId));
            }

            BackgroundWebEventsQueue.Queue(IndexEventSplunkContractFactory
                                           .Create(webEventBodyDocument, applicationId, indexEventSplunkType));
        }