public LogEntryInformation Transform(string logEntry)
        {
            LogEntryInformation logEntryInfo = new LogEntryInformation()
            {
                TimeStamp = DateTime.Parse(timestampRegex.Match(logEntry).Groups[timestampGroupKey].Value),
                EventType = type,
                EventKey  = keyRegex.Match(logEntry).Groups[valueGroupKey].Value,
            };

            return(logEntryInfo);
        }
Esempio n. 2
0
        public static void UploadToCosmos(LogEntryInformation logEntryInfo)
        {
            DocumentClient client = new DocumentClient(new Uri(LogEntryUploader.EndpointUrl), LogEntryUploader.PrimaryKey);

            client.CreateDatabaseIfNotExistsAsync(new Database {
                Id = "LogTracerEntry"
            }).Wait();

            client.CreateDocumentCollectionIfNotExistsAsync(UriFactory.CreateDatabaseUri("LogTracerEntry"), new DocumentCollection {
                Id = "Entries"
            }).Wait();
            client.CreateDocumentAsync(UriFactory.CreateDocumentCollectionUri("LogTracerEntry", "Entries"), logEntryInfo).Wait();
        }